From 91c468e7362d41bbbf5b57711703cc3e86e8a435 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Wed, 4 Dec 2024 00:13:07 +0100 Subject: [PATCH] Add missing gitignore --- node_modules/.bin/acorn | 1 - node_modules/.bin/errno | 1 - node_modules/.bin/eslint | 1 - node_modules/.bin/eslint-config-prettier | 1 - node_modules/.bin/fvtt | 1 - node_modules/.bin/gulp | 1 - node_modules/.bin/image-size | 1 - node_modules/.bin/js-yaml | 1 - node_modules/.bin/lessc | 1 - node_modules/.bin/mime | 1 - node_modules/.bin/mkdirp | 1 - node_modules/.bin/needle | 1 - node_modules/.bin/node-gyp-build | 1 - node_modules/.bin/node-gyp-build-optional | 1 - node_modules/.bin/node-gyp-build-test | 1 - node_modules/.bin/node-which | 1 - node_modules/.bin/prettier | 1 - node_modules/.bin/resolve | 1 - node_modules/.bin/semver | 1 - node_modules/.package-lock.json | 3465 --- node_modules/@es-joy/jsdoccomment/CHANGES.md | 589 - .../@es-joy/jsdoccomment/LICENSE-MIT.txt | 20 - node_modules/@es-joy/jsdoccomment/README.md | 241 - .../@es-joy/jsdoccomment/dist/index.cjs.cjs | 1333 - .../@es-joy/jsdoccomment/dist/index.d.ts | 361 - .../@es-joy/jsdoccomment/package.json | 106 - .../jsdoccomment/src/commentHandler.js | 39 - .../jsdoccomment/src/commentParserToESTree.js | 504 - .../jsdoccomment/src/estreeToString.js | 179 - .../@es-joy/jsdoccomment/src/index.js | 50 - .../@es-joy/jsdoccomment/src/jsdoccomment.js | 487 - .../@es-joy/jsdoccomment/src/parseComment.js | 190 - .../jsdoccomment/src/parseInlineTags.js | 108 - .../@es-joy/jsdoccomment/src/toCamelCase.js | 13 - .../@eslint-community/eslint-utils/LICENSE | 21 - .../@eslint-community/eslint-utils/README.md | 37 - .../@eslint-community/eslint-utils/index.js | 2059 -- .../eslint-utils/index.js.map | 1 - .../@eslint-community/eslint-utils/index.mjs | 2018 -- .../eslint-utils/index.mjs.map | 1 - .../node_modules/eslint-visitor-keys/LICENSE | 201 - .../eslint-visitor-keys/README.md | 105 - .../dist/eslint-visitor-keys.cjs | 384 - .../dist/eslint-visitor-keys.d.cts | 27 - .../eslint-visitor-keys/dist/index.d.ts | 16 - .../dist/visitor-keys.d.ts | 12 - .../eslint-visitor-keys/lib/index.js | 65 - .../eslint-visitor-keys/lib/visitor-keys.js | 315 - .../eslint-visitor-keys/package.json | 74 - .../eslint-utils/package.json | 80 - .../@eslint-community/regexpp/LICENSE | 21 - .../@eslint-community/regexpp/README.md | 177 - .../@eslint-community/regexpp/index.d.ts | 1163 - .../@eslint-community/regexpp/index.js | 3037 --- .../@eslint-community/regexpp/index.js.map | 1 - .../@eslint-community/regexpp/index.mjs | 3027 --- .../@eslint-community/regexpp/index.mjs.map | 1 - .../@eslint-community/regexpp/package.json | 91 - node_modules/@eslint/config-array/LICENSE | 201 - node_modules/@eslint/config-array/README.md | 358 - .../@eslint/config-array/dist/cjs/index.cjs | 1304 - .../@eslint/config-array/dist/cjs/index.d.cts | 141 - .../config-array/dist/cjs/std__path/posix.cjs | 1323 - .../dist/cjs/std__path/windows.cjs | 1669 -- .../@eslint/config-array/dist/cjs/types.ts | 24 - .../@eslint/config-array/dist/esm/index.d.ts | 141 - .../@eslint/config-array/dist/esm/index.js | 1279 - .../config-array/dist/esm/std__path/posix.js | 1301 - .../dist/esm/std__path/windows.js | 1647 -- .../@eslint/config-array/dist/esm/types.d.ts | 19 - .../@eslint/config-array/dist/esm/types.ts | 24 - .../@eslint/config-array/package.json | 66 - node_modules/@eslint/core/LICENSE | 201 - node_modules/@eslint/core/README.md | 29 - .../@eslint/core/dist/cjs/types.d.cts | 735 - node_modules/@eslint/core/dist/esm/types.d.ts | 735 - node_modules/@eslint/core/package.json | 45 - node_modules/@eslint/eslintrc/LICENSE | 19 - node_modules/@eslint/eslintrc/README.md | 126 - .../@eslint/eslintrc/conf/config-schema.js | 79 - .../@eslint/eslintrc/conf/environments.js | 215 - .../eslintrc/dist/eslintrc-universal.cjs | 1203 - .../eslintrc/dist/eslintrc-universal.cjs.map | 1 - .../@eslint/eslintrc/dist/eslintrc.cjs | 4431 ---- .../@eslint/eslintrc/dist/eslintrc.cjs.map | 1 - .../lib/cascading-config-array-factory.js | 532 - .../eslintrc/lib/config-array-factory.js | 1155 - .../eslintrc/lib/config-array/config-array.js | 510 - .../lib/config-array/config-dependency.js | 124 - .../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 | 318 - .../@eslint/eslintrc/lib/index-universal.js | 29 - node_modules/@eslint/eslintrc/lib/index.js | 58 - .../@eslint/eslintrc/lib/shared/ajv.js | 191 - .../@eslint/eslintrc/lib/shared/config-ops.js | 135 - .../eslintrc/lib/shared/config-validator.js | 374 - .../eslintrc/lib/shared/deep-merge-arrays.js | 58 - .../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 - .../node_modules/globals/globals.json | 1998 -- .../eslintrc/node_modules/globals/index.d.ts | 2077 -- .../eslintrc/node_modules/globals/index.js | 2 - .../eslintrc/node_modules/globals/license | 9 - .../node_modules/globals/package.json | 58 - .../eslintrc/node_modules/globals/readme.md | 44 - node_modules/@eslint/eslintrc/package.json | 82 - node_modules/@eslint/eslintrc/universal.js | 9 - node_modules/@eslint/js/LICENSE | 19 - node_modules/@eslint/js/README.md | 60 - node_modules/@eslint/js/package.json | 35 - .../@eslint/js/src/configs/eslint-all.js | 217 - .../js/src/configs/eslint-recommended.js | 83 - node_modules/@eslint/js/src/index.js | 23 - node_modules/@eslint/js/types/index.d.ts | 14 - node_modules/@eslint/object-schema/LICENSE | 201 - node_modules/@eslint/object-schema/README.md | 237 - .../@eslint/object-schema/dist/cjs/index.cjs | 455 - .../object-schema/dist/cjs/index.d.cts | 123 - .../@eslint/object-schema/dist/cjs/types.ts | 55 - .../@eslint/object-schema/dist/esm/index.d.ts | 123 - .../@eslint/object-schema/dist/esm/index.js | 452 - .../@eslint/object-schema/dist/esm/types.d.ts | 40 - .../@eslint/object-schema/dist/esm/types.ts | 55 - .../@eslint/object-schema/package.json | 60 - node_modules/@eslint/plugin-kit/LICENSE | 201 - node_modules/@eslint/plugin-kit/README.md | 273 - .../@eslint/plugin-kit/dist/cjs/index.cjs | 610 - .../@eslint/plugin-kit/dist/cjs/index.d.cts | 286 - .../@eslint/plugin-kit/dist/cjs/types.ts | 7 - .../@eslint/plugin-kit/dist/esm/index.d.ts | 286 - .../@eslint/plugin-kit/dist/esm/index.js | 605 - .../@eslint/plugin-kit/dist/esm/types.d.ts | 6 - .../@eslint/plugin-kit/dist/esm/types.ts | 7 - node_modules/@eslint/plugin-kit/package.json | 62 - .../@foundryvtt/foundryvtt-cli/CHANGELOG.md | 71 - .../@foundryvtt/foundryvtt-cli/LICENSE | 21 - .../@foundryvtt/foundryvtt-cli/README.md | 171 - .../foundryvtt-cli/commands/configuration.mjs | 72 - .../foundryvtt-cli/commands/launch.mjs | 91 - .../foundryvtt-cli/commands/package.mjs | 438 - .../foundryvtt-cli/config.example.yml | 4 - .../@foundryvtt/foundryvtt-cli/config.mjs | 107 - .../@foundryvtt/foundryvtt-cli/fvtt.mjs | 15 - .../@foundryvtt/foundryvtt-cli/index.mjs | 1 - .../foundryvtt-cli/lib/package.mjs | 552 - .../@foundryvtt/foundryvtt-cli/package.json | 34 - node_modules/@gulpjs/messages/LICENSE | 21 - node_modules/@gulpjs/messages/README.md | 47 - node_modules/@gulpjs/messages/index.js | 93 - node_modules/@gulpjs/messages/package.json | 46 - node_modules/@gulpjs/to-absolute-glob/LICENSE | 21 - .../@gulpjs/to-absolute-glob/README.md | 58 - .../@gulpjs/to-absolute-glob/index.js | 90 - .../@gulpjs/to-absolute-glob/package.json | 59 - node_modules/@humanfs/core/LICENSE | 201 - node_modules/@humanfs/core/README.md | 140 - node_modules/@humanfs/core/dist/errors.d.ts | 64 - node_modules/@humanfs/core/dist/fsx.d.ts | 193 - node_modules/@humanfs/core/dist/hfs.d.ts | 288 - node_modules/@humanfs/core/dist/index.d.ts | 3 - node_modules/@humanfs/core/dist/path.d.ts | 82 - node_modules/@humanfs/core/package.json | 52 - node_modules/@humanfs/core/src/errors.js | 105 - node_modules/@humanfs/core/src/hfs.js | 699 - node_modules/@humanfs/core/src/index.js | 8 - node_modules/@humanfs/core/src/path.js | 237 - node_modules/@humanfs/node/LICENSE | 201 - node_modules/@humanfs/node/README.md | 141 - node_modules/@humanfs/node/dist/index.d.ts | 2 - node_modules/@humanfs/node/dist/node-fsx.d.ts | 150 - node_modules/@humanfs/node/dist/node-hfs.d.ts | 176 - .../node_modules/@humanwhocodes/retry/LICENSE | 201 - .../@humanwhocodes/retry/README.md | 138 - .../@humanwhocodes/retry/dist/retrier.cjs | 303 - .../@humanwhocodes/retry/dist/retrier.d.cts | 28 - .../@humanwhocodes/retry/dist/retrier.d.ts | 28 - .../@humanwhocodes/retry/dist/retrier.js | 302 - .../@humanwhocodes/retry/dist/retrier.min.js | 1 - .../@humanwhocodes/retry/dist/retrier.mjs | 301 - .../@humanwhocodes/retry/package.json | 77 - node_modules/@humanfs/node/package.json | 57 - node_modules/@humanfs/node/src/index.js | 7 - node_modules/@humanfs/node/src/node-hfs.js | 452 - .../module-importer/CHANGELOG.md | 15 - .../@humanwhocodes/module-importer/LICENSE | 201 - .../@humanwhocodes/module-importer/README.md | 80 - .../module-importer/dist/module-importer.cjs | 22 - .../dist/module-importer.d.cts | 27 - .../module-importer/dist/module-importer.d.ts | 2 - .../module-importer/dist/module-importer.js | 18 - .../module-importer/package.json | 65 - .../module-importer/src/module-importer.cjs | 81 - .../module-importer/src/module-importer.js | 22 - node_modules/@humanwhocodes/retry/LICENSE | 201 - node_modules/@humanwhocodes/retry/README.md | 177 - .../@humanwhocodes/retry/dist/retrier.cjs | 477 - .../@humanwhocodes/retry/dist/retrier.d.cts | 45 - .../@humanwhocodes/retry/dist/retrier.d.ts | 45 - .../@humanwhocodes/retry/dist/retrier.js | 476 - .../@humanwhocodes/retry/dist/retrier.min.js | 1 - .../@humanwhocodes/retry/dist/retrier.mjs | 475 - .../@humanwhocodes/retry/package.json | 77 - node_modules/@pkgr/core/lib/constants.d.ts | 4 - node_modules/@pkgr/core/lib/constants.js | 5 - node_modules/@pkgr/core/lib/constants.js.map | 1 - node_modules/@pkgr/core/lib/helpers.d.ts | 5 - node_modules/@pkgr/core/lib/helpers.js | 49 - node_modules/@pkgr/core/lib/helpers.js.map | 1 - node_modules/@pkgr/core/lib/index.cjs | 64 - node_modules/@pkgr/core/lib/index.d.ts | 2 - node_modules/@pkgr/core/lib/index.js | 3 - node_modules/@pkgr/core/lib/index.js.map | 1 - node_modules/@pkgr/core/package.json | 29 - .../@seald-io/binary-search-tree/CHANGELOG.md | 64 - .../@seald-io/binary-search-tree/LICENSE.md | 19 - .../@seald-io/binary-search-tree/README.md | 130 - .../@seald-io/binary-search-tree/index.js | 2 - .../binary-search-tree/lib/avltree.js | 412 - .../@seald-io/binary-search-tree/lib/bst.js | 452 - .../binary-search-tree/lib/customUtils.js | 38 - .../@seald-io/binary-search-tree/package.json | 51 - node_modules/@seald-io/nedb/LICENSE.md | 19 - node_modules/@seald-io/nedb/README.md | 905 - .../nedb/browser-version/lib/byline.js | 1 - .../nedb/browser-version/lib/customUtils.js | 76 - .../browser-version/lib/storage.browser.js | 191 - .../lib/storage.react-native.js | 295 - .../nedb/browser-version/out/nedb.js | 10155 ------- .../nedb/browser-version/out/nedb.min.js | 2 - .../nedb/browser-version/out/testutils.js | 2472 -- .../nedb/browser-version/out/testutils.min.js | 1 - node_modules/@seald-io/nedb/index.d.ts | 206 - node_modules/@seald-io/nedb/index.js | 3 - node_modules/@seald-io/nedb/lib/byline.js | 118 - node_modules/@seald-io/nedb/lib/cursor.js | 250 - .../@seald-io/nedb/lib/customUtils.js | 26 - node_modules/@seald-io/nedb/lib/datastore.js | 1137 - node_modules/@seald-io/nedb/lib/executor.js | 79 - node_modules/@seald-io/nedb/lib/indexes.js | 333 - node_modules/@seald-io/nedb/lib/model.js | 827 - .../@seald-io/nedb/lib/persistence.js | 380 - node_modules/@seald-io/nedb/lib/storage.js | 317 - node_modules/@seald-io/nedb/lib/utils.js | 84 - node_modules/@seald-io/nedb/lib/waterfall.js | 48 - node_modules/@seald-io/nedb/package.json | 121 - node_modules/@types/estree/LICENSE | 21 - node_modules/@types/estree/README.md | 15 - node_modules/@types/estree/flow.d.ts | 167 - node_modules/@types/estree/index.d.ts | 684 - node_modules/@types/estree/package.json | 26 - node_modules/@types/json-schema/LICENSE | 21 - node_modules/@types/json-schema/README.md | 15 - node_modules/@types/json-schema/index.d.ts | 749 - node_modules/@types/json-schema/package.json | 40 - node_modules/abstract-level/CHANGELOG.md | 48 - node_modules/abstract-level/LICENSE | 21 - node_modules/abstract-level/README.md | 1436 - node_modules/abstract-level/UPGRADING.md | 479 - .../abstract-level/abstract-chained-batch.js | 181 - .../abstract-level/abstract-iterator.js | 490 - node_modules/abstract-level/abstract-level.js | 818 - node_modules/abstract-level/index.d.ts | 42 - node_modules/abstract-level/index.js | 8 - .../lib/abstract-sublevel-iterator.js | 124 - .../abstract-level/lib/abstract-sublevel.js | 258 - node_modules/abstract-level/lib/common.js | 17 - .../lib/default-chained-batch.js | 41 - .../abstract-level/lib/default-kv-iterator.js | 72 - .../abstract-level/lib/deferred-iterator.js | 108 - .../abstract-level/lib/next-tick-browser.js | 11 - node_modules/abstract-level/lib/next-tick.js | 3 - .../abstract-level/lib/range-options.js | 38 - node_modules/abstract-level/package.json | 64 - .../test/async-iterator-test.js | 143 - .../abstract-level/test/batch-test.js | 320 - .../abstract-level/test/chained-batch-test.js | 295 - .../abstract-level/test/clear-range-test.js | 274 - .../abstract-level/test/clear-test.js | 183 - .../abstract-level/test/close-test.js | 32 - node_modules/abstract-level/test/common.js | 90 - .../abstract-level/test/deferred-open-test.js | 329 - node_modules/abstract-level/test/del-test.js | 105 - .../test/encoding-buffer-test.js | 255 - .../test/encoding-custom-test.js | 99 - .../test/encoding-decode-error-test.js | 64 - .../abstract-level/test/encoding-json-test.js | 88 - .../abstract-level/test/encoding-test.js | 141 - .../abstract-level/test/factory-test.js | 52 - .../abstract-level/test/get-many-test.js | 276 - node_modules/abstract-level/test/get-test.js | 144 - node_modules/abstract-level/test/index.js | 72 - .../test/iterator-no-snapshot-test.js | 63 - .../test/iterator-range-test.js | 287 - .../abstract-level/test/iterator-seek-test.js | 252 - .../test/iterator-snapshot-test.js | 99 - .../abstract-level/test/iterator-test.js | 548 - .../abstract-level/test/manifest-test.js | 24 - .../test/open-create-if-missing-test.js | 35 - .../test/open-error-if-exists-test.js | 29 - node_modules/abstract-level/test/open-test.js | 297 - .../abstract-level/test/put-get-del-test.js | 113 - node_modules/abstract-level/test/put-test.js | 131 - node_modules/abstract-level/test/self.js | 1080 - .../test/self/abstract-iterator-test.js | 263 - .../test/self/async-iterator-test.js | 213 - .../test/self/attach-resource-test.js | 75 - .../abstract-level/test/self/defer-test.js | 90 - .../test/self/deferred-chained-batch-test.js | 98 - .../test/self/deferred-iterator-test.js | 298 - .../test/self/deferred-operations-test.js | 93 - .../abstract-level/test/self/encoding-test.js | 426 - .../abstract-level/test/self/iterator-test.js | 829 - .../abstract-level/test/self/sublevel-test.js | 931 - .../abstract-level/test/sublevel-test.js | 108 - node_modules/abstract-level/test/util.js | 280 - .../types/abstract-chained-batch.d.ts | 123 - .../types/abstract-iterator.d.ts | 252 - .../abstract-level/types/abstract-level.d.ts | 485 - .../types/abstract-sublevel.d.ts | 58 - .../abstract-level/types/interfaces.d.ts | 14 - 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 | 928 - node_modules/acorn/LICENSE | 21 - node_modules/acorn/README.md | 282 - node_modules/acorn/bin/acorn | 4 - node_modules/acorn/dist/acorn.d.mts | 866 - node_modules/acorn/dist/acorn.d.ts | 866 - node_modules/acorn/dist/acorn.js | 6174 ----- node_modules/acorn/dist/acorn.mjs | 6145 ----- node_modules/acorn/dist/bin.js | 90 - 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-colors/LICENSE | 21 - node_modules/ansi-colors/README.md | 105 - node_modules/ansi-colors/index.js | 456 - node_modules/ansi-colors/package.json | 138 - node_modules/ansi-colors/types/index.d.ts | 31 - 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/ansi-styles/index.d.ts | 345 - node_modules/ansi-styles/index.js | 163 - node_modules/ansi-styles/license | 9 - node_modules/ansi-styles/package.json | 56 - node_modules/ansi-styles/readme.md | 152 - node_modules/ansi-wrap/LICENSE | 21 - node_modules/ansi-wrap/README.md | 89 - node_modules/ansi-wrap/index.js | 5 - node_modules/ansi-wrap/package.json | 34 - node_modules/anymatch/LICENSE | 15 - node_modules/anymatch/README.md | 87 - node_modules/anymatch/index.d.ts | 20 - node_modules/anymatch/index.js | 104 - node_modules/anymatch/package.json | 48 - node_modules/are-docs-informative/LICENSE.md | 20 - node_modules/are-docs-informative/README.md | 109 - .../are-docs-informative/lib/index.cjs | 56 - .../are-docs-informative/lib/index.d.cts | 57 - .../are-docs-informative/lib/index.d.ts | 57 - .../are-docs-informative/lib/index.js | 31 - .../are-docs-informative/package.json | 89 - 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/arr-diff/LICENSE | 21 - node_modules/arr-diff/README.md | 130 - node_modules/arr-diff/index.js | 47 - node_modules/arr-diff/package.json | 69 - node_modules/arr-union/LICENSE | 21 - node_modules/arr-union/README.md | 99 - node_modules/arr-union/index.js | 29 - node_modules/arr-union/package.json | 76 - node_modules/array-each/LICENSE | 21 - node_modules/array-each/README.md | 84 - node_modules/array-each/index.js | 46 - node_modules/array-each/package.json | 50 - node_modules/array-slice/LICENSE | 21 - node_modules/array-slice/README.md | 82 - node_modules/array-slice/index.js | 33 - node_modules/array-slice/package.json | 54 - node_modules/assign-symbols/LICENSE | 21 - node_modules/assign-symbols/README.md | 73 - node_modules/assign-symbols/index.js | 40 - node_modules/assign-symbols/package.json | 40 - node_modules/async-done/LICENSE | 21 - node_modules/async-done/README.md | 122 - node_modules/async-done/index.d.ts | 112 - node_modules/async-done/index.js | 85 - node_modules/async-done/package.json | 71 - node_modules/async-settle/LICENSE | 21 - node_modules/async-settle/README.md | 100 - node_modules/async-settle/index.js | 21 - node_modules/async-settle/package.json | 52 - node_modules/available-typed-arrays/.eslintrc | 5 - .../.github/FUNDING.yml | 12 - node_modules/available-typed-arrays/.nycrc | 9 - .../available-typed-arrays/CHANGELOG.md | 100 - node_modules/available-typed-arrays/LICENSE | 21 - node_modules/available-typed-arrays/README.md | 55 - .../available-typed-arrays/index.d.ts | 8 - node_modules/available-typed-arrays/index.js | 17 - .../available-typed-arrays/package.json | 93 - .../available-typed-arrays/test/index.js | 18 - .../available-typed-arrays/tsconfig.json | 49 - node_modules/bach/LICENSE | 21 - node_modules/bach/README.md | 261 - node_modules/bach/index.js | 8 - node_modules/bach/lib/helpers.js | 94 - node_modules/bach/lib/parallel.js | 28 - node_modules/bach/lib/series.js | 28 - node_modules/bach/lib/settleParallel.js | 29 - node_modules/bach/lib/settleSeries.js | 29 - node_modules/bach/package.json | 76 - .../balanced-match/.github/FUNDING.yml | 2 - node_modules/balanced-match/LICENSE.md | 21 - node_modules/balanced-match/README.md | 97 - node_modules/balanced-match/index.js | 62 - node_modules/balanced-match/package.json | 48 - node_modules/bare-events/LICENSE | 201 - node_modules/bare-events/README.md | 25 - node_modules/bare-events/index.js | 336 - node_modules/bare-events/lib/errors.js | 22 - node_modules/bare-events/package.json | 34 - node_modules/base64-js/LICENSE | 21 - node_modules/base64-js/README.md | 34 - node_modules/base64-js/base64js.min.js | 1 - node_modules/base64-js/index.d.ts | 3 - node_modules/base64-js/index.js | 150 - node_modules/base64-js/package.json | 47 - .../binary-extensions/binary-extensions.json | 263 - .../binary-extensions.json.d.ts | 3 - node_modules/binary-extensions/index.d.ts | 14 - node_modules/binary-extensions/index.js | 1 - node_modules/binary-extensions/license | 10 - node_modules/binary-extensions/package.json | 40 - node_modules/binary-extensions/readme.md | 25 - node_modules/bl/.github/dependabot.yml | 16 - .../bl/.github/workflows/test-and-release.yml | 61 - node_modules/bl/BufferList.d.ts | 382 - node_modules/bl/BufferList.js | 396 - node_modules/bl/CHANGELOG.md | 17 - node_modules/bl/LICENSE.md | 13 - node_modules/bl/README.md | 247 - node_modules/bl/bl.js | 84 - node_modules/bl/index.d.ts | 88 - node_modules/bl/package.json | 123 - node_modules/bl/test/convert.js | 21 - node_modules/bl/test/indexOf.js | 492 - node_modules/bl/test/isBufferList.js | 32 - node_modules/bl/test/test.js | 914 - node_modules/brace-expansion/LICENSE | 21 - node_modules/brace-expansion/README.md | 129 - node_modules/brace-expansion/index.js | 201 - node_modules/brace-expansion/package.json | 47 - node_modules/braces/LICENSE | 21 - node_modules/braces/README.md | 586 - node_modules/braces/index.js | 170 - node_modules/braces/lib/compile.js | 60 - node_modules/braces/lib/constants.js | 57 - node_modules/braces/lib/expand.js | 113 - node_modules/braces/lib/parse.js | 331 - node_modules/braces/lib/stringify.js | 32 - node_modules/braces/lib/utils.js | 122 - node_modules/braces/package.json | 77 - node_modules/buffer/AUTHORS.md | 73 - node_modules/buffer/LICENSE | 21 - node_modules/buffer/README.md | 410 - node_modules/buffer/index.d.ts | 194 - node_modules/buffer/index.js | 2106 -- node_modules/buffer/package.json | 93 - node_modules/call-bind/.eslintignore | 1 - node_modules/call-bind/.eslintrc | 16 - node_modules/call-bind/.github/FUNDING.yml | 12 - node_modules/call-bind/.nycrc | 9 - node_modules/call-bind/CHANGELOG.md | 93 - node_modules/call-bind/LICENSE | 21 - node_modules/call-bind/README.md | 64 - node_modules/call-bind/callBound.js | 15 - node_modules/call-bind/index.js | 35 - node_modules/call-bind/package.json | 95 - node_modules/call-bind/test/callBound.js | 54 - node_modules/call-bind/test/index.js | 80 - 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/catering/LICENSE | 21 - node_modules/catering/index.d.ts | 10 - node_modules/catering/index.js | 28 - node_modules/catering/next-tick-browser.js | 1 - node_modules/catering/next-tick.js | 1 - node_modules/catering/package.json | 38 - node_modules/catering/readme.md | 55 - node_modules/chalk/license | 9 - node_modules/chalk/package.json | 83 - node_modules/chalk/readme.md | 325 - node_modules/chalk/source/index.d.ts | 320 - node_modules/chalk/source/index.js | 225 - node_modules/chalk/source/utilities.js | 33 - .../source/vendor/ansi-styles/index.d.ts | 236 - .../chalk/source/vendor/ansi-styles/index.js | 223 - .../source/vendor/supports-color/browser.d.ts | 1 - .../source/vendor/supports-color/browser.js | 30 - .../source/vendor/supports-color/index.d.ts | 55 - .../source/vendor/supports-color/index.js | 182 - node_modules/chokidar/LICENSE | 21 - node_modules/chokidar/README.md | 308 - node_modules/chokidar/index.js | 973 - node_modules/chokidar/lib/constants.js | 66 - node_modules/chokidar/lib/fsevents-handler.js | 526 - node_modules/chokidar/lib/nodefs-handler.js | 654 - .../node_modules/glob-parent/CHANGELOG.md | 110 - .../chokidar/node_modules/glob-parent/LICENSE | 15 - .../node_modules/glob-parent/README.md | 137 - .../node_modules/glob-parent/index.js | 42 - .../node_modules/glob-parent/package.json | 48 - node_modules/chokidar/package.json | 70 - node_modules/chokidar/types/index.d.ts | 192 - node_modules/classic-level/CHANGELOG.md | 65 - node_modules/classic-level/LICENSE | 21 - node_modules/classic-level/README.md | 789 - node_modules/classic-level/UPGRADING.md | 123 - node_modules/classic-level/binding.cc | 2170 -- node_modules/classic-level/binding.gyp | 70 - node_modules/classic-level/binding.js | 1 - node_modules/classic-level/chained-batch.js | 36 - .../deps/leveldb/leveldb-1.20/LICENSE | 27 - .../deps/leveldb/leveldb-1.20/Makefile | 424 - .../deps/leveldb/leveldb-1.20/README.md | 174 - .../leveldb-1.20/build_detect_platform | 256 - .../leveldb-1.20/db/autocompact_test.cc | 118 - .../deps/leveldb/leveldb-1.20/db/builder.cc | 88 - .../deps/leveldb/leveldb-1.20/db/builder.h | 34 - .../deps/leveldb/leveldb-1.20/db/c.cc | 595 - .../deps/leveldb/leveldb-1.20/db/c_test.c | 390 - .../leveldb-1.20/db/corruption_test.cc | 374 - .../deps/leveldb/leveldb-1.20/db/db_bench.cc | 1020 - .../deps/leveldb/leveldb-1.20/db/db_impl.cc | 1568 -- .../deps/leveldb/leveldb-1.20/db/db_impl.h | 211 - .../deps/leveldb/leveldb-1.20/db/db_iter.cc | 317 - .../deps/leveldb/leveldb-1.20/db/db_iter.h | 28 - .../deps/leveldb/leveldb-1.20/db/db_test.cc | 2158 -- .../deps/leveldb/leveldb-1.20/db/dbformat.cc | 140 - .../deps/leveldb/leveldb-1.20/db/dbformat.h | 230 - .../leveldb/leveldb-1.20/db/dbformat_test.cc | 112 - .../deps/leveldb/leveldb-1.20/db/dumpfile.cc | 225 - .../leveldb-1.20/db/fault_injection_test.cc | 554 - .../deps/leveldb/leveldb-1.20/db/filename.cc | 144 - .../deps/leveldb/leveldb-1.20/db/filename.h | 85 - .../leveldb/leveldb-1.20/db/filename_test.cc | 123 - .../leveldb/leveldb-1.20/db/leveldbutil.cc | 64 - .../deps/leveldb/leveldb-1.20/db/log_format.h | 35 - .../leveldb/leveldb-1.20/db/log_reader.cc | 284 - .../deps/leveldb/leveldb-1.20/db/log_reader.h | 113 - .../deps/leveldb/leveldb-1.20/db/log_test.cc | 591 - .../leveldb/leveldb-1.20/db/log_writer.cc | 112 - .../deps/leveldb/leveldb-1.20/db/log_writer.h | 54 - .../deps/leveldb/leveldb-1.20/db/memtable.cc | 145 - .../deps/leveldb/leveldb-1.20/db/memtable.h | 88 - .../leveldb/leveldb-1.20/db/recovery_test.cc | 324 - .../deps/leveldb/leveldb-1.20/db/repair.cc | 461 - .../deps/leveldb/leveldb-1.20/db/skiplist.h | 384 - .../leveldb/leveldb-1.20/db/skiplist_test.cc | 378 - .../deps/leveldb/leveldb-1.20/db/snapshot.h | 67 - .../leveldb/leveldb-1.20/db/table_cache.cc | 127 - .../leveldb/leveldb-1.20/db/table_cache.h | 61 - .../leveldb/leveldb-1.20/db/version_edit.cc | 266 - .../leveldb/leveldb-1.20/db/version_edit.h | 107 - .../leveldb-1.20/db/version_edit_test.cc | 46 - .../leveldb/leveldb-1.20/db/version_set.cc | 1535 -- .../leveldb/leveldb-1.20/db/version_set.h | 398 - .../leveldb-1.20/db/version_set_test.cc | 179 - .../leveldb/leveldb-1.20/db/write_batch.cc | 147 - .../leveldb-1.20/db/write_batch_internal.h | 50 - .../leveldb-1.20/db/write_batch_test.cc | 120 - .../leveldb-1.20/helpers/memenv/memenv.cc | 398 - .../leveldb-1.20/helpers/memenv/memenv.h | 20 - .../helpers/memenv/memenv_test.cc | 241 - .../leveldb/leveldb-1.20/include/leveldb/c.h | 290 - .../leveldb-1.20/include/leveldb/cache.h | 110 - .../leveldb-1.20/include/leveldb/comparator.h | 63 - .../leveldb/leveldb-1.20/include/leveldb/db.h | 163 - .../leveldb-1.20/include/leveldb/dumpfile.h | 25 - .../leveldb-1.20/include/leveldb/env.h | 351 - .../include/leveldb/filter_policy.h | 70 - .../leveldb-1.20/include/leveldb/iterator.h | 100 - .../leveldb-1.20/include/leveldb/options.h | 213 - .../leveldb-1.20/include/leveldb/slice.h | 109 - .../leveldb-1.20/include/leveldb/status.h | 112 - .../leveldb-1.20/include/leveldb/table.h | 85 - .../include/leveldb/table_builder.h | 92 - .../include/leveldb/write_batch.h | 64 - .../leveldb-1.20/issues/issue178_test.cc | 92 - .../leveldb-1.20/issues/issue200_test.cc | 59 - .../deps/leveldb/leveldb-1.20/port/README | 10 - .../leveldb-1.20/port/atomic_pointer.h | 242 - .../deps/leveldb/leveldb-1.20/port/port.h | 21 - .../leveldb/leveldb-1.20/port/port_example.h | 141 - .../leveldb/leveldb-1.20/port/port_posix.cc | 53 - .../leveldb/leveldb-1.20/port/port_posix.h | 156 - .../leveldb-1.20/port/port_posix_sse.cc | 129 - .../leveldb-1.20/port/thread_annotations.h | 60 - .../leveldb/leveldb-1.20/port/win/stdint.h | 24 - .../deps/leveldb/leveldb-1.20/table/block.cc | 268 - .../deps/leveldb/leveldb-1.20/table/block.h | 44 - .../leveldb-1.20/table/block_builder.cc | 109 - .../leveldb-1.20/table/block_builder.h | 57 - .../leveldb-1.20/table/filter_block.cc | 111 - .../leveldb/leveldb-1.20/table/filter_block.h | 68 - .../leveldb-1.20/table/filter_block_test.cc | 128 - .../deps/leveldb/leveldb-1.20/table/format.cc | 144 - .../deps/leveldb/leveldb-1.20/table/format.h | 108 - .../leveldb/leveldb-1.20/table/iterator.cc | 67 - .../leveldb-1.20/table/iterator_wrapper.h | 66 - .../deps/leveldb/leveldb-1.20/table/merger.cc | 197 - .../deps/leveldb/leveldb-1.20/table/merger.h | 26 - .../deps/leveldb/leveldb-1.20/table/table.cc | 285 - .../leveldb-1.20/table/table_builder.cc | 270 - .../leveldb/leveldb-1.20/table/table_test.cc | 876 - .../leveldb-1.20/table/two_level_iterator.cc | 182 - .../leveldb-1.20/table/two_level_iterator.h | 34 - .../deps/leveldb/leveldb-1.20/util/arena.cc | 68 - .../deps/leveldb/leveldb-1.20/util/arena.h | 68 - .../leveldb/leveldb-1.20/util/arena_test.cc | 68 - .../deps/leveldb/leveldb-1.20/util/bloom.cc | 95 - .../leveldb/leveldb-1.20/util/bloom_test.cc | 162 - .../deps/leveldb/leveldb-1.20/util/cache.cc | 405 - .../leveldb/leveldb-1.20/util/cache_test.cc | 226 - .../deps/leveldb/leveldb-1.20/util/coding.cc | 194 - .../deps/leveldb/leveldb-1.20/util/coding.h | 104 - .../leveldb/leveldb-1.20/util/coding_test.cc | 196 - .../leveldb/leveldb-1.20/util/comparator.cc | 81 - .../deps/leveldb/leveldb-1.20/util/crc32c.cc | 350 - .../deps/leveldb/leveldb-1.20/util/crc32c.h | 45 - .../leveldb/leveldb-1.20/util/crc32c_test.cc | 72 - .../deps/leveldb/leveldb-1.20/util/env.cc | 100 - .../leveldb/leveldb-1.20/util/env_posix.cc | 695 - .../leveldb-1.20/util/env_posix_test.cc | 66 - .../leveldb-1.20/util/env_posix_test_helper.h | 28 - .../leveldb/leveldb-1.20/util/env_test.cc | 106 - .../leveldb-1.20/util/filter_policy.cc | 11 - .../deps/leveldb/leveldb-1.20/util/hash.cc | 52 - .../deps/leveldb/leveldb-1.20/util/hash.h | 19 - .../leveldb/leveldb-1.20/util/hash_test.cc | 54 - .../leveldb/leveldb-1.20/util/histogram.cc | 139 - .../leveldb/leveldb-1.20/util/histogram.h | 42 - .../deps/leveldb/leveldb-1.20/util/logging.cc | 72 - .../deps/leveldb/leveldb-1.20/util/logging.h | 43 - .../leveldb/leveldb-1.20/util/mutexlock.h | 41 - .../deps/leveldb/leveldb-1.20/util/options.cc | 30 - .../leveldb/leveldb-1.20/util/posix_logger.h | 98 - .../deps/leveldb/leveldb-1.20/util/random.h | 64 - .../deps/leveldb/leveldb-1.20/util/status.cc | 75 - .../leveldb/leveldb-1.20/util/testharness.cc | 77 - .../leveldb/leveldb-1.20/util/testharness.h | 138 - .../leveldb/leveldb-1.20/util/testutil.cc | 51 - .../deps/leveldb/leveldb-1.20/util/testutil.h | 63 - .../classic-level/deps/leveldb/leveldb.gyp | 281 - .../leveldb/port-libuv/atomic_pointer_win.h | 48 - .../deps/leveldb/port-libuv/env_win.cc | 692 - .../deps/leveldb/port-libuv/port_uv.cc | 36 - .../deps/leveldb/port-libuv/port_uv.h | 157 - .../deps/leveldb/port-libuv/port_uv.h.bak | 153 - .../deps/leveldb/port-libuv/stdint-msvc2008.h | 247 - .../deps/leveldb/port-libuv/uv_condvar.h | 45 - .../leveldb/port-libuv/uv_condvar_posix.cc | 139 - .../deps/leveldb/port-libuv/win_logger.cc | 79 - .../deps/leveldb/port-libuv/win_logger.h | 28 - .../deps/snappy/freebsd/config.h | 135 - .../deps/snappy/freebsd/snappy-stubs-public.h | 100 - .../classic-level/deps/snappy/linux/config.h | 135 - .../deps/snappy/linux/snappy-stubs-public.h | 100 - .../classic-level/deps/snappy/mac/config.h | 137 - .../deps/snappy/mac/snappy-stubs-public.h | 100 - .../deps/snappy/openbsd/config.h | 135 - .../deps/snappy/openbsd/snappy-stubs-public.h | 100 - .../classic-level/deps/snappy/snappy.gyp | 118 - .../classic-level/deps/snappy/snappy/COPYING | 54 - .../deps/snappy/snappy/README.md | 149 - .../snappy/snappy/cmake/SnappyConfig.cmake | 1 - .../deps/snappy/snappy/cmake/config.h.in | 62 - .../deps/snappy/snappy/snappy-c.cc | 90 - .../deps/snappy/snappy/snappy-c.h | 138 - .../deps/snappy/snappy/snappy-internal.h | 224 - .../deps/snappy/snappy/snappy-sinksource.cc | 104 - .../deps/snappy/snappy/snappy-sinksource.h | 182 - .../snappy/snappy/snappy-stubs-internal.cc | 42 - .../snappy/snappy/snappy-stubs-internal.h | 561 - .../snappy/snappy/snappy-stubs-public.h.in | 94 - .../deps/snappy/snappy/snappy-test.cc | 612 - .../deps/snappy/snappy/snappy-test.h | 573 - .../deps/snappy/snappy/snappy.cc | 1515 -- .../classic-level/deps/snappy/snappy/snappy.h | 203 - .../deps/snappy/snappy/snappy_unittest.cc | 1410 - .../deps/snappy/solaris/config.h | 135 - .../deps/snappy/solaris/snappy-stubs-public.h | 100 - .../classic-level/deps/snappy/win32/config.h | 29 - .../deps/snappy/win32/snappy-stubs-public.h | 100 - node_modules/classic-level/index.d.ts | 338 - node_modules/classic-level/index.js | 190 - node_modules/classic-level/iterator.js | 106 - node_modules/classic-level/package.json | 73 - .../android-arm/node.napi.armv7.node | Bin 327600 -> 0 bytes .../android-arm64/node.napi.armv8.node | Bin 363760 -> 0 bytes .../prebuilds/darwin-x64+arm64/node.napi.node | Bin 647376 -> 0 bytes .../prebuilds/linux-arm/node.napi.armv6.node | Bin 396772 -> 0 bytes .../prebuilds/linux-arm/node.napi.armv7.node | Bin 396784 -> 0 bytes .../linux-arm64/node.napi.armv8.node | Bin 427536 -> 0 bytes .../prebuilds/linux-x64/node.napi.glibc.node | Bin 505424 -> 0 bytes .../prebuilds/linux-x64/node.napi.musl.node | Bin 464816 -> 0 bytes .../prebuilds/win32-ia32/node.napi.node | Bin 455168 -> 0 bytes .../prebuilds/win32-x64/node.napi.node | Bin 527872 -> 0 bytes node_modules/cliui/CHANGELOG.md | 139 - node_modules/cliui/LICENSE.txt | 14 - node_modules/cliui/README.md | 141 - node_modules/cliui/build/index.cjs | 302 - node_modules/cliui/build/index.d.cts | 43 - node_modules/cliui/build/lib/index.js | 287 - node_modules/cliui/build/lib/string-utils.js | 27 - node_modules/cliui/index.mjs | 13 - node_modules/cliui/package.json | 83 - node_modules/clone-stats/LICENSE.md | 21 - node_modules/clone-stats/README.md | 17 - node_modules/clone-stats/index.js | 13 - node_modules/clone-stats/package.json | 31 - node_modules/clone-stats/test.js | 36 - node_modules/clone/.npmignore | 4 - node_modules/clone/LICENSE | 18 - node_modules/clone/README.md | 194 - node_modules/clone/clone.iml | 10 - node_modules/clone/clone.js | 257 - node_modules/clone/package.json | 56 - node_modules/color-convert/CHANGELOG.md | 54 - node_modules/color-convert/LICENSE | 21 - node_modules/color-convert/README.md | 68 - node_modules/color-convert/conversions.js | 839 - node_modules/color-convert/index.js | 81 - node_modules/color-convert/package.json | 48 - node_modules/color-convert/route.js | 97 - node_modules/color-name/LICENSE | 8 - node_modules/color-name/README.md | 11 - node_modules/color-name/index.js | 152 - node_modules/color-name/package.json | 28 - node_modules/commander/LICENSE | 22 - node_modules/commander/Readme.md | 1148 - node_modules/commander/esm.mjs | 16 - node_modules/commander/index.js | 26 - node_modules/commander/lib/argument.js | 145 - node_modules/commander/lib/command.js | 2179 -- node_modules/commander/lib/error.js | 43 - node_modules/commander/lib/help.js | 462 - node_modules/commander/lib/option.js | 329 - node_modules/commander/lib/suggestSimilar.js | 100 - node_modules/commander/package-support.json | 16 - node_modules/commander/package.json | 80 - node_modules/commander/typings/esm.d.mts | 3 - node_modules/commander/typings/index.d.ts | 884 - node_modules/comment-parser/CHANGELOG.md | 172 - node_modules/comment-parser/LICENSE | 21 - node_modules/comment-parser/README.md | 220 - node_modules/comment-parser/browser/index.js | 650 - node_modules/comment-parser/es6/index.d.ts | 32 - node_modules/comment-parser/es6/index.js | 30 - .../es6/parser/block-parser.d.ts | 24 - .../comment-parser/es6/parser/block-parser.js | 29 - .../comment-parser/es6/parser/index.d.ts | 11 - .../comment-parser/es6/parser/index.js | 39 - .../es6/parser/source-parser.d.ts | 7 - .../es6/parser/source-parser.js | 46 - .../es6/parser/spec-parser.d.ts | 7 - .../comment-parser/es6/parser/spec-parser.js | 13 - .../es6/parser/tokenizers/description.d.ts | 20 - .../es6/parser/tokenizers/description.js | 47 - .../es6/parser/tokenizers/index.d.ts | 7 - .../es6/parser/tokenizers/index.js | 1 - .../es6/parser/tokenizers/name.d.ts | 6 - .../es6/parser/tokenizers/name.js | 91 - .../es6/parser/tokenizers/tag.d.ts | 6 - .../es6/parser/tokenizers/tag.js | 24 - .../es6/parser/tokenizers/type.d.ts | 27 - .../es6/parser/tokenizers/type.js | 65 - .../comment-parser/es6/primitives.d.ts | 54 - node_modules/comment-parser/es6/primitives.js | 8 - .../comment-parser/es6/stringifier/index.d.ts | 3 - .../comment-parser/es6/stringifier/index.js | 17 - .../es6/stringifier/inspect.d.ts | 2 - .../comment-parser/es6/stringifier/inspect.js | 44 - .../comment-parser/es6/transforms/align.d.ts | 3 - .../comment-parser/es6/transforms/align.js | 93 - .../comment-parser/es6/transforms/crlf.d.ts | 3 - .../comment-parser/es6/transforms/crlf.js | 34 - .../comment-parser/es6/transforms/indent.d.ts | 2 - .../comment-parser/es6/transforms/indent.js | 32 - .../comment-parser/es6/transforms/index.d.ts | 3 - .../comment-parser/es6/transforms/index.js | 3 - node_modules/comment-parser/es6/util.d.ts | 21 - node_modules/comment-parser/es6/util.js | 52 - node_modules/comment-parser/jest.config.cjs | 209 - node_modules/comment-parser/lib/index.cjs | 88 - node_modules/comment-parser/lib/index.cjs.map | 1 - node_modules/comment-parser/lib/index.d.ts | 32 - .../lib/parser/block-parser.cjs | 44 - .../lib/parser/block-parser.cjs.map | 1 - .../lib/parser/block-parser.d.ts | 24 - .../comment-parser/lib/parser/index.cjs | 65 - .../comment-parser/lib/parser/index.cjs.map | 1 - .../comment-parser/lib/parser/index.d.ts | 11 - .../lib/parser/source-parser.cjs | 68 - .../lib/parser/source-parser.cjs.map | 1 - .../lib/parser/source-parser.d.ts | 7 - .../comment-parser/lib/parser/spec-parser.cjs | 29 - .../lib/parser/spec-parser.cjs.map | 1 - .../lib/parser/spec-parser.d.ts | 7 - .../lib/parser/tokenizers/description.cjs | 62 - .../lib/parser/tokenizers/description.cjs.map | 1 - .../lib/parser/tokenizers/description.d.ts | 20 - .../lib/parser/tokenizers/index.cjs | 6 - .../lib/parser/tokenizers/index.cjs.map | 1 - .../lib/parser/tokenizers/index.d.ts | 7 - .../lib/parser/tokenizers/name.cjs | 109 - .../lib/parser/tokenizers/name.cjs.map | 1 - .../lib/parser/tokenizers/name.d.ts | 6 - .../lib/parser/tokenizers/tag.cjs | 37 - .../lib/parser/tokenizers/tag.cjs.map | 1 - .../lib/parser/tokenizers/tag.d.ts | 6 - .../lib/parser/tokenizers/type.cjs | 79 - .../lib/parser/tokenizers/type.cjs.map | 1 - .../lib/parser/tokenizers/type.d.ts | 27 - .../comment-parser/lib/primitives.cjs | 17 - .../comment-parser/lib/primitives.cjs.map | 1 - .../comment-parser/lib/primitives.d.ts | 54 - .../comment-parser/lib/stringifier/index.cjs | 18 - .../lib/stringifier/index.cjs.map | 1 - .../comment-parser/lib/stringifier/index.d.ts | 3 - .../lib/stringifier/inspect.cjs | 72 - .../lib/stringifier/inspect.cjs.map | 1 - .../lib/stringifier/inspect.d.ts | 2 - .../comment-parser/lib/transforms/align.cjs | 127 - .../lib/transforms/align.cjs.map | 1 - .../comment-parser/lib/transforms/align.d.ts | 3 - .../comment-parser/lib/transforms/crlf.cjs | 44 - .../lib/transforms/crlf.cjs.map | 1 - .../comment-parser/lib/transforms/crlf.d.ts | 3 - .../comment-parser/lib/transforms/indent.cjs | 58 - .../lib/transforms/indent.cjs.map | 1 - .../comment-parser/lib/transforms/indent.d.ts | 2 - .../comment-parser/lib/transforms/index.cjs | 13 - .../lib/transforms/index.cjs.map | 1 - .../comment-parser/lib/transforms/index.d.ts | 3 - node_modules/comment-parser/lib/util.cjs | 113 - node_modules/comment-parser/lib/util.cjs.map | 1 - node_modules/comment-parser/lib/util.d.ts | 21 - node_modules/comment-parser/migrate-1.0.md | 105 - node_modules/comment-parser/package.json | 84 - node_modules/comment-parser/src/index.ts | 36 - .../comment-parser/src/parser/block-parser.ts | 60 - .../comment-parser/src/parser/index.ts | 70 - .../src/parser/source-parser.ts | 71 - .../comment-parser/src/parser/spec-parser.ts | 20 - .../src/parser/tokenizers/description.ts | 78 - .../src/parser/tokenizers/index.ts | 8 - .../src/parser/tokenizers/name.ts | 112 - .../src/parser/tokenizers/tag.ts | 30 - .../src/parser/tokenizers/type.ts | 91 - node_modules/comment-parser/src/primitives.ts | 69 - .../comment-parser/src/stringifier/index.ts | 25 - .../comment-parser/src/stringifier/inspect.ts | 68 - .../comment-parser/src/transforms/align.ts | 109 - .../comment-parser/src/transforms/crlf.ts | 31 - .../comment-parser/src/transforms/indent.ts | 28 - .../comment-parser/src/transforms/index.ts | 8 - node_modules/comment-parser/src/util.ts | 99 - .../comment-parser/tests/e2e/examples.js | 244 - .../comment-parser/tests/e2e/examples.spec.js | 16 - .../tests/e2e/issue-109.spec.js | 49 - .../tests/e2e/issue-112.spec.js | 20 - .../tests/e2e/issue-113.spec.js | 23 - .../tests/e2e/issue-119.spec.js | 29 - .../tests/e2e/issue-120.spec.js | 29 - .../tests/e2e/issue-121.spec.js | 105 - .../tests/e2e/issue-129.spec.js | 143 - .../comment-parser/tests/e2e/issue-41.spec.js | 362 - .../comment-parser/tests/e2e/issue-61.spec.js | 581 - .../comment-parser/tests/e2e/parse.spec.js | 1840 -- .../tests/e2e/stringify.spec.js | 13 - .../tests/e2e/transforms.spec.js | 32 - .../tests/unit/block-parser.spec.ts | 169 - .../comment-parser/tests/unit/inspect.spec.ts | 43 - .../comment-parser/tests/unit/parser.spec.ts | 298 - .../tests/unit/source-parser.spec.ts | 438 - .../unit/spacer-description-joiner.spec.ts | 120 - .../unit/spec-description-tokenizer.spec.ts | 227 - .../tests/unit/spec-name-tokenizer.spec.ts | 736 - .../tests/unit/spec-parser.spec.ts | 184 - .../tests/unit/spec-tag-tokenizer.spec.ts | 112 - .../tests/unit/spec-type-tokenizer.spec.ts | 265 - .../tests/unit/stringifier.spec.ts | 169 - .../tests/unit/transforms-align.spec.ts | 165 - .../tests/unit/transforms-crlf.spec.ts | 70 - .../tests/unit/transforms-indent.spec.ts | 95 - .../tests/unit/transforms.spec.ts | 21 - .../tests/unit/util-rewire.spec.ts | 107 - .../comment-parser/tests/unit/util.spec.ts | 130 - node_modules/comment-parser/tsconfig.json | 11 - .../comment-parser/tsconfig.node.json | 12 - node_modules/concat-map/.travis.yml | 4 - node_modules/concat-map/LICENSE | 18 - node_modules/concat-map/README.markdown | 62 - node_modules/concat-map/example/map.js | 6 - node_modules/concat-map/index.js | 13 - node_modules/concat-map/package.json | 43 - node_modules/concat-map/test/map.js | 39 - node_modules/convert-source-map/LICENSE | 23 - node_modules/convert-source-map/README.md | 206 - node_modules/convert-source-map/index.js | 233 - node_modules/convert-source-map/package.json | 38 - node_modules/copy-anything/LICENSE | 21 - node_modules/copy-anything/README.md | 130 - node_modules/copy-anything/dist/index.cjs | 52 - node_modules/copy-anything/dist/index.es.js | 48 - .../copy-anything/dist/types/index.d.ts | 15 - node_modules/copy-anything/package.json | 98 - node_modules/copy-props/LICENSE | 21 - node_modules/copy-props/README.md | 238 - node_modules/copy-props/index.js | 234 - node_modules/copy-props/package.json | 50 - node_modules/cross-spawn/LICENSE | 21 - node_modules/cross-spawn/README.md | 89 - 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 | 47 - .../cross-spawn/lib/util/readShebang.js | 23 - .../cross-spawn/lib/util/resolveCommand.js | 52 - node_modules/cross-spawn/package.json | 73 - node_modules/debug/LICENSE | 20 - node_modules/debug/README.md | 481 - node_modules/debug/package.json | 60 - node_modules/debug/src/browser.js | 271 - node_modules/debug/src/common.js | 274 - node_modules/debug/src/index.js | 10 - node_modules/debug/src/node.js | 263 - 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-data-property/.eslintrc | 24 - .../define-data-property/.github/FUNDING.yml | 12 - node_modules/define-data-property/.nycrc | 13 - .../define-data-property/CHANGELOG.md | 70 - node_modules/define-data-property/LICENSE | 21 - node_modules/define-data-property/README.md | 67 - node_modules/define-data-property/index.d.ts | 12 - node_modules/define-data-property/index.js | 56 - .../define-data-property/package.json | 106 - .../define-data-property/test/index.js | 392 - .../define-data-property/tsconfig.json | 59 - node_modules/detect-file/LICENSE | 21 - node_modules/detect-file/README.md | 99 - node_modules/detect-file/index.js | 109 - node_modules/detect-file/package.json | 60 - node_modules/each-props/LICENSE | 21 - node_modules/each-props/README.md | 119 - node_modules/each-props/index.js | 56 - node_modules/each-props/package.json | 50 - node_modules/emoji-regex/LICENSE-MIT.txt | 20 - node_modules/emoji-regex/README.md | 73 - node_modules/emoji-regex/es2015/index.js | 6 - node_modules/emoji-regex/es2015/text.js | 6 - node_modules/emoji-regex/index.d.ts | 23 - node_modules/emoji-regex/index.js | 6 - node_modules/emoji-regex/package.json | 50 - node_modules/emoji-regex/text.js | 6 - node_modules/end-of-stream/LICENSE | 21 - node_modules/end-of-stream/README.md | 54 - node_modules/end-of-stream/index.js | 94 - node_modules/end-of-stream/package.json | 37 - node_modules/errno/.jshintrc | 59 - node_modules/errno/.travis.yml | 19 - node_modules/errno/README.md | 145 - node_modules/errno/build.js | 43 - node_modules/errno/cli.js | 22 - node_modules/errno/custom.js | 57 - node_modules/errno/errno.js | 313 - node_modules/errno/package.json | 33 - node_modules/errno/test.js | 88 - node_modules/es-define-property/.eslintrc | 13 - .../es-define-property/.github/FUNDING.yml | 12 - node_modules/es-define-property/.nycrc | 9 - node_modules/es-define-property/CHANGELOG.md | 15 - node_modules/es-define-property/LICENSE | 21 - node_modules/es-define-property/README.md | 49 - node_modules/es-define-property/index.d.ts | 3 - node_modules/es-define-property/index.js | 16 - node_modules/es-define-property/package.json | 81 - node_modules/es-define-property/test/index.js | 55 - node_modules/es-define-property/tsconfig.json | 50 - node_modules/es-errors/.eslintrc | 5 - node_modules/es-errors/.github/FUNDING.yml | 12 - node_modules/es-errors/CHANGELOG.md | 40 - node_modules/es-errors/LICENSE | 21 - node_modules/es-errors/README.md | 55 - node_modules/es-errors/eval.d.ts | 3 - node_modules/es-errors/eval.js | 4 - node_modules/es-errors/index.d.ts | 3 - node_modules/es-errors/index.js | 4 - node_modules/es-errors/package.json | 80 - node_modules/es-errors/range.d.ts | 3 - node_modules/es-errors/range.js | 4 - node_modules/es-errors/ref.d.ts | 3 - node_modules/es-errors/ref.js | 4 - node_modules/es-errors/syntax.d.ts | 3 - node_modules/es-errors/syntax.js | 4 - node_modules/es-errors/test/index.js | 19 - node_modules/es-errors/tsconfig.json | 49 - node_modules/es-errors/type.d.ts | 3 - node_modules/es-errors/type.js | 4 - node_modules/es-errors/uri.d.ts | 3 - node_modules/es-errors/uri.js | 4 - node_modules/es-module-lexer/LICENSE | 10 - node_modules/es-module-lexer/README.md | 338 - .../es-module-lexer/dist/lexer.asm.js | 2 - node_modules/es-module-lexer/dist/lexer.cjs | 1 - node_modules/es-module-lexer/dist/lexer.js | 2 - node_modules/es-module-lexer/lexer.js | 925 - node_modules/es-module-lexer/package.json | 54 - node_modules/es-module-lexer/types/lexer.d.ts | 183 - node_modules/escalade/dist/index.js | 22 - node_modules/escalade/dist/index.mjs | 22 - node_modules/escalade/index.d.mts | 11 - node_modules/escalade/index.d.ts | 15 - node_modules/escalade/license | 9 - node_modules/escalade/package.json | 74 - node_modules/escalade/readme.md | 211 - node_modules/escalade/sync/index.d.mts | 9 - node_modules/escalade/sync/index.d.ts | 13 - node_modules/escalade/sync/index.js | 18 - node_modules/escalade/sync/index.mjs | 18 - 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 - .../@typescript-eslint.js | 3 - node_modules/eslint-config-prettier/LICENSE | 21 - node_modules/eslint-config-prettier/README.md | 11 - node_modules/eslint-config-prettier/babel.js | 3 - .../eslint-config-prettier/bin/cli.js | 236 - .../eslint-config-prettier/bin/validators.js | 86 - .../eslint-config-prettier/flowtype.js | 3 - node_modules/eslint-config-prettier/index.js | 217 - .../eslint-config-prettier/package.json | 13 - .../eslint-config-prettier/prettier.js | 12 - node_modules/eslint-config-prettier/react.js | 3 - .../eslint-config-prettier/standard.js | 3 - .../eslint-config-prettier/unicorn.js | 3 - node_modules/eslint-config-prettier/vue.js | 3 - node_modules/eslint-plugin-jsdoc/LICENSE | 24 - node_modules/eslint-plugin-jsdoc/README.md | 318 - .../eslint-plugin-jsdoc/dist/WarnSettings.cjs | 38 - .../dist/WarnSettings.cjs.map | 1 - .../dist/alignTransform.cjs | 323 - .../dist/alignTransform.cjs.map | 1 - .../dist/defaultTagOrder.cjs | 46 - .../dist/defaultTagOrder.cjs.map | 1 - .../eslint-plugin-jsdoc/dist/exportParser.cjs | 730 - .../dist/exportParser.cjs.map | 1 - .../eslint-plugin-jsdoc/dist/generateRule.cjs | 247 - .../dist/generateRule.cjs.map | 1 - .../dist/getDefaultTagStructureForMode.cjs | 293 - .../getDefaultTagStructureForMode.cjs.map | 1 - .../dist/getJsdocProcessorPlugin.cjs | 541 - .../dist/getJsdocProcessorPlugin.cjs.map | 1 - .../dist/import-worker.cjs | 17 - .../dist/import-worker.cjs.map | 1 - .../dist/import-worker.mjs | 11 - .../eslint-plugin-jsdoc/dist/index.cjs | 359 - .../eslint-plugin-jsdoc/dist/index.cjs.map | 1 - .../eslint-plugin-jsdoc/dist/index.d.ts | 19 - .../eslint-plugin-jsdoc/dist/index.d.ts.map | 1 - .../eslint-plugin-jsdoc/dist/iterateJsdoc.cjs | 2066 -- .../dist/iterateJsdoc.cjs.map | 1 - .../eslint-plugin-jsdoc/dist/jsdocUtils.cjs | 1537 -- .../dist/jsdocUtils.cjs.map | 1 - .../dist/rules/checkAccess.cjs | 40 - .../dist/rules/checkAccess.cjs.map | 1 - .../dist/rules/checkAlignment.cjs | 60 - .../dist/rules/checkAlignment.cjs.map | 1 - .../dist/rules/checkExamples.cjs | 512 - .../dist/rules/checkExamples.cjs.map | 1 - .../dist/rules/checkIndentation.cjs | 74 - .../dist/rules/checkIndentation.cjs.map | 1 - .../dist/rules/checkLineAlignment.cjs | 321 - .../dist/rules/checkLineAlignment.cjs.map | 1 - .../dist/rules/checkParamNames.cjs | 329 - .../dist/rules/checkParamNames.cjs.map | 1 - .../dist/rules/checkPropertyNames.cjs | 116 - .../dist/rules/checkPropertyNames.cjs.map | 1 - .../dist/rules/checkSyntax.cjs | 38 - .../dist/rules/checkSyntax.cjs.map | 1 - .../dist/rules/checkTagNames.cjs | 215 - .../dist/rules/checkTagNames.cjs.map | 1 - .../dist/rules/checkTemplateNames.cjs | 173 - .../dist/rules/checkTemplateNames.cjs.map | 1 - .../dist/rules/checkTypes.cjs | 396 - .../dist/rules/checkTypes.cjs.map | 1 - .../dist/rules/checkValues.cjs | 154 - .../dist/rules/checkValues.cjs.map | 1 - .../dist/rules/convertToJsdocComments.cjs | 312 - .../dist/rules/convertToJsdocComments.cjs.map | 1 - .../dist/rules/emptyTags.cjs | 75 - .../dist/rules/emptyTags.cjs.map | 1 - .../dist/rules/implementsOnClasses.cjs | 60 - .../dist/rules/implementsOnClasses.cjs.map | 1 - .../dist/rules/importsAsDependencies.cjs | 106 - .../dist/rules/importsAsDependencies.cjs.map | 1 - .../dist/rules/informativeDocs.cjs | 148 - .../dist/rules/informativeDocs.cjs.map | 1 - .../dist/rules/matchDescription.cjs | 229 - .../dist/rules/matchDescription.cjs.map | 1 - .../dist/rules/matchName.cjs | 128 - .../dist/rules/matchName.cjs.map | 1 - .../dist/rules/multilineBlocks.cjs | 237 - .../dist/rules/multilineBlocks.cjs.map | 1 - .../dist/rules/noBadBlocks.cjs | 87 - .../dist/rules/noBadBlocks.cjs.map | 1 - .../dist/rules/noBlankBlockDescriptions.cjs | 63 - .../rules/noBlankBlockDescriptions.cjs.map | 1 - .../dist/rules/noBlankBlocks.cjs | 52 - .../dist/rules/noBlankBlocks.cjs.map | 1 - .../dist/rules/noDefaults.cjs | 83 - .../dist/rules/noDefaults.cjs.map | 1 - .../dist/rules/noMissingSyntax.cjs | 176 - .../dist/rules/noMissingSyntax.cjs.map | 1 - .../dist/rules/noMultiAsterisks.cjs | 99 - .../dist/rules/noMultiAsterisks.cjs.map | 1 - .../dist/rules/noRestrictedSyntax.cjs | 83 - .../dist/rules/noRestrictedSyntax.cjs.map | 1 - .../dist/rules/noTypes.cjs | 73 - .../dist/rules/noTypes.cjs.map | 1 - .../dist/rules/noUndefinedTypes.cjs | 300 - .../dist/rules/noUndefinedTypes.cjs.map | 1 - .../dist/rules/requireAsteriskPrefix.cjs | 166 - .../dist/rules/requireAsteriskPrefix.cjs.map | 1 - .../dist/rules/requireDescription.cjs | 135 - .../dist/rules/requireDescription.cjs.map | 1 - .../requireDescriptionCompleteSentence.cjs | 282 - ...requireDescriptionCompleteSentence.cjs.map | 1 - .../dist/rules/requireExample.cjs | 108 - .../dist/rules/requireExample.cjs.map | 1 - .../dist/rules/requireFileOverview.cjs | 135 - .../dist/rules/requireFileOverview.cjs.map | 1 - .../requireHyphenBeforeParamDescription.cjs | 141 - ...equireHyphenBeforeParamDescription.cjs.map | 1 - .../dist/rules/requireJsdoc.cjs | 507 - .../dist/rules/requireJsdoc.cjs.map | 1 - .../dist/rules/requireParam.cjs | 527 - .../dist/rules/requireParam.cjs.map | 1 - .../dist/rules/requireParamDescription.cjs | 84 - .../rules/requireParamDescription.cjs.map | 1 - .../dist/rules/requireParamName.cjs | 54 - .../dist/rules/requireParamName.cjs.map | 1 - .../dist/rules/requireParamType.cjs | 84 - .../dist/rules/requireParamType.cjs.map | 1 - .../dist/rules/requireProperty.cjs | 46 - .../dist/rules/requireProperty.cjs.map | 1 - .../dist/rules/requirePropertyDescription.cjs | 29 - .../rules/requirePropertyDescription.cjs.map | 1 - .../dist/rules/requirePropertyName.cjs | 29 - .../dist/rules/requirePropertyName.cjs.map | 1 - .../dist/rules/requirePropertyType.cjs | 29 - .../dist/rules/requirePropertyType.cjs.map | 1 - .../dist/rules/requireReturns.cjs | 209 - .../dist/rules/requireReturns.cjs.map | 1 - .../dist/rules/requireReturnsCheck.cjs | 109 - .../dist/rules/requireReturnsCheck.cjs.map | 1 - .../dist/rules/requireReturnsDescription.cjs | 58 - .../rules/requireReturnsDescription.cjs.map | 1 - .../dist/rules/requireReturnsType.cjs | 54 - .../dist/rules/requireReturnsType.cjs.map | 1 - .../dist/rules/requireTemplate.cjs | 182 - .../dist/rules/requireTemplate.cjs.map | 1 - .../dist/rules/requireThrows.cjs | 101 - .../dist/rules/requireThrows.cjs.map | 1 - .../dist/rules/requireYields.cjs | 175 - .../dist/rules/requireYields.cjs.map | 1 - .../dist/rules/requireYieldsCheck.cjs | 161 - .../dist/rules/requireYieldsCheck.cjs.map | 1 - .../dist/rules/sortTags.cjs | 450 - .../dist/rules/sortTags.cjs.map | 1 - .../dist/rules/tagLines.cjs | 274 - .../dist/rules/tagLines.cjs.map | 1 - .../dist/rules/textEscaping.cjs | 131 - .../dist/rules/textEscaping.cjs.map | 1 - .../dist/rules/validTypes.cjs | 264 - .../dist/rules/validTypes.cjs.map | 1 - .../eslint-plugin-jsdoc/dist/tagNames.cjs | 183 - .../eslint-plugin-jsdoc/dist/tagNames.cjs.map | 1 - .../dist/utils/hasReturnValue.cjs | 492 - .../dist/utils/hasReturnValue.cjs.map | 1 - .../eslint-plugin-jsdoc/eslint.config.js | 82 - node_modules/eslint-plugin-jsdoc/package.json | 156 - .../eslint-plugin-jsdoc/src/WarnSettings.js | 34 - .../eslint-plugin-jsdoc/src/alignTransform.js | 358 - .../src/defaultTagOrder.js | 169 - .../eslint-plugin-jsdoc/src/exportParser.js | 964 - .../src/getDefaultTagStructureForMode.js | 969 - .../src/getJsdocProcessorPlugin.js | 606 - .../eslint-plugin-jsdoc/src/import-worker.mjs | 11 - node_modules/eslint-plugin-jsdoc/src/index.js | 387 - .../eslint-plugin-jsdoc/src/iterateJsdoc.js | 2479 -- .../eslint-plugin-jsdoc/src/jsdocUtils.js | 1880 -- .../src/rules/checkAccess.js | 45 - .../src/rules/checkAlignment.js | 63 - .../src/rules/checkExamples.js | 593 - .../src/rules/checkIndentation.js | 75 - .../src/rules/checkLineAlignment.js | 372 - .../src/rules/checkParamNames.js | 454 - .../src/rules/checkPropertyNames.js | 152 - .../src/rules/checkSyntax.js | 30 - .../src/rules/checkTagNames.js | 314 - .../src/rules/checkTemplateNames.js | 172 - .../src/rules/checkTypes.js | 535 - .../src/rules/checkValues.js | 249 - .../src/rules/convertToJsdocComments.js | 388 - .../src/rules/emptyTags.js | 88 - .../src/rules/implementsOnClasses.js | 64 - .../src/rules/importsAsDependencies.js | 131 - .../src/rules/informativeDocs.js | 189 - .../src/rules/matchDescription.js | 286 - .../src/rules/matchName.js | 147 - .../src/rules/multilineBlocks.js | 333 - .../src/rules/noBadBlocks.js | 109 - .../src/rules/noBlankBlockDescriptions.js | 69 - .../src/rules/noBlankBlocks.js | 53 - .../src/rules/noDefaults.js | 85 - .../src/rules/noMissingSyntax.js | 195 - .../src/rules/noMultiAsterisks.js | 134 - .../src/rules/noRestrictedSyntax.js | 91 - .../eslint-plugin-jsdoc/src/rules/noTypes.js | 77 - .../src/rules/noUndefinedTypes.js | 380 - .../src/rules/requireAsteriskPrefix.js | 189 - .../src/rules/requireDescription.js | 161 - .../requireDescriptionCompleteSentence.js | 335 - .../src/rules/requireExample.js | 118 - .../src/rules/requireFileOverview.js | 154 - .../requireHyphenBeforeParamDescription.js | 178 - .../src/rules/requireJsdoc.js | 645 - .../src/rules/requireParam.js | 594 - .../src/rules/requireParamDescription.js | 89 - .../src/rules/requireParamName.js | 55 - .../src/rules/requireParamType.js | 89 - .../src/rules/requireProperty.js | 48 - .../src/rules/requirePropertyDescription.js | 25 - .../src/rules/requirePropertyName.js | 25 - .../src/rules/requirePropertyType.js | 25 - .../src/rules/requireReturns.js | 238 - .../src/rules/requireReturnsCheck.js | 145 - .../src/rules/requireReturnsDescription.js | 59 - .../src/rules/requireReturnsType.js | 51 - .../src/rules/requireTemplate.js | 180 - .../src/rules/requireThrows.js | 111 - .../src/rules/requireYields.js | 216 - .../src/rules/requireYieldsCheck.js | 208 - .../eslint-plugin-jsdoc/src/rules/sortTags.js | 557 - .../eslint-plugin-jsdoc/src/rules/tagLines.js | 359 - .../src/rules/textEscaping.js | 146 - .../src/rules/validTypes.js | 384 - .../eslint-plugin-jsdoc/src/tagNames.js | 238 - .../src/utils/hasReturnValue.js | 549 - .../eslint-plugin-prettier/LICENSE.md | 24 - node_modules/eslint-plugin-prettier/README.md | 202 - .../eslint-plugin-prettier.d.ts | 5 - .../eslint-plugin-prettier.js | 254 - .../eslint-plugin-prettier/package.json | 102 - .../eslint-plugin-prettier/recommended.d.ts | 5 - .../eslint-plugin-prettier/recommended.js | 17 - node_modules/eslint-plugin-prettier/worker.js | 191 - node_modules/eslint-scope/LICENSE | 22 - node_modules/eslint-scope/README.md | 108 - .../eslint-scope/dist/eslint-scope.cjs | 2282 -- node_modules/eslint-scope/lib/assert.js | 17 - node_modules/eslint-scope/lib/definition.js | 85 - node_modules/eslint-scope/lib/index.js | 169 - .../eslint-scope/lib/pattern-visitor.js | 154 - node_modules/eslint-scope/lib/reference.js | 166 - node_modules/eslint-scope/lib/referencer.js | 656 - .../eslint-scope/lib/scope-manager.js | 249 - node_modules/eslint-scope/lib/scope.js | 793 - node_modules/eslint-scope/lib/variable.js | 87 - node_modules/eslint-scope/lib/version.js | 3 - node_modules/eslint-scope/package.json | 59 - node_modules/eslint-visitor-keys/LICENSE | 201 - node_modules/eslint-visitor-keys/README.md | 120 - .../dist/eslint-visitor-keys.cjs | 396 - .../dist/eslint-visitor-keys.d.cts | 27 - .../eslint-visitor-keys/dist/index.d.ts | 16 - .../dist/visitor-keys.d.ts | 12 - node_modules/eslint-visitor-keys/lib/index.js | 67 - .../eslint-visitor-keys/lib/visitor-keys.js | 327 - node_modules/eslint-visitor-keys/package.json | 67 - node_modules/eslint/LICENSE | 19 - node_modules/eslint/README.md | 310 - node_modules/eslint/bin/eslint.js | 179 - .../eslint/conf/default-cli-options.js | 32 - node_modules/eslint/conf/ecma-version.js | 16 - node_modules/eslint/conf/globals.js | 160 - node_modules/eslint/conf/replacements.json | 22 - node_modules/eslint/conf/rule-type-list.json | 30 - node_modules/eslint/lib/api.js | 50 - .../eslint/lib/cli-engine/cli-engine.js | 1089 - .../eslint/lib/cli-engine/file-enumerator.js | 547 - .../formatters/formatters-meta.json | 18 - .../eslint/lib/cli-engine/formatters/html.js | 351 - .../formatters/json-with-metadata.js | 16 - .../eslint/lib/cli-engine/formatters/json.js | 13 - .../lib/cli-engine/formatters/stylish.js | 101 - 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 | 203 - .../eslint/lib/cli-engine/load-rules.js | 46 - node_modules/eslint/lib/cli.js | 548 - .../eslint/lib/config/config-loader.js | 719 - node_modules/eslint/lib/config/config.js | 297 - .../eslint/lib/config/default-config.js | 69 - .../eslint/lib/config/flat-config-array.js | 222 - .../eslint/lib/config/flat-config-helpers.js | 128 - .../eslint/lib/config/flat-config-schema.js | 576 - .../eslint/lib/config/rule-validator.js | 194 - .../eslint/lib/eslint/eslint-helpers.js | 965 - node_modules/eslint/lib/eslint/eslint.js | 1121 - node_modules/eslint/lib/eslint/index.js | 9 - .../eslint/lib/eslint/legacy-eslint.js | 742 - node_modules/eslint/lib/languages/js/index.js | 336 - .../lib/languages/js/source-code/index.js | 7 - .../languages/js/source-code/source-code.js | 1202 - .../backward-token-comment-cursor.js | 57 - .../token-store/backward-token-cursor.js | 58 - .../js/source-code/token-store/cursor.js | 76 - .../js/source-code/token-store/cursors.js | 92 - .../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 - .../js/source-code/token-store/index.js | 627 - .../source-code/token-store/limit-cursor.js | 40 - .../token-store/padded-token-cursor.js | 38 - .../js/source-code/token-store/skip-cursor.js | 42 - .../js/source-code/token-store/utils.js | 107 - .../languages/js/validate-language-options.js | 181 - .../lib/linter/apply-disable-directives.js | 502 - .../code-path-analysis/code-path-analyzer.js | 851 - .../code-path-analysis/code-path-segment.js | 263 - .../code-path-analysis/code-path-state.js | 2348 -- .../linter/code-path-analysis/code-path.js | 344 - .../code-path-analysis/debug-helpers.js | 203 - .../linter/code-path-analysis/fork-context.js | 349 - .../linter/code-path-analysis/id-generator.js | 45 - .../eslint/lib/linter/file-context.js | 134 - node_modules/eslint/lib/linter/index.js | 11 - node_modules/eslint/lib/linter/interpolate.js | 50 - node_modules/eslint/lib/linter/linter.js | 2407 -- .../eslint/lib/linter/node-event-generator.js | 352 - .../eslint/lib/linter/report-translator.js | 376 - node_modules/eslint/lib/linter/rule-fixer.js | 163 - node_modules/eslint/lib/linter/rules.js | 71 - .../eslint/lib/linter/safe-emitter.js | 52 - .../eslint/lib/linter/source-code-fixer.js | 152 - node_modules/eslint/lib/linter/timing.js | 169 - node_modules/eslint/lib/linter/vfile.js | 118 - node_modules/eslint/lib/options.js | 442 - node_modules/eslint/lib/rule-tester/index.js | 7 - .../eslint/lib/rule-tester/rule-tester.js | 1307 - .../eslint/lib/rules/accessor-pairs.js | 350 - .../eslint/lib/rules/array-bracket-newline.js | 261 - .../eslint/lib/rules/array-bracket-spacing.js | 244 - .../eslint/lib/rules/array-callback-return.js | 448 - .../eslint/lib/rules/array-element-newline.js | 311 - .../eslint/lib/rules/arrow-body-style.js | 298 - node_modules/eslint/lib/rules/arrow-parens.js | 186 - .../eslint/lib/rules/arrow-spacing.js | 164 - .../eslint/lib/rules/block-scoped-var.js | 135 - .../eslint/lib/rules/block-spacing.js | 174 - node_modules/eslint/lib/rules/brace-style.js | 197 - .../eslint/lib/rules/callback-return.js | 187 - node_modules/eslint/lib/rules/camelcase.js | 410 - .../eslint/lib/rules/capitalized-comments.js | 303 - .../lib/rules/class-methods-use-this.js | 191 - node_modules/eslint/lib/rules/comma-dangle.js | 373 - .../eslint/lib/rules/comma-spacing.js | 192 - node_modules/eslint/lib/rules/comma-style.js | 314 - node_modules/eslint/lib/rules/complexity.js | 192 - .../lib/rules/computed-property-spacing.js | 208 - .../eslint/lib/rules/consistent-return.js | 210 - .../eslint/lib/rules/consistent-this.js | 149 - .../eslint/lib/rules/constructor-super.js | 445 - node_modules/eslint/lib/rules/curly.js | 349 - .../eslint/lib/rules/default-case-last.js | 44 - node_modules/eslint/lib/rules/default-case.js | 99 - .../eslint/lib/rules/default-param-last.js | 62 - node_modules/eslint/lib/rules/dot-location.js | 108 - node_modules/eslint/lib/rules/dot-notation.js | 179 - node_modules/eslint/lib/rules/eol-last.js | 115 - node_modules/eslint/lib/rules/eqeqeq.js | 174 - .../eslint/lib/rules/for-direction.js | 140 - .../eslint/lib/rules/func-call-spacing.js | 233 - .../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 | 138 - .../rules/function-call-argument-newline.js | 125 - .../lib/rules/function-paren-newline.js | 292 - .../lib/rules/generator-star-spacing.js | 209 - .../eslint/lib/rules/getter-return.js | 206 - .../eslint/lib/rules/global-require.js | 90 - .../lib/rules/grouped-accessor-pairs.js | 217 - node_modules/eslint/lib/rules/guard-for-in.js | 76 - .../eslint/lib/rules/handle-callback-err.js | 101 - node_modules/eslint/lib/rules/id-blacklist.js | 246 - node_modules/eslint/lib/rules/id-denylist.js | 241 - node_modules/eslint/lib/rules/id-length.js | 190 - node_modules/eslint/lib/rules/id-match.js | 307 - .../lib/rules/implicit-arrow-linebreak.js | 84 - .../eslint/lib/rules/indent-legacy.js | 1126 - node_modules/eslint/lib/rules/indent.js | 1803 -- node_modules/eslint/lib/rules/index.js | 305 - .../eslint/lib/rules/init-declarations.js | 139 - node_modules/eslint/lib/rules/jsx-quotes.js | 98 - node_modules/eslint/lib/rules/key-spacing.js | 687 - .../eslint/lib/rules/keyword-spacing.js | 640 - .../eslint/lib/rules/line-comment-position.js | 125 - .../eslint/lib/rules/linebreak-style.js | 108 - .../eslint/lib/rules/lines-around-comment.js | 471 - .../lib/rules/lines-around-directive.js | 201 - .../lib/rules/lines-between-class-members.js | 269 - .../lib/rules/logical-assignment-operators.js | 504 - .../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 | 440 - .../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 | 199 - .../eslint/lib/rules/max-statements.js | 184 - .../lib/rules/multiline-comment-style.js | 476 - .../eslint/lib/rules/multiline-ternary.js | 174 - node_modules/eslint/lib/rules/new-cap.js | 257 - node_modules/eslint/lib/rules/new-parens.js | 93 - .../eslint/lib/rules/newline-after-var.js | 253 - .../eslint/lib/rules/newline-before-return.js | 217 - .../lib/rules/newline-per-chained-call.js | 126 - node_modules/eslint/lib/rules/no-alert.js | 138 - .../eslint/lib/rules/no-array-constructor.js | 133 - .../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 | 121 - .../eslint/lib/rules/no-buffer-constructor.js | 50 - node_modules/eslint/lib/rules/no-caller.js | 46 - .../eslint/lib/rules/no-case-declarations.js | 76 - .../eslint/lib/rules/no-catch-shadow.js | 82 - .../eslint/lib/rules/no-class-assign.js | 63 - .../eslint/lib/rules/no-compare-neg-zero.js | 60 - .../eslint/lib/rules/no-cond-assign.js | 159 - .../eslint/lib/rules/no-confusing-arrow.js | 92 - node_modules/eslint/lib/rules/no-console.js | 208 - .../eslint/lib/rules/no-const-assign.js | 56 - .../rules/no-constant-binary-expression.js | 508 - .../eslint/lib/rules/no-constant-condition.js | 162 - .../eslint/lib/rules/no-constructor-return.js | 62 - node_modules/eslint/lib/rules/no-continue.js | 39 - .../eslint/lib/rules/no-control-regex.js | 138 - 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 | 82 - .../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 | 293 - .../eslint/lib/rules/no-else-return.js | 404 - .../lib/rules/no-empty-character-class.js | 76 - .../eslint/lib/rules/no-empty-function.js | 167 - .../eslint/lib/rules/no-empty-pattern.js | 80 - .../eslint/lib/rules/no-empty-static-block.js | 47 - node_modules/eslint/lib/rules/no-empty.js | 104 - node_modules/eslint/lib/rules/no-eq-null.js | 46 - node_modules/eslint/lib/rules/no-eval.js | 287 - node_modules/eslint/lib/rules/no-ex-assign.js | 54 - .../eslint/lib/rules/no-extend-native.js | 178 - .../eslint/lib/rules/no-extra-bind.js | 213 - .../eslint/lib/rules/no-extra-boolean-cast.js | 369 - .../eslint/lib/rules/no-extra-label.js | 149 - .../eslint/lib/rules/no-extra-parens.js | 1322 - .../eslint/lib/rules/no-extra-semi.js | 147 - .../eslint/lib/rules/no-fallthrough.js | 218 - .../eslint/lib/rules/no-floating-decimal.js | 73 - .../eslint/lib/rules/no-func-assign.js | 78 - .../eslint/lib/rules/no-global-assign.js | 96 - .../eslint/lib/rules/no-implicit-coercion.js | 411 - .../eslint/lib/rules/no-implicit-globals.js | 148 - .../eslint/lib/rules/no-implied-eval.js | 132 - .../eslint/lib/rules/no-import-assign.js | 241 - .../eslint/lib/rules/no-inline-comments.js | 108 - .../eslint/lib/rules/no-inner-declarations.js | 133 - .../eslint/lib/rules/no-invalid-regexp.js | 211 - .../eslint/lib/rules/no-invalid-this.js | 150 - .../lib/rules/no-irregular-whitespace.js | 278 - node_modules/eslint/lib/rules/no-iterator.js | 52 - node_modules/eslint/lib/rules/no-label-var.js | 80 - node_modules/eslint/lib/rules/no-labels.js | 150 - .../eslint/lib/rules/no-lone-blocks.js | 136 - node_modules/eslint/lib/rules/no-lonely-if.js | 94 - node_modules/eslint/lib/rules/no-loop-func.js | 238 - .../eslint/lib/rules/no-loss-of-precision.js | 214 - .../eslint/lib/rules/no-magic-numbers.js | 243 - .../rules/no-misleading-character-class.js | 537 - .../eslint/lib/rules/no-mixed-operators.js | 229 - .../eslint/lib/rules/no-mixed-requires.js | 238 - .../lib/rules/no-mixed-spaces-and-tabs.js | 116 - .../eslint/lib/rules/no-multi-assign.js | 64 - .../eslint/lib/rules/no-multi-spaces.js | 141 - node_modules/eslint/lib/rules/no-multi-str.js | 65 - .../lib/rules/no-multiple-empty-lines.js | 154 - .../eslint/lib/rules/no-native-reassign.js | 98 - .../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 | 87 - .../lib/rules/no-new-native-nonconstructor.js | 66 - .../eslint/lib/rules/no-new-object.js | 67 - .../eslint/lib/rules/no-new-require.js | 50 - .../eslint/lib/rules/no-new-symbol.js | 63 - .../eslint/lib/rules/no-new-wrappers.js | 60 - 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 | 86 - .../eslint/lib/rules/no-object-constructor.js | 117 - .../eslint/lib/rules/no-octal-escape.js | 56 - node_modules/eslint/lib/rules/no-octal.js | 45 - .../eslint/lib/rules/no-param-reassign.js | 230 - .../eslint/lib/rules/no-path-concat.js | 64 - node_modules/eslint/lib/rules/no-plusplus.js | 102 - .../eslint/lib/rules/no-process-env.js | 51 - .../eslint/lib/rules/no-process-exit.js | 47 - .../lib/rules/no-promise-executor-return.js | 263 - node_modules/eslint/lib/rules/no-proto.js | 48 - .../eslint/lib/rules/no-prototype-builtins.js | 159 - node_modules/eslint/lib/rules/no-redeclare.js | 171 - .../eslint/lib/rules/no-regex-spaces.js | 197 - .../eslint/lib/rules/no-restricted-exports.js | 204 - .../eslint/lib/rules/no-restricted-globals.js | 124 - .../eslint/lib/rules/no-restricted-imports.js | 563 - .../eslint/lib/rules/no-restricted-modules.js | 213 - .../lib/rules/no-restricted-properties.js | 168 - .../eslint/lib/rules/no-restricted-syntax.js | 70 - .../eslint/lib/rules/no-return-assign.js | 82 - .../eslint/lib/rules/no-return-await.js | 135 - .../eslint/lib/rules/no-script-url.js | 61 - .../eslint/lib/rules/no-self-assign.js | 184 - .../eslint/lib/rules/no-self-compare.js | 60 - node_modules/eslint/lib/rules/no-sequences.js | 139 - .../eslint/lib/rules/no-setter-return.js | 226 - .../lib/rules/no-shadow-restricted-names.js | 65 - node_modules/eslint/lib/rules/no-shadow.js | 342 - .../eslint/lib/rules/no-spaced-func.js | 83 - .../eslint/lib/rules/no-sparse-arrays.js | 73 - node_modules/eslint/lib/rules/no-sync.js | 64 - node_modules/eslint/lib/rules/no-tabs.js | 81 - .../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 | 363 - .../eslint/lib/rules/no-throw-literal.js | 51 - .../eslint/lib/rules/no-trailing-spaces.js | 192 - .../eslint/lib/rules/no-undef-init.js | 75 - node_modules/eslint/lib/rules/no-undef.js | 81 - node_modules/eslint/lib/rules/no-undefined.js | 86 - .../eslint/lib/rules/no-underscore-dangle.js | 339 - .../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 | 187 - .../eslint/lib/rules/no-unreachable.js | 293 - .../eslint/lib/rules/no-unsafe-finally.js | 111 - .../eslint/lib/rules/no-unsafe-negation.js | 130 - .../lib/rules/no-unsafe-optional-chaining.js | 207 - .../eslint/lib/rules/no-unused-expressions.js | 190 - .../eslint/lib/rules/no-unused-labels.js | 143 - .../rules/no-unused-private-class-members.js | 195 - .../eslint/lib/rules/no-unused-vars.js | 881 - .../eslint/lib/rules/no-use-before-define.js | 350 - .../eslint/lib/rules/no-useless-assignment.js | 566 - .../lib/rules/no-useless-backreference.js | 244 - .../eslint/lib/rules/no-useless-call.js | 90 - .../eslint/lib/rules/no-useless-catch.js | 57 - .../lib/rules/no-useless-computed-key.js | 174 - .../eslint/lib/rules/no-useless-concat.js | 115 - .../lib/rules/no-useless-constructor.js | 205 - .../eslint/lib/rules/no-useless-escape.js | 333 - .../eslint/lib/rules/no-useless-rename.js | 175 - .../eslint/lib/rules/no-useless-return.js | 369 - node_modules/eslint/lib/rules/no-var.js | 334 - node_modules/eslint/lib/rules/no-void.js | 66 - .../eslint/lib/rules/no-warning-comments.js | 203 - .../rules/no-whitespace-before-property.js | 116 - node_modules/eslint/lib/rules/no-with.js | 39 - .../rules/nonblock-statement-body-position.js | 127 - .../eslint/lib/rules/object-curly-newline.js | 324 - .../eslint/lib/rules/object-curly-spacing.js | 311 - .../lib/rules/object-property-newline.js | 102 - .../eslint/lib/rules/object-shorthand.js | 521 - .../lib/rules/one-var-declaration-per-line.js | 95 - node_modules/eslint/lib/rules/one-var.js | 567 - .../eslint/lib/rules/operator-assignment.js | 211 - .../eslint/lib/rules/operator-linebreak.js | 253 - .../eslint/lib/rules/padded-blocks.js | 310 - .../rules/padding-line-between-statements.js | 590 - .../eslint/lib/rules/prefer-arrow-callback.js | 378 - node_modules/eslint/lib/rules/prefer-const.js | 505 - .../eslint/lib/rules/prefer-destructuring.js | 301 - .../rules/prefer-exponentiation-operator.js | 191 - .../lib/rules/prefer-named-capture-group.js | 178 - .../lib/rules/prefer-numeric-literals.js | 148 - .../eslint/lib/rules/prefer-object-has-own.js | 114 - .../eslint/lib/rules/prefer-object-spread.js | 298 - .../lib/rules/prefer-promise-reject-errors.js | 136 - .../eslint/lib/rules/prefer-reflect.js | 127 - .../eslint/lib/rules/prefer-regex-literals.js | 510 - .../eslint/lib/rules/prefer-rest-params.js | 118 - .../eslint/lib/rules/prefer-spread.js | 87 - .../eslint/lib/rules/prefer-template.js | 275 - node_modules/eslint/lib/rules/quote-props.js | 310 - node_modules/eslint/lib/rules/quotes.js | 350 - node_modules/eslint/lib/rules/radix.js | 200 - .../lib/rules/require-atomic-updates.js | 334 - .../eslint/lib/rules/require-await.js | 147 - .../lib/rules/require-unicode-regexp.js | 210 - .../eslint/lib/rules/require-yield.js | 77 - .../eslint/lib/rules/rest-spread-spacing.js | 123 - node_modules/eslint/lib/rules/semi-spacing.js | 248 - node_modules/eslint/lib/rules/semi-style.js | 158 - node_modules/eslint/lib/rules/semi.js | 438 - node_modules/eslint/lib/rules/sort-imports.js | 245 - node_modules/eslint/lib/rules/sort-keys.js | 236 - node_modules/eslint/lib/rules/sort-vars.js | 105 - .../eslint/lib/rules/space-before-blocks.js | 204 - .../lib/rules/space-before-function-paren.js | 167 - .../eslint/lib/rules/space-in-parens.js | 285 - .../eslint/lib/rules/space-infix-ops.js | 198 - .../eslint/lib/rules/space-unary-ops.js | 324 - .../eslint/lib/rules/spaced-comment.js | 385 - node_modules/eslint/lib/rules/strict.js | 278 - .../eslint/lib/rules/switch-colon-spacing.js | 132 - .../eslint/lib/rules/symbol-description.js | 73 - .../lib/rules/template-curly-spacing.js | 144 - .../eslint/lib/rules/template-tag-spacing.js | 93 - node_modules/eslint/lib/rules/unicode-bom.js | 75 - node_modules/eslint/lib/rules/use-isnan.js | 237 - .../eslint/lib/rules/utils/ast-utils.js | 2476 -- .../eslint/lib/rules/utils/char-source.js | 240 - .../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/regular-expressions.js | 50 - .../eslint/lib/rules/utils/unicode/index.js | 16 - .../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-typeof.js | 129 - node_modules/eslint/lib/rules/vars-on-top.js | 157 - node_modules/eslint/lib/rules/wrap-iife.js | 207 - node_modules/eslint/lib/rules/wrap-regex.js | 61 - .../eslint/lib/rules/yield-star-spacing.js | 130 - node_modules/eslint/lib/rules/yoda.js | 350 - .../eslint/lib/services/parser-service.js | 65 - .../eslint/lib/services/processor-service.js | 109 - node_modules/eslint/lib/shared/ajv.js | 34 - node_modules/eslint/lib/shared/assert.js | 22 - node_modules/eslint/lib/shared/ast-utils.js | 29 - .../eslint/lib/shared/deep-merge-arrays.js | 60 - node_modules/eslint/lib/shared/directives.js | 15 - node_modules/eslint/lib/shared/flags.js | 28 - node_modules/eslint/lib/shared/logging.js | 39 - .../eslint/lib/shared/runtime-info.js | 168 - .../eslint/lib/shared/serialization.js | 55 - node_modules/eslint/lib/shared/severity.js | 49 - node_modules/eslint/lib/shared/stats.js | 30 - .../eslint/lib/shared/string-utils.js | 58 - node_modules/eslint/lib/shared/text-table.js | 67 - node_modules/eslint/lib/shared/traverser.js | 195 - node_modules/eslint/lib/shared/types.js | 251 - node_modules/eslint/lib/types/index.d.ts | 1683 -- .../lib/types/rules/best-practices.d.ts | 1129 - .../eslint/lib/types/rules/deprecated.d.ts | 235 - .../eslint/lib/types/rules/ecmascript-6.d.ts | 647 - .../eslint/lib/types/rules/index.d.ts | 50 - .../eslint/lib/types/rules/node-commonjs.d.ts | 160 - .../lib/types/rules/possible-errors.d.ts | 653 - .../eslint/lib/types/rules/strict-mode.d.ts | 38 - .../lib/types/rules/stylistic-issues.d.ts | 2037 -- .../eslint/lib/types/rules/variables.d.ts | 234 - node_modules/eslint/lib/types/universal.d.ts | 6 - .../lib/types/use-at-your-own-risk.d.ts | 85 - node_modules/eslint/lib/universal.js | 10 - node_modules/eslint/lib/unsupported-api.js | 29 - .../eslint/messages/all-files-ignored.js | 16 - .../messages/all-matched-files-ignored.js | 21 - .../eslint/messages/config-file-missing.js | 16 - .../eslint/messages/eslintrc-incompat.js | 119 - .../eslint/messages/eslintrc-plugins.js | 24 - .../eslint/messages/extend-config-missing.js | 13 - .../eslint/messages/failed-to-read-json.js | 11 - .../eslint/messages/file-not-found.js | 10 - .../eslint/messages/invalid-rule-options.js | 17 - .../eslint/messages/invalid-rule-severity.js | 13 - .../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 - node_modules/eslint/messages/shared.js | 18 - .../eslint/messages/whitespace-found.js | 11 - .../eslint/node_modules/chalk/index.d.ts | 415 - .../eslint/node_modules/chalk/license | 9 - .../eslint/node_modules/chalk/package.json | 68 - .../eslint/node_modules/chalk/readme.md | 341 - .../eslint/node_modules/chalk/source/index.js | 229 - .../node_modules/chalk/source/templates.js | 134 - .../eslint/node_modules/chalk/source/util.js | 39 - node_modules/eslint/package.json | 219 - node_modules/esm/LICENSE | 23 - node_modules/esm/README.md | 137 - node_modules/esm/esm.js | 1 - node_modules/esm/esm/loader.js | 1 - node_modules/esm/index.js | 1 - node_modules/esm/package.json | 27 - node_modules/espree/LICENSE | 25 - node_modules/espree/README.md | 261 - node_modules/espree/dist/espree.cjs | 939 - node_modules/espree/espree.js | 174 - node_modules/espree/lib/espree.js | 349 - node_modules/espree/lib/features.js | 27 - node_modules/espree/lib/options.js | 124 - node_modules/espree/lib/token-translator.js | 263 - node_modules/espree/lib/version.js | 3 - node_modules/espree/package.json | 75 - node_modules/esquery/README.md | 27 - node_modules/esquery/dist/esquery.esm.js | 4172 --- node_modules/esquery/dist/esquery.esm.min.js | 2 - .../esquery/dist/esquery.esm.min.js.map | 1 - node_modules/esquery/dist/esquery.js | 4180 --- node_modules/esquery/dist/esquery.lite.js | 3470 --- 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 | 2694 -- 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/expand-tilde/LICENSE | 21 - node_modules/expand-tilde/README.md | 80 - node_modules/expand-tilde/index.js | 22 - node_modules/expand-tilde/package.json | 67 - node_modules/extend-shallow/LICENSE | 21 - node_modules/extend-shallow/README.md | 97 - node_modules/extend-shallow/index.js | 60 - node_modules/extend-shallow/package.json | 83 - node_modules/extend/.editorconfig | 20 - node_modules/extend/.eslintrc | 17 - node_modules/extend/.jscs.json | 175 - node_modules/extend/.travis.yml | 230 - node_modules/extend/CHANGELOG.md | 83 - node_modules/extend/LICENSE | 23 - node_modules/extend/README.md | 81 - node_modules/extend/component.json | 32 - node_modules/extend/index.js | 117 - node_modules/extend/package.json | 42 - 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 - node_modules/fast-diff/LICENSE | 201 - node_modules/fast-diff/README.md | 24 - node_modules/fast-diff/diff.d.ts | 21 - node_modules/fast-diff/diff.js | 1138 - node_modules/fast-diff/package.json | 30 - node_modules/fast-fifo/LICENSE | 21 - node_modules/fast-fifo/README.md | 78 - node_modules/fast-fifo/fixed-size.js | 39 - node_modules/fast-fifo/index.js | 48 - node_modules/fast-fifo/package.json | 28 - .../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 - .../fastest-levenshtein/.eslintrc.json | 30 - node_modules/fastest-levenshtein/.prettierrc | 4 - node_modules/fastest-levenshtein/.travis.yml | 21 - node_modules/fastest-levenshtein/LICENSE.md | 21 - node_modules/fastest-levenshtein/README.md | 57 - node_modules/fastest-levenshtein/bench.js | 96 - node_modules/fastest-levenshtein/esm/mod.d.ts | 4 - .../fastest-levenshtein/esm/mod.d.ts.map | 1 - node_modules/fastest-levenshtein/esm/mod.js | 138 - node_modules/fastest-levenshtein/mod.d.ts | 3 - node_modules/fastest-levenshtein/mod.js | 142 - node_modules/fastest-levenshtein/package.json | 72 - node_modules/fastest-levenshtein/test.js | 55 - node_modules/fastest-levenshtein/test.ts | 67 - node_modules/fastq/.github/dependabot.yml | 11 - node_modules/fastq/.github/workflows/ci.yml | 75 - node_modules/fastq/LICENSE | 13 - node_modules/fastq/README.md | 306 - node_modules/fastq/bench.js | 66 - node_modules/fastq/example.js | 14 - node_modules/fastq/example.mjs | 11 - node_modules/fastq/index.d.ts | 38 - node_modules/fastq/package.json | 53 - node_modules/fastq/queue.js | 311 - node_modules/fastq/test/example.ts | 83 - node_modules/fastq/test/promise.js | 248 - node_modules/fastq/test/test.js | 642 - node_modules/fastq/test/tsconfig.json | 11 - node_modules/file-entry-cache/LICENSE | 22 - node_modules/file-entry-cache/README.md | 115 - node_modules/file-entry-cache/cache.js | 291 - node_modules/file-entry-cache/package.json | 56 - node_modules/fill-range/LICENSE | 21 - node_modules/fill-range/README.md | 237 - node_modules/fill-range/index.js | 248 - node_modules/fill-range/package.json | 74 - node_modules/find-up/index.d.ts | 138 - node_modules/find-up/index.js | 89 - node_modules/find-up/license | 9 - node_modules/find-up/package.json | 54 - node_modules/find-up/readme.md | 151 - node_modules/findup-sync/LICENSE | 21 - node_modules/findup-sync/README.md | 56 - node_modules/findup-sync/index.js | 90 - node_modules/findup-sync/package.json | 64 - node_modules/fined/LICENSE | 21 - node_modules/fined/README.md | 76 - node_modules/fined/index.js | 173 - node_modules/fined/package.json | 54 - node_modules/flagged-respawn/LICENSE | 21 - node_modules/flagged-respawn/README.md | 106 - node_modules/flagged-respawn/index.js | 53 - .../flagged-respawn/lib/is-v8flags.js | 5 - node_modules/flagged-respawn/lib/remover.js | 13 - node_modules/flagged-respawn/lib/reorder.js | 18 - node_modules/flagged-respawn/lib/respawn.js | 16 - node_modules/flagged-respawn/package.json | 50 - node_modules/flat-cache/LICENSE | 22 - node_modules/flat-cache/README.md | 77 - node_modules/flat-cache/changelog.md | 278 - node_modules/flat-cache/package.json | 63 - node_modules/flat-cache/src/cache.js | 214 - node_modules/flat-cache/src/del.js | 30 - node_modules/flat-cache/src/utils.js | 42 - node_modules/flatted/LICENSE | 15 - node_modules/flatted/README.md | 115 - node_modules/flatted/cjs/index.js | 125 - node_modules/flatted/cjs/package.json | 1 - node_modules/flatted/es.js | 1 - node_modules/flatted/esm.js | 1 - node_modules/flatted/esm/index.js | 120 - node_modules/flatted/index.js | 146 - node_modules/flatted/min.js | 1 - node_modules/flatted/package.json | 65 - node_modules/flatted/php/flatted.php | 156 - node_modules/flatted/python/flatted.py | 149 - node_modules/flatted/python/test.py | 63 - node_modules/flatted/types/index.d.ts | 4 - node_modules/for-each/.editorconfig | 20 - node_modules/for-each/.eslintrc | 16 - node_modules/for-each/.travis.yml | 45 - node_modules/for-each/LICENSE | 22 - node_modules/for-each/README.md | 43 - node_modules/for-each/index.js | 62 - node_modules/for-each/package.json | 65 - node_modules/for-each/test/.eslintrc | 8 - node_modules/for-each/test/test.js | 182 - node_modules/for-in/LICENSE | 21 - node_modules/for-in/README.md | 85 - node_modules/for-in/index.js | 16 - node_modules/for-in/package.json | 68 - node_modules/for-own/LICENSE | 21 - node_modules/for-own/README.md | 85 - node_modules/for-own/index.js | 19 - node_modules/for-own/package.json | 70 - node_modules/fs-mkdirp-stream/LICENSE | 21 - node_modules/fs-mkdirp-stream/README.md | 63 - node_modules/fs-mkdirp-stream/index.js | 44 - node_modules/fs-mkdirp-stream/mkdirp.js | 143 - node_modules/fs-mkdirp-stream/package.json | 58 - node_modules/function-bind/.eslintrc | 21 - .../function-bind/.github/FUNDING.yml | 12 - .../function-bind/.github/SECURITY.md | 3 - node_modules/function-bind/.nycrc | 13 - node_modules/function-bind/CHANGELOG.md | 136 - node_modules/function-bind/LICENSE | 20 - node_modules/function-bind/README.md | 46 - node_modules/function-bind/implementation.js | 84 - node_modules/function-bind/index.js | 5 - node_modules/function-bind/package.json | 87 - node_modules/function-bind/test/.eslintrc | 9 - node_modules/function-bind/test/index.js | 252 - node_modules/get-caller-file/LICENSE.md | 6 - node_modules/get-caller-file/README.md | 41 - node_modules/get-caller-file/index.d.ts | 2 - node_modules/get-caller-file/index.js | 22 - node_modules/get-caller-file/index.js.map | 1 - node_modules/get-caller-file/package.json | 42 - node_modules/get-intrinsic/.eslintrc | 38 - .../get-intrinsic/.github/FUNDING.yml | 12 - node_modules/get-intrinsic/.nycrc | 9 - node_modules/get-intrinsic/CHANGELOG.md | 143 - node_modules/get-intrinsic/LICENSE | 21 - node_modules/get-intrinsic/README.md | 71 - node_modules/get-intrinsic/index.js | 359 - node_modules/get-intrinsic/package.json | 93 - .../get-intrinsic/test/GetIntrinsic.js | 274 - 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-stream/LICENSE | 21 - node_modules/glob-stream/README.md | 118 - node_modules/glob-stream/index.js | 361 - node_modules/glob-stream/package.json | 62 - node_modules/glob-watcher/LICENSE | 21 - node_modules/glob-watcher/README.md | 136 - node_modules/glob-watcher/index.js | 60 - node_modules/glob-watcher/lib/debounce.js | 26 - .../glob-watcher/lib/normalize-args.js | 33 - node_modules/glob-watcher/package.json | 54 - node_modules/global-modules/LICENSE | 21 - node_modules/global-modules/README.md | 75 - node_modules/global-modules/index.js | 31 - node_modules/global-modules/package.json | 72 - node_modules/global-prefix/LICENSE | 21 - node_modules/global-prefix/README.md | 78 - node_modules/global-prefix/index.js | 96 - .../global-prefix/node_modules/.bin/which | 1 - .../node_modules/which/CHANGELOG.md | 152 - .../global-prefix/node_modules/which/LICENSE | 15 - .../node_modules/which/README.md | 51 - .../node_modules/which/bin/which | 52 - .../node_modules/which/package.json | 30 - .../global-prefix/node_modules/which/which.js | 135 - node_modules/global-prefix/package.json | 75 - node_modules/globals/globals.json | 2972 --- node_modules/globals/index.d.ts | 3069 --- node_modules/globals/index.js | 2 - node_modules/globals/license | 9 - node_modules/globals/package.json | 98 - node_modules/globals/readme.md | 42 - node_modules/glogg/LICENSE | 22 - node_modules/glogg/README.md | 118 - node_modules/glogg/index.js | 41 - node_modules/glogg/package.json | 51 - node_modules/gopd/.eslintrc | 16 - node_modules/gopd/.github/FUNDING.yml | 12 - node_modules/gopd/CHANGELOG.md | 39 - node_modules/gopd/LICENSE | 21 - node_modules/gopd/README.md | 40 - node_modules/gopd/index.d.ts | 5 - node_modules/gopd/index.js | 17 - node_modules/gopd/package.json | 80 - node_modules/gopd/test/index.js | 36 - node_modules/gopd/tsconfig.json | 9 - node_modules/graceful-fs/LICENSE | 15 - node_modules/graceful-fs/README.md | 143 - node_modules/graceful-fs/clone.js | 23 - node_modules/graceful-fs/graceful-fs.js | 448 - node_modules/graceful-fs/legacy-streams.js | 118 - node_modules/graceful-fs/package.json | 53 - node_modules/graceful-fs/polyfills.js | 355 - node_modules/gulp-cli/LICENSE | 21 - node_modules/gulp-cli/README.md | 243 - node_modules/gulp-cli/bin/gulp.js | 5 - node_modules/gulp-cli/completion/README.md | 20 - node_modules/gulp-cli/completion/bash | 27 - node_modules/gulp-cli/completion/fish | 10 - node_modules/gulp-cli/completion/powershell | 61 - node_modules/gulp-cli/completion/zsh | 25 - node_modules/gulp-cli/gulp.1 | 80 - node_modules/gulp-cli/index.js | 231 - .../gulp-cli/lib/shared/array-find.js | 19 - .../gulp-cli/lib/shared/completion.js | 20 - .../gulp-cli/lib/shared/config/cli-flags.js | 26 - node_modules/gulp-cli/lib/shared/exit.js | 15 - node_modules/gulp-cli/lib/shared/is-object.js | 7 - .../gulp-cli/lib/shared/log/copy-tree.js | 81 - .../gulp-cli/lib/shared/log/format-hrtime.js | 48 - node_modules/gulp-cli/lib/shared/log/tasks.js | 171 - .../gulp-cli/lib/shared/log/to-console.js | 135 - .../gulp-cli/lib/shared/make-title.js | 11 - .../lib/shared/options/cli-options.js | 94 - .../gulp-cli/lib/shared/options/make-help.js | 24 - .../gulp-cli/lib/shared/register-exports.js | 21 - .../gulp-cli/lib/shared/require-or-import.js | 39 - node_modules/gulp-cli/lib/shared/tildify.js | 9 - node_modules/gulp-cli/lib/shared/translate.js | 305 - .../lib/versioned/^3.7.0/format-error.js | 23 - .../gulp-cli/lib/versioned/^3.7.0/index.js | 74 - .../lib/versioned/^3.7.0/log/events.js | 46 - .../lib/versioned/^3.7.0/log/tasks-simple.js | 9 - .../lib/versioned/^3.7.0/task-tree.js | 27 - .../lib/versioned/^4.0.0/format-error.js | 24 - .../gulp-cli/lib/versioned/^4.0.0/index.js | 91 - .../lib/versioned/^4.0.0/log/events.js | 39 - .../lib/versioned/^4.0.0/log/get-task.js | 43 - .../lib/versioned/^4.0.0/log/sync-task.js | 46 - .../lib/versioned/^4.0.0/log/tasks-simple.js | 7 - .../lib/versioned/^4.0.0/normalize-error.js | 26 - .../lib/versioned/^5.0.0/format-error.js | 24 - .../gulp-cli/lib/versioned/^5.0.0/index.js | 89 - .../lib/versioned/^5.0.0/log/events.js | 39 - .../lib/versioned/^5.0.0/log/get-task.js | 43 - .../lib/versioned/^5.0.0/log/sync-task.js | 46 - .../lib/versioned/^5.0.0/log/tasks-simple.js | 7 - .../gulp-cli/node_modules/chalk/index.d.ts | 415 - .../gulp-cli/node_modules/chalk/license | 9 - .../gulp-cli/node_modules/chalk/package.json | 68 - .../gulp-cli/node_modules/chalk/readme.md | 341 - .../node_modules/chalk/source/index.js | 229 - .../node_modules/chalk/source/templates.js | 134 - .../node_modules/chalk/source/util.js | 39 - .../gulp-cli/node_modules/cliui/CHANGELOG.md | 121 - .../gulp-cli/node_modules/cliui/LICENSE.txt | 14 - .../gulp-cli/node_modules/cliui/README.md | 141 - .../node_modules/cliui/build/index.cjs | 302 - .../node_modules/cliui/build/lib/index.js | 287 - .../cliui/build/lib/string-utils.js | 27 - .../gulp-cli/node_modules/cliui/index.mjs | 13 - .../gulp-cli/node_modules/cliui/package.json | 83 - .../node_modules/yargs-parser/CHANGELOG.md | 263 - .../node_modules/yargs-parser/LICENSE.txt | 14 - .../node_modules/yargs-parser/README.md | 518 - .../node_modules/yargs-parser/browser.js | 29 - .../node_modules/yargs-parser/build/index.cjs | 1042 - .../yargs-parser/build/lib/index.js | 59 - .../yargs-parser/build/lib/string-utils.js | 65 - .../build/lib/tokenize-arg-string.js | 40 - .../build/lib/yargs-parser-types.js | 12 - .../yargs-parser/build/lib/yargs-parser.js | 1037 - .../node_modules/yargs-parser/package.json | 87 - .../gulp-cli/node_modules/yargs/CHANGELOG.md | 88 - .../gulp-cli/node_modules/yargs/LICENSE | 21 - .../gulp-cli/node_modules/yargs/README.md | 202 - .../gulp-cli/node_modules/yargs/browser.mjs | 7 - .../node_modules/yargs/build/index.cjs | 2920 -- .../node_modules/yargs/build/lib/argsert.js | 62 - .../node_modules/yargs/build/lib/command.js | 382 - .../yargs/build/lib/completion-templates.js | 47 - .../yargs/build/lib/completion.js | 128 - .../yargs/build/lib/middleware.js | 53 - .../yargs/build/lib/parse-command.js | 32 - .../yargs/build/lib/typings/common-types.js | 9 - .../build/lib/typings/yargs-parser-types.js | 1 - .../node_modules/yargs/build/lib/usage.js | 548 - .../yargs/build/lib/utils/apply-extends.js | 59 - .../yargs/build/lib/utils/is-promise.js | 5 - .../yargs/build/lib/utils/levenshtein.js | 26 - .../yargs/build/lib/utils/obj-filter.js | 10 - .../yargs/build/lib/utils/process-argv.js | 17 - .../yargs/build/lib/utils/set-blocking.js | 12 - .../yargs/build/lib/utils/which-module.js | 10 - .../yargs/build/lib/validation.js | 308 - .../yargs/build/lib/yargs-factory.js | 1143 - .../node_modules/yargs/build/lib/yerror.js | 7 - .../node_modules/yargs/helpers/helpers.mjs | 10 - .../node_modules/yargs/helpers/index.js | 14 - .../node_modules/yargs/helpers/package.json | 3 - .../gulp-cli/node_modules/yargs/index.cjs | 39 - .../gulp-cli/node_modules/yargs/index.mjs | 8 - .../yargs/lib/platform-shims/browser.mjs | 92 - .../yargs/lib/platform-shims/esm.mjs | 67 - .../node_modules/yargs/locales/be.json | 46 - .../node_modules/yargs/locales/de.json | 46 - .../node_modules/yargs/locales/en.json | 51 - .../node_modules/yargs/locales/es.json | 46 - .../node_modules/yargs/locales/fi.json | 49 - .../node_modules/yargs/locales/fr.json | 53 - .../node_modules/yargs/locales/hi.json | 49 - .../node_modules/yargs/locales/hu.json | 46 - .../node_modules/yargs/locales/id.json | 50 - .../node_modules/yargs/locales/it.json | 46 - .../node_modules/yargs/locales/ja.json | 51 - .../node_modules/yargs/locales/ko.json | 49 - .../node_modules/yargs/locales/nb.json | 44 - .../node_modules/yargs/locales/nl.json | 49 - .../node_modules/yargs/locales/nn.json | 44 - .../node_modules/yargs/locales/pirate.json | 13 - .../node_modules/yargs/locales/pl.json | 49 - .../node_modules/yargs/locales/pt.json | 45 - .../node_modules/yargs/locales/pt_BR.json | 48 - .../node_modules/yargs/locales/ru.json | 46 - .../node_modules/yargs/locales/th.json | 46 - .../node_modules/yargs/locales/tr.json | 48 - .../node_modules/yargs/locales/zh_CN.json | 48 - .../node_modules/yargs/locales/zh_TW.json | 47 - .../gulp-cli/node_modules/yargs/package.json | 122 - .../gulp-cli/node_modules/yargs/yargs | 9 - node_modules/gulp-cli/package.json | 80 - node_modules/gulp-less/Changelog.md | 49 - node_modules/gulp-less/README.md | 120 - node_modules/gulp-less/index.js | 112 - node_modules/gulp-less/package.json | 37 - node_modules/gulp/LICENSE | 21 - node_modules/gulp/README.md | 232 - node_modules/gulp/bin/gulp.js | 3 - node_modules/gulp/index.js | 55 - node_modules/gulp/index.mjs | 16 - node_modules/gulp/package.json | 74 - node_modules/gulplog/LICENSE | 22 - node_modules/gulplog/README.md | 91 - node_modules/gulplog/index.d.ts | 44 - node_modules/gulplog/index.js | 7 - node_modules/gulplog/package.json | 51 - node_modules/has-flag/index.d.ts | 39 - node_modules/has-flag/index.js | 8 - node_modules/has-flag/license | 9 - node_modules/has-flag/package.json | 46 - node_modules/has-flag/readme.md | 89 - .../has-property-descriptors/.eslintrc | 13 - .../.github/FUNDING.yml | 12 - node_modules/has-property-descriptors/.nycrc | 9 - .../has-property-descriptors/CHANGELOG.md | 35 - node_modules/has-property-descriptors/LICENSE | 21 - .../has-property-descriptors/README.md | 43 - .../has-property-descriptors/index.js | 22 - .../has-property-descriptors/package.json | 77 - .../has-property-descriptors/test/index.js | 57 - node_modules/has-proto/.eslintrc | 5 - node_modules/has-proto/.github/FUNDING.yml | 12 - node_modules/has-proto/CHANGELOG.md | 38 - node_modules/has-proto/LICENSE | 21 - node_modules/has-proto/README.md | 38 - node_modules/has-proto/index.d.ts | 3 - node_modules/has-proto/index.js | 15 - node_modules/has-proto/package.json | 78 - node_modules/has-proto/test/index.js | 19 - node_modules/has-proto/tsconfig.json | 49 - node_modules/has-symbols/.eslintrc | 11 - node_modules/has-symbols/.github/FUNDING.yml | 12 - node_modules/has-symbols/.nycrc | 9 - node_modules/has-symbols/CHANGELOG.md | 75 - node_modules/has-symbols/LICENSE | 21 - node_modules/has-symbols/README.md | 46 - node_modules/has-symbols/index.js | 13 - node_modules/has-symbols/package.json | 101 - node_modules/has-symbols/shams.js | 42 - node_modules/has-symbols/test/index.js | 22 - .../has-symbols/test/shams/core-js.js | 28 - .../test/shams/get-own-property-symbols.js | 28 - node_modules/has-symbols/test/tests.js | 56 - node_modules/has-tostringtag/.eslintrc | 5 - .../has-tostringtag/.github/FUNDING.yml | 12 - node_modules/has-tostringtag/.nycrc | 13 - node_modules/has-tostringtag/CHANGELOG.md | 42 - node_modules/has-tostringtag/LICENSE | 21 - node_modules/has-tostringtag/README.md | 46 - node_modules/has-tostringtag/index.d.ts | 3 - node_modules/has-tostringtag/index.js | 8 - node_modules/has-tostringtag/package.json | 108 - node_modules/has-tostringtag/shams.d.ts | 3 - node_modules/has-tostringtag/shams.js | 8 - node_modules/has-tostringtag/test/index.js | 21 - .../has-tostringtag/test/shams/core-js.js | 31 - .../test/shams/get-own-property-symbols.js | 30 - node_modules/has-tostringtag/test/tests.js | 15 - node_modules/has-tostringtag/tsconfig.json | 49 - node_modules/hasown/.eslintrc | 5 - node_modules/hasown/.github/FUNDING.yml | 12 - node_modules/hasown/.nycrc | 13 - node_modules/hasown/CHANGELOG.md | 40 - node_modules/hasown/LICENSE | 21 - node_modules/hasown/README.md | 40 - node_modules/hasown/index.d.ts | 3 - node_modules/hasown/index.js | 8 - node_modules/hasown/package.json | 92 - node_modules/hasown/tsconfig.json | 6 - node_modules/homedir-polyfill/LICENSE | 21 - node_modules/homedir-polyfill/README.md | 96 - node_modules/homedir-polyfill/index.js | 9 - node_modules/homedir-polyfill/package.json | 62 - node_modules/homedir-polyfill/polyfill.js | 81 - .../iconv-lite/.github/dependabot.yml | 11 - .../iconv-lite/.idea/codeStyles/Project.xml | 47 - .../.idea/codeStyles/codeStyleConfig.xml | 5 - node_modules/iconv-lite/.idea/iconv-lite.iml | 12 - .../inspectionProfiles/Project_Default.xml | 6 - node_modules/iconv-lite/.idea/modules.xml | 8 - node_modules/iconv-lite/.idea/vcs.xml | 6 - node_modules/iconv-lite/Changelog.md | 212 - node_modules/iconv-lite/LICENSE | 21 - node_modules/iconv-lite/README.md | 130 - .../iconv-lite/encodings/dbcs-codec.js | 597 - .../iconv-lite/encodings/dbcs-data.js | 188 - node_modules/iconv-lite/encodings/index.js | 23 - node_modules/iconv-lite/encodings/internal.js | 198 - .../iconv-lite/encodings/sbcs-codec.js | 72 - .../encodings/sbcs-data-generated.js | 451 - .../iconv-lite/encodings/sbcs-data.js | 179 - .../encodings/tables/big5-added.json | 122 - .../iconv-lite/encodings/tables/cp936.json | 264 - .../iconv-lite/encodings/tables/cp949.json | 273 - .../iconv-lite/encodings/tables/cp950.json | 177 - .../iconv-lite/encodings/tables/eucjp.json | 182 - .../encodings/tables/gb18030-ranges.json | 1 - .../encodings/tables/gbk-added.json | 56 - .../iconv-lite/encodings/tables/shiftjis.json | 125 - node_modules/iconv-lite/encodings/utf16.js | 197 - node_modules/iconv-lite/encodings/utf32.js | 319 - node_modules/iconv-lite/encodings/utf7.js | 290 - node_modules/iconv-lite/lib/bom-handling.js | 52 - node_modules/iconv-lite/lib/index.d.ts | 41 - node_modules/iconv-lite/lib/index.js | 180 - node_modules/iconv-lite/lib/streams.js | 109 - node_modules/iconv-lite/package.json | 44 - node_modules/ieee754/LICENSE | 11 - node_modules/ieee754/README.md | 51 - node_modules/ieee754/index.d.ts | 10 - node_modules/ieee754/index.js | 85 - node_modules/ieee754/package.json | 52 - node_modules/ignore/LICENSE-MIT | 21 - node_modules/ignore/README.md | 412 - node_modules/ignore/index.d.ts | 61 - node_modules/ignore/index.js | 636 - node_modules/ignore/legacy.js | 559 - node_modules/ignore/package.json | 74 - node_modules/image-size/LICENSE | 9 - node_modules/image-size/Readme.md | 88 - node_modules/image-size/bin/image-size.js | 36 - node_modules/image-size/lib/detector.js | 19 - node_modules/image-size/lib/index.js | 105 - node_modules/image-size/lib/readUInt.js | 11 - node_modules/image-size/lib/types.js | 13 - node_modules/image-size/lib/types/bmp.js | 17 - node_modules/image-size/lib/types/dds.js | 18 - node_modules/image-size/lib/types/gif.js | 19 - node_modules/image-size/lib/types/jpg.js | 62 - node_modules/image-size/lib/types/png.js | 36 - node_modules/image-size/lib/types/psd.js | 17 - node_modules/image-size/lib/types/svg.js | 78 - node_modules/image-size/lib/types/tiff.js | 118 - node_modules/image-size/lib/types/webp.js | 69 - node_modules/image-size/package.json | 49 - node_modules/immediate/LICENSE.txt | 20 - node_modules/immediate/README.md | 93 - node_modules/immediate/dist/immediate.js | 75 - node_modules/immediate/dist/immediate.min.js | 1 - node_modules/immediate/lib/browser.js | 69 - node_modules/immediate/lib/index.js | 73 - node_modules/immediate/package.json | 42 - 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/inherits/LICENSE | 16 - node_modules/inherits/README.md | 42 - node_modules/inherits/inherits.js | 9 - node_modules/inherits/inherits_browser.js | 27 - node_modules/inherits/package.json | 29 - node_modules/ini/LICENSE | 15 - node_modules/ini/README.md | 102 - node_modules/ini/ini.js | 206 - node_modules/ini/package.json | 33 - node_modules/interpret/LICENSE | 21 - node_modules/interpret/README.md | 244 - node_modules/interpret/cjs-stub.js | 1 - node_modules/interpret/index.js | 542 - node_modules/interpret/mjs-stub.js | 1 - node_modules/interpret/package.json | 73 - node_modules/is-absolute/LICENSE | 22 - node_modules/is-absolute/README.md | 114 - node_modules/is-absolute/index.js | 47 - node_modules/is-absolute/package.json | 91 - node_modules/is-arguments/.editorconfig | 20 - node_modules/is-arguments/.eslintignore | 1 - node_modules/is-arguments/.eslintrc | 10 - node_modules/is-arguments/.github/FUNDING.yml | 12 - node_modules/is-arguments/.nycrc | 9 - node_modules/is-arguments/CHANGELOG.md | 179 - node_modules/is-arguments/LICENSE | 20 - node_modules/is-arguments/README.md | 47 - node_modules/is-arguments/index.js | 33 - node_modules/is-arguments/package.json | 91 - node_modules/is-arguments/test/index.js | 44 - node_modules/is-binary-path/index.d.ts | 17 - node_modules/is-binary-path/index.js | 7 - node_modules/is-binary-path/license | 9 - node_modules/is-binary-path/package.json | 40 - node_modules/is-binary-path/readme.md | 34 - node_modules/is-buffer/LICENSE | 21 - node_modules/is-buffer/README.md | 54 - node_modules/is-buffer/index.d.ts | 2 - node_modules/is-buffer/index.js | 11 - node_modules/is-buffer/package.json | 65 - node_modules/is-callable/.editorconfig | 31 - node_modules/is-callable/.eslintrc | 10 - node_modules/is-callable/.github/FUNDING.yml | 12 - node_modules/is-callable/.nycrc | 9 - node_modules/is-callable/CHANGELOG.md | 158 - node_modules/is-callable/LICENSE | 22 - node_modules/is-callable/README.md | 83 - node_modules/is-callable/index.js | 101 - node_modules/is-callable/package.json | 106 - node_modules/is-callable/test/index.js | 244 - node_modules/is-core-module/.eslintrc | 18 - node_modules/is-core-module/.nycrc | 9 - node_modules/is-core-module/CHANGELOG.md | 205 - node_modules/is-core-module/LICENSE | 20 - node_modules/is-core-module/README.md | 40 - node_modules/is-core-module/core.json | 161 - node_modules/is-core-module/index.js | 69 - node_modules/is-core-module/package.json | 76 - node_modules/is-core-module/test/index.js | 154 - node_modules/is-extendable/LICENSE | 21 - node_modules/is-extendable/README.md | 88 - node_modules/is-extendable/index.d.ts | 5 - node_modules/is-extendable/index.js | 14 - .../node_modules/is-plain-object/LICENSE | 21 - .../node_modules/is-plain-object/README.md | 104 - .../node_modules/is-plain-object/index.d.ts | 5 - .../node_modules/is-plain-object/index.js | 37 - .../node_modules/is-plain-object/package.json | 79 - node_modules/is-extendable/package.json | 67 - 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 - .../is-fullwidth-code-point/index.d.ts | 17 - node_modules/is-fullwidth-code-point/index.js | 50 - node_modules/is-fullwidth-code-point/license | 9 - .../is-fullwidth-code-point/package.json | 42 - .../is-fullwidth-code-point/readme.md | 39 - .../is-generator-function/.eslintignore | 1 - node_modules/is-generator-function/.eslintrc | 9 - node_modules/is-generator-function/.nvmrc | 1 - node_modules/is-generator-function/.nycrc | 9 - .../is-generator-function/CHANGELOG.md | 216 - node_modules/is-generator-function/LICENSE | 20 - node_modules/is-generator-function/README.md | 40 - node_modules/is-generator-function/index.js | 38 - .../is-generator-function/package.json | 87 - .../is-generator-function/test/corejs.js | 5 - .../is-generator-function/test/index.js | 83 - .../is-generator-function/test/uglified.js | 8 - 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-negated-glob/LICENSE | 21 - node_modules/is-negated-glob/README.md | 73 - node_modules/is-negated-glob/index.js | 15 - node_modules/is-negated-glob/package.json | 68 - node_modules/is-number/LICENSE | 21 - node_modules/is-number/README.md | 187 - node_modules/is-number/index.js | 18 - node_modules/is-number/package.json | 82 - node_modules/is-plain-object/LICENSE | 21 - node_modules/is-plain-object/README.md | 125 - .../is-plain-object/dist/is-plain-object.js | 38 - .../is-plain-object/dist/is-plain-object.mjs | 34 - .../is-plain-object/is-plain-object.d.ts | 1 - node_modules/is-plain-object/package.json | 85 - node_modules/is-relative/LICENSE | 21 - node_modules/is-relative/README.md | 77 - node_modules/is-relative/index.js | 12 - node_modules/is-relative/package.json | 71 - node_modules/is-typed-array/.editorconfig | 20 - node_modules/is-typed-array/.eslintrc | 13 - .../is-typed-array/.github/FUNDING.yml | 12 - node_modules/is-typed-array/.nycrc | 9 - node_modules/is-typed-array/CHANGELOG.md | 144 - node_modules/is-typed-array/LICENSE | 22 - node_modules/is-typed-array/README.md | 70 - node_modules/is-typed-array/index.d.ts | 16 - node_modules/is-typed-array/index.js | 8 - node_modules/is-typed-array/package.json | 127 - node_modules/is-typed-array/test/index.js | 111 - node_modules/is-typed-array/tsconfig.json | 49 - node_modules/is-unc-path/LICENSE | 21 - node_modules/is-unc-path/README.md | 115 - node_modules/is-unc-path/index.js | 10 - node_modules/is-unc-path/package.json | 65 - node_modules/is-valid-glob/LICENSE | 21 - node_modules/is-valid-glob/README.md | 103 - node_modules/is-valid-glob/index.js | 21 - node_modules/is-valid-glob/package.json | 64 - node_modules/is-what/.babelrc | 3 - node_modules/is-what/.eslintignore | 9 - node_modules/is-what/.eslintrc.js | 18 - node_modules/is-what/.github/FUNDING.yml | 12 - node_modules/is-what/.prettierrc | 9 - node_modules/is-what/.vscode/settings.json | 9 - node_modules/is-what/LICENSE | 21 - node_modules/is-what/README.md | 191 - node_modules/is-what/build.js | 60 - node_modules/is-what/dist/index.cjs.js | 364 - node_modules/is-what/dist/index.esm.js | 327 - node_modules/is-what/package.json | 86 - node_modules/is-what/src/index.ts | 395 - node_modules/is-what/test/ava.ts | 376 - node_modules/is-what/test/index.test.js | 15 - node_modules/is-what/tsconfig.json | 11 - node_modules/is-what/types/index.d.ts | 253 - node_modules/is-windows/LICENSE | 21 - node_modules/is-windows/README.md | 95 - node_modules/is-windows/index.js | 27 - node_modules/is-windows/package.json | 71 - 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/isobject/LICENSE | 21 - node_modules/isobject/README.md | 122 - node_modules/isobject/index.d.ts | 5 - node_modules/isobject/index.js | 12 - node_modules/isobject/package.json | 74 - 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 - node_modules/jsdoc-type-pratt-parser/LICENSE | 21 - .../jsdoc-type-pratt-parser/README.md | 165 - .../jsdoc-type-pratt-parser/dist/index.js | 2538 -- .../dist/src/Parser.d.ts | 41 - .../dist/src/Precedence.d.ts | 22 - .../dist/src/assertTypes.d.ts | 12 - .../dist/src/errors.d.ts | 15 - .../dist/src/grammars/Grammar.d.ts | 2 - .../dist/src/grammars/baseGrammar.d.ts | 2 - .../dist/src/grammars/closureGrammar.d.ts | 1 - .../dist/src/grammars/jsdocGrammar.d.ts | 2 - .../dist/src/grammars/pathGrammar.d.ts | 2 - .../dist/src/grammars/typescriptGrammar.d.ts | 2 - .../dist/src/index.d.ts | 14 - .../dist/src/lexer/Lexer.d.ts | 11 - .../dist/src/lexer/Token.d.ts | 6 - .../dist/src/parse.d.ts | 16 - .../src/parslets/ArrayBracketsParslet.d.ts | 1 - .../src/parslets/ArrowFunctionParslet.d.ts | 1 - .../dist/src/parslets/FunctionParslet.d.ts | 12 - .../dist/src/parslets/GenericParslet.d.ts | 1 - .../dist/src/parslets/ImportParslet.d.ts | 1 - .../src/parslets/IntersectionParslet.d.ts | 1 - .../dist/src/parslets/KeyOfParslet.d.ts | 1 - .../dist/src/parslets/KeyValueParslet.d.ts | 5 - .../dist/src/parslets/NameParslet.d.ts | 5 - .../dist/src/parslets/NamePathParslet.d.ts | 7 - .../dist/src/parslets/NotNullableParslet.d.ts | 1 - .../dist/src/parslets/NullableParslets.d.ts | 2 - .../dist/src/parslets/NumberParslet.d.ts | 1 - .../dist/src/parslets/ObjectFieldParslet.d.ts | 7 - .../dist/src/parslets/ObjectParslet.d.ts | 6 - .../ObjectSquaredPropertyParslet.d.ts | 1 - .../dist/src/parslets/OptionalParslet.d.ts | 1 - .../src/parslets/ParameterListParslet.d.ts | 4 - .../dist/src/parslets/ParenthesisParslet.d.ts | 1 - .../dist/src/parslets/Parslet.d.ts | 26 - .../src/parslets/ReadonlyPropertyParslet.d.ts | 1 - .../src/parslets/SpecialNamePathParslet.d.ts | 7 - .../src/parslets/SpecialTypesParslet.d.ts | 1 - .../dist/src/parslets/StringValueParslet.d.ts | 1 - .../dist/src/parslets/SymbolParslet.d.ts | 1 - .../dist/src/parslets/TupleParslet.d.ts | 4 - .../dist/src/parslets/TypeOfParslet.d.ts | 1 - .../dist/src/parslets/UnionParslets.d.ts | 1 - .../dist/src/parslets/VariadicParslet.d.ts | 5 - .../parslets/isQuestionMarkUnkownType.d.ts | 2 - .../dist/src/parslets/predicateParslet.d.ts | 1 - .../dist/src/result/IntermediateResult.d.ts | 11 - .../dist/src/result/NonRootResult.d.ts | 48 - .../dist/src/result/RootResult.d.ts | 227 - .../src/transforms/catharsisTransform.d.ts | 52 - .../transforms/identityTransformRules.d.ts | 3 - .../dist/src/transforms/jtpTransform.d.ts | 129 - .../dist/src/transforms/simplify.d.ts | 2 - .../dist/src/transforms/stringify.d.ts | 5 - .../dist/src/transforms/transform.d.ts | 16 - .../dist/src/traverse.d.ts | 17 - .../dist/src/visitorKeys.d.ts | 5 - .../dist/test/fixtures/Fixture.d.ts | 52 - .../test/fixtures/typescript/namePath.d.ts | 1 - .../dist/test/fuzzer.d.ts | 1 - .../jsdoc-type-pratt-parser/package.json | 103 - .../jsdoc-type-pratt-parser/src/Parser.ts | 109 - .../jsdoc-type-pratt-parser/src/Precedence.ts | 23 - .../src/assertTypes.ts | 60 - .../jsdoc-type-pratt-parser/src/errors.ts | 71 - .../src/grammars/Grammar.ts | 3 - .../src/grammars/baseGrammar.ts | 25 - .../src/grammars/closureGrammar.ts | 73 - .../src/grammars/jsdocGrammar.ts | 68 - .../src/grammars/pathGrammar.ts | 27 - .../src/grammars/typescriptGrammar.ts | 88 - .../jsdoc-type-pratt-parser/src/index.ts | 15 - .../src/lexer/Lexer.ts | 219 - .../src/lexer/Token.ts | 49 - .../jsdoc-type-pratt-parser/src/parse.ts | 42 - .../src/parslets/ArrayBracketsParslet.ts | 27 - .../src/parslets/ArrowFunctionParslet.ts | 21 - .../src/parslets/FunctionParslet.ts | 92 - .../src/parslets/GenericParslet.ts | 32 - .../src/parslets/ImportParslet.ts | 24 - .../src/parslets/IntersectionParslet.ts | 22 - .../src/parslets/KeyOfParslet.ts | 15 - .../src/parslets/KeyValueParslet.ts | 44 - .../src/parslets/NameParslet.ts | 20 - .../src/parslets/NamePathParslet.ts | 105 - .../src/parslets/NotNullableParslet.ts | 29 - .../src/parslets/NullableParslets.ts | 36 - .../src/parslets/NumberParslet.ts | 14 - .../src/parslets/ObjectFieldParslet.ts | 80 - .../src/parslets/ObjectParslet.ts | 90 - .../parslets/ObjectSquaredPropertyParslet.ts | 49 - .../src/parslets/OptionalParslet.ts | 29 - .../src/parslets/ParameterListParslet.ts | 43 - .../src/parslets/ParenthesisParslet.ts | 33 - .../src/parslets/Parslet.ts | 58 - .../src/parslets/ReadonlyPropertyParslet.ts | 14 - .../src/parslets/SpecialNamePathParslet.ts | 63 - .../src/parslets/SpecialTypesParslet.ts | 35 - .../src/parslets/StringValueParslet.ts | 17 - .../src/parslets/SymbolParslet.ts | 29 - .../src/parslets/TupleParslet.ts | 50 - .../src/parslets/TypeOfParslet.ts | 15 - .../src/parslets/UnionParslets.ts | 22 - .../src/parslets/VariadicParslet.ts | 64 - .../src/parslets/isQuestionMarkUnkownType.ts | 5 - .../src/parslets/predicateParslet.ts | 23 - .../src/result/IntermediateResult.ts | 14 - .../src/result/NonRootResult.ts | 65 - .../src/result/RootResult.ts | 285 - .../src/transforms/catharsisTransform.ts | 323 - .../src/transforms/identityTransformRules.ts | 197 - .../src/transforms/jtpTransform.ts | 531 - .../src/transforms/simplify.ts | 19 - .../src/transforms/stringify.ts | 174 - .../src/transforms/transform.ts | 51 - .../jsdoc-type-pratt-parser/src/traverse.ts | 43 - .../src/visitorKeys.ts | 39 - node_modules/json-buffer/.travis.yml | 3 - node_modules/json-buffer/LICENSE | 22 - node_modules/json-buffer/README.md | 24 - node_modules/json-buffer/index.js | 58 - node_modules/json-buffer/package.json | 34 - node_modules/json-buffer/test/index.js | 63 - .../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/keyv/README.md | 429 - node_modules/keyv/package.json | 57 - node_modules/keyv/src/index.d.ts | 112 - node_modules/keyv/src/index.js | 259 - node_modules/last-run/LICENSE | 21 - node_modules/last-run/README.md | 65 - node_modules/last-run/index.js | 42 - node_modules/last-run/package.json | 47 - node_modules/lead/LICENSE | 21 - node_modules/lead/README.md | 52 - node_modules/lead/index.js | 50 - node_modules/lead/package.json | 50 - node_modules/less/.eslintignore | 6 - node_modules/less/.eslintrc.js | 63 - node_modules/less/Gruntfile.js | 406 - node_modules/less/README.md | 13 - node_modules/less/bin/lessc | 662 - node_modules/less/bower.json | 22 - node_modules/less/dist/less.js | 11558 -------- node_modules/less/dist/less.min.js | 11 - node_modules/less/dist/less.min.js.map | 1 - node_modules/less/index.js | 1 - .../lib/less-browser/add-default-options.js | 43 - .../less-browser/add-default-options.js.map | 1 - .../less/lib/less-browser/bootstrap.js | 61 - .../less/lib/less-browser/bootstrap.js.map | 1 - node_modules/less/lib/less-browser/browser.js | 62 - .../less/lib/less-browser/browser.js.map | 1 - node_modules/less/lib/less-browser/cache.js | 45 - .../less/lib/less-browser/cache.js.map | 1 - .../less/lib/less-browser/error-reporting.js | 162 - .../lib/less-browser/error-reporting.js.map | 1 - .../less/lib/less-browser/file-manager.js | 102 - .../less/lib/less-browser/file-manager.js.map | 1 - .../less/lib/less-browser/image-size.js | 28 - .../less/lib/less-browser/image-size.js.map | 1 - node_modules/less/lib/less-browser/index.js | 258 - .../less/lib/less-browser/index.js.map | 1 - .../less/lib/less-browser/log-listener.js | 43 - .../less/lib/less-browser/log-listener.js.map | 1 - .../less/lib/less-browser/plugin-loader.js | 24 - .../lib/less-browser/plugin-loader.js.map | 1 - node_modules/less/lib/less-browser/utils.js | 32 - .../less/lib/less-browser/utils.js.map | 1 - .../less/lib/less-node/environment.js | 19 - .../less/lib/less-node/environment.js.map | 1 - .../less/lib/less-node/file-manager.js | 139 - .../less/lib/less-node/file-manager.js.map | 1 - node_modules/less/lib/less-node/fs.js | 11 - node_modules/less/lib/less-node/fs.js.map | 1 - node_modules/less/lib/less-node/image-size.js | 50 - .../less/lib/less-node/image-size.js.map | 1 - node_modules/less/lib/less-node/index.js | 22 - node_modules/less/lib/less-node/index.js.map | 1 - .../less/lib/less-node/lessc-helper.js | 94 - .../less/lib/less-node/lessc-helper.js.map | 1 - .../less/lib/less-node/plugin-loader.js | 54 - .../less/lib/less-node/plugin-loader.js.map | 1 - .../less/lib/less-node/url-file-manager.js | 58 - .../lib/less-node/url-file-manager.js.map | 1 - node_modules/less/lib/less/constants.js | 15 - node_modules/less/lib/less/constants.js.map | 1 - node_modules/less/lib/less/contexts.js | 149 - node_modules/less/lib/less/contexts.js.map | 1 - node_modules/less/lib/less/data/colors.js | 153 - node_modules/less/lib/less/data/colors.js.map | 1 - node_modules/less/lib/less/data/index.js | 7 - node_modules/less/lib/less/data/index.js.map | 1 - .../less/lib/less/data/unit-conversions.js | 24 - .../lib/less/data/unit-conversions.js.map | 1 - node_modules/less/lib/less/default-options.js | 60 - .../less/lib/less/default-options.js.map | 1 - .../less/environment/abstract-file-manager.js | 128 - .../environment/abstract-file-manager.js.map | 1 - .../environment/abstract-plugin-loader.js | 162 - .../environment/abstract-plugin-loader.js.map | 1 - .../lib/less/environment/environment-api.js | 3 - .../less/environment/environment-api.js.map | 1 - .../less/lib/less/environment/environment.js | 55 - .../lib/less/environment/environment.js.map | 1 - .../lib/less/environment/file-manager-api.js | 3 - .../less/environment/file-manager-api.js.map | 1 - .../less/lib/less/functions/boolean.js | 29 - .../less/lib/less/functions/boolean.js.map | 1 - .../less/lib/less/functions/color-blending.js | 77 - .../lib/less/functions/color-blending.js.map | 1 - node_modules/less/lib/less/functions/color.js | 436 - .../less/lib/less/functions/color.js.map | 1 - .../less/lib/less/functions/data-uri.js | 65 - .../less/lib/less/functions/data-uri.js.map | 1 - .../less/lib/less/functions/default.js | 28 - .../less/lib/less/functions/default.js.map | 1 - .../lib/less/functions/function-caller.js | 54 - .../lib/less/functions/function-caller.js.map | 1 - .../lib/less/functions/function-registry.js | 37 - .../less/functions/function-registry.js.map | 1 - node_modules/less/lib/less/functions/index.js | 35 - .../less/lib/less/functions/index.js.map | 1 - node_modules/less/lib/less/functions/list.js | 145 - .../less/lib/less/functions/list.js.map | 1 - .../less/lib/less/functions/math-helper.js | 18 - .../lib/less/functions/math-helper.js.map | 1 - node_modules/less/lib/less/functions/math.js | 29 - .../less/lib/less/functions/math.js.map | 1 - .../less/lib/less/functions/number.js | 106 - .../less/lib/less/functions/number.js.map | 1 - .../less/lib/less/functions/string.js | 40 - .../less/lib/less/functions/string.js.map | 1 - node_modules/less/lib/less/functions/style.js | 28 - .../less/lib/less/functions/style.js.map | 1 - node_modules/less/lib/less/functions/svg.js | 86 - .../less/lib/less/functions/svg.js.map | 1 - node_modules/less/lib/less/functions/types.js | 74 - .../less/lib/less/functions/types.js.map | 1 - node_modules/less/lib/less/import-manager.js | 174 - .../less/lib/less/import-manager.js.map | 1 - node_modules/less/lib/less/index.js | 95 - node_modules/less/lib/less/index.js.map | 1 - node_modules/less/lib/less/less-error.js | 143 - node_modules/less/lib/less/less-error.js.map | 1 - node_modules/less/lib/less/logger.js | 37 - node_modules/less/lib/less/logger.js.map | 1 - node_modules/less/lib/less/parse-tree.js | 68 - node_modules/less/lib/less/parse-tree.js.map | 1 - node_modules/less/lib/less/parse.js | 87 - node_modules/less/lib/less/parse.js.map | 1 - node_modules/less/lib/less/parser/chunker.js | 148 - .../less/lib/less/parser/chunker.js.map | 1 - .../less/lib/less/parser/parser-input.js | 359 - .../less/lib/less/parser/parser-input.js.map | 1 - node_modules/less/lib/less/parser/parser.js | 2305 -- .../less/lib/less/parser/parser.js.map | 1 - node_modules/less/lib/less/plugin-manager.js | 157 - .../less/lib/less/plugin-manager.js.map | 1 - node_modules/less/lib/less/render.js | 47 - node_modules/less/lib/less/render.js.map | 1 - .../less/lib/less/source-map-builder.js | 73 - .../less/lib/less/source-map-builder.js.map | 1 - .../less/lib/less/source-map-output.js | 138 - .../less/lib/less/source-map-output.js.map | 1 - node_modules/less/lib/less/transform-tree.js | 92 - .../less/lib/less/transform-tree.js.map | 1 - node_modules/less/lib/less/tree/anonymous.js | 33 - .../less/lib/less/tree/anonymous.js.map | 1 - node_modules/less/lib/less/tree/assignment.js | 31 - .../less/lib/less/tree/assignment.js.map | 1 - .../less/lib/less/tree/atrule-syntax.js | 10 - .../less/lib/less/tree/atrule-syntax.js.map | 1 - node_modules/less/lib/less/tree/atrule.js | 135 - node_modules/less/lib/less/tree/atrule.js.map | 1 - node_modules/less/lib/less/tree/attribute.js | 32 - .../less/lib/less/tree/attribute.js.map | 1 - node_modules/less/lib/less/tree/call.js | 104 - node_modules/less/lib/less/tree/call.js.map | 1 - node_modules/less/lib/less/tree/color.js | 236 - node_modules/less/lib/less/tree/color.js.map | 1 - node_modules/less/lib/less/tree/combinator.js | 28 - .../less/lib/less/tree/combinator.js.map | 1 - node_modules/less/lib/less/tree/comment.js | 27 - .../less/lib/less/tree/comment.js.map | 1 - node_modules/less/lib/less/tree/condition.js | 40 - .../less/lib/less/tree/condition.js.map | 1 - node_modules/less/lib/less/tree/container.js | 48 - .../less/lib/less/tree/container.js.map | 1 - node_modules/less/lib/less/tree/debug-info.js | 36 - .../less/lib/less/tree/debug-info.js.map | 1 - .../less/lib/less/tree/declaration.js | 94 - .../less/lib/less/tree/declaration.js.map | 1 - .../less/lib/less/tree/detached-ruleset.js | 27 - .../lib/less/tree/detached-ruleset.js.map | 1 - node_modules/less/lib/less/tree/dimension.js | 159 - .../less/lib/less/tree/dimension.js.map | 1 - node_modules/less/lib/less/tree/element.js | 63 - .../less/lib/less/tree/element.js.map | 1 - node_modules/less/lib/less/tree/expression.js | 73 - .../less/lib/less/tree/expression.js.map | 1 - node_modules/less/lib/less/tree/extend.js | 58 - node_modules/less/lib/less/tree/extend.js.map | 1 - node_modules/less/lib/less/tree/import.js | 171 - node_modules/less/lib/less/tree/import.js.map | 1 - node_modules/less/lib/less/tree/index.js | 85 - node_modules/less/lib/less/tree/index.js.map | 1 - node_modules/less/lib/less/tree/javascript.js | 34 - .../less/lib/less/tree/javascript.js.map | 1 - .../less/lib/less/tree/js-eval-node.js | 60 - .../less/lib/less/tree/js-eval-node.js.map | 1 - node_modules/less/lib/less/tree/keyword.js | 20 - .../less/lib/less/tree/keyword.js.map | 1 - node_modules/less/lib/less/tree/media.js | 48 - node_modules/less/lib/less/tree/media.js.map | 1 - node_modules/less/lib/less/tree/mixin-call.js | 196 - .../less/lib/less/tree/mixin-call.js.map | 1 - .../less/lib/less/tree/mixin-definition.js | 213 - .../lib/less/tree/mixin-definition.js.map | 1 - .../less/lib/less/tree/namespace-value.js | 76 - .../less/lib/less/tree/namespace-value.js.map | 1 - node_modules/less/lib/less/tree/negative.js | 24 - .../less/lib/less/tree/negative.js.map | 1 - .../less/lib/less/tree/nested-at-rule.js | 91 - .../less/lib/less/tree/nested-at-rule.js.map | 1 - node_modules/less/lib/less/tree/node.js | 175 - node_modules/less/lib/less/tree/node.js.map | 1 - node_modules/less/lib/less/tree/operation.js | 56 - .../less/lib/less/tree/operation.js.map | 1 - node_modules/less/lib/less/tree/paren.js | 20 - node_modules/less/lib/less/tree/paren.js.map | 1 - node_modules/less/lib/less/tree/property.js | 65 - .../less/lib/less/tree/property.js.map | 1 - .../less/lib/less/tree/query-in-parens.js | 41 - .../less/lib/less/tree/query-in-parens.js.map | 1 - node_modules/less/lib/less/tree/quoted.js | 65 - node_modules/less/lib/less/tree/quoted.js.map | 1 - node_modules/less/lib/less/tree/ruleset.js | 752 - .../less/lib/less/tree/ruleset.js.map | 1 - node_modules/less/lib/less/tree/selector.js | 127 - .../less/lib/less/tree/selector.js.map | 1 - .../less/lib/less/tree/unicode-descriptor.js | 12 - .../lib/less/tree/unicode-descriptor.js.map | 1 - node_modules/less/lib/less/tree/unit.js | 122 - node_modules/less/lib/less/tree/unit.js.map | 1 - node_modules/less/lib/less/tree/url.js | 59 - node_modules/less/lib/less/tree/url.js.map | 1 - node_modules/less/lib/less/tree/value.js | 44 - node_modules/less/lib/less/tree/value.js.map | 1 - .../less/lib/less/tree/variable-call.js | 43 - .../less/lib/less/tree/variable-call.js.map | 1 - node_modules/less/lib/less/tree/variable.js | 63 - .../less/lib/less/tree/variable.js.map | 1 - node_modules/less/lib/less/utils.js | 129 - node_modules/less/lib/less/utils.js.map | 1 - .../less/lib/less/visitors/extend-visitor.js | 439 - .../lib/less/visitors/extend-visitor.js.map | 1 - .../lib/less/visitors/import-sequencer.js | 56 - .../lib/less/visitors/import-sequencer.js.map | 1 - .../less/lib/less/visitors/import-visitor.js | 180 - .../lib/less/visitors/import-visitor.js.map | 1 - node_modules/less/lib/less/visitors/index.js | 18 - .../less/lib/less/visitors/index.js.map | 1 - .../less/visitors/join-selector-visitor.js | 59 - .../visitors/join-selector-visitor.js.map | 1 - .../visitors/set-tree-visibility-visitor.js | 43 - .../set-tree-visibility-visitor.js.map | 1 - .../less/lib/less/visitors/to-css-visitor.js | 325 - .../lib/less/visitors/to-css-visitor.js.map | 1 - .../less/lib/less/visitors/visitor.js | 150 - .../less/lib/less/visitors/visitor.js.map | 1 - node_modules/less/package.json | 140 - node_modules/less/test/.eslintrc.json | 9 - node_modules/less/test/README.md | 3 - node_modules/less/test/browser/common.js | 230 - .../test/browser/css/global-vars/simple.css | 3 - .../test/browser/css/modify-vars/simple.css | 8 - .../less/test/browser/css/plugin/plugin.css | 3 - .../css/postProcessor/postProcessor.css | 4 - .../test/browser/css/relative-urls/urls.css | 36 - .../test/browser/css/rewrite-urls/urls.css | 36 - .../browser/css/rootpath-relative/urls.css | 35 - .../css/rootpath-rewrite-urls/urls.css | 35 - .../less/test/browser/css/rootpath/urls.css | 35 - node_modules/less/test/browser/css/urls.css | 54 - .../browser/generator/benchmark.config.js | 50 - .../less/test/browser/generator/generate.js | 78 - .../test/browser/generator/runner.config.js | 188 - .../less/test/browser/generator/runner.js | 2 - .../less/test/browser/generator/template.js | 93 - .../less/test/browser/generator/utils.js | 14 - .../less/console-errors/test-error.less | 3 - .../less/console-errors/test-error.txt | 2 - .../less/errors/image-height-error.less | 3 - .../less/errors/image-height-error.txt | 4 - .../browser/less/errors/image-size-error.less | 3 - .../browser/less/errors/image-size-error.txt | 4 - .../less/errors/image-width-error.less | 3 - .../browser/less/errors/image-width-error.txt | 4 - .../test/browser/less/global-vars/simple.less | 3 - .../less/test/browser/less/imports/urls.less | 4 - .../less/test/browser/less/imports/urls2.less | 4 - .../less/modify-vars/imports/simple2.less | 4 - .../test/browser/less/modify-vars/simple.less | 8 - .../mixin-consumer.less | 5 - .../svg-gradient-mixin.less | 15 - .../less/test/browser/less/plugin/plugin.js | 4 - .../less/test/browser/less/plugin/plugin.less | 4 - .../less/postProcessor/postProcessor.less | 4 - .../test/browser/less/relative-urls/urls.less | 34 - .../test/browser/less/rewrite-urls/urls.less | 34 - .../browser/less/rootpath-relative/urls.less | 33 - .../less/rootpath-rewrite-urls/urls.less | 33 - .../less/test/browser/less/rootpath/urls.less | 33 - node_modules/less/test/browser/less/urls.less | 62 - .../browser/runner-VisitorPlugin-options.js | 3 - .../less/test/browser/runner-VisitorPlugin.js | 3 - .../test/browser/runner-browser-options.js | 51 - .../less/test/browser/runner-browser-spec.js | 12 - .../test/browser/runner-console-errors.js | 5 - .../test/browser/runner-errors-options.js | 6 - .../less/test/browser/runner-errors-spec.js | 3 - .../runner-filemanagerPlugin-options.js | 5 - .../test/browser/runner-filemanagerPlugin.js | 3 - .../browser/runner-global-vars-options.js | 7 - .../test/browser/runner-global-vars-spec.js | 3 - .../test/browser/runner-legacy-options.js | 6 - .../less/test/browser/runner-legacy-spec.js | 3 - .../less/test/browser/runner-main-options.js | 17 - .../less/test/browser/runner-main-spec.js | 7 - .../browser/runner-modify-vars-options.js | 5 - .../test/browser/runner-modify-vars-spec.js | 33 - .../browser/runner-no-js-errors-options.js | 4 - .../test/browser/runner-no-js-errors-spec.js | 3 - .../runner-postProcessorPlugin-options.js | 3 - .../browser/runner-postProcessorPlugin.js | 3 - .../runner-preProcessorPlugin-options.js | 3 - .../test/browser/runner-preProcessorPlugin.js | 3 - .../test/browser/runner-production-options.js | 3 - .../test/browser/runner-production-spec.js | 5 - .../browser/runner-relative-urls-options.js | 3 - .../test/browser/runner-relative-urls-spec.js | 3 - .../browser/runner-rewrite-urls-options.js | 3 - .../test/browser/runner-rewrite-urls-spec.js | 3 - .../test/browser/runner-rootpath-options.js | 3 - .../runner-rootpath-relative-options.js | 4 - .../browser/runner-rootpath-relative-spec.js | 3 - .../runner-rootpath-rewrite-urls-options.js | 4 - .../runner-rootpath-rewrite-urls-spec.js | 3 - .../less/test/browser/runner-rootpath-spec.js | 3 - .../browser/runner-strict-units-options.js | 5 - .../test/browser/runner-strict-units-spec.js | 3 - node_modules/less/test/index.js | 112 - node_modules/less/test/less-test.js | 623 - node_modules/less/test/modify-vars.js | 28 - .../less/test/plugins/filemanager/index.js | 19 - .../less/test/plugins/postprocess/index.js | 14 - .../less/test/plugins/preprocess/index.js | 19 - .../less/test/plugins/visitor/index.js | 24 - .../sourcemaps-disable-annotation/basic.json | 1 - .../sourcemaps-variable-selector/basic.json | 1 - node_modules/less/test/sourcemaps/basic.json | 1 - .../less/test/sourcemaps/custom-props.json | 1 - node_modules/less/test/sourcemaps/index.html | 17 - node_modules/less/test/test-es6.ts | 17 - node_modules/less/tsconfig.build.json | 7 - node_modules/less/tsconfig.json | 21 - node_modules/level-supports/CHANGELOG.md | 95 - node_modules/level-supports/LICENSE | 21 - node_modules/level-supports/README.md | 405 - node_modules/level-supports/index.d.ts | 161 - node_modules/level-supports/index.js | 26 - node_modules/level-supports/package.json | 48 - node_modules/level-supports/test/cloneable.js | 26 - node_modules/level-supports/test/index.js | 29 - node_modules/level-supports/test/self.js | 75 - node_modules/level-supports/test/shape.js | 22 - node_modules/level-transcoder/CHANGELOG.md | 15 - node_modules/level-transcoder/LICENSE | 21 - node_modules/level-transcoder/README.md | 214 - node_modules/level-transcoder/UPGRADING.md | 13 - node_modules/level-transcoder/index.d.ts | 27 - node_modules/level-transcoder/index.js | 158 - .../level-transcoder/lib/encoding.d.ts | 158 - node_modules/level-transcoder/lib/encoding.js | 105 - .../level-transcoder/lib/encodings.d.ts | 9 - .../level-transcoder/lib/encodings.js | 135 - .../level-transcoder/lib/formats.d.ts | 13 - node_modules/level-transcoder/lib/formats.js | 111 - .../level-transcoder/lib/text-endec.d.ts | 6 - .../level-transcoder/lib/text-endec.js | 19 - node_modules/level-transcoder/package.json | 46 - 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/lie/README.md | 64 - node_modules/lie/dist/lie.js | 330 - node_modules/lie/dist/lie.min.js | 1 - node_modules/lie/dist/lie.polyfill.js | 338 - node_modules/lie/dist/lie.polyfill.min.js | 1 - node_modules/lie/lib/browser.js | 253 - node_modules/lie/lib/index.js | 278 - node_modules/lie/license.md | 7 - node_modules/lie/package.json | 66 - node_modules/lie/polyfill.js | 4 - node_modules/liftoff/LICENSE | 21 - node_modules/liftoff/README.md | 624 - node_modules/liftoff/index.js | 338 - node_modules/liftoff/lib/array_find.js | 18 - node_modules/liftoff/lib/build_config_name.js | 17 - node_modules/liftoff/lib/file_search.js | 14 - node_modules/liftoff/lib/find_config.js | 27 - node_modules/liftoff/lib/find_cwd.js | 18 - node_modules/liftoff/lib/get_node_flags.js | 29 - node_modules/liftoff/lib/needs_lookup.js | 18 - node_modules/liftoff/lib/parse_options.js | 35 - node_modules/liftoff/lib/register_loader.js | 26 - node_modules/liftoff/lib/silent_require.js | 5 - node_modules/liftoff/package.json | 59 - node_modules/localforage/.huskyrc | 5 - node_modules/localforage/.lintstagedrc | 6 - node_modules/localforage/CHANGELOG.md | 161 - node_modules/localforage/CONTRIBUTING.md | 59 - node_modules/localforage/LICENSE | 201 - node_modules/localforage/README.md | 258 - node_modules/localforage/bower.json | 27 - .../build/es5src/drivers/indexeddb.js | 1013 - .../build/es5src/drivers/localstorage.js | 357 - .../build/es5src/drivers/websql.js | 474 - .../localforage/build/es5src/localforage.js | 408 - .../build/es5src/utils/serializer.js | 256 - node_modules/localforage/component.json | 15 - node_modules/localforage/contribute.json | 31 - node_modules/localforage/dist/localforage.js | 2816 -- .../localforage/dist/localforage.min.js | 7 - .../dist/localforage.nopromises.js | 2480 -- .../dist/localforage.nopromises.min.js | 7 - node_modules/localforage/package.json | 73 - .../localforage/src/drivers/indexeddb.js | 1116 - .../localforage/src/drivers/localstorage.js | 332 - .../localforage/src/drivers/websql.js | 610 - node_modules/localforage/src/localforage.js | 414 - .../localforage/src/utils/createBlob.js | 33 - .../localforage/src/utils/executeCallback.js | 14 - .../src/utils/executeTwoCallbacks.js | 11 - .../localforage/src/utils/getCallback.js | 8 - node_modules/localforage/src/utils/idb.js | 25 - .../localforage/src/utils/includes.js | 18 - node_modules/localforage/src/utils/isArray.js | 7 - .../localforage/src/utils/isIndexedDBValid.js | 44 - .../src/utils/isLocalStorageValid.js | 14 - .../localforage/src/utils/isWebSQLValid.js | 5 - .../localforage/src/utils/normalizeKey.js | 9 - node_modules/localforage/src/utils/promise.js | 8 - .../localforage/src/utils/serializer.js | 245 - .../localforage/typings/localforage.d.ts | 123 - node_modules/locate-path/index.d.ts | 83 - node_modules/locate-path/index.js | 68 - node_modules/locate-path/license | 9 - node_modules/locate-path/package.json | 46 - node_modules/locate-path/readme.md | 125 - 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/make-dir/index.d.ts | 39 - node_modules/make-dir/index.js | 139 - node_modules/make-dir/license | 9 - .../make-dir/node_modules/.bin/semver | 1 - .../make-dir/node_modules/semver/LICENSE | 15 - .../make-dir/node_modules/semver/README.md | 412 - .../make-dir/node_modules/semver/bin/semver | 160 - .../make-dir/node_modules/semver/package.json | 38 - .../make-dir/node_modules/semver/range.bnf | 16 - .../make-dir/node_modules/semver/semver.js | 1525 -- node_modules/make-dir/package.json | 59 - node_modules/make-dir/readme.md | 123 - node_modules/map-cache/LICENSE | 21 - node_modules/map-cache/README.md | 145 - node_modules/map-cache/index.js | 100 - node_modules/map-cache/package.json | 59 - node_modules/micromatch/LICENSE | 21 - node_modules/micromatch/README.md | 1024 - node_modules/micromatch/index.js | 474 - node_modules/micromatch/package.json | 119 - node_modules/mime/.npmignore | 0 node_modules/mime/CHANGELOG.md | 164 - node_modules/mime/LICENSE | 21 - node_modules/mime/README.md | 90 - node_modules/mime/cli.js | 8 - node_modules/mime/mime.js | 108 - node_modules/mime/package.json | 44 - node_modules/mime/src/build.js | 53 - node_modules/mime/src/test.js | 60 - node_modules/mime/types.json | 1 - node_modules/minimatch/LICENSE | 15 - node_modules/minimatch/README.md | 230 - node_modules/minimatch/minimatch.js | 947 - node_modules/minimatch/package.json | 33 - node_modules/mkdirp/LICENSE | 21 - node_modules/mkdirp/dist/cjs/package.json | 91 - node_modules/mkdirp/dist/cjs/src/bin.d.ts | 3 - node_modules/mkdirp/dist/cjs/src/bin.d.ts.map | 1 - node_modules/mkdirp/dist/cjs/src/bin.js | 80 - node_modules/mkdirp/dist/cjs/src/bin.js.map | 1 - .../mkdirp/dist/cjs/src/find-made.d.ts | 4 - .../mkdirp/dist/cjs/src/find-made.d.ts.map | 1 - node_modules/mkdirp/dist/cjs/src/find-made.js | 35 - .../mkdirp/dist/cjs/src/find-made.js.map | 1 - node_modules/mkdirp/dist/cjs/src/index.d.ts | 39 - .../mkdirp/dist/cjs/src/index.d.ts.map | 1 - node_modules/mkdirp/dist/cjs/src/index.js | 53 - node_modules/mkdirp/dist/cjs/src/index.js.map | 1 - .../mkdirp/dist/cjs/src/mkdirp-manual.d.ts | 6 - .../dist/cjs/src/mkdirp-manual.d.ts.map | 1 - .../mkdirp/dist/cjs/src/mkdirp-manual.js | 79 - .../mkdirp/dist/cjs/src/mkdirp-manual.js.map | 1 - .../mkdirp/dist/cjs/src/mkdirp-native.d.ts | 6 - .../dist/cjs/src/mkdirp-native.d.ts.map | 1 - .../mkdirp/dist/cjs/src/mkdirp-native.js | 50 - .../mkdirp/dist/cjs/src/mkdirp-native.js.map | 1 - .../mkdirp/dist/cjs/src/opts-arg.d.ts | 42 - .../mkdirp/dist/cjs/src/opts-arg.d.ts.map | 1 - node_modules/mkdirp/dist/cjs/src/opts-arg.js | 38 - .../mkdirp/dist/cjs/src/opts-arg.js.map | 1 - .../mkdirp/dist/cjs/src/path-arg.d.ts | 2 - .../mkdirp/dist/cjs/src/path-arg.d.ts.map | 1 - node_modules/mkdirp/dist/cjs/src/path-arg.js | 28 - .../mkdirp/dist/cjs/src/path-arg.js.map | 1 - .../mkdirp/dist/cjs/src/use-native.d.ts | 6 - .../mkdirp/dist/cjs/src/use-native.d.ts.map | 1 - .../mkdirp/dist/cjs/src/use-native.js | 17 - .../mkdirp/dist/cjs/src/use-native.js.map | 1 - node_modules/mkdirp/dist/mjs/find-made.d.ts | 4 - .../mkdirp/dist/mjs/find-made.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/find-made.js | 30 - node_modules/mkdirp/dist/mjs/find-made.js.map | 1 - node_modules/mkdirp/dist/mjs/index.d.ts | 39 - node_modules/mkdirp/dist/mjs/index.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/index.js | 43 - node_modules/mkdirp/dist/mjs/index.js.map | 1 - .../mkdirp/dist/mjs/mkdirp-manual.d.ts | 6 - .../mkdirp/dist/mjs/mkdirp-manual.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/mkdirp-manual.js | 75 - .../mkdirp/dist/mjs/mkdirp-manual.js.map | 1 - .../mkdirp/dist/mjs/mkdirp-native.d.ts | 6 - .../mkdirp/dist/mjs/mkdirp-native.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/mkdirp-native.js | 46 - .../mkdirp/dist/mjs/mkdirp-native.js.map | 1 - node_modules/mkdirp/dist/mjs/opts-arg.d.ts | 42 - .../mkdirp/dist/mjs/opts-arg.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/opts-arg.js | 34 - node_modules/mkdirp/dist/mjs/opts-arg.js.map | 1 - node_modules/mkdirp/dist/mjs/package.json | 3 - node_modules/mkdirp/dist/mjs/path-arg.d.ts | 2 - .../mkdirp/dist/mjs/path-arg.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/path-arg.js | 24 - node_modules/mkdirp/dist/mjs/path-arg.js.map | 1 - node_modules/mkdirp/dist/mjs/use-native.d.ts | 6 - .../mkdirp/dist/mjs/use-native.d.ts.map | 1 - node_modules/mkdirp/dist/mjs/use-native.js | 14 - .../mkdirp/dist/mjs/use-native.js.map | 1 - node_modules/mkdirp/package.json | 91 - node_modules/mkdirp/readme.markdown | 281 - node_modules/module-error/CHANGELOG.md | 23 - node_modules/module-error/LICENSE | 21 - node_modules/module-error/README.md | 89 - node_modules/module-error/index.d.ts | 18 - node_modules/module-error/index.js | 22 - node_modules/module-error/package.json | 36 - 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/mute-stdout/LICENSE | 22 - node_modules/mute-stdout/README.md | 51 - node_modules/mute-stdout/index.js | 19 - node_modules/mute-stdout/package.json | 47 - node_modules/napi-macros/LICENSE | 21 - node_modules/napi-macros/README.md | 277 - node_modules/napi-macros/index.js | 1 - node_modules/napi-macros/napi-macros.h | 255 - node_modules/napi-macros/package.json | 22 - node_modules/natural-compare/README.md | 125 - node_modules/natural-compare/index.js | 57 - node_modules/natural-compare/package.json | 42 - node_modules/nedb-promises/.eslintrc.js | 57 - node_modules/nedb-promises/.github/stale.yml | 11 - node_modules/nedb-promises/CHANGELOG.md | 82 - node_modules/nedb-promises/LICENSE | 21 - node_modules/nedb-promises/README.md | 99 - node_modules/nedb-promises/docs.md | 673 - node_modules/nedb-promises/index.d.ts | 720 - node_modules/nedb-promises/index.js | 1 - node_modules/nedb-promises/logo.svg | 1 - node_modules/nedb-promises/package.json | 36 - node_modules/nedb-promises/src/Cursor.js | 154 - node_modules/nedb-promises/src/Datastore.js | 497 - .../nedb-promises/test/a.create.test.js | 29 - .../nedb-promises/test/b.insert.test.js | 27 - .../nedb-promises/test/c.find.test.js | 43 - .../nedb-promises/test/d.update.test.js | 70 - .../nedb-promises/test/e.count.test.js | 25 - .../nedb-promises/test/f.proxy.test.js | 16 - .../nedb-promises/test/g.mongocompat.test.js | 62 - .../needle/.github/workflows/nodejs.yml | 28 - node_modules/needle/README.md | 637 - node_modules/needle/bin/needle | 40 - .../needle/examples/deflated-stream.js | 22 - node_modules/needle/examples/digest-auth.js | 16 - .../needle/examples/download-to-file.js | 18 - .../needle/examples/multipart-stream.js | 25 - node_modules/needle/examples/parsed-stream.js | 23 - .../needle/examples/parsed-stream2.js | 21 - node_modules/needle/examples/stream-events.js | 23 - .../needle/examples/stream-multiple/app.js | 21 - .../needle/examples/stream-multiple/env.js | 9 - .../examples/stream-multiple/package.json | 19 - .../stream-multiple/stream-multiple.js | 50 - .../needle/examples/stream-to-file.js | 14 - node_modules/needle/examples/upload-image.js | 51 - node_modules/needle/lib/auth.js | 111 - node_modules/needle/lib/cookies.js | 79 - node_modules/needle/lib/decoder.js | 62 - node_modules/needle/lib/multipart.js | 98 - node_modules/needle/lib/needle.js | 858 - node_modules/needle/lib/parsers.js | 122 - node_modules/needle/lib/querystring.js | 49 - node_modules/needle/lib/utils.js | 111 - node_modules/needle/license.txt | 19 - node_modules/needle/package.json | 70 - node_modules/needle/test/auth_digest_spec.js | 231 - node_modules/needle/test/basic_auth_spec.js | 196 - node_modules/needle/test/compression_spec.js | 112 - node_modules/needle/test/cookies_spec.js | 396 - node_modules/needle/test/decoder_spec.js | 270 - node_modules/needle/test/errors_spec.js | 406 - .../needle/test/files/Appalachia.html | 797 - .../needle/test/files/tomcat_charset.html | 342 - node_modules/needle/test/headers_spec.js | 320 - node_modules/needle/test/helpers.js | 74 - node_modules/needle/test/long_string_spec.js | 43 - node_modules/needle/test/mimetype.js | 81 - node_modules/needle/test/output_spec.js | 263 - node_modules/needle/test/parsing_spec.js | 588 - node_modules/needle/test/post_data_spec.js | 1021 - node_modules/needle/test/proxy_spec.js | 268 - node_modules/needle/test/querystring_spec.js | 128 - node_modules/needle/test/redirect_spec.js | 465 - .../needle/test/redirect_with_timeout.js | 45 - .../needle/test/request_stream_spec.js | 164 - .../needle/test/response_stream_spec.js | 138 - .../needle/test/socket_cleanup_spec.js | 79 - node_modules/needle/test/socket_pool_spec.js | 67 - .../needle/test/stream_events_spec.js | 144 - node_modules/needle/test/tls_options_spec.js | 57 - node_modules/needle/test/uri_modifier_spec.js | 46 - node_modules/needle/test/url_spec.js | 155 - node_modules/needle/test/utils/formidable.js | 17 - node_modules/needle/test/utils/proxy.js | 62 - node_modules/needle/test/utils/test.js | 104 - node_modules/needle/test/utils_spec.js | 105 - node_modules/node-gyp-build/LICENSE | 21 - node_modules/node-gyp-build/README.md | 58 - node_modules/node-gyp-build/SECURITY.md | 5 - node_modules/node-gyp-build/bin.js | 84 - node_modules/node-gyp-build/build-test.js | 19 - node_modules/node-gyp-build/index.js | 6 - node_modules/node-gyp-build/node-gyp-build.js | 207 - node_modules/node-gyp-build/optional.js | 7 - node_modules/node-gyp-build/package.json | 43 - node_modules/normalize-path/LICENSE | 21 - node_modules/normalize-path/README.md | 127 - node_modules/normalize-path/index.js | 35 - node_modules/normalize-path/package.json | 77 - node_modules/now-and-later/LICENSE | 21 - node_modules/now-and-later/README.md | 215 - node_modules/now-and-later/index.js | 6 - node_modules/now-and-later/lib/helpers.js | 41 - node_modules/now-and-later/lib/map.js | 83 - node_modules/now-and-later/lib/mapSeries.js | 63 - node_modules/now-and-later/package.json | 62 - node_modules/object-assign/index.js | 90 - node_modules/object-assign/license | 21 - node_modules/object-assign/package.json | 42 - node_modules/object-assign/readme.md | 61 - node_modules/object.defaults/LICENSE | 21 - node_modules/object.defaults/README.md | 85 - node_modules/object.defaults/immutable.js | 20 - node_modules/object.defaults/index.js | 11 - node_modules/object.defaults/mutable.js | 35 - node_modules/object.defaults/package.json | 67 - node_modules/object.pick/LICENSE | 21 - node_modules/object.pick/README.md | 76 - node_modules/object.pick/index.js | 35 - node_modules/object.pick/package.json | 60 - 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.d.ts | 42 - node_modules/p-limit/index.js | 71 - node_modules/p-limit/license | 9 - node_modules/p-limit/package.json | 52 - node_modules/p-limit/readme.md | 101 - node_modules/p-locate/index.d.ts | 53 - node_modules/p-locate/index.js | 50 - node_modules/p-locate/license | 9 - node_modules/p-locate/package.json | 54 - node_modules/p-locate/readme.md | 93 - 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/parse-filepath/LICENSE | 21 - node_modules/parse-filepath/README.md | 111 - node_modules/parse-filepath/index.js | 95 - node_modules/parse-filepath/package.json | 79 - node_modules/parse-imports/dist/index.cjs | 242 - node_modules/parse-imports/dist/index.d.ts | 150 - node_modules/parse-imports/dist/index.js | 239 - node_modules/parse-imports/license-apache | 73 - node_modules/parse-imports/license-mit | 20 - node_modules/parse-imports/notice-apache | 13 - node_modules/parse-imports/package.json | 63 - node_modules/parse-imports/readme.md | 278 - node_modules/parse-node-version/LICENSE | 22 - node_modules/parse-node-version/README.md | 51 - node_modules/parse-node-version/index.js | 20 - node_modules/parse-node-version/package.json | 40 - node_modules/parse-passwd/LICENSE | 21 - node_modules/parse-passwd/README.md | 86 - node_modules/parse-passwd/index.js | 56 - node_modules/parse-passwd/package.json | 55 - node_modules/path-exists/index.d.ts | 28 - node_modules/path-exists/index.js | 23 - node_modules/path-exists/license | 9 - node_modules/path-exists/package.json | 39 - node_modules/path-exists/readme.md | 52 - 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/path-root-regex/LICENSE | 21 - node_modules/path-root-regex/README.md | 53 - node_modules/path-root-regex/index.js | 13 - node_modules/path-root-regex/package.json | 65 - node_modules/path-root/LICENSE | 21 - node_modules/path-root/README.md | 94 - node_modules/path-root/index.js | 21 - node_modules/path-root/package.json | 58 - node_modules/picomatch/CHANGELOG.md | 136 - node_modules/picomatch/LICENSE | 21 - node_modules/picomatch/README.md | 708 - node_modules/picomatch/index.js | 3 - node_modules/picomatch/lib/constants.js | 179 - node_modules/picomatch/lib/parse.js | 1091 - node_modules/picomatch/lib/picomatch.js | 342 - node_modules/picomatch/lib/scan.js | 391 - node_modules/picomatch/lib/utils.js | 64 - node_modules/picomatch/package.json | 81 - node_modules/pify/index.js | 68 - node_modules/pify/license | 9 - node_modules/pify/package.json | 51 - node_modules/pify/readme.md | 145 - node_modules/plugin-error/LICENSE | 21 - node_modules/plugin-error/README.md | 69 - node_modules/plugin-error/index.d.ts | 114 - node_modules/plugin-error/index.js | 190 - node_modules/plugin-error/package.json | 51 - .../possible-typed-array-names/.eslintrc | 5 - .../.github/FUNDING.yml | 12 - .../possible-typed-array-names/CHANGELOG.md | 15 - .../possible-typed-array-names/LICENSE | 21 - .../possible-typed-array-names/README.md | 48 - .../possible-typed-array-names/index.d.ts | 15 - .../possible-typed-array-names/index.js | 16 - .../possible-typed-array-names/package.json | 83 - .../possible-typed-array-names/test/index.js | 16 - .../possible-typed-array-names/tsconfig.json | 49 - 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 - .../prettier-linter-helpers/.editorconfig | 15 - .../prettier-linter-helpers/.eslintignore | 2 - .../prettier-linter-helpers/.eslintrc.js | 6 - .../.github/CONTRIBUTING.md | 41 - .../prettier-linter-helpers/.prettierignore | 1 - .../prettier-linter-helpers/.prettierrc | 6 - .../.vscode/settings.json | 12 - .../prettier-linter-helpers/LICENSE.md | 24 - .../prettier-linter-helpers/README.md | 14 - node_modules/prettier-linter-helpers/index.js | 145 - .../prettier-linter-helpers/package.json | 38 - .../test/index.test.js | 29 - node_modules/prettier/LICENSE | 4380 --- node_modules/prettier/README.md | 109 - node_modules/prettier/bin/prettier.cjs | 68 - node_modules/prettier/doc.d.ts | 254 - node_modules/prettier/doc.js | 1236 - node_modules/prettier/doc.mjs | 1208 - node_modules/prettier/index.cjs | 674 - node_modules/prettier/index.d.ts | 946 - node_modules/prettier/index.mjs | 22061 ---------------- node_modules/prettier/internal/cli.mjs | 3895 --- node_modules/prettier/package.json | 199 - node_modules/prettier/plugins/acorn.d.ts | 6 - node_modules/prettier/plugins/acorn.js | 15 - node_modules/prettier/plugins/acorn.mjs | 15 - node_modules/prettier/plugins/angular.d.ts | 8 - node_modules/prettier/plugins/angular.js | 2 - node_modules/prettier/plugins/angular.mjs | 2 - node_modules/prettier/plugins/babel.d.ts | 18 - node_modules/prettier/plugins/babel.js | 15 - node_modules/prettier/plugins/babel.mjs | 15 - node_modules/prettier/plugins/estree.d.ts | 1 - node_modules/prettier/plugins/estree.js | 36 - node_modules/prettier/plugins/estree.mjs | 36 - node_modules/prettier/plugins/flow.d.ts | 5 - node_modules/prettier/plugins/flow.js | 19 - node_modules/prettier/plugins/flow.mjs | 19 - node_modules/prettier/plugins/glimmer.d.ts | 5 - node_modules/prettier/plugins/glimmer.js | 30 - node_modules/prettier/plugins/glimmer.mjs | 30 - node_modules/prettier/plugins/graphql.d.ts | 5 - node_modules/prettier/plugins/graphql.js | 29 - node_modules/prettier/plugins/graphql.mjs | 29 - node_modules/prettier/plugins/html.d.ts | 8 - node_modules/prettier/plugins/html.js | 22 - node_modules/prettier/plugins/html.mjs | 22 - node_modules/prettier/plugins/markdown.d.ts | 7 - node_modules/prettier/plugins/markdown.js | 63 - node_modules/prettier/plugins/markdown.mjs | 63 - node_modules/prettier/plugins/meriyah.d.ts | 5 - node_modules/prettier/plugins/meriyah.js | 4 - node_modules/prettier/plugins/meriyah.mjs | 4 - node_modules/prettier/plugins/postcss.d.ts | 7 - node_modules/prettier/plugins/postcss.js | 54 - node_modules/prettier/plugins/postcss.mjs | 54 - node_modules/prettier/plugins/typescript.d.ts | 5 - node_modules/prettier/plugins/typescript.js | 20 - node_modules/prettier/plugins/typescript.mjs | 20 - node_modules/prettier/plugins/yaml.d.ts | 5 - node_modules/prettier/plugins/yaml.js | 161 - node_modules/prettier/plugins/yaml.mjs | 161 - node_modules/prettier/standalone.d.ts | 33 - node_modules/prettier/standalone.js | 39 - node_modules/prettier/standalone.mjs | 39 - node_modules/prr/.jshintrc | 61 - node_modules/prr/.npmignore | 1 - node_modules/prr/.travis.yml | 10 - node_modules/prr/LICENSE.md | 11 - node_modules/prr/README.md | 47 - node_modules/prr/package.json | 26 - node_modules/prr/prr.js | 63 - node_modules/prr/test.js | 169 - node_modules/punycode/LICENSE-MIT.txt | 20 - node_modules/punycode/README.md | 148 - node_modules/punycode/package.json | 58 - node_modules/punycode/punycode.es6.js | 444 - node_modules/punycode/punycode.js | 443 - node_modules/queue-microtask/LICENSE | 20 - node_modules/queue-microtask/README.md | 90 - node_modules/queue-microtask/index.d.ts | 2 - node_modules/queue-microtask/index.js | 9 - node_modules/queue-microtask/package.json | 55 - .../.github/workflows/test-node.yml | 24 - node_modules/queue-tick/LICENSE | 21 - node_modules/queue-tick/README.md | 20 - node_modules/queue-tick/package.json | 25 - node_modules/queue-tick/process-next-tick.js | 3 - node_modules/queue-tick/queue-microtask.js | 1 - node_modules/queue-tick/test.js | 10 - node_modules/readable-stream/CONTRIBUTING.md | 38 - node_modules/readable-stream/GOVERNANCE.md | 136 - node_modules/readable-stream/LICENSE | 47 - node_modules/readable-stream/README.md | 106 - .../readable-stream/errors-browser.js | 127 - node_modules/readable-stream/errors.js | 116 - .../readable-stream/experimentalWarning.js | 17 - .../readable-stream/lib/_stream_duplex.js | 126 - .../lib/_stream_passthrough.js | 37 - .../readable-stream/lib/_stream_readable.js | 1027 - .../readable-stream/lib/_stream_transform.js | 190 - .../readable-stream/lib/_stream_writable.js | 641 - .../lib/internal/streams/async_iterator.js | 180 - .../lib/internal/streams/buffer_list.js | 183 - .../lib/internal/streams/destroy.js | 96 - .../lib/internal/streams/end-of-stream.js | 86 - .../lib/internal/streams/from-browser.js | 3 - .../lib/internal/streams/from.js | 52 - .../lib/internal/streams/pipeline.js | 86 - .../lib/internal/streams/state.js | 22 - .../lib/internal/streams/stream-browser.js | 1 - .../lib/internal/streams/stream.js | 1 - node_modules/readable-stream/package.json | 68 - .../readable-stream/readable-browser.js | 9 - node_modules/readable-stream/readable.js | 16 - node_modules/readdirp/LICENSE | 21 - node_modules/readdirp/README.md | 122 - node_modules/readdirp/index.d.ts | 43 - node_modules/readdirp/index.js | 287 - node_modules/readdirp/package.json | 122 - node_modules/rechoir/CHANGELOG.md | 12 - node_modules/rechoir/LICENSE | 21 - node_modules/rechoir/README.md | 73 - node_modules/rechoir/index.js | 69 - node_modules/rechoir/lib/extension.js | 44 - node_modules/rechoir/lib/normalize.js | 13 - node_modules/rechoir/lib/register.js | 15 - node_modules/rechoir/package.json | 52 - .../remove-trailing-separator/history.md | 17 - .../remove-trailing-separator/index.js | 17 - .../remove-trailing-separator/license | 3 - .../remove-trailing-separator/package.json | 37 - .../remove-trailing-separator/readme.md | 51 - node_modules/replace-ext/LICENSE | 21 - node_modules/replace-ext/README.md | 54 - node_modules/replace-ext/index.js | 32 - node_modules/replace-ext/package.json | 47 - node_modules/replace-homedir/LICENSE | 21 - node_modules/replace-homedir/README.md | 44 - node_modules/replace-homedir/index.js | 40 - node_modules/replace-homedir/package.json | 51 - node_modules/require-directory/.jshintrc | 67 - node_modules/require-directory/.npmignore | 1 - node_modules/require-directory/.travis.yml | 3 - node_modules/require-directory/LICENSE | 22 - .../require-directory/README.markdown | 184 - node_modules/require-directory/index.js | 86 - node_modules/require-directory/package.json | 40 - node_modules/resolve-dir/LICENSE | 21 - node_modules/resolve-dir/README.md | 88 - node_modules/resolve-dir/index.js | 22 - node_modules/resolve-dir/package.json | 73 - 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-options/LICENSE | 21 - node_modules/resolve-options/README.md | 107 - node_modules/resolve-options/index.js | 107 - node_modules/resolve-options/package.json | 55 - 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 | 12 - node_modules/resolve/lib/core.json | 158 - 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 | 72 - 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 | 597 - .../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 - 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 | 730 - 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/reusify/.coveralls.yml | 1 - node_modules/reusify/.travis.yml | 28 - node_modules/reusify/LICENSE | 22 - node_modules/reusify/README.md | 145 - .../benchmarks/createNoCodeFunction.js | 30 - node_modules/reusify/benchmarks/fib.js | 13 - .../reusify/benchmarks/reuseNoCodeFunction.js | 38 - node_modules/reusify/package.json | 45 - node_modules/reusify/reusify.js | 33 - node_modules/reusify/test.js | 66 - node_modules/safe-buffer/LICENSE | 21 - node_modules/safe-buffer/README.md | 584 - node_modules/safe-buffer/index.d.ts | 187 - node_modules/safe-buffer/index.js | 65 - node_modules/safe-buffer/package.json | 51 - node_modules/safer-buffer/LICENSE | 21 - node_modules/safer-buffer/Porting-Buffer.md | 268 - node_modules/safer-buffer/Readme.md | 156 - node_modules/safer-buffer/dangerous.js | 58 - node_modules/safer-buffer/package.json | 34 - node_modules/safer-buffer/safer.js | 77 - node_modules/safer-buffer/tests.js | 406 - node_modules/sax/LICENSE | 41 - node_modules/sax/README.md | 228 - node_modules/sax/lib/sax.js | 1597 -- node_modules/sax/package.json | 29 - .../semver-greatest-satisfied-range/LICENSE | 21 - .../semver-greatest-satisfied-range/README.md | 46 - .../semver-greatest-satisfied-range/index.js | 19 - .../package.json | 53 - node_modules/semver/LICENSE | 15 - node_modules/semver/README.md | 654 - node_modules/semver/bin/semver.js | 188 - node_modules/semver/classes/comparator.js | 141 - node_modules/semver/classes/index.js | 5 - node_modules/semver/classes/range.js | 554 - node_modules/semver/classes/semver.js | 302 - node_modules/semver/functions/clean.js | 6 - node_modules/semver/functions/cmp.js | 52 - node_modules/semver/functions/coerce.js | 60 - .../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 | 65 - 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 | 19 - 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 | 16 - 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 | 89 - node_modules/semver/internal/constants.js | 35 - node_modules/semver/internal/debug.js | 9 - node_modules/semver/internal/identifiers.js | 23 - node_modules/semver/internal/lrucache.js | 40 - node_modules/semver/internal/parse-options.js | 15 - node_modules/semver/internal/re.js | 217 - node_modules/semver/package.json | 77 - 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 | 247 - node_modules/semver/ranges/to-comparators.js | 8 - node_modules/semver/ranges/valid.js | 11 - node_modules/set-function-length/.eslintrc | 27 - .../set-function-length/.github/FUNDING.yml | 12 - node_modules/set-function-length/.nycrc | 13 - node_modules/set-function-length/CHANGELOG.md | 70 - node_modules/set-function-length/LICENSE | 21 - node_modules/set-function-length/README.md | 56 - node_modules/set-function-length/env.d.ts | 9 - node_modules/set-function-length/env.js | 25 - node_modules/set-function-length/index.d.ts | 7 - node_modules/set-function-length/index.js | 42 - node_modules/set-function-length/package.json | 102 - .../set-function-length/tsconfig.json | 9 - 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 - node_modules/slashes/LICENSE | 17 - node_modules/slashes/README.md | 103 - node_modules/slashes/lib/cjs/add-slashes.js | 24 - .../slashes/lib/cjs/add-slashes.js.map | 1 - .../slashes/lib/cjs/get-escaped-any.js | 27 - .../slashes/lib/cjs/get-escaped-any.js.map | 1 - .../lib/cjs/get-escaped-json-unsafe.js | 20 - .../lib/cjs/get-escaped-json-unsafe.js.map | 1 - .../slashes/lib/cjs/get-unescaped-any.js | 25 - .../slashes/lib/cjs/get-unescaped-any.js.map | 1 - node_modules/slashes/lib/cjs/index.js | 22 - node_modules/slashes/lib/cjs/index.js.map | 1 - node_modules/slashes/lib/cjs/package.json | 1 - .../slashes/lib/cjs/remove-slashes.js | 47 - .../slashes/lib/cjs/remove-slashes.js.map | 1 - .../slashes/lib/cjs/types/escape-sequence.js | 3 - .../lib/cjs/types/escape-sequence.js.map | 1 - node_modules/slashes/lib/esm/add-slashes.js | 21 - .../slashes/lib/esm/add-slashes.js.map | 1 - .../slashes/lib/esm/get-escaped-any.js | 24 - .../slashes/lib/esm/get-escaped-any.js.map | 1 - .../lib/esm/get-escaped-json-unsafe.js | 17 - .../lib/esm/get-escaped-json-unsafe.js.map | 1 - .../slashes/lib/esm/get-unescaped-any.js | 22 - .../slashes/lib/esm/get-unescaped-any.js.map | 1 - node_modules/slashes/lib/esm/index.js | 6 - node_modules/slashes/lib/esm/index.js.map | 1 - .../slashes/lib/esm/remove-slashes.js | 43 - .../slashes/lib/esm/remove-slashes.js.map | 1 - .../slashes/lib/esm/types/escape-sequence.js | 2 - .../lib/esm/types/escape-sequence.js.map | 1 - .../slashes/lib/types/add-slashes.d.ts | 31 - .../slashes/lib/types/get-escaped-any.d.ts | 7 - .../lib/types/get-escaped-json-unsafe.d.ts | 18 - .../slashes/lib/types/get-unescaped-any.d.ts | 3 - node_modules/slashes/lib/types/index.d.ts | 5 - .../slashes/lib/types/remove-slashes.d.ts | 16 - .../lib/types/types/escape-sequence.d.ts | 2 - node_modules/slashes/package.json | 58 - node_modules/source-map/CHANGELOG.md | 301 - node_modules/source-map/LICENSE | 28 - node_modules/source-map/README.md | 742 - .../source-map/dist/source-map.debug.js | 3234 --- node_modules/source-map/dist/source-map.js | 3233 --- .../source-map/dist/source-map.min.js | 2 - .../source-map/dist/source-map.min.js.map | 1 - node_modules/source-map/lib/array-set.js | 121 - node_modules/source-map/lib/base64-vlq.js | 140 - node_modules/source-map/lib/base64.js | 67 - node_modules/source-map/lib/binary-search.js | 111 - node_modules/source-map/lib/mapping-list.js | 79 - node_modules/source-map/lib/quick-sort.js | 114 - .../source-map/lib/source-map-consumer.js | 1145 - .../source-map/lib/source-map-generator.js | 425 - node_modules/source-map/lib/source-node.js | 413 - node_modules/source-map/lib/util.js | 488 - node_modules/source-map/package.json | 73 - node_modules/source-map/source-map.d.ts | 98 - node_modules/source-map/source-map.js | 8 - node_modules/sparkles/LICENSE | 22 - node_modules/sparkles/README.md | 60 - node_modules/sparkles/index.js | 44 - node_modules/sparkles/legacy.js | 48 - node_modules/sparkles/package.json | 49 - node_modules/spdx-exceptions/README.md | 36 - node_modules/spdx-exceptions/deprecated.json | 3 - node_modules/spdx-exceptions/index.json | 68 - node_modules/spdx-exceptions/package.json | 19 - node_modules/spdx-expression-parse/AUTHORS | 4 - node_modules/spdx-expression-parse/LICENSE | 22 - node_modules/spdx-expression-parse/README.md | 105 - node_modules/spdx-expression-parse/index.js | 8 - .../spdx-expression-parse/package.json | 39 - node_modules/spdx-expression-parse/parse.js | 138 - node_modules/spdx-expression-parse/scan.js | 131 - node_modules/spdx-license-ids/README.md | 52 - node_modules/spdx-license-ids/deprecated.json | 28 - node_modules/spdx-license-ids/index.json | 636 - node_modules/spdx-license-ids/package.json | 39 - .../.github/workflows/test-node.yml | 23 - node_modules/stream-composer/LICENSE | 21 - node_modules/stream-composer/README.md | 61 - node_modules/stream-composer/index.js | 192 - node_modules/stream-composer/package.json | 26 - node_modules/stream-composer/test.js | 283 - node_modules/stream-exhaust/README.md | 33 - node_modules/stream-exhaust/index.js | 34 - node_modules/stream-exhaust/package.json | 24 - node_modules/stream-exhaust/test.js | 209 - node_modules/streamx/LICENSE | 21 - node_modules/streamx/README.md | 489 - node_modules/streamx/index.js | 1170 - node_modules/streamx/package.json | 42 - node_modules/string-width/index.d.ts | 29 - node_modules/string-width/index.js | 47 - node_modules/string-width/license | 9 - node_modules/string-width/package.json | 56 - node_modules/string-width/readme.md | 50 - node_modules/string_decoder/LICENSE | 48 - node_modules/string_decoder/README.md | 47 - .../string_decoder/lib/string_decoder.js | 296 - node_modules/string_decoder/package.json | 34 - 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-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 - node_modules/supports-color/browser.js | 5 - node_modules/supports-color/index.js | 135 - node_modules/supports-color/license | 9 - node_modules/supports-color/package.json | 53 - node_modules/supports-color/readme.md | 76 - .../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/sver/.travis.yml | 10 - node_modules/sver/LICENSE | 10 - node_modules/sver/README.md | 161 - node_modules/sver/convert-range.js | 144 - node_modules/sver/node_modules/.bin/semver | 1 - node_modules/sver/node_modules/semver/LICENSE | 15 - .../sver/node_modules/semver/README.md | 443 - .../sver/node_modules/semver/bin/semver.js | 174 - .../sver/node_modules/semver/package.json | 38 - .../sver/node_modules/semver/range.bnf | 16 - .../sver/node_modules/semver/semver.js | 1643 -- node_modules/sver/package.json | 29 - node_modules/sver/sver.js | 392 - node_modules/synckit/LICENSE | 21 - node_modules/synckit/README.md | 191 - node_modules/synckit/lib/index.cjs | 472 - node_modules/synckit/lib/index.d.ts | 32 - node_modules/synckit/lib/index.js | 380 - node_modules/synckit/lib/index.js.map | 1 - node_modules/synckit/lib/types.d.ts | 35 - node_modules/synckit/lib/types.js | 2 - node_modules/synckit/lib/types.js.map | 1 - node_modules/synckit/package.json | 40 - node_modules/teex/LICENSE | 21 - node_modules/teex/README.md | 31 - node_modules/teex/example.js | 16 - node_modules/teex/index.js | 52 - node_modules/teex/package.json | 26 - node_modules/teex/test.js | 68 - node_modules/text-decoder/LICENSE | 201 - node_modules/text-decoder/README.md | 36 - node_modules/text-decoder/index.js | 64 - .../text-decoder/lib/browser-decoder.js | 17 - .../text-decoder/lib/pass-through-decoder.js | 17 - node_modules/text-decoder/lib/utf8-decoder.js | 102 - node_modules/text-decoder/package.json | 31 - node_modules/through2/LICENSE.md | 9 - node_modules/through2/README.md | 140 - node_modules/through2/package.json | 38 - node_modules/through2/through2.js | 83 - node_modules/to-regex-range/LICENSE | 21 - node_modules/to-regex-range/README.md | 305 - node_modules/to-regex-range/index.js | 288 - node_modules/to-regex-range/package.json | 88 - node_modules/to-through/LICENSE | 21 - node_modules/to-through/README.md | 55 - node_modules/to-through/index.js | 134 - node_modules/to-through/package.json | 51 - node_modules/tslib/CopyrightNotice.txt | 15 - node_modules/tslib/LICENSE.txt | 12 - node_modules/tslib/README.md | 164 - node_modules/tslib/SECURITY.md | 41 - node_modules/tslib/modules/index.d.ts | 38 - node_modules/tslib/modules/index.js | 70 - node_modules/tslib/modules/package.json | 3 - node_modules/tslib/package.json | 47 - node_modules/tslib/tslib.d.ts | 460 - node_modules/tslib/tslib.es6.html | 1 - node_modules/tslib/tslib.es6.js | 402 - node_modules/tslib/tslib.es6.mjs | 401 - node_modules/tslib/tslib.html | 1 - node_modules/tslib/tslib.js | 484 - 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/unc-path-regex/LICENSE | 21 - node_modules/unc-path-regex/README.md | 88 - node_modules/unc-path-regex/index.js | 5 - node_modules/unc-path-regex/package.json | 56 - node_modules/undertaker-registry/LICENSE | 21 - node_modules/undertaker-registry/README.md | 217 - node_modules/undertaker-registry/index.js | 31 - node_modules/undertaker-registry/package.json | 47 - node_modules/undertaker/LICENSE | 21 - node_modules/undertaker/README.md | 319 - node_modules/undertaker/index.js | 47 - node_modules/undertaker/lib/get-task.js | 7 - .../undertaker/lib/helpers/buildTree.js | 27 - .../lib/helpers/createExtensions.js | 73 - .../undertaker/lib/helpers/metadata.js | 5 - .../undertaker/lib/helpers/normalizeArgs.js | 55 - .../lib/helpers/validateRegistry.js | 41 - node_modules/undertaker/lib/last-run.js | 22 - node_modules/undertaker/lib/parallel.js | 31 - node_modules/undertaker/lib/registry.js | 25 - node_modules/undertaker/lib/series.js | 31 - node_modules/undertaker/lib/set-task.js | 42 - node_modules/undertaker/lib/task.js | 16 - node_modules/undertaker/lib/tree.js | 25 - .../node_modules/fast-levenshtein/LICENSE.md | 25 - .../node_modules/fast-levenshtein/README.md | 69 - .../fast-levenshtein/levenshtein.js | 107 - .../fast-levenshtein/package.json | 42 - node_modules/undertaker/package.json | 61 - 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/util-deprecate/History.md | 16 - node_modules/util-deprecate/LICENSE | 24 - node_modules/util-deprecate/README.md | 53 - node_modules/util-deprecate/browser.js | 67 - node_modules/util-deprecate/node.js | 6 - node_modules/util-deprecate/package.json | 27 - node_modules/util/LICENSE | 18 - node_modules/util/README.md | 48 - node_modules/util/package.json | 50 - node_modules/util/support/isBuffer.js | 3 - node_modules/util/support/isBufferBrowser.js | 6 - node_modules/util/support/types.js | 334 - node_modules/util/util.js | 715 - node_modules/v8flags/LICENSE | 21 - node_modules/v8flags/README.md | 61 - node_modules/v8flags/config-path.js | 37 - node_modules/v8flags/index.js | 162 - node_modules/v8flags/package.json | 53 - node_modules/value-or-function/LICENSE | 21 - node_modules/value-or-function/README.md | 139 - node_modules/value-or-function/index.js | 113 - node_modules/value-or-function/package.json | 48 - node_modules/vinyl-contents/LICENSE | 21 - node_modules/vinyl-contents/README.md | 73 - node_modules/vinyl-contents/index.js | 33 - node_modules/vinyl-contents/package.json | 48 - node_modules/vinyl-fs/LICENSE | 21 - node_modules/vinyl-fs/README.md | 366 - node_modules/vinyl-fs/index.js | 7 - node_modules/vinyl-fs/lib/codecs.js | 107 - node_modules/vinyl-fs/lib/constants.js | 7 - node_modules/vinyl-fs/lib/dest/index.js | 47 - node_modules/vinyl-fs/lib/dest/options.js | 47 - node_modules/vinyl-fs/lib/dest/prepare.js | 50 - node_modules/vinyl-fs/lib/dest/sourcemap.js | 39 - .../vinyl-fs/lib/dest/write-contents/index.js | 59 - .../lib/dest/write-contents/write-buffer.js | 46 - .../lib/dest/write-contents/write-dir.js | 50 - .../lib/dest/write-contents/write-stream.js | 68 - .../write-contents/write-symbolic-link.js | 77 - node_modules/vinyl-fs/lib/file-operations.js | 459 - node_modules/vinyl-fs/lib/src/index.js | 46 - node_modules/vinyl-fs/lib/src/options.js | 35 - node_modules/vinyl-fs/lib/src/prepare.js | 24 - .../vinyl-fs/lib/src/read-contents/index.js | 52 - .../lib/src/read-contents/read-buffer.js | 37 - .../lib/src/read-contents/read-dir.js | 8 - .../lib/src/read-contents/read-stream.js | 46 - .../src/read-contents/read-symbolic-link.js | 20 - .../vinyl-fs/lib/src/resolve-symlinks.js | 44 - node_modules/vinyl-fs/lib/src/sourcemap.js | 30 - node_modules/vinyl-fs/lib/src/wrap-vinyl.js | 18 - node_modules/vinyl-fs/lib/symlink/index.js | 45 - .../vinyl-fs/lib/symlink/link-file.js | 90 - node_modules/vinyl-fs/lib/symlink/options.js | 26 - node_modules/vinyl-fs/lib/symlink/prepare.js | 54 - node_modules/vinyl-fs/package.json | 70 - node_modules/vinyl-sourcemap/LICENSE | 21 - node_modules/vinyl-sourcemap/README.md | 77 - node_modules/vinyl-sourcemap/index.js | 63 - node_modules/vinyl-sourcemap/lib/helpers.js | 349 - node_modules/vinyl-sourcemap/package.json | 60 - node_modules/vinyl-sourcemaps-apply/.jshintrc | 4 - .../vinyl-sourcemaps-apply/.npmignore | 2 - node_modules/vinyl-sourcemaps-apply/README.md | 42 - node_modules/vinyl-sourcemaps-apply/index.js | 39 - .../node_modules/source-map/CHANGELOG.md | 301 - .../node_modules/source-map/LICENSE | 28 - .../node_modules/source-map/README.md | 729 - .../source-map/dist/source-map.debug.js | 3091 --- .../source-map/dist/source-map.js | 3090 --- .../source-map/dist/source-map.min.js | 2 - .../source-map/dist/source-map.min.js.map | 1 - .../node_modules/source-map/lib/array-set.js | 121 - .../node_modules/source-map/lib/base64-vlq.js | 140 - .../node_modules/source-map/lib/base64.js | 67 - .../source-map/lib/binary-search.js | 111 - .../source-map/lib/mapping-list.js | 79 - .../node_modules/source-map/lib/quick-sort.js | 114 - .../source-map/lib/source-map-consumer.js | 1082 - .../source-map/lib/source-map-generator.js | 416 - .../source-map/lib/source-node.js | 413 - .../node_modules/source-map/lib/util.js | 417 - .../node_modules/source-map/package.json | 72 - .../node_modules/source-map/source-map.js | 8 - .../vinyl-sourcemaps-apply/package.json | 22 - node_modules/vinyl/LICENSE | 21 - node_modules/vinyl/README.md | 447 - node_modules/vinyl/index.js | 343 - node_modules/vinyl/lib/inspect-stream.js | 13 - node_modules/vinyl/lib/is-stream.js | 15 - node_modules/vinyl/lib/normalize.js | 9 - node_modules/vinyl/package.json | 60 - node_modules/which-typed-array/.editorconfig | 20 - node_modules/which-typed-array/.eslintrc | 9 - .../which-typed-array/.github/FUNDING.yml | 12 - node_modules/which-typed-array/.nycrc | 13 - node_modules/which-typed-array/CHANGELOG.md | 235 - node_modules/which-typed-array/LICENSE | 22 - node_modules/which-typed-array/README.md | 70 - node_modules/which-typed-array/index.d.ts | 62 - node_modules/which-typed-array/index.js | 116 - node_modules/which-typed-array/package.json | 127 - node_modules/which-typed-array/test/index.js | 105 - node_modules/which-typed-array/tsconfig.json | 9 - 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 | 201 - node_modules/word-wrap/index.d.ts | 50 - node_modules/word-wrap/index.js | 61 - node_modules/word-wrap/package.json | 77 - node_modules/wrap-ansi/index.js | 216 - node_modules/wrap-ansi/license | 9 - node_modules/wrap-ansi/package.json | 62 - node_modules/wrap-ansi/readme.md | 91 - 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/y18n/CHANGELOG.md | 100 - node_modules/y18n/LICENSE | 13 - node_modules/y18n/README.md | 127 - node_modules/y18n/build/index.cjs | 203 - node_modules/y18n/build/lib/cjs.js | 6 - node_modules/y18n/build/lib/index.js | 174 - .../y18n/build/lib/platform-shims/node.js | 19 - node_modules/y18n/index.mjs | 8 - node_modules/y18n/package.json | 70 - node_modules/yargs-parser/CHANGELOG.md | 308 - node_modules/yargs-parser/LICENSE.txt | 14 - node_modules/yargs-parser/README.md | 518 - node_modules/yargs-parser/browser.js | 29 - node_modules/yargs-parser/build/index.cjs | 1050 - node_modules/yargs-parser/build/lib/index.js | 62 - .../yargs-parser/build/lib/string-utils.js | 65 - .../build/lib/tokenize-arg-string.js | 40 - .../build/lib/yargs-parser-types.js | 12 - .../yargs-parser/build/lib/yargs-parser.js | 1045 - node_modules/yargs-parser/package.json | 92 - node_modules/yargs/LICENSE | 21 - node_modules/yargs/README.md | 204 - node_modules/yargs/browser.d.ts | 5 - node_modules/yargs/browser.mjs | 7 - node_modules/yargs/build/index.cjs | 1 - node_modules/yargs/build/lib/argsert.js | 62 - node_modules/yargs/build/lib/command.js | 449 - .../yargs/build/lib/completion-templates.js | 48 - node_modules/yargs/build/lib/completion.js | 243 - node_modules/yargs/build/lib/middleware.js | 88 - node_modules/yargs/build/lib/parse-command.js | 32 - .../yargs/build/lib/typings/common-types.js | 9 - .../build/lib/typings/yargs-parser-types.js | 1 - node_modules/yargs/build/lib/usage.js | 584 - .../yargs/build/lib/utils/apply-extends.js | 59 - .../yargs/build/lib/utils/is-promise.js | 5 - .../yargs/build/lib/utils/levenshtein.js | 34 - .../build/lib/utils/maybe-async-result.js | 17 - .../yargs/build/lib/utils/obj-filter.js | 10 - .../yargs/build/lib/utils/process-argv.js | 17 - .../yargs/build/lib/utils/set-blocking.js | 12 - .../yargs/build/lib/utils/which-module.js | 10 - node_modules/yargs/build/lib/validation.js | 305 - node_modules/yargs/build/lib/yargs-factory.js | 1512 -- node_modules/yargs/build/lib/yerror.js | 9 - node_modules/yargs/helpers/helpers.mjs | 10 - node_modules/yargs/helpers/index.js | 14 - node_modules/yargs/helpers/package.json | 3 - node_modules/yargs/index.cjs | 53 - node_modules/yargs/index.mjs | 8 - .../yargs/lib/platform-shims/browser.mjs | 95 - node_modules/yargs/lib/platform-shims/esm.mjs | 73 - node_modules/yargs/locales/be.json | 46 - node_modules/yargs/locales/cs.json | 51 - node_modules/yargs/locales/de.json | 46 - node_modules/yargs/locales/en.json | 55 - node_modules/yargs/locales/es.json | 46 - node_modules/yargs/locales/fi.json | 49 - node_modules/yargs/locales/fr.json | 53 - node_modules/yargs/locales/hi.json | 49 - node_modules/yargs/locales/hu.json | 46 - node_modules/yargs/locales/id.json | 50 - node_modules/yargs/locales/it.json | 46 - node_modules/yargs/locales/ja.json | 51 - node_modules/yargs/locales/ko.json | 49 - node_modules/yargs/locales/nb.json | 44 - node_modules/yargs/locales/nl.json | 49 - node_modules/yargs/locales/nn.json | 44 - node_modules/yargs/locales/pirate.json | 13 - node_modules/yargs/locales/pl.json | 49 - node_modules/yargs/locales/pt.json | 45 - node_modules/yargs/locales/pt_BR.json | 48 - node_modules/yargs/locales/ru.json | 51 - node_modules/yargs/locales/th.json | 46 - node_modules/yargs/locales/tr.json | 48 - node_modules/yargs/locales/uk_UA.json | 51 - node_modules/yargs/locales/uz.json | 52 - node_modules/yargs/locales/zh_CN.json | 48 - node_modules/yargs/locales/zh_TW.json | 51 - node_modules/yargs/package.json | 123 - node_modules/yargs/yargs | 9 - node_modules/yargs/yargs.mjs | 10 - node_modules/yocto-queue/index.d.ts | 56 - node_modules/yocto-queue/index.js | 68 - node_modules/yocto-queue/license | 9 - node_modules/yocto-queue/package.json | 43 - node_modules/yocto-queue/readme.md | 64 - 4393 files changed, 664600 deletions(-) delete mode 120000 node_modules/.bin/acorn delete mode 120000 node_modules/.bin/errno delete mode 120000 node_modules/.bin/eslint delete mode 120000 node_modules/.bin/eslint-config-prettier delete mode 120000 node_modules/.bin/fvtt delete mode 120000 node_modules/.bin/gulp delete mode 120000 node_modules/.bin/image-size delete mode 120000 node_modules/.bin/js-yaml delete mode 120000 node_modules/.bin/lessc delete mode 120000 node_modules/.bin/mime delete mode 120000 node_modules/.bin/mkdirp delete mode 120000 node_modules/.bin/needle delete mode 120000 node_modules/.bin/node-gyp-build delete mode 120000 node_modules/.bin/node-gyp-build-optional delete mode 120000 node_modules/.bin/node-gyp-build-test delete mode 120000 node_modules/.bin/node-which delete mode 120000 node_modules/.bin/prettier delete mode 120000 node_modules/.bin/resolve delete mode 120000 node_modules/.bin/semver delete mode 100644 node_modules/.package-lock.json delete mode 100644 node_modules/@es-joy/jsdoccomment/CHANGES.md delete mode 100644 node_modules/@es-joy/jsdoccomment/LICENSE-MIT.txt delete mode 100644 node_modules/@es-joy/jsdoccomment/README.md delete mode 100644 node_modules/@es-joy/jsdoccomment/dist/index.cjs.cjs delete mode 100644 node_modules/@es-joy/jsdoccomment/dist/index.d.ts delete mode 100644 node_modules/@es-joy/jsdoccomment/package.json delete mode 100644 node_modules/@es-joy/jsdoccomment/src/commentHandler.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/commentParserToESTree.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/estreeToString.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/index.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/jsdoccomment.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/parseComment.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/parseInlineTags.js delete mode 100644 node_modules/@es-joy/jsdoccomment/src/toCamelCase.js delete mode 100644 node_modules/@eslint-community/eslint-utils/LICENSE delete mode 100644 node_modules/@eslint-community/eslint-utils/README.md delete mode 100644 node_modules/@eslint-community/eslint-utils/index.js delete mode 100644 node_modules/@eslint-community/eslint-utils/index.js.map delete mode 100644 node_modules/@eslint-community/eslint-utils/index.mjs delete mode 100644 node_modules/@eslint-community/eslint-utils/index.mjs.map delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js delete mode 100644 node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json delete mode 100644 node_modules/@eslint-community/eslint-utils/package.json delete mode 100644 node_modules/@eslint-community/regexpp/LICENSE delete mode 100644 node_modules/@eslint-community/regexpp/README.md delete mode 100644 node_modules/@eslint-community/regexpp/index.d.ts delete mode 100644 node_modules/@eslint-community/regexpp/index.js delete mode 100644 node_modules/@eslint-community/regexpp/index.js.map delete mode 100644 node_modules/@eslint-community/regexpp/index.mjs delete mode 100644 node_modules/@eslint-community/regexpp/index.mjs.map delete mode 100644 node_modules/@eslint-community/regexpp/package.json delete mode 100644 node_modules/@eslint/config-array/LICENSE delete mode 100644 node_modules/@eslint/config-array/README.md delete mode 100644 node_modules/@eslint/config-array/dist/cjs/index.cjs delete mode 100644 node_modules/@eslint/config-array/dist/cjs/index.d.cts delete mode 100644 node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs delete mode 100644 node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs delete mode 100644 node_modules/@eslint/config-array/dist/cjs/types.ts delete mode 100644 node_modules/@eslint/config-array/dist/esm/index.d.ts delete mode 100644 node_modules/@eslint/config-array/dist/esm/index.js delete mode 100644 node_modules/@eslint/config-array/dist/esm/std__path/posix.js delete mode 100644 node_modules/@eslint/config-array/dist/esm/std__path/windows.js delete mode 100644 node_modules/@eslint/config-array/dist/esm/types.d.ts delete mode 100644 node_modules/@eslint/config-array/dist/esm/types.ts delete mode 100644 node_modules/@eslint/config-array/package.json delete mode 100644 node_modules/@eslint/core/LICENSE delete mode 100644 node_modules/@eslint/core/README.md delete mode 100644 node_modules/@eslint/core/dist/cjs/types.d.cts delete mode 100644 node_modules/@eslint/core/dist/esm/types.d.ts delete mode 100644 node_modules/@eslint/core/package.json delete mode 100644 node_modules/@eslint/eslintrc/LICENSE delete mode 100644 node_modules/@eslint/eslintrc/README.md delete mode 100644 node_modules/@eslint/eslintrc/conf/config-schema.js delete mode 100644 node_modules/@eslint/eslintrc/conf/environments.js delete mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs delete mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map delete mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc.cjs delete mode 100644 node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map delete mode 100644 node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array-factory.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array/config-array.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array/index.js delete mode 100644 node_modules/@eslint/eslintrc/lib/config-array/override-tester.js delete mode 100644 node_modules/@eslint/eslintrc/lib/flat-compat.js delete mode 100644 node_modules/@eslint/eslintrc/lib/index-universal.js delete mode 100644 node_modules/@eslint/eslintrc/lib/index.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/ajv.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/config-ops.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/config-validator.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/deep-merge-arrays.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/naming.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js delete mode 100644 node_modules/@eslint/eslintrc/lib/shared/types.js delete mode 100644 node_modules/@eslint/eslintrc/node_modules/globals/globals.json delete mode 100644 node_modules/@eslint/eslintrc/node_modules/globals/index.d.ts delete mode 100644 node_modules/@eslint/eslintrc/node_modules/globals/index.js delete mode 100644 node_modules/@eslint/eslintrc/node_modules/globals/license delete mode 100644 node_modules/@eslint/eslintrc/node_modules/globals/package.json delete mode 100644 node_modules/@eslint/eslintrc/node_modules/globals/readme.md delete mode 100644 node_modules/@eslint/eslintrc/package.json delete mode 100644 node_modules/@eslint/eslintrc/universal.js delete mode 100644 node_modules/@eslint/js/LICENSE delete mode 100644 node_modules/@eslint/js/README.md delete mode 100644 node_modules/@eslint/js/package.json delete mode 100644 node_modules/@eslint/js/src/configs/eslint-all.js delete mode 100644 node_modules/@eslint/js/src/configs/eslint-recommended.js delete mode 100644 node_modules/@eslint/js/src/index.js delete mode 100644 node_modules/@eslint/js/types/index.d.ts delete mode 100644 node_modules/@eslint/object-schema/LICENSE delete mode 100644 node_modules/@eslint/object-schema/README.md delete mode 100644 node_modules/@eslint/object-schema/dist/cjs/index.cjs delete mode 100644 node_modules/@eslint/object-schema/dist/cjs/index.d.cts delete mode 100644 node_modules/@eslint/object-schema/dist/cjs/types.ts delete mode 100644 node_modules/@eslint/object-schema/dist/esm/index.d.ts delete mode 100644 node_modules/@eslint/object-schema/dist/esm/index.js delete mode 100644 node_modules/@eslint/object-schema/dist/esm/types.d.ts delete mode 100644 node_modules/@eslint/object-schema/dist/esm/types.ts delete mode 100644 node_modules/@eslint/object-schema/package.json delete mode 100644 node_modules/@eslint/plugin-kit/LICENSE delete mode 100644 node_modules/@eslint/plugin-kit/README.md delete mode 100644 node_modules/@eslint/plugin-kit/dist/cjs/index.cjs delete mode 100644 node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts delete mode 100644 node_modules/@eslint/plugin-kit/dist/cjs/types.ts delete mode 100644 node_modules/@eslint/plugin-kit/dist/esm/index.d.ts delete mode 100644 node_modules/@eslint/plugin-kit/dist/esm/index.js delete mode 100644 node_modules/@eslint/plugin-kit/dist/esm/types.d.ts delete mode 100644 node_modules/@eslint/plugin-kit/dist/esm/types.ts delete mode 100644 node_modules/@eslint/plugin-kit/package.json delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/CHANGELOG.md delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/LICENSE delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/README.md delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/commands/configuration.mjs delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/commands/launch.mjs delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/commands/package.mjs delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/config.example.yml delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/config.mjs delete mode 100755 node_modules/@foundryvtt/foundryvtt-cli/fvtt.mjs delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/index.mjs delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/lib/package.mjs delete mode 100644 node_modules/@foundryvtt/foundryvtt-cli/package.json delete mode 100644 node_modules/@gulpjs/messages/LICENSE delete mode 100644 node_modules/@gulpjs/messages/README.md delete mode 100644 node_modules/@gulpjs/messages/index.js delete mode 100644 node_modules/@gulpjs/messages/package.json delete mode 100644 node_modules/@gulpjs/to-absolute-glob/LICENSE delete mode 100644 node_modules/@gulpjs/to-absolute-glob/README.md delete mode 100644 node_modules/@gulpjs/to-absolute-glob/index.js delete mode 100644 node_modules/@gulpjs/to-absolute-glob/package.json delete mode 100644 node_modules/@humanfs/core/LICENSE delete mode 100644 node_modules/@humanfs/core/README.md delete mode 100644 node_modules/@humanfs/core/dist/errors.d.ts delete mode 100644 node_modules/@humanfs/core/dist/fsx.d.ts delete mode 100644 node_modules/@humanfs/core/dist/hfs.d.ts delete mode 100644 node_modules/@humanfs/core/dist/index.d.ts delete mode 100644 node_modules/@humanfs/core/dist/path.d.ts delete mode 100644 node_modules/@humanfs/core/package.json delete mode 100644 node_modules/@humanfs/core/src/errors.js delete mode 100644 node_modules/@humanfs/core/src/hfs.js delete mode 100644 node_modules/@humanfs/core/src/index.js delete mode 100644 node_modules/@humanfs/core/src/path.js delete mode 100644 node_modules/@humanfs/node/LICENSE delete mode 100644 node_modules/@humanfs/node/README.md delete mode 100644 node_modules/@humanfs/node/dist/index.d.ts delete mode 100644 node_modules/@humanfs/node/dist/node-fsx.d.ts delete mode 100644 node_modules/@humanfs/node/dist/node-hfs.d.ts delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/LICENSE delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/README.md delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.cjs delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.cts delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.ts delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.js delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.min.js delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.mjs delete mode 100644 node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/package.json delete mode 100644 node_modules/@humanfs/node/package.json delete mode 100644 node_modules/@humanfs/node/src/index.js delete mode 100644 node_modules/@humanfs/node/src/node-hfs.js delete mode 100644 node_modules/@humanwhocodes/module-importer/CHANGELOG.md delete mode 100644 node_modules/@humanwhocodes/module-importer/LICENSE delete mode 100644 node_modules/@humanwhocodes/module-importer/README.md delete mode 100644 node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs delete mode 100644 node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts delete mode 100644 node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts delete mode 100644 node_modules/@humanwhocodes/module-importer/dist/module-importer.js delete mode 100644 node_modules/@humanwhocodes/module-importer/package.json delete mode 100644 node_modules/@humanwhocodes/module-importer/src/module-importer.cjs delete mode 100644 node_modules/@humanwhocodes/module-importer/src/module-importer.js delete mode 100644 node_modules/@humanwhocodes/retry/LICENSE delete mode 100644 node_modules/@humanwhocodes/retry/README.md delete mode 100644 node_modules/@humanwhocodes/retry/dist/retrier.cjs delete mode 100644 node_modules/@humanwhocodes/retry/dist/retrier.d.cts delete mode 100644 node_modules/@humanwhocodes/retry/dist/retrier.d.ts delete mode 100644 node_modules/@humanwhocodes/retry/dist/retrier.js delete mode 100644 node_modules/@humanwhocodes/retry/dist/retrier.min.js delete mode 100644 node_modules/@humanwhocodes/retry/dist/retrier.mjs delete mode 100644 node_modules/@humanwhocodes/retry/package.json delete mode 100644 node_modules/@pkgr/core/lib/constants.d.ts delete mode 100644 node_modules/@pkgr/core/lib/constants.js delete mode 100644 node_modules/@pkgr/core/lib/constants.js.map delete mode 100644 node_modules/@pkgr/core/lib/helpers.d.ts delete mode 100644 node_modules/@pkgr/core/lib/helpers.js delete mode 100644 node_modules/@pkgr/core/lib/helpers.js.map delete mode 100644 node_modules/@pkgr/core/lib/index.cjs delete mode 100644 node_modules/@pkgr/core/lib/index.d.ts delete mode 100644 node_modules/@pkgr/core/lib/index.js delete mode 100644 node_modules/@pkgr/core/lib/index.js.map delete mode 100644 node_modules/@pkgr/core/package.json delete mode 100644 node_modules/@seald-io/binary-search-tree/CHANGELOG.md delete mode 100644 node_modules/@seald-io/binary-search-tree/LICENSE.md delete mode 100644 node_modules/@seald-io/binary-search-tree/README.md delete mode 100644 node_modules/@seald-io/binary-search-tree/index.js delete mode 100644 node_modules/@seald-io/binary-search-tree/lib/avltree.js delete mode 100644 node_modules/@seald-io/binary-search-tree/lib/bst.js delete mode 100644 node_modules/@seald-io/binary-search-tree/lib/customUtils.js delete mode 100644 node_modules/@seald-io/binary-search-tree/package.json delete mode 100644 node_modules/@seald-io/nedb/LICENSE.md delete mode 100755 node_modules/@seald-io/nedb/README.md delete mode 100644 node_modules/@seald-io/nedb/browser-version/lib/byline.js delete mode 100755 node_modules/@seald-io/nedb/browser-version/lib/customUtils.js delete mode 100755 node_modules/@seald-io/nedb/browser-version/lib/storage.browser.js delete mode 100755 node_modules/@seald-io/nedb/browser-version/lib/storage.react-native.js delete mode 100644 node_modules/@seald-io/nedb/browser-version/out/nedb.js delete mode 100644 node_modules/@seald-io/nedb/browser-version/out/nedb.min.js delete mode 100644 node_modules/@seald-io/nedb/browser-version/out/testutils.js delete mode 100644 node_modules/@seald-io/nedb/browser-version/out/testutils.min.js delete mode 100644 node_modules/@seald-io/nedb/index.d.ts delete mode 100755 node_modules/@seald-io/nedb/index.js delete mode 100644 node_modules/@seald-io/nedb/lib/byline.js delete mode 100755 node_modules/@seald-io/nedb/lib/cursor.js delete mode 100755 node_modules/@seald-io/nedb/lib/customUtils.js delete mode 100755 node_modules/@seald-io/nedb/lib/datastore.js delete mode 100755 node_modules/@seald-io/nedb/lib/executor.js delete mode 100755 node_modules/@seald-io/nedb/lib/indexes.js delete mode 100755 node_modules/@seald-io/nedb/lib/model.js delete mode 100755 node_modules/@seald-io/nedb/lib/persistence.js delete mode 100755 node_modules/@seald-io/nedb/lib/storage.js delete mode 100644 node_modules/@seald-io/nedb/lib/utils.js delete mode 100644 node_modules/@seald-io/nedb/lib/waterfall.js delete mode 100755 node_modules/@seald-io/nedb/package.json delete mode 100644 node_modules/@types/estree/LICENSE delete mode 100644 node_modules/@types/estree/README.md delete mode 100644 node_modules/@types/estree/flow.d.ts delete mode 100644 node_modules/@types/estree/index.d.ts delete mode 100644 node_modules/@types/estree/package.json delete mode 100644 node_modules/@types/json-schema/LICENSE delete mode 100644 node_modules/@types/json-schema/README.md delete mode 100644 node_modules/@types/json-schema/index.d.ts delete mode 100644 node_modules/@types/json-schema/package.json delete mode 100644 node_modules/abstract-level/CHANGELOG.md delete mode 100644 node_modules/abstract-level/LICENSE delete mode 100644 node_modules/abstract-level/README.md delete mode 100644 node_modules/abstract-level/UPGRADING.md delete mode 100644 node_modules/abstract-level/abstract-chained-batch.js delete mode 100644 node_modules/abstract-level/abstract-iterator.js delete mode 100644 node_modules/abstract-level/abstract-level.js delete mode 100644 node_modules/abstract-level/index.d.ts delete mode 100644 node_modules/abstract-level/index.js delete mode 100644 node_modules/abstract-level/lib/abstract-sublevel-iterator.js delete mode 100644 node_modules/abstract-level/lib/abstract-sublevel.js delete mode 100644 node_modules/abstract-level/lib/common.js delete mode 100644 node_modules/abstract-level/lib/default-chained-batch.js delete mode 100644 node_modules/abstract-level/lib/default-kv-iterator.js delete mode 100644 node_modules/abstract-level/lib/deferred-iterator.js delete mode 100644 node_modules/abstract-level/lib/next-tick-browser.js delete mode 100644 node_modules/abstract-level/lib/next-tick.js delete mode 100644 node_modules/abstract-level/lib/range-options.js delete mode 100644 node_modules/abstract-level/package.json delete mode 100644 node_modules/abstract-level/test/async-iterator-test.js delete mode 100644 node_modules/abstract-level/test/batch-test.js delete mode 100644 node_modules/abstract-level/test/chained-batch-test.js delete mode 100644 node_modules/abstract-level/test/clear-range-test.js delete mode 100644 node_modules/abstract-level/test/clear-test.js delete mode 100644 node_modules/abstract-level/test/close-test.js delete mode 100644 node_modules/abstract-level/test/common.js delete mode 100644 node_modules/abstract-level/test/deferred-open-test.js delete mode 100644 node_modules/abstract-level/test/del-test.js delete mode 100644 node_modules/abstract-level/test/encoding-buffer-test.js delete mode 100644 node_modules/abstract-level/test/encoding-custom-test.js delete mode 100644 node_modules/abstract-level/test/encoding-decode-error-test.js delete mode 100644 node_modules/abstract-level/test/encoding-json-test.js delete mode 100644 node_modules/abstract-level/test/encoding-test.js delete mode 100644 node_modules/abstract-level/test/factory-test.js delete mode 100644 node_modules/abstract-level/test/get-many-test.js delete mode 100644 node_modules/abstract-level/test/get-test.js delete mode 100644 node_modules/abstract-level/test/index.js delete mode 100644 node_modules/abstract-level/test/iterator-no-snapshot-test.js delete mode 100644 node_modules/abstract-level/test/iterator-range-test.js delete mode 100644 node_modules/abstract-level/test/iterator-seek-test.js delete mode 100644 node_modules/abstract-level/test/iterator-snapshot-test.js delete mode 100644 node_modules/abstract-level/test/iterator-test.js delete mode 100644 node_modules/abstract-level/test/manifest-test.js delete mode 100644 node_modules/abstract-level/test/open-create-if-missing-test.js delete mode 100644 node_modules/abstract-level/test/open-error-if-exists-test.js delete mode 100644 node_modules/abstract-level/test/open-test.js delete mode 100644 node_modules/abstract-level/test/put-get-del-test.js delete mode 100644 node_modules/abstract-level/test/put-test.js delete mode 100644 node_modules/abstract-level/test/self.js delete mode 100644 node_modules/abstract-level/test/self/abstract-iterator-test.js delete mode 100644 node_modules/abstract-level/test/self/async-iterator-test.js delete mode 100644 node_modules/abstract-level/test/self/attach-resource-test.js delete mode 100644 node_modules/abstract-level/test/self/defer-test.js delete mode 100644 node_modules/abstract-level/test/self/deferred-chained-batch-test.js delete mode 100644 node_modules/abstract-level/test/self/deferred-iterator-test.js delete mode 100644 node_modules/abstract-level/test/self/deferred-operations-test.js delete mode 100644 node_modules/abstract-level/test/self/encoding-test.js delete mode 100644 node_modules/abstract-level/test/self/iterator-test.js delete mode 100644 node_modules/abstract-level/test/self/sublevel-test.js delete mode 100644 node_modules/abstract-level/test/sublevel-test.js delete mode 100644 node_modules/abstract-level/test/util.js delete mode 100644 node_modules/abstract-level/types/abstract-chained-batch.d.ts delete mode 100644 node_modules/abstract-level/types/abstract-iterator.d.ts delete mode 100644 node_modules/abstract-level/types/abstract-level.d.ts delete mode 100644 node_modules/abstract-level/types/abstract-sublevel.d.ts delete mode 100644 node_modules/abstract-level/types/interfaces.d.ts delete mode 100644 node_modules/acorn-jsx/LICENSE delete mode 100644 node_modules/acorn-jsx/README.md delete mode 100644 node_modules/acorn-jsx/index.d.ts delete mode 100644 node_modules/acorn-jsx/index.js delete mode 100644 node_modules/acorn-jsx/package.json delete mode 100644 node_modules/acorn-jsx/xhtml.js delete mode 100644 node_modules/acorn/CHANGELOG.md delete mode 100644 node_modules/acorn/LICENSE delete mode 100644 node_modules/acorn/README.md delete mode 100755 node_modules/acorn/bin/acorn delete mode 100644 node_modules/acorn/dist/acorn.d.mts delete mode 100644 node_modules/acorn/dist/acorn.d.ts delete mode 100644 node_modules/acorn/dist/acorn.js delete mode 100644 node_modules/acorn/dist/acorn.mjs delete mode 100644 node_modules/acorn/dist/bin.js delete mode 100644 node_modules/acorn/package.json delete mode 100644 node_modules/ajv/.tonic_example.js delete mode 100644 node_modules/ajv/LICENSE delete mode 100644 node_modules/ajv/README.md delete mode 100644 node_modules/ajv/dist/ajv.bundle.js delete mode 100644 node_modules/ajv/dist/ajv.min.js delete mode 100644 node_modules/ajv/dist/ajv.min.js.map delete mode 100644 node_modules/ajv/lib/ajv.d.ts delete mode 100644 node_modules/ajv/lib/ajv.js delete mode 100644 node_modules/ajv/lib/cache.js delete mode 100644 node_modules/ajv/lib/compile/async.js delete mode 100644 node_modules/ajv/lib/compile/equal.js delete mode 100644 node_modules/ajv/lib/compile/error_classes.js delete mode 100644 node_modules/ajv/lib/compile/formats.js delete mode 100644 node_modules/ajv/lib/compile/index.js delete mode 100644 node_modules/ajv/lib/compile/resolve.js delete mode 100644 node_modules/ajv/lib/compile/rules.js delete mode 100644 node_modules/ajv/lib/compile/schema_obj.js delete mode 100644 node_modules/ajv/lib/compile/ucs2length.js delete mode 100644 node_modules/ajv/lib/compile/util.js delete mode 100644 node_modules/ajv/lib/data.js delete mode 100644 node_modules/ajv/lib/definition_schema.js delete mode 100644 node_modules/ajv/lib/dot/_limit.jst delete mode 100644 node_modules/ajv/lib/dot/_limitItems.jst delete mode 100644 node_modules/ajv/lib/dot/_limitLength.jst delete mode 100644 node_modules/ajv/lib/dot/_limitProperties.jst delete mode 100644 node_modules/ajv/lib/dot/allOf.jst delete mode 100644 node_modules/ajv/lib/dot/anyOf.jst delete mode 100644 node_modules/ajv/lib/dot/coerce.def delete mode 100644 node_modules/ajv/lib/dot/comment.jst delete mode 100644 node_modules/ajv/lib/dot/const.jst delete mode 100644 node_modules/ajv/lib/dot/contains.jst delete mode 100644 node_modules/ajv/lib/dot/custom.jst delete mode 100644 node_modules/ajv/lib/dot/defaults.def delete mode 100644 node_modules/ajv/lib/dot/definitions.def delete mode 100644 node_modules/ajv/lib/dot/dependencies.jst delete mode 100644 node_modules/ajv/lib/dot/enum.jst delete mode 100644 node_modules/ajv/lib/dot/errors.def delete mode 100644 node_modules/ajv/lib/dot/format.jst delete mode 100644 node_modules/ajv/lib/dot/if.jst delete mode 100644 node_modules/ajv/lib/dot/items.jst delete mode 100644 node_modules/ajv/lib/dot/missing.def delete mode 100644 node_modules/ajv/lib/dot/multipleOf.jst delete mode 100644 node_modules/ajv/lib/dot/not.jst delete mode 100644 node_modules/ajv/lib/dot/oneOf.jst delete mode 100644 node_modules/ajv/lib/dot/pattern.jst delete mode 100644 node_modules/ajv/lib/dot/properties.jst delete mode 100644 node_modules/ajv/lib/dot/propertyNames.jst delete mode 100644 node_modules/ajv/lib/dot/ref.jst delete mode 100644 node_modules/ajv/lib/dot/required.jst delete mode 100644 node_modules/ajv/lib/dot/uniqueItems.jst delete mode 100644 node_modules/ajv/lib/dot/validate.jst delete mode 100644 node_modules/ajv/lib/dotjs/README.md delete mode 100644 node_modules/ajv/lib/dotjs/_limit.js delete mode 100644 node_modules/ajv/lib/dotjs/_limitItems.js delete mode 100644 node_modules/ajv/lib/dotjs/_limitLength.js delete mode 100644 node_modules/ajv/lib/dotjs/_limitProperties.js delete mode 100644 node_modules/ajv/lib/dotjs/allOf.js delete mode 100644 node_modules/ajv/lib/dotjs/anyOf.js delete mode 100644 node_modules/ajv/lib/dotjs/comment.js delete mode 100644 node_modules/ajv/lib/dotjs/const.js delete mode 100644 node_modules/ajv/lib/dotjs/contains.js delete mode 100644 node_modules/ajv/lib/dotjs/custom.js delete mode 100644 node_modules/ajv/lib/dotjs/dependencies.js delete mode 100644 node_modules/ajv/lib/dotjs/enum.js delete mode 100644 node_modules/ajv/lib/dotjs/format.js delete mode 100644 node_modules/ajv/lib/dotjs/if.js delete mode 100644 node_modules/ajv/lib/dotjs/index.js delete mode 100644 node_modules/ajv/lib/dotjs/items.js delete mode 100644 node_modules/ajv/lib/dotjs/multipleOf.js delete mode 100644 node_modules/ajv/lib/dotjs/not.js delete mode 100644 node_modules/ajv/lib/dotjs/oneOf.js delete mode 100644 node_modules/ajv/lib/dotjs/pattern.js delete mode 100644 node_modules/ajv/lib/dotjs/properties.js delete mode 100644 node_modules/ajv/lib/dotjs/propertyNames.js delete mode 100644 node_modules/ajv/lib/dotjs/ref.js delete mode 100644 node_modules/ajv/lib/dotjs/required.js delete mode 100644 node_modules/ajv/lib/dotjs/uniqueItems.js delete mode 100644 node_modules/ajv/lib/dotjs/validate.js delete mode 100644 node_modules/ajv/lib/keyword.js delete mode 100644 node_modules/ajv/lib/refs/data.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-draft-04.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-draft-06.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-draft-07.json delete mode 100644 node_modules/ajv/lib/refs/json-schema-secure.json delete mode 100644 node_modules/ajv/package.json delete mode 100644 node_modules/ajv/scripts/.eslintrc.yml delete mode 100644 node_modules/ajv/scripts/bundle.js delete mode 100644 node_modules/ajv/scripts/compile-dots.js delete mode 100644 node_modules/ajv/scripts/info delete mode 100644 node_modules/ajv/scripts/prepare-tests delete mode 100644 node_modules/ajv/scripts/publish-built-version delete mode 100644 node_modules/ajv/scripts/travis-gh-pages delete mode 100644 node_modules/ansi-colors/LICENSE delete mode 100644 node_modules/ansi-colors/README.md delete mode 100644 node_modules/ansi-colors/index.js delete mode 100644 node_modules/ansi-colors/package.json delete mode 100644 node_modules/ansi-colors/types/index.d.ts delete mode 100644 node_modules/ansi-regex/index.d.ts delete mode 100644 node_modules/ansi-regex/index.js delete mode 100644 node_modules/ansi-regex/license delete mode 100644 node_modules/ansi-regex/package.json delete mode 100644 node_modules/ansi-regex/readme.md delete mode 100644 node_modules/ansi-styles/index.d.ts delete mode 100644 node_modules/ansi-styles/index.js delete mode 100644 node_modules/ansi-styles/license delete mode 100644 node_modules/ansi-styles/package.json delete mode 100644 node_modules/ansi-styles/readme.md delete mode 100644 node_modules/ansi-wrap/LICENSE delete mode 100644 node_modules/ansi-wrap/README.md delete mode 100644 node_modules/ansi-wrap/index.js delete mode 100644 node_modules/ansi-wrap/package.json delete mode 100644 node_modules/anymatch/LICENSE delete mode 100644 node_modules/anymatch/README.md delete mode 100644 node_modules/anymatch/index.d.ts delete mode 100644 node_modules/anymatch/index.js delete mode 100644 node_modules/anymatch/package.json delete mode 100644 node_modules/are-docs-informative/LICENSE.md delete mode 100644 node_modules/are-docs-informative/README.md delete mode 100644 node_modules/are-docs-informative/lib/index.cjs delete mode 100644 node_modules/are-docs-informative/lib/index.d.cts delete mode 100644 node_modules/are-docs-informative/lib/index.d.ts delete mode 100644 node_modules/are-docs-informative/lib/index.js delete mode 100644 node_modules/are-docs-informative/package.json delete mode 100644 node_modules/argparse/CHANGELOG.md delete mode 100644 node_modules/argparse/LICENSE delete mode 100644 node_modules/argparse/README.md delete mode 100644 node_modules/argparse/argparse.js delete mode 100644 node_modules/argparse/lib/sub.js delete mode 100644 node_modules/argparse/lib/textwrap.js delete mode 100644 node_modules/argparse/package.json delete mode 100755 node_modules/arr-diff/LICENSE delete mode 100644 node_modules/arr-diff/README.md delete mode 100644 node_modules/arr-diff/index.js delete mode 100644 node_modules/arr-diff/package.json delete mode 100644 node_modules/arr-union/LICENSE delete mode 100644 node_modules/arr-union/README.md delete mode 100644 node_modules/arr-union/index.js delete mode 100644 node_modules/arr-union/package.json delete mode 100644 node_modules/array-each/LICENSE delete mode 100644 node_modules/array-each/README.md delete mode 100644 node_modules/array-each/index.js delete mode 100644 node_modules/array-each/package.json delete mode 100755 node_modules/array-slice/LICENSE delete mode 100755 node_modules/array-slice/README.md delete mode 100644 node_modules/array-slice/index.js delete mode 100644 node_modules/array-slice/package.json delete mode 100644 node_modules/assign-symbols/LICENSE delete mode 100644 node_modules/assign-symbols/README.md delete mode 100644 node_modules/assign-symbols/index.js delete mode 100644 node_modules/assign-symbols/package.json delete mode 100644 node_modules/async-done/LICENSE delete mode 100644 node_modules/async-done/README.md delete mode 100644 node_modules/async-done/index.d.ts delete mode 100644 node_modules/async-done/index.js delete mode 100644 node_modules/async-done/package.json delete mode 100644 node_modules/async-settle/LICENSE delete mode 100644 node_modules/async-settle/README.md delete mode 100644 node_modules/async-settle/index.js delete mode 100644 node_modules/async-settle/package.json delete mode 100644 node_modules/available-typed-arrays/.eslintrc delete mode 100644 node_modules/available-typed-arrays/.github/FUNDING.yml delete mode 100644 node_modules/available-typed-arrays/.nycrc delete mode 100644 node_modules/available-typed-arrays/CHANGELOG.md delete mode 100644 node_modules/available-typed-arrays/LICENSE delete mode 100644 node_modules/available-typed-arrays/README.md delete mode 100644 node_modules/available-typed-arrays/index.d.ts delete mode 100644 node_modules/available-typed-arrays/index.js delete mode 100644 node_modules/available-typed-arrays/package.json delete mode 100644 node_modules/available-typed-arrays/test/index.js delete mode 100644 node_modules/available-typed-arrays/tsconfig.json delete mode 100644 node_modules/bach/LICENSE delete mode 100644 node_modules/bach/README.md delete mode 100644 node_modules/bach/index.js delete mode 100644 node_modules/bach/lib/helpers.js delete mode 100644 node_modules/bach/lib/parallel.js delete mode 100644 node_modules/bach/lib/series.js delete mode 100644 node_modules/bach/lib/settleParallel.js delete mode 100644 node_modules/bach/lib/settleSeries.js delete mode 100644 node_modules/bach/package.json delete mode 100644 node_modules/balanced-match/.github/FUNDING.yml delete mode 100644 node_modules/balanced-match/LICENSE.md delete mode 100644 node_modules/balanced-match/README.md delete mode 100644 node_modules/balanced-match/index.js delete mode 100644 node_modules/balanced-match/package.json delete mode 100644 node_modules/bare-events/LICENSE delete mode 100644 node_modules/bare-events/README.md delete mode 100644 node_modules/bare-events/index.js delete mode 100644 node_modules/bare-events/lib/errors.js delete mode 100644 node_modules/bare-events/package.json delete mode 100644 node_modules/base64-js/LICENSE delete mode 100644 node_modules/base64-js/README.md delete mode 100644 node_modules/base64-js/base64js.min.js delete mode 100644 node_modules/base64-js/index.d.ts delete mode 100644 node_modules/base64-js/index.js delete mode 100644 node_modules/base64-js/package.json delete mode 100644 node_modules/binary-extensions/binary-extensions.json delete mode 100644 node_modules/binary-extensions/binary-extensions.json.d.ts delete mode 100644 node_modules/binary-extensions/index.d.ts delete mode 100644 node_modules/binary-extensions/index.js delete mode 100644 node_modules/binary-extensions/license delete mode 100644 node_modules/binary-extensions/package.json delete mode 100644 node_modules/binary-extensions/readme.md delete mode 100644 node_modules/bl/.github/dependabot.yml delete mode 100644 node_modules/bl/.github/workflows/test-and-release.yml delete mode 100644 node_modules/bl/BufferList.d.ts delete mode 100644 node_modules/bl/BufferList.js delete mode 100644 node_modules/bl/CHANGELOG.md delete mode 100644 node_modules/bl/LICENSE.md delete mode 100644 node_modules/bl/README.md delete mode 100644 node_modules/bl/bl.js delete mode 100644 node_modules/bl/index.d.ts delete mode 100644 node_modules/bl/package.json delete mode 100644 node_modules/bl/test/convert.js delete mode 100644 node_modules/bl/test/indexOf.js delete mode 100644 node_modules/bl/test/isBufferList.js delete mode 100644 node_modules/bl/test/test.js delete mode 100644 node_modules/brace-expansion/LICENSE delete mode 100644 node_modules/brace-expansion/README.md delete mode 100644 node_modules/brace-expansion/index.js delete mode 100644 node_modules/brace-expansion/package.json delete mode 100644 node_modules/braces/LICENSE delete mode 100644 node_modules/braces/README.md delete mode 100644 node_modules/braces/index.js delete mode 100644 node_modules/braces/lib/compile.js delete mode 100644 node_modules/braces/lib/constants.js delete mode 100644 node_modules/braces/lib/expand.js delete mode 100644 node_modules/braces/lib/parse.js delete mode 100644 node_modules/braces/lib/stringify.js delete mode 100644 node_modules/braces/lib/utils.js delete mode 100644 node_modules/braces/package.json delete mode 100644 node_modules/buffer/AUTHORS.md delete mode 100644 node_modules/buffer/LICENSE delete mode 100644 node_modules/buffer/README.md delete mode 100644 node_modules/buffer/index.d.ts delete mode 100644 node_modules/buffer/index.js delete mode 100644 node_modules/buffer/package.json delete mode 100644 node_modules/call-bind/.eslintignore delete mode 100644 node_modules/call-bind/.eslintrc delete mode 100644 node_modules/call-bind/.github/FUNDING.yml delete mode 100644 node_modules/call-bind/.nycrc delete mode 100644 node_modules/call-bind/CHANGELOG.md delete mode 100644 node_modules/call-bind/LICENSE delete mode 100644 node_modules/call-bind/README.md delete mode 100644 node_modules/call-bind/callBound.js delete mode 100644 node_modules/call-bind/index.js delete mode 100644 node_modules/call-bind/package.json delete mode 100644 node_modules/call-bind/test/callBound.js delete mode 100644 node_modules/call-bind/test/index.js delete mode 100644 node_modules/callsites/index.d.ts delete mode 100644 node_modules/callsites/index.js delete mode 100644 node_modules/callsites/license delete mode 100644 node_modules/callsites/package.json delete mode 100644 node_modules/callsites/readme.md delete mode 100644 node_modules/catering/LICENSE delete mode 100644 node_modules/catering/index.d.ts delete mode 100644 node_modules/catering/index.js delete mode 100644 node_modules/catering/next-tick-browser.js delete mode 100644 node_modules/catering/next-tick.js delete mode 100644 node_modules/catering/package.json delete mode 100644 node_modules/catering/readme.md delete mode 100644 node_modules/chalk/license delete mode 100644 node_modules/chalk/package.json delete mode 100644 node_modules/chalk/readme.md delete mode 100644 node_modules/chalk/source/index.d.ts delete mode 100644 node_modules/chalk/source/index.js delete mode 100644 node_modules/chalk/source/utilities.js delete mode 100644 node_modules/chalk/source/vendor/ansi-styles/index.d.ts delete mode 100644 node_modules/chalk/source/vendor/ansi-styles/index.js delete mode 100644 node_modules/chalk/source/vendor/supports-color/browser.d.ts delete mode 100644 node_modules/chalk/source/vendor/supports-color/browser.js delete mode 100644 node_modules/chalk/source/vendor/supports-color/index.d.ts delete mode 100644 node_modules/chalk/source/vendor/supports-color/index.js delete mode 100644 node_modules/chokidar/LICENSE delete mode 100644 node_modules/chokidar/README.md delete mode 100644 node_modules/chokidar/index.js delete mode 100644 node_modules/chokidar/lib/constants.js delete mode 100644 node_modules/chokidar/lib/fsevents-handler.js delete mode 100644 node_modules/chokidar/lib/nodefs-handler.js delete mode 100644 node_modules/chokidar/node_modules/glob-parent/CHANGELOG.md delete mode 100644 node_modules/chokidar/node_modules/glob-parent/LICENSE delete mode 100644 node_modules/chokidar/node_modules/glob-parent/README.md delete mode 100644 node_modules/chokidar/node_modules/glob-parent/index.js delete mode 100644 node_modules/chokidar/node_modules/glob-parent/package.json delete mode 100644 node_modules/chokidar/package.json delete mode 100644 node_modules/chokidar/types/index.d.ts delete mode 100644 node_modules/classic-level/CHANGELOG.md delete mode 100644 node_modules/classic-level/LICENSE delete mode 100644 node_modules/classic-level/README.md delete mode 100644 node_modules/classic-level/UPGRADING.md delete mode 100644 node_modules/classic-level/binding.cc delete mode 100644 node_modules/classic-level/binding.gyp delete mode 100644 node_modules/classic-level/binding.js delete mode 100644 node_modules/classic-level/chained-batch.js delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/LICENSE delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/Makefile delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/README.md delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/build_detect_platform delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/autocompact_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/builder.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/c_test.c delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/corruption_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_bench.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_impl.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_iter.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/db_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dbformat_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/dumpfile.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/fault_injection_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/filename_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/leveldbutil.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_format.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_reader.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/log_writer.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/memtable.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/recovery_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/repair.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/skiplist_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/snapshot.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/table_cache.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_edit_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/version_set_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_internal.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/db/write_batch_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/helpers/memenv/memenv_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/c.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/cache.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/comparator.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/db.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/dumpfile.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/env.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/filter_policy.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/iterator.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/options.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/slice.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/status.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/table_builder.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/include/leveldb/write_batch.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue178_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/issues/issue200_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/README delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/atomic_pointer.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_example.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/port_posix_sse.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/thread_annotations.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/port/win/stdint.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/block_builder.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/filter_block_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/format.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/iterator_wrapper.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/merger.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_builder.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/table_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/table/two_level_iterator.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/arena_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/bloom_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/cache_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/coding_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/comparator.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/crc32c_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_posix_test_helper.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/env_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/filter_policy.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/hash_test.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/histogram.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/logging.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/mutexlock.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/options.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/posix_logger.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/random.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/status.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testharness.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.cc delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb-1.20/util/testutil.h delete mode 100644 node_modules/classic-level/deps/leveldb/leveldb.gyp delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/atomic_pointer_win.h delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/env_win.cc delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/port_uv.cc delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/port_uv.h.bak delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/stdint-msvc2008.h delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar.h delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/uv_condvar_posix.cc delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/win_logger.cc delete mode 100644 node_modules/classic-level/deps/leveldb/port-libuv/win_logger.h delete mode 100644 node_modules/classic-level/deps/snappy/freebsd/config.h delete mode 100644 node_modules/classic-level/deps/snappy/freebsd/snappy-stubs-public.h delete mode 100644 node_modules/classic-level/deps/snappy/linux/config.h delete mode 100644 node_modules/classic-level/deps/snappy/linux/snappy-stubs-public.h delete mode 100644 node_modules/classic-level/deps/snappy/mac/config.h delete mode 100644 node_modules/classic-level/deps/snappy/mac/snappy-stubs-public.h delete mode 100644 node_modules/classic-level/deps/snappy/openbsd/config.h delete mode 100644 node_modules/classic-level/deps/snappy/openbsd/snappy-stubs-public.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy.gyp delete mode 100644 node_modules/classic-level/deps/snappy/snappy/COPYING delete mode 100644 node_modules/classic-level/deps/snappy/snappy/README.md delete mode 100644 node_modules/classic-level/deps/snappy/snappy/cmake/SnappyConfig.cmake delete mode 100644 node_modules/classic-level/deps/snappy/snappy/cmake/config.h.in delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-c.cc delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-c.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-internal.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.cc delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-sinksource.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.cc delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-stubs-internal.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-stubs-public.h.in delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-test.cc delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy-test.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy.cc delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy.h delete mode 100644 node_modules/classic-level/deps/snappy/snappy/snappy_unittest.cc delete mode 100644 node_modules/classic-level/deps/snappy/solaris/config.h delete mode 100644 node_modules/classic-level/deps/snappy/solaris/snappy-stubs-public.h delete mode 100644 node_modules/classic-level/deps/snappy/win32/config.h delete mode 100644 node_modules/classic-level/deps/snappy/win32/snappy-stubs-public.h delete mode 100644 node_modules/classic-level/index.d.ts delete mode 100644 node_modules/classic-level/index.js delete mode 100644 node_modules/classic-level/iterator.js delete mode 100644 node_modules/classic-level/package.json delete mode 100644 node_modules/classic-level/prebuilds/android-arm/node.napi.armv7.node delete mode 100644 node_modules/classic-level/prebuilds/android-arm64/node.napi.armv8.node delete mode 100644 node_modules/classic-level/prebuilds/darwin-x64+arm64/node.napi.node delete mode 100644 node_modules/classic-level/prebuilds/linux-arm/node.napi.armv6.node delete mode 100644 node_modules/classic-level/prebuilds/linux-arm/node.napi.armv7.node delete mode 100644 node_modules/classic-level/prebuilds/linux-arm64/node.napi.armv8.node delete mode 100644 node_modules/classic-level/prebuilds/linux-x64/node.napi.glibc.node delete mode 100644 node_modules/classic-level/prebuilds/linux-x64/node.napi.musl.node delete mode 100644 node_modules/classic-level/prebuilds/win32-ia32/node.napi.node delete mode 100644 node_modules/classic-level/prebuilds/win32-x64/node.napi.node delete mode 100644 node_modules/cliui/CHANGELOG.md delete mode 100644 node_modules/cliui/LICENSE.txt delete mode 100644 node_modules/cliui/README.md delete mode 100644 node_modules/cliui/build/index.cjs delete mode 100644 node_modules/cliui/build/index.d.cts delete mode 100644 node_modules/cliui/build/lib/index.js delete mode 100644 node_modules/cliui/build/lib/string-utils.js delete mode 100644 node_modules/cliui/index.mjs delete mode 100644 node_modules/cliui/package.json delete mode 100644 node_modules/clone-stats/LICENSE.md delete mode 100644 node_modules/clone-stats/README.md delete mode 100644 node_modules/clone-stats/index.js delete mode 100644 node_modules/clone-stats/package.json delete mode 100644 node_modules/clone-stats/test.js delete mode 100644 node_modules/clone/.npmignore delete mode 100644 node_modules/clone/LICENSE delete mode 100644 node_modules/clone/README.md delete mode 100644 node_modules/clone/clone.iml delete mode 100644 node_modules/clone/clone.js delete mode 100644 node_modules/clone/package.json delete mode 100644 node_modules/color-convert/CHANGELOG.md delete mode 100644 node_modules/color-convert/LICENSE delete mode 100644 node_modules/color-convert/README.md delete mode 100644 node_modules/color-convert/conversions.js delete mode 100644 node_modules/color-convert/index.js delete mode 100644 node_modules/color-convert/package.json delete mode 100644 node_modules/color-convert/route.js delete mode 100644 node_modules/color-name/LICENSE delete mode 100644 node_modules/color-name/README.md delete mode 100644 node_modules/color-name/index.js delete mode 100644 node_modules/color-name/package.json delete mode 100644 node_modules/commander/LICENSE delete mode 100644 node_modules/commander/Readme.md delete mode 100644 node_modules/commander/esm.mjs delete mode 100644 node_modules/commander/index.js delete mode 100644 node_modules/commander/lib/argument.js delete mode 100644 node_modules/commander/lib/command.js delete mode 100644 node_modules/commander/lib/error.js delete mode 100644 node_modules/commander/lib/help.js delete mode 100644 node_modules/commander/lib/option.js delete mode 100644 node_modules/commander/lib/suggestSimilar.js delete mode 100644 node_modules/commander/package-support.json delete mode 100644 node_modules/commander/package.json delete mode 100644 node_modules/commander/typings/esm.d.mts delete mode 100644 node_modules/commander/typings/index.d.ts delete mode 100644 node_modules/comment-parser/CHANGELOG.md delete mode 100644 node_modules/comment-parser/LICENSE delete mode 100644 node_modules/comment-parser/README.md delete mode 100644 node_modules/comment-parser/browser/index.js delete mode 100644 node_modules/comment-parser/es6/index.d.ts delete mode 100644 node_modules/comment-parser/es6/index.js delete mode 100644 node_modules/comment-parser/es6/parser/block-parser.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/block-parser.js delete mode 100644 node_modules/comment-parser/es6/parser/index.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/index.js delete mode 100644 node_modules/comment-parser/es6/parser/source-parser.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/source-parser.js delete mode 100644 node_modules/comment-parser/es6/parser/spec-parser.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/spec-parser.js delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/description.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/description.js delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/index.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/index.js delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/name.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/name.js delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/tag.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/tag.js delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/type.d.ts delete mode 100644 node_modules/comment-parser/es6/parser/tokenizers/type.js delete mode 100644 node_modules/comment-parser/es6/primitives.d.ts delete mode 100644 node_modules/comment-parser/es6/primitives.js delete mode 100644 node_modules/comment-parser/es6/stringifier/index.d.ts delete mode 100644 node_modules/comment-parser/es6/stringifier/index.js delete mode 100644 node_modules/comment-parser/es6/stringifier/inspect.d.ts delete mode 100644 node_modules/comment-parser/es6/stringifier/inspect.js delete mode 100644 node_modules/comment-parser/es6/transforms/align.d.ts delete mode 100644 node_modules/comment-parser/es6/transforms/align.js delete mode 100644 node_modules/comment-parser/es6/transforms/crlf.d.ts delete mode 100644 node_modules/comment-parser/es6/transforms/crlf.js delete mode 100644 node_modules/comment-parser/es6/transforms/indent.d.ts delete mode 100644 node_modules/comment-parser/es6/transforms/indent.js delete mode 100644 node_modules/comment-parser/es6/transforms/index.d.ts delete mode 100644 node_modules/comment-parser/es6/transforms/index.js delete mode 100644 node_modules/comment-parser/es6/util.d.ts delete mode 100644 node_modules/comment-parser/es6/util.js delete mode 100644 node_modules/comment-parser/jest.config.cjs delete mode 100644 node_modules/comment-parser/lib/index.cjs delete mode 100644 node_modules/comment-parser/lib/index.cjs.map delete mode 100644 node_modules/comment-parser/lib/index.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/block-parser.cjs delete mode 100644 node_modules/comment-parser/lib/parser/block-parser.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/block-parser.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/index.cjs delete mode 100644 node_modules/comment-parser/lib/parser/index.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/index.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/source-parser.cjs delete mode 100644 node_modules/comment-parser/lib/parser/source-parser.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/source-parser.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/spec-parser.cjs delete mode 100644 node_modules/comment-parser/lib/parser/spec-parser.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/spec-parser.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/description.cjs delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/description.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/description.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/index.cjs delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/index.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/index.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/name.cjs delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/name.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/name.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/tag.cjs delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/tag.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/tag.d.ts delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/type.cjs delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/type.cjs.map delete mode 100644 node_modules/comment-parser/lib/parser/tokenizers/type.d.ts delete mode 100644 node_modules/comment-parser/lib/primitives.cjs delete mode 100644 node_modules/comment-parser/lib/primitives.cjs.map delete mode 100644 node_modules/comment-parser/lib/primitives.d.ts delete mode 100644 node_modules/comment-parser/lib/stringifier/index.cjs delete mode 100644 node_modules/comment-parser/lib/stringifier/index.cjs.map delete mode 100644 node_modules/comment-parser/lib/stringifier/index.d.ts delete mode 100644 node_modules/comment-parser/lib/stringifier/inspect.cjs delete mode 100644 node_modules/comment-parser/lib/stringifier/inspect.cjs.map delete mode 100644 node_modules/comment-parser/lib/stringifier/inspect.d.ts delete mode 100644 node_modules/comment-parser/lib/transforms/align.cjs delete mode 100644 node_modules/comment-parser/lib/transforms/align.cjs.map delete mode 100644 node_modules/comment-parser/lib/transforms/align.d.ts delete mode 100644 node_modules/comment-parser/lib/transforms/crlf.cjs delete mode 100644 node_modules/comment-parser/lib/transforms/crlf.cjs.map delete mode 100644 node_modules/comment-parser/lib/transforms/crlf.d.ts delete mode 100644 node_modules/comment-parser/lib/transforms/indent.cjs delete mode 100644 node_modules/comment-parser/lib/transforms/indent.cjs.map delete mode 100644 node_modules/comment-parser/lib/transforms/indent.d.ts delete mode 100644 node_modules/comment-parser/lib/transforms/index.cjs delete mode 100644 node_modules/comment-parser/lib/transforms/index.cjs.map delete mode 100644 node_modules/comment-parser/lib/transforms/index.d.ts delete mode 100644 node_modules/comment-parser/lib/util.cjs delete mode 100644 node_modules/comment-parser/lib/util.cjs.map delete mode 100644 node_modules/comment-parser/lib/util.d.ts delete mode 100644 node_modules/comment-parser/migrate-1.0.md delete mode 100644 node_modules/comment-parser/package.json delete mode 100644 node_modules/comment-parser/src/index.ts delete mode 100644 node_modules/comment-parser/src/parser/block-parser.ts delete mode 100644 node_modules/comment-parser/src/parser/index.ts delete mode 100644 node_modules/comment-parser/src/parser/source-parser.ts delete mode 100644 node_modules/comment-parser/src/parser/spec-parser.ts delete mode 100644 node_modules/comment-parser/src/parser/tokenizers/description.ts delete mode 100644 node_modules/comment-parser/src/parser/tokenizers/index.ts delete mode 100644 node_modules/comment-parser/src/parser/tokenizers/name.ts delete mode 100644 node_modules/comment-parser/src/parser/tokenizers/tag.ts delete mode 100644 node_modules/comment-parser/src/parser/tokenizers/type.ts delete mode 100644 node_modules/comment-parser/src/primitives.ts delete mode 100644 node_modules/comment-parser/src/stringifier/index.ts delete mode 100644 node_modules/comment-parser/src/stringifier/inspect.ts delete mode 100644 node_modules/comment-parser/src/transforms/align.ts delete mode 100644 node_modules/comment-parser/src/transforms/crlf.ts delete mode 100644 node_modules/comment-parser/src/transforms/indent.ts delete mode 100644 node_modules/comment-parser/src/transforms/index.ts delete mode 100644 node_modules/comment-parser/src/util.ts delete mode 100644 node_modules/comment-parser/tests/e2e/examples.js delete mode 100644 node_modules/comment-parser/tests/e2e/examples.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-109.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-112.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-113.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-119.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-120.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-121.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-129.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-41.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/issue-61.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/parse.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/stringify.spec.js delete mode 100644 node_modules/comment-parser/tests/e2e/transforms.spec.js delete mode 100644 node_modules/comment-parser/tests/unit/block-parser.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/inspect.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/parser.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/source-parser.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/spacer-description-joiner.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/spec-description-tokenizer.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/spec-name-tokenizer.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/spec-parser.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/spec-tag-tokenizer.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/spec-type-tokenizer.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/stringifier.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/transforms-align.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/transforms-crlf.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/transforms-indent.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/transforms.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/util-rewire.spec.ts delete mode 100644 node_modules/comment-parser/tests/unit/util.spec.ts delete mode 100644 node_modules/comment-parser/tsconfig.json delete mode 100644 node_modules/comment-parser/tsconfig.node.json delete mode 100644 node_modules/concat-map/.travis.yml delete mode 100644 node_modules/concat-map/LICENSE delete mode 100644 node_modules/concat-map/README.markdown delete mode 100644 node_modules/concat-map/example/map.js delete mode 100644 node_modules/concat-map/index.js delete mode 100644 node_modules/concat-map/package.json delete mode 100644 node_modules/concat-map/test/map.js delete mode 100644 node_modules/convert-source-map/LICENSE delete mode 100644 node_modules/convert-source-map/README.md delete mode 100644 node_modules/convert-source-map/index.js delete mode 100644 node_modules/convert-source-map/package.json delete mode 100644 node_modules/copy-anything/LICENSE delete mode 100644 node_modules/copy-anything/README.md delete mode 100644 node_modules/copy-anything/dist/index.cjs delete mode 100644 node_modules/copy-anything/dist/index.es.js delete mode 100644 node_modules/copy-anything/dist/types/index.d.ts delete mode 100644 node_modules/copy-anything/package.json delete mode 100644 node_modules/copy-props/LICENSE delete mode 100644 node_modules/copy-props/README.md delete mode 100644 node_modules/copy-props/index.js delete mode 100644 node_modules/copy-props/package.json delete mode 100644 node_modules/cross-spawn/LICENSE delete mode 100644 node_modules/cross-spawn/README.md delete mode 100644 node_modules/cross-spawn/index.js delete mode 100644 node_modules/cross-spawn/lib/enoent.js delete mode 100644 node_modules/cross-spawn/lib/parse.js delete mode 100644 node_modules/cross-spawn/lib/util/escape.js delete mode 100644 node_modules/cross-spawn/lib/util/readShebang.js delete mode 100644 node_modules/cross-spawn/lib/util/resolveCommand.js delete mode 100644 node_modules/cross-spawn/package.json delete mode 100644 node_modules/debug/LICENSE delete mode 100644 node_modules/debug/README.md delete mode 100644 node_modules/debug/package.json delete mode 100644 node_modules/debug/src/browser.js delete mode 100644 node_modules/debug/src/common.js delete mode 100644 node_modules/debug/src/index.js delete mode 100644 node_modules/debug/src/node.js delete mode 100644 node_modules/deep-is/.travis.yml delete mode 100644 node_modules/deep-is/LICENSE delete mode 100644 node_modules/deep-is/README.markdown delete mode 100644 node_modules/deep-is/example/cmp.js delete mode 100644 node_modules/deep-is/index.js delete mode 100644 node_modules/deep-is/package.json delete mode 100644 node_modules/deep-is/test/NaN.js delete mode 100644 node_modules/deep-is/test/cmp.js delete mode 100644 node_modules/deep-is/test/neg-vs-pos-0.js delete mode 100644 node_modules/define-data-property/.eslintrc delete mode 100644 node_modules/define-data-property/.github/FUNDING.yml delete mode 100644 node_modules/define-data-property/.nycrc delete mode 100644 node_modules/define-data-property/CHANGELOG.md delete mode 100644 node_modules/define-data-property/LICENSE delete mode 100644 node_modules/define-data-property/README.md delete mode 100644 node_modules/define-data-property/index.d.ts delete mode 100644 node_modules/define-data-property/index.js delete mode 100644 node_modules/define-data-property/package.json delete mode 100644 node_modules/define-data-property/test/index.js delete mode 100644 node_modules/define-data-property/tsconfig.json delete mode 100644 node_modules/detect-file/LICENSE delete mode 100644 node_modules/detect-file/README.md delete mode 100644 node_modules/detect-file/index.js delete mode 100644 node_modules/detect-file/package.json delete mode 100644 node_modules/each-props/LICENSE delete mode 100644 node_modules/each-props/README.md delete mode 100644 node_modules/each-props/index.js delete mode 100644 node_modules/each-props/package.json delete mode 100644 node_modules/emoji-regex/LICENSE-MIT.txt delete mode 100644 node_modules/emoji-regex/README.md delete mode 100644 node_modules/emoji-regex/es2015/index.js delete mode 100644 node_modules/emoji-regex/es2015/text.js delete mode 100644 node_modules/emoji-regex/index.d.ts delete mode 100644 node_modules/emoji-regex/index.js delete mode 100644 node_modules/emoji-regex/package.json delete mode 100644 node_modules/emoji-regex/text.js delete mode 100644 node_modules/end-of-stream/LICENSE delete mode 100644 node_modules/end-of-stream/README.md delete mode 100644 node_modules/end-of-stream/index.js delete mode 100644 node_modules/end-of-stream/package.json delete mode 100644 node_modules/errno/.jshintrc delete mode 100644 node_modules/errno/.travis.yml delete mode 100644 node_modules/errno/README.md delete mode 100755 node_modules/errno/build.js delete mode 100755 node_modules/errno/cli.js delete mode 100644 node_modules/errno/custom.js delete mode 100644 node_modules/errno/errno.js delete mode 100644 node_modules/errno/package.json delete mode 100644 node_modules/errno/test.js delete mode 100644 node_modules/es-define-property/.eslintrc delete mode 100644 node_modules/es-define-property/.github/FUNDING.yml delete mode 100644 node_modules/es-define-property/.nycrc delete mode 100644 node_modules/es-define-property/CHANGELOG.md delete mode 100644 node_modules/es-define-property/LICENSE delete mode 100644 node_modules/es-define-property/README.md delete mode 100644 node_modules/es-define-property/index.d.ts delete mode 100644 node_modules/es-define-property/index.js delete mode 100644 node_modules/es-define-property/package.json delete mode 100644 node_modules/es-define-property/test/index.js delete mode 100644 node_modules/es-define-property/tsconfig.json delete mode 100644 node_modules/es-errors/.eslintrc delete mode 100644 node_modules/es-errors/.github/FUNDING.yml delete mode 100644 node_modules/es-errors/CHANGELOG.md delete mode 100644 node_modules/es-errors/LICENSE delete mode 100644 node_modules/es-errors/README.md delete mode 100644 node_modules/es-errors/eval.d.ts delete mode 100644 node_modules/es-errors/eval.js delete mode 100644 node_modules/es-errors/index.d.ts delete mode 100644 node_modules/es-errors/index.js delete mode 100644 node_modules/es-errors/package.json delete mode 100644 node_modules/es-errors/range.d.ts delete mode 100644 node_modules/es-errors/range.js delete mode 100644 node_modules/es-errors/ref.d.ts delete mode 100644 node_modules/es-errors/ref.js delete mode 100644 node_modules/es-errors/syntax.d.ts delete mode 100644 node_modules/es-errors/syntax.js delete mode 100644 node_modules/es-errors/test/index.js delete mode 100644 node_modules/es-errors/tsconfig.json delete mode 100644 node_modules/es-errors/type.d.ts delete mode 100644 node_modules/es-errors/type.js delete mode 100644 node_modules/es-errors/uri.d.ts delete mode 100644 node_modules/es-errors/uri.js delete mode 100644 node_modules/es-module-lexer/LICENSE delete mode 100644 node_modules/es-module-lexer/README.md delete mode 100644 node_modules/es-module-lexer/dist/lexer.asm.js delete mode 100644 node_modules/es-module-lexer/dist/lexer.cjs delete mode 100644 node_modules/es-module-lexer/dist/lexer.js delete mode 100644 node_modules/es-module-lexer/lexer.js delete mode 100644 node_modules/es-module-lexer/package.json delete mode 100644 node_modules/es-module-lexer/types/lexer.d.ts delete mode 100644 node_modules/escalade/dist/index.js delete mode 100644 node_modules/escalade/dist/index.mjs delete mode 100644 node_modules/escalade/index.d.mts delete mode 100644 node_modules/escalade/index.d.ts delete mode 100644 node_modules/escalade/license delete mode 100644 node_modules/escalade/package.json delete mode 100644 node_modules/escalade/readme.md delete mode 100644 node_modules/escalade/sync/index.d.mts delete mode 100644 node_modules/escalade/sync/index.d.ts delete mode 100644 node_modules/escalade/sync/index.js delete mode 100644 node_modules/escalade/sync/index.mjs delete mode 100644 node_modules/escape-string-regexp/index.d.ts delete mode 100644 node_modules/escape-string-regexp/index.js delete mode 100644 node_modules/escape-string-regexp/license delete mode 100644 node_modules/escape-string-regexp/package.json delete mode 100644 node_modules/escape-string-regexp/readme.md delete mode 100644 node_modules/eslint-config-prettier/@typescript-eslint.js delete mode 100644 node_modules/eslint-config-prettier/LICENSE delete mode 100644 node_modules/eslint-config-prettier/README.md delete mode 100644 node_modules/eslint-config-prettier/babel.js delete mode 100755 node_modules/eslint-config-prettier/bin/cli.js delete mode 100644 node_modules/eslint-config-prettier/bin/validators.js delete mode 100644 node_modules/eslint-config-prettier/flowtype.js delete mode 100644 node_modules/eslint-config-prettier/index.js delete mode 100644 node_modules/eslint-config-prettier/package.json delete mode 100644 node_modules/eslint-config-prettier/prettier.js delete mode 100644 node_modules/eslint-config-prettier/react.js delete mode 100644 node_modules/eslint-config-prettier/standard.js delete mode 100644 node_modules/eslint-config-prettier/unicorn.js delete mode 100644 node_modules/eslint-config-prettier/vue.js delete mode 100644 node_modules/eslint-plugin-jsdoc/LICENSE delete mode 100644 node_modules/eslint-plugin-jsdoc/README.md delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/WarnSettings.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/WarnSettings.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/alignTransform.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/alignTransform.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/defaultTagOrder.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/defaultTagOrder.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/exportParser.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/exportParser.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/generateRule.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/generateRule.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/getDefaultTagStructureForMode.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/getDefaultTagStructureForMode.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/getJsdocProcessorPlugin.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/getJsdocProcessorPlugin.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/import-worker.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/import-worker.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/import-worker.mjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/index.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/index.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/index.d.ts delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/index.d.ts.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/iterateJsdoc.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/jsdocUtils.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/jsdocUtils.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkAccess.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkAccess.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkAlignment.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkAlignment.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkExamples.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkExamples.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkIndentation.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkIndentation.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkLineAlignment.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkLineAlignment.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkParamNames.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkParamNames.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkPropertyNames.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkPropertyNames.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkSyntax.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkSyntax.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkTagNames.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkTagNames.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkTemplateNames.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkTemplateNames.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkTypes.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkTypes.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/convertToJsdocComments.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/convertToJsdocComments.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/emptyTags.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/emptyTags.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/implementsOnClasses.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/implementsOnClasses.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/importsAsDependencies.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/importsAsDependencies.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/informativeDocs.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/informativeDocs.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/matchDescription.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/matchDescription.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/matchName.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/matchName.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/multilineBlocks.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/multilineBlocks.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noBadBlocks.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noBadBlocks.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noBlankBlockDescriptions.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noBlankBlockDescriptions.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noBlankBlocks.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noBlankBlocks.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noDefaults.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noDefaults.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noMissingSyntax.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noMissingSyntax.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noMultiAsterisks.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noMultiAsterisks.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noRestrictedSyntax.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noRestrictedSyntax.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noTypes.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noTypes.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireAsteriskPrefix.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireAsteriskPrefix.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireDescription.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireDescription.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireDescriptionCompleteSentence.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireDescriptionCompleteSentence.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireExample.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireExample.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireFileOverview.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireFileOverview.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireHyphenBeforeParamDescription.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireHyphenBeforeParamDescription.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireJsdoc.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireJsdoc.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParam.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParam.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParamDescription.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParamDescription.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParamName.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParamName.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParamType.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireParamType.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireProperty.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireProperty.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requirePropertyDescription.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requirePropertyDescription.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requirePropertyName.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requirePropertyName.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requirePropertyType.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requirePropertyType.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturns.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturns.cjs.map delete mode 100755 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturnsCheck.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturnsCheck.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturnsDescription.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturnsDescription.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturnsType.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireReturnsType.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireTemplate.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireTemplate.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireThrows.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireThrows.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireYields.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireYields.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireYieldsCheck.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/requireYieldsCheck.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/sortTags.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/sortTags.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/tagLines.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/tagLines.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/textEscaping.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/textEscaping.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/validTypes.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/rules/validTypes.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/tagNames.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/tagNames.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/utils/hasReturnValue.cjs delete mode 100644 node_modules/eslint-plugin-jsdoc/dist/utils/hasReturnValue.cjs.map delete mode 100644 node_modules/eslint-plugin-jsdoc/eslint.config.js delete mode 100644 node_modules/eslint-plugin-jsdoc/package.json delete mode 100644 node_modules/eslint-plugin-jsdoc/src/WarnSettings.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/alignTransform.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/defaultTagOrder.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/exportParser.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/getDefaultTagStructureForMode.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/getJsdocProcessorPlugin.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/import-worker.mjs delete mode 100644 node_modules/eslint-plugin-jsdoc/src/index.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/iterateJsdoc.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/jsdocUtils.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkAccess.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkAlignment.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkExamples.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkIndentation.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkLineAlignment.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkParamNames.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkPropertyNames.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkSyntax.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkTagNames.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkTemplateNames.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkTypes.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/checkValues.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/convertToJsdocComments.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/emptyTags.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/implementsOnClasses.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/importsAsDependencies.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/informativeDocs.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/matchDescription.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/matchName.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/multilineBlocks.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noBadBlocks.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noBlankBlockDescriptions.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noBlankBlocks.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noDefaults.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noMissingSyntax.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noMultiAsterisks.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noRestrictedSyntax.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noTypes.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/noUndefinedTypes.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireAsteriskPrefix.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireDescription.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireDescriptionCompleteSentence.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireExample.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireFileOverview.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireHyphenBeforeParamDescription.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireJsdoc.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireParam.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireParamDescription.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireParamName.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireParamType.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireProperty.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requirePropertyDescription.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requirePropertyName.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requirePropertyType.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireReturns.js delete mode 100755 node_modules/eslint-plugin-jsdoc/src/rules/requireReturnsCheck.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireReturnsDescription.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireReturnsType.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireTemplate.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireThrows.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireYields.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/requireYieldsCheck.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/sortTags.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/tagLines.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/textEscaping.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/rules/validTypes.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/tagNames.js delete mode 100644 node_modules/eslint-plugin-jsdoc/src/utils/hasReturnValue.js delete mode 100644 node_modules/eslint-plugin-prettier/LICENSE.md delete mode 100644 node_modules/eslint-plugin-prettier/README.md delete mode 100644 node_modules/eslint-plugin-prettier/eslint-plugin-prettier.d.ts delete mode 100644 node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js delete mode 100644 node_modules/eslint-plugin-prettier/package.json delete mode 100644 node_modules/eslint-plugin-prettier/recommended.d.ts delete mode 100644 node_modules/eslint-plugin-prettier/recommended.js delete mode 100644 node_modules/eslint-plugin-prettier/worker.js delete mode 100644 node_modules/eslint-scope/LICENSE delete mode 100644 node_modules/eslint-scope/README.md delete mode 100644 node_modules/eslint-scope/dist/eslint-scope.cjs delete mode 100644 node_modules/eslint-scope/lib/assert.js delete mode 100644 node_modules/eslint-scope/lib/definition.js delete mode 100644 node_modules/eslint-scope/lib/index.js delete mode 100644 node_modules/eslint-scope/lib/pattern-visitor.js delete mode 100644 node_modules/eslint-scope/lib/reference.js delete mode 100644 node_modules/eslint-scope/lib/referencer.js delete mode 100644 node_modules/eslint-scope/lib/scope-manager.js delete mode 100644 node_modules/eslint-scope/lib/scope.js delete mode 100644 node_modules/eslint-scope/lib/variable.js delete mode 100644 node_modules/eslint-scope/lib/version.js delete mode 100644 node_modules/eslint-scope/package.json delete mode 100644 node_modules/eslint-visitor-keys/LICENSE delete mode 100644 node_modules/eslint-visitor-keys/README.md delete mode 100644 node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs delete mode 100644 node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts delete mode 100644 node_modules/eslint-visitor-keys/dist/index.d.ts delete mode 100644 node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts delete mode 100644 node_modules/eslint-visitor-keys/lib/index.js delete mode 100644 node_modules/eslint-visitor-keys/lib/visitor-keys.js delete mode 100644 node_modules/eslint-visitor-keys/package.json delete mode 100644 node_modules/eslint/LICENSE delete mode 100644 node_modules/eslint/README.md delete mode 100755 node_modules/eslint/bin/eslint.js delete mode 100644 node_modules/eslint/conf/default-cli-options.js delete mode 100644 node_modules/eslint/conf/ecma-version.js delete mode 100644 node_modules/eslint/conf/globals.js delete mode 100644 node_modules/eslint/conf/replacements.json delete mode 100644 node_modules/eslint/conf/rule-type-list.json delete mode 100644 node_modules/eslint/lib/api.js delete mode 100644 node_modules/eslint/lib/cli-engine/cli-engine.js delete mode 100644 node_modules/eslint/lib/cli-engine/file-enumerator.js delete mode 100644 node_modules/eslint/lib/cli-engine/formatters/formatters-meta.json delete mode 100644 node_modules/eslint/lib/cli-engine/formatters/html.js delete mode 100644 node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js delete mode 100644 node_modules/eslint/lib/cli-engine/formatters/json.js delete mode 100644 node_modules/eslint/lib/cli-engine/formatters/stylish.js delete mode 100644 node_modules/eslint/lib/cli-engine/hash.js delete mode 100644 node_modules/eslint/lib/cli-engine/index.js delete mode 100644 node_modules/eslint/lib/cli-engine/lint-result-cache.js delete mode 100644 node_modules/eslint/lib/cli-engine/load-rules.js delete mode 100644 node_modules/eslint/lib/cli.js delete mode 100644 node_modules/eslint/lib/config/config-loader.js delete mode 100644 node_modules/eslint/lib/config/config.js delete mode 100644 node_modules/eslint/lib/config/default-config.js delete mode 100644 node_modules/eslint/lib/config/flat-config-array.js delete mode 100644 node_modules/eslint/lib/config/flat-config-helpers.js delete mode 100644 node_modules/eslint/lib/config/flat-config-schema.js delete mode 100644 node_modules/eslint/lib/config/rule-validator.js delete mode 100644 node_modules/eslint/lib/eslint/eslint-helpers.js delete mode 100644 node_modules/eslint/lib/eslint/eslint.js delete mode 100644 node_modules/eslint/lib/eslint/index.js delete mode 100644 node_modules/eslint/lib/eslint/legacy-eslint.js delete mode 100644 node_modules/eslint/lib/languages/js/index.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/index.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/source-code.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/index.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js delete mode 100644 node_modules/eslint/lib/languages/js/source-code/token-store/utils.js delete mode 100644 node_modules/eslint/lib/languages/js/validate-language-options.js delete mode 100644 node_modules/eslint/lib/linter/apply-disable-directives.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/code-path.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/fork-context.js delete mode 100644 node_modules/eslint/lib/linter/code-path-analysis/id-generator.js delete mode 100644 node_modules/eslint/lib/linter/file-context.js delete mode 100644 node_modules/eslint/lib/linter/index.js delete mode 100644 node_modules/eslint/lib/linter/interpolate.js delete mode 100644 node_modules/eslint/lib/linter/linter.js delete mode 100644 node_modules/eslint/lib/linter/node-event-generator.js delete mode 100644 node_modules/eslint/lib/linter/report-translator.js delete mode 100644 node_modules/eslint/lib/linter/rule-fixer.js delete mode 100644 node_modules/eslint/lib/linter/rules.js delete mode 100644 node_modules/eslint/lib/linter/safe-emitter.js delete mode 100644 node_modules/eslint/lib/linter/source-code-fixer.js delete mode 100644 node_modules/eslint/lib/linter/timing.js delete mode 100644 node_modules/eslint/lib/linter/vfile.js delete mode 100644 node_modules/eslint/lib/options.js delete mode 100644 node_modules/eslint/lib/rule-tester/index.js delete mode 100644 node_modules/eslint/lib/rule-tester/rule-tester.js delete mode 100644 node_modules/eslint/lib/rules/accessor-pairs.js delete mode 100644 node_modules/eslint/lib/rules/array-bracket-newline.js delete mode 100644 node_modules/eslint/lib/rules/array-bracket-spacing.js delete mode 100644 node_modules/eslint/lib/rules/array-callback-return.js delete mode 100644 node_modules/eslint/lib/rules/array-element-newline.js delete mode 100644 node_modules/eslint/lib/rules/arrow-body-style.js delete mode 100644 node_modules/eslint/lib/rules/arrow-parens.js delete mode 100644 node_modules/eslint/lib/rules/arrow-spacing.js delete mode 100644 node_modules/eslint/lib/rules/block-scoped-var.js delete mode 100644 node_modules/eslint/lib/rules/block-spacing.js delete mode 100644 node_modules/eslint/lib/rules/brace-style.js delete mode 100644 node_modules/eslint/lib/rules/callback-return.js delete mode 100644 node_modules/eslint/lib/rules/camelcase.js delete mode 100644 node_modules/eslint/lib/rules/capitalized-comments.js delete mode 100644 node_modules/eslint/lib/rules/class-methods-use-this.js delete mode 100644 node_modules/eslint/lib/rules/comma-dangle.js delete mode 100644 node_modules/eslint/lib/rules/comma-spacing.js delete mode 100644 node_modules/eslint/lib/rules/comma-style.js delete mode 100644 node_modules/eslint/lib/rules/complexity.js delete mode 100644 node_modules/eslint/lib/rules/computed-property-spacing.js delete mode 100644 node_modules/eslint/lib/rules/consistent-return.js delete mode 100644 node_modules/eslint/lib/rules/consistent-this.js delete mode 100644 node_modules/eslint/lib/rules/constructor-super.js delete mode 100644 node_modules/eslint/lib/rules/curly.js delete mode 100644 node_modules/eslint/lib/rules/default-case-last.js delete mode 100644 node_modules/eslint/lib/rules/default-case.js delete mode 100644 node_modules/eslint/lib/rules/default-param-last.js delete mode 100644 node_modules/eslint/lib/rules/dot-location.js delete mode 100644 node_modules/eslint/lib/rules/dot-notation.js delete mode 100644 node_modules/eslint/lib/rules/eol-last.js delete mode 100644 node_modules/eslint/lib/rules/eqeqeq.js delete mode 100644 node_modules/eslint/lib/rules/for-direction.js delete mode 100644 node_modules/eslint/lib/rules/func-call-spacing.js delete mode 100644 node_modules/eslint/lib/rules/func-name-matching.js delete mode 100644 node_modules/eslint/lib/rules/func-names.js delete mode 100644 node_modules/eslint/lib/rules/func-style.js delete mode 100644 node_modules/eslint/lib/rules/function-call-argument-newline.js delete mode 100644 node_modules/eslint/lib/rules/function-paren-newline.js delete mode 100644 node_modules/eslint/lib/rules/generator-star-spacing.js delete mode 100644 node_modules/eslint/lib/rules/getter-return.js delete mode 100644 node_modules/eslint/lib/rules/global-require.js delete mode 100644 node_modules/eslint/lib/rules/grouped-accessor-pairs.js delete mode 100644 node_modules/eslint/lib/rules/guard-for-in.js delete mode 100644 node_modules/eslint/lib/rules/handle-callback-err.js delete mode 100644 node_modules/eslint/lib/rules/id-blacklist.js delete mode 100644 node_modules/eslint/lib/rules/id-denylist.js delete mode 100644 node_modules/eslint/lib/rules/id-length.js delete mode 100644 node_modules/eslint/lib/rules/id-match.js delete mode 100644 node_modules/eslint/lib/rules/implicit-arrow-linebreak.js delete mode 100644 node_modules/eslint/lib/rules/indent-legacy.js delete mode 100644 node_modules/eslint/lib/rules/indent.js delete mode 100644 node_modules/eslint/lib/rules/index.js delete mode 100644 node_modules/eslint/lib/rules/init-declarations.js delete mode 100644 node_modules/eslint/lib/rules/jsx-quotes.js delete mode 100644 node_modules/eslint/lib/rules/key-spacing.js delete mode 100644 node_modules/eslint/lib/rules/keyword-spacing.js delete mode 100644 node_modules/eslint/lib/rules/line-comment-position.js delete mode 100644 node_modules/eslint/lib/rules/linebreak-style.js delete mode 100644 node_modules/eslint/lib/rules/lines-around-comment.js delete mode 100644 node_modules/eslint/lib/rules/lines-around-directive.js delete mode 100644 node_modules/eslint/lib/rules/lines-between-class-members.js delete mode 100644 node_modules/eslint/lib/rules/logical-assignment-operators.js delete mode 100644 node_modules/eslint/lib/rules/max-classes-per-file.js delete mode 100644 node_modules/eslint/lib/rules/max-depth.js delete mode 100644 node_modules/eslint/lib/rules/max-len.js delete mode 100644 node_modules/eslint/lib/rules/max-lines-per-function.js delete mode 100644 node_modules/eslint/lib/rules/max-lines.js delete mode 100644 node_modules/eslint/lib/rules/max-nested-callbacks.js delete mode 100644 node_modules/eslint/lib/rules/max-params.js delete mode 100644 node_modules/eslint/lib/rules/max-statements-per-line.js delete mode 100644 node_modules/eslint/lib/rules/max-statements.js delete mode 100644 node_modules/eslint/lib/rules/multiline-comment-style.js delete mode 100644 node_modules/eslint/lib/rules/multiline-ternary.js delete mode 100644 node_modules/eslint/lib/rules/new-cap.js delete mode 100644 node_modules/eslint/lib/rules/new-parens.js delete mode 100644 node_modules/eslint/lib/rules/newline-after-var.js delete mode 100644 node_modules/eslint/lib/rules/newline-before-return.js delete mode 100644 node_modules/eslint/lib/rules/newline-per-chained-call.js delete mode 100644 node_modules/eslint/lib/rules/no-alert.js delete mode 100644 node_modules/eslint/lib/rules/no-array-constructor.js delete mode 100644 node_modules/eslint/lib/rules/no-async-promise-executor.js delete mode 100644 node_modules/eslint/lib/rules/no-await-in-loop.js delete mode 100644 node_modules/eslint/lib/rules/no-bitwise.js delete mode 100644 node_modules/eslint/lib/rules/no-buffer-constructor.js delete mode 100644 node_modules/eslint/lib/rules/no-caller.js delete mode 100644 node_modules/eslint/lib/rules/no-case-declarations.js delete mode 100644 node_modules/eslint/lib/rules/no-catch-shadow.js delete mode 100644 node_modules/eslint/lib/rules/no-class-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-compare-neg-zero.js delete mode 100644 node_modules/eslint/lib/rules/no-cond-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-confusing-arrow.js delete mode 100644 node_modules/eslint/lib/rules/no-console.js delete mode 100644 node_modules/eslint/lib/rules/no-const-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-constant-binary-expression.js delete mode 100644 node_modules/eslint/lib/rules/no-constant-condition.js delete mode 100644 node_modules/eslint/lib/rules/no-constructor-return.js delete mode 100644 node_modules/eslint/lib/rules/no-continue.js delete mode 100644 node_modules/eslint/lib/rules/no-control-regex.js delete mode 100644 node_modules/eslint/lib/rules/no-debugger.js delete mode 100644 node_modules/eslint/lib/rules/no-delete-var.js delete mode 100644 node_modules/eslint/lib/rules/no-div-regex.js delete mode 100644 node_modules/eslint/lib/rules/no-dupe-args.js delete mode 100644 node_modules/eslint/lib/rules/no-dupe-class-members.js delete mode 100644 node_modules/eslint/lib/rules/no-dupe-else-if.js delete mode 100644 node_modules/eslint/lib/rules/no-dupe-keys.js delete mode 100644 node_modules/eslint/lib/rules/no-duplicate-case.js delete mode 100644 node_modules/eslint/lib/rules/no-duplicate-imports.js delete mode 100644 node_modules/eslint/lib/rules/no-else-return.js delete mode 100644 node_modules/eslint/lib/rules/no-empty-character-class.js delete mode 100644 node_modules/eslint/lib/rules/no-empty-function.js delete mode 100644 node_modules/eslint/lib/rules/no-empty-pattern.js delete mode 100644 node_modules/eslint/lib/rules/no-empty-static-block.js delete mode 100644 node_modules/eslint/lib/rules/no-empty.js delete mode 100644 node_modules/eslint/lib/rules/no-eq-null.js delete mode 100644 node_modules/eslint/lib/rules/no-eval.js delete mode 100644 node_modules/eslint/lib/rules/no-ex-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-extend-native.js delete mode 100644 node_modules/eslint/lib/rules/no-extra-bind.js delete mode 100644 node_modules/eslint/lib/rules/no-extra-boolean-cast.js delete mode 100644 node_modules/eslint/lib/rules/no-extra-label.js delete mode 100644 node_modules/eslint/lib/rules/no-extra-parens.js delete mode 100644 node_modules/eslint/lib/rules/no-extra-semi.js delete mode 100644 node_modules/eslint/lib/rules/no-fallthrough.js delete mode 100644 node_modules/eslint/lib/rules/no-floating-decimal.js delete mode 100644 node_modules/eslint/lib/rules/no-func-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-global-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-implicit-coercion.js delete mode 100644 node_modules/eslint/lib/rules/no-implicit-globals.js delete mode 100644 node_modules/eslint/lib/rules/no-implied-eval.js delete mode 100644 node_modules/eslint/lib/rules/no-import-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-inline-comments.js delete mode 100644 node_modules/eslint/lib/rules/no-inner-declarations.js delete mode 100644 node_modules/eslint/lib/rules/no-invalid-regexp.js delete mode 100644 node_modules/eslint/lib/rules/no-invalid-this.js delete mode 100644 node_modules/eslint/lib/rules/no-irregular-whitespace.js delete mode 100644 node_modules/eslint/lib/rules/no-iterator.js delete mode 100644 node_modules/eslint/lib/rules/no-label-var.js delete mode 100644 node_modules/eslint/lib/rules/no-labels.js delete mode 100644 node_modules/eslint/lib/rules/no-lone-blocks.js delete mode 100644 node_modules/eslint/lib/rules/no-lonely-if.js delete mode 100644 node_modules/eslint/lib/rules/no-loop-func.js delete mode 100644 node_modules/eslint/lib/rules/no-loss-of-precision.js delete mode 100644 node_modules/eslint/lib/rules/no-magic-numbers.js delete mode 100644 node_modules/eslint/lib/rules/no-misleading-character-class.js delete mode 100644 node_modules/eslint/lib/rules/no-mixed-operators.js delete mode 100644 node_modules/eslint/lib/rules/no-mixed-requires.js delete mode 100644 node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js delete mode 100644 node_modules/eslint/lib/rules/no-multi-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-multi-spaces.js delete mode 100644 node_modules/eslint/lib/rules/no-multi-str.js delete mode 100644 node_modules/eslint/lib/rules/no-multiple-empty-lines.js delete mode 100644 node_modules/eslint/lib/rules/no-native-reassign.js delete mode 100644 node_modules/eslint/lib/rules/no-negated-condition.js delete mode 100644 node_modules/eslint/lib/rules/no-negated-in-lhs.js delete mode 100644 node_modules/eslint/lib/rules/no-nested-ternary.js delete mode 100644 node_modules/eslint/lib/rules/no-new-func.js delete mode 100644 node_modules/eslint/lib/rules/no-new-native-nonconstructor.js delete mode 100644 node_modules/eslint/lib/rules/no-new-object.js delete mode 100644 node_modules/eslint/lib/rules/no-new-require.js delete mode 100644 node_modules/eslint/lib/rules/no-new-symbol.js delete mode 100644 node_modules/eslint/lib/rules/no-new-wrappers.js delete mode 100644 node_modules/eslint/lib/rules/no-new.js delete mode 100644 node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js delete mode 100644 node_modules/eslint/lib/rules/no-obj-calls.js delete mode 100644 node_modules/eslint/lib/rules/no-object-constructor.js delete mode 100644 node_modules/eslint/lib/rules/no-octal-escape.js delete mode 100644 node_modules/eslint/lib/rules/no-octal.js delete mode 100644 node_modules/eslint/lib/rules/no-param-reassign.js delete mode 100644 node_modules/eslint/lib/rules/no-path-concat.js delete mode 100644 node_modules/eslint/lib/rules/no-plusplus.js delete mode 100644 node_modules/eslint/lib/rules/no-process-env.js delete mode 100644 node_modules/eslint/lib/rules/no-process-exit.js delete mode 100644 node_modules/eslint/lib/rules/no-promise-executor-return.js delete mode 100644 node_modules/eslint/lib/rules/no-proto.js delete mode 100644 node_modules/eslint/lib/rules/no-prototype-builtins.js delete mode 100644 node_modules/eslint/lib/rules/no-redeclare.js delete mode 100644 node_modules/eslint/lib/rules/no-regex-spaces.js delete mode 100644 node_modules/eslint/lib/rules/no-restricted-exports.js delete mode 100644 node_modules/eslint/lib/rules/no-restricted-globals.js delete mode 100644 node_modules/eslint/lib/rules/no-restricted-imports.js delete mode 100644 node_modules/eslint/lib/rules/no-restricted-modules.js delete mode 100644 node_modules/eslint/lib/rules/no-restricted-properties.js delete mode 100644 node_modules/eslint/lib/rules/no-restricted-syntax.js delete mode 100644 node_modules/eslint/lib/rules/no-return-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-return-await.js delete mode 100644 node_modules/eslint/lib/rules/no-script-url.js delete mode 100644 node_modules/eslint/lib/rules/no-self-assign.js delete mode 100644 node_modules/eslint/lib/rules/no-self-compare.js delete mode 100644 node_modules/eslint/lib/rules/no-sequences.js delete mode 100644 node_modules/eslint/lib/rules/no-setter-return.js delete mode 100644 node_modules/eslint/lib/rules/no-shadow-restricted-names.js delete mode 100644 node_modules/eslint/lib/rules/no-shadow.js delete mode 100644 node_modules/eslint/lib/rules/no-spaced-func.js delete mode 100644 node_modules/eslint/lib/rules/no-sparse-arrays.js delete mode 100644 node_modules/eslint/lib/rules/no-sync.js delete mode 100644 node_modules/eslint/lib/rules/no-tabs.js delete mode 100644 node_modules/eslint/lib/rules/no-template-curly-in-string.js delete mode 100644 node_modules/eslint/lib/rules/no-ternary.js delete mode 100644 node_modules/eslint/lib/rules/no-this-before-super.js delete mode 100644 node_modules/eslint/lib/rules/no-throw-literal.js delete mode 100644 node_modules/eslint/lib/rules/no-trailing-spaces.js delete mode 100644 node_modules/eslint/lib/rules/no-undef-init.js delete mode 100644 node_modules/eslint/lib/rules/no-undef.js delete mode 100644 node_modules/eslint/lib/rules/no-undefined.js delete mode 100644 node_modules/eslint/lib/rules/no-underscore-dangle.js delete mode 100644 node_modules/eslint/lib/rules/no-unexpected-multiline.js delete mode 100644 node_modules/eslint/lib/rules/no-unmodified-loop-condition.js delete mode 100644 node_modules/eslint/lib/rules/no-unneeded-ternary.js delete mode 100644 node_modules/eslint/lib/rules/no-unreachable-loop.js delete mode 100644 node_modules/eslint/lib/rules/no-unreachable.js delete mode 100644 node_modules/eslint/lib/rules/no-unsafe-finally.js delete mode 100644 node_modules/eslint/lib/rules/no-unsafe-negation.js delete mode 100644 node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js delete mode 100644 node_modules/eslint/lib/rules/no-unused-expressions.js delete mode 100644 node_modules/eslint/lib/rules/no-unused-labels.js delete mode 100644 node_modules/eslint/lib/rules/no-unused-private-class-members.js delete mode 100644 node_modules/eslint/lib/rules/no-unused-vars.js delete mode 100644 node_modules/eslint/lib/rules/no-use-before-define.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-assignment.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-backreference.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-call.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-catch.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-computed-key.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-concat.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-constructor.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-escape.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-rename.js delete mode 100644 node_modules/eslint/lib/rules/no-useless-return.js delete mode 100644 node_modules/eslint/lib/rules/no-var.js delete mode 100644 node_modules/eslint/lib/rules/no-void.js delete mode 100644 node_modules/eslint/lib/rules/no-warning-comments.js delete mode 100644 node_modules/eslint/lib/rules/no-whitespace-before-property.js delete mode 100644 node_modules/eslint/lib/rules/no-with.js delete mode 100644 node_modules/eslint/lib/rules/nonblock-statement-body-position.js delete mode 100644 node_modules/eslint/lib/rules/object-curly-newline.js delete mode 100644 node_modules/eslint/lib/rules/object-curly-spacing.js delete mode 100644 node_modules/eslint/lib/rules/object-property-newline.js delete mode 100644 node_modules/eslint/lib/rules/object-shorthand.js delete mode 100644 node_modules/eslint/lib/rules/one-var-declaration-per-line.js delete mode 100644 node_modules/eslint/lib/rules/one-var.js delete mode 100644 node_modules/eslint/lib/rules/operator-assignment.js delete mode 100644 node_modules/eslint/lib/rules/operator-linebreak.js delete mode 100644 node_modules/eslint/lib/rules/padded-blocks.js delete mode 100644 node_modules/eslint/lib/rules/padding-line-between-statements.js delete mode 100644 node_modules/eslint/lib/rules/prefer-arrow-callback.js delete mode 100644 node_modules/eslint/lib/rules/prefer-const.js delete mode 100644 node_modules/eslint/lib/rules/prefer-destructuring.js delete mode 100644 node_modules/eslint/lib/rules/prefer-exponentiation-operator.js delete mode 100644 node_modules/eslint/lib/rules/prefer-named-capture-group.js delete mode 100644 node_modules/eslint/lib/rules/prefer-numeric-literals.js delete mode 100644 node_modules/eslint/lib/rules/prefer-object-has-own.js delete mode 100644 node_modules/eslint/lib/rules/prefer-object-spread.js delete mode 100644 node_modules/eslint/lib/rules/prefer-promise-reject-errors.js delete mode 100644 node_modules/eslint/lib/rules/prefer-reflect.js delete mode 100644 node_modules/eslint/lib/rules/prefer-regex-literals.js delete mode 100644 node_modules/eslint/lib/rules/prefer-rest-params.js delete mode 100644 node_modules/eslint/lib/rules/prefer-spread.js delete mode 100644 node_modules/eslint/lib/rules/prefer-template.js delete mode 100644 node_modules/eslint/lib/rules/quote-props.js delete mode 100644 node_modules/eslint/lib/rules/quotes.js delete mode 100644 node_modules/eslint/lib/rules/radix.js delete mode 100644 node_modules/eslint/lib/rules/require-atomic-updates.js delete mode 100644 node_modules/eslint/lib/rules/require-await.js delete mode 100644 node_modules/eslint/lib/rules/require-unicode-regexp.js delete mode 100644 node_modules/eslint/lib/rules/require-yield.js delete mode 100644 node_modules/eslint/lib/rules/rest-spread-spacing.js delete mode 100644 node_modules/eslint/lib/rules/semi-spacing.js delete mode 100644 node_modules/eslint/lib/rules/semi-style.js delete mode 100644 node_modules/eslint/lib/rules/semi.js delete mode 100644 node_modules/eslint/lib/rules/sort-imports.js delete mode 100644 node_modules/eslint/lib/rules/sort-keys.js delete mode 100644 node_modules/eslint/lib/rules/sort-vars.js delete mode 100644 node_modules/eslint/lib/rules/space-before-blocks.js delete mode 100644 node_modules/eslint/lib/rules/space-before-function-paren.js delete mode 100644 node_modules/eslint/lib/rules/space-in-parens.js delete mode 100644 node_modules/eslint/lib/rules/space-infix-ops.js delete mode 100644 node_modules/eslint/lib/rules/space-unary-ops.js delete mode 100644 node_modules/eslint/lib/rules/spaced-comment.js delete mode 100644 node_modules/eslint/lib/rules/strict.js delete mode 100644 node_modules/eslint/lib/rules/switch-colon-spacing.js delete mode 100644 node_modules/eslint/lib/rules/symbol-description.js delete mode 100644 node_modules/eslint/lib/rules/template-curly-spacing.js delete mode 100644 node_modules/eslint/lib/rules/template-tag-spacing.js delete mode 100644 node_modules/eslint/lib/rules/unicode-bom.js delete mode 100644 node_modules/eslint/lib/rules/use-isnan.js delete mode 100644 node_modules/eslint/lib/rules/utils/ast-utils.js delete mode 100644 node_modules/eslint/lib/rules/utils/char-source.js delete mode 100644 node_modules/eslint/lib/rules/utils/fix-tracker.js delete mode 100644 node_modules/eslint/lib/rules/utils/keywords.js delete mode 100644 node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js delete mode 100644 node_modules/eslint/lib/rules/utils/regular-expressions.js delete mode 100644 node_modules/eslint/lib/rules/utils/unicode/index.js delete mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js delete mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js delete mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js delete mode 100644 node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js delete mode 100644 node_modules/eslint/lib/rules/valid-typeof.js delete mode 100644 node_modules/eslint/lib/rules/vars-on-top.js delete mode 100644 node_modules/eslint/lib/rules/wrap-iife.js delete mode 100644 node_modules/eslint/lib/rules/wrap-regex.js delete mode 100644 node_modules/eslint/lib/rules/yield-star-spacing.js delete mode 100644 node_modules/eslint/lib/rules/yoda.js delete mode 100644 node_modules/eslint/lib/services/parser-service.js delete mode 100644 node_modules/eslint/lib/services/processor-service.js delete mode 100644 node_modules/eslint/lib/shared/ajv.js delete mode 100644 node_modules/eslint/lib/shared/assert.js delete mode 100644 node_modules/eslint/lib/shared/ast-utils.js delete mode 100644 node_modules/eslint/lib/shared/deep-merge-arrays.js delete mode 100644 node_modules/eslint/lib/shared/directives.js delete mode 100644 node_modules/eslint/lib/shared/flags.js delete mode 100644 node_modules/eslint/lib/shared/logging.js delete mode 100644 node_modules/eslint/lib/shared/runtime-info.js delete mode 100644 node_modules/eslint/lib/shared/serialization.js delete mode 100644 node_modules/eslint/lib/shared/severity.js delete mode 100644 node_modules/eslint/lib/shared/stats.js delete mode 100644 node_modules/eslint/lib/shared/string-utils.js delete mode 100644 node_modules/eslint/lib/shared/text-table.js delete mode 100644 node_modules/eslint/lib/shared/traverser.js delete mode 100644 node_modules/eslint/lib/shared/types.js delete mode 100644 node_modules/eslint/lib/types/index.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/best-practices.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/deprecated.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/ecmascript-6.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/index.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/node-commonjs.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/possible-errors.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/strict-mode.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/stylistic-issues.d.ts delete mode 100644 node_modules/eslint/lib/types/rules/variables.d.ts delete mode 100644 node_modules/eslint/lib/types/universal.d.ts delete mode 100644 node_modules/eslint/lib/types/use-at-your-own-risk.d.ts delete mode 100644 node_modules/eslint/lib/universal.js delete mode 100644 node_modules/eslint/lib/unsupported-api.js delete mode 100644 node_modules/eslint/messages/all-files-ignored.js delete mode 100644 node_modules/eslint/messages/all-matched-files-ignored.js delete mode 100644 node_modules/eslint/messages/config-file-missing.js delete mode 100644 node_modules/eslint/messages/eslintrc-incompat.js delete mode 100644 node_modules/eslint/messages/eslintrc-plugins.js delete mode 100644 node_modules/eslint/messages/extend-config-missing.js delete mode 100644 node_modules/eslint/messages/failed-to-read-json.js delete mode 100644 node_modules/eslint/messages/file-not-found.js delete mode 100644 node_modules/eslint/messages/invalid-rule-options.js delete mode 100644 node_modules/eslint/messages/invalid-rule-severity.js delete mode 100644 node_modules/eslint/messages/no-config-found.js delete mode 100644 node_modules/eslint/messages/plugin-conflict.js delete mode 100644 node_modules/eslint/messages/plugin-invalid.js delete mode 100644 node_modules/eslint/messages/plugin-missing.js delete mode 100644 node_modules/eslint/messages/print-config-with-directory-path.js delete mode 100644 node_modules/eslint/messages/shared.js delete mode 100644 node_modules/eslint/messages/whitespace-found.js delete mode 100644 node_modules/eslint/node_modules/chalk/index.d.ts delete mode 100644 node_modules/eslint/node_modules/chalk/license delete mode 100644 node_modules/eslint/node_modules/chalk/package.json delete mode 100644 node_modules/eslint/node_modules/chalk/readme.md delete mode 100644 node_modules/eslint/node_modules/chalk/source/index.js delete mode 100644 node_modules/eslint/node_modules/chalk/source/templates.js delete mode 100644 node_modules/eslint/node_modules/chalk/source/util.js delete mode 100644 node_modules/eslint/package.json delete mode 100644 node_modules/esm/LICENSE delete mode 100644 node_modules/esm/README.md delete mode 100644 node_modules/esm/esm.js delete mode 100644 node_modules/esm/esm/loader.js delete mode 100644 node_modules/esm/index.js delete mode 100644 node_modules/esm/package.json delete mode 100644 node_modules/espree/LICENSE delete mode 100644 node_modules/espree/README.md delete mode 100644 node_modules/espree/dist/espree.cjs delete mode 100644 node_modules/espree/espree.js delete mode 100644 node_modules/espree/lib/espree.js delete mode 100644 node_modules/espree/lib/features.js delete mode 100644 node_modules/espree/lib/options.js delete mode 100644 node_modules/espree/lib/token-translator.js delete mode 100644 node_modules/espree/lib/version.js delete mode 100644 node_modules/espree/package.json delete mode 100644 node_modules/esquery/README.md delete mode 100644 node_modules/esquery/dist/esquery.esm.js delete mode 100644 node_modules/esquery/dist/esquery.esm.min.js delete mode 100644 node_modules/esquery/dist/esquery.esm.min.js.map delete mode 100644 node_modules/esquery/dist/esquery.js delete mode 100644 node_modules/esquery/dist/esquery.lite.js delete mode 100644 node_modules/esquery/dist/esquery.lite.min.js delete mode 100644 node_modules/esquery/dist/esquery.lite.min.js.map delete mode 100644 node_modules/esquery/dist/esquery.min.js delete mode 100644 node_modules/esquery/dist/esquery.min.js.map delete mode 100644 node_modules/esquery/license.txt delete mode 100644 node_modules/esquery/package.json delete mode 100644 node_modules/esquery/parser.js delete mode 100644 node_modules/esrecurse/.babelrc delete mode 100644 node_modules/esrecurse/README.md delete mode 100644 node_modules/esrecurse/esrecurse.js delete mode 100644 node_modules/esrecurse/gulpfile.babel.js delete mode 100755 node_modules/esrecurse/package.json delete mode 100644 node_modules/estraverse/.jshintrc delete mode 100644 node_modules/estraverse/LICENSE.BSD delete mode 100644 node_modules/estraverse/README.md delete mode 100644 node_modules/estraverse/estraverse.js delete mode 100644 node_modules/estraverse/gulpfile.js delete mode 100644 node_modules/estraverse/package.json delete mode 100644 node_modules/esutils/LICENSE.BSD delete mode 100644 node_modules/esutils/README.md delete mode 100644 node_modules/esutils/lib/ast.js delete mode 100644 node_modules/esutils/lib/code.js delete mode 100644 node_modules/esutils/lib/keyword.js delete mode 100644 node_modules/esutils/lib/utils.js delete mode 100644 node_modules/esutils/package.json delete mode 100644 node_modules/expand-tilde/LICENSE delete mode 100644 node_modules/expand-tilde/README.md delete mode 100644 node_modules/expand-tilde/index.js delete mode 100644 node_modules/expand-tilde/package.json delete mode 100644 node_modules/extend-shallow/LICENSE delete mode 100644 node_modules/extend-shallow/README.md delete mode 100644 node_modules/extend-shallow/index.js delete mode 100644 node_modules/extend-shallow/package.json delete mode 100644 node_modules/extend/.editorconfig delete mode 100644 node_modules/extend/.eslintrc delete mode 100644 node_modules/extend/.jscs.json delete mode 100644 node_modules/extend/.travis.yml delete mode 100644 node_modules/extend/CHANGELOG.md delete mode 100644 node_modules/extend/LICENSE delete mode 100644 node_modules/extend/README.md delete mode 100644 node_modules/extend/component.json delete mode 100644 node_modules/extend/index.js delete mode 100644 node_modules/extend/package.json delete mode 100644 node_modules/fast-deep-equal/LICENSE delete mode 100644 node_modules/fast-deep-equal/README.md delete mode 100644 node_modules/fast-deep-equal/es6/index.d.ts delete mode 100644 node_modules/fast-deep-equal/es6/index.js delete mode 100644 node_modules/fast-deep-equal/es6/react.d.ts delete mode 100644 node_modules/fast-deep-equal/es6/react.js delete mode 100644 node_modules/fast-deep-equal/index.d.ts delete mode 100644 node_modules/fast-deep-equal/index.js delete mode 100644 node_modules/fast-deep-equal/package.json delete mode 100644 node_modules/fast-deep-equal/react.d.ts delete mode 100644 node_modules/fast-deep-equal/react.js delete mode 100644 node_modules/fast-diff/LICENSE delete mode 100644 node_modules/fast-diff/README.md delete mode 100644 node_modules/fast-diff/diff.d.ts delete mode 100644 node_modules/fast-diff/diff.js delete mode 100644 node_modules/fast-diff/package.json delete mode 100644 node_modules/fast-fifo/LICENSE delete mode 100644 node_modules/fast-fifo/README.md delete mode 100644 node_modules/fast-fifo/fixed-size.js delete mode 100644 node_modules/fast-fifo/index.js delete mode 100644 node_modules/fast-fifo/package.json delete mode 100644 node_modules/fast-json-stable-stringify/.eslintrc.yml delete mode 100644 node_modules/fast-json-stable-stringify/.github/FUNDING.yml delete mode 100644 node_modules/fast-json-stable-stringify/.travis.yml delete mode 100644 node_modules/fast-json-stable-stringify/LICENSE delete mode 100644 node_modules/fast-json-stable-stringify/README.md delete mode 100644 node_modules/fast-json-stable-stringify/benchmark/index.js delete mode 100644 node_modules/fast-json-stable-stringify/benchmark/test.json delete mode 100644 node_modules/fast-json-stable-stringify/example/key_cmp.js delete mode 100644 node_modules/fast-json-stable-stringify/example/nested.js delete mode 100644 node_modules/fast-json-stable-stringify/example/str.js delete mode 100644 node_modules/fast-json-stable-stringify/example/value_cmp.js delete mode 100644 node_modules/fast-json-stable-stringify/index.d.ts delete mode 100644 node_modules/fast-json-stable-stringify/index.js delete mode 100644 node_modules/fast-json-stable-stringify/package.json delete mode 100644 node_modules/fast-json-stable-stringify/test/cmp.js delete mode 100644 node_modules/fast-json-stable-stringify/test/nested.js delete mode 100644 node_modules/fast-json-stable-stringify/test/str.js delete mode 100644 node_modules/fast-json-stable-stringify/test/to-json.js delete mode 100644 node_modules/fast-levenshtein/LICENSE.md delete mode 100644 node_modules/fast-levenshtein/README.md delete mode 100644 node_modules/fast-levenshtein/levenshtein.js delete mode 100644 node_modules/fast-levenshtein/package.json delete mode 100644 node_modules/fastest-levenshtein/.eslintrc.json delete mode 100644 node_modules/fastest-levenshtein/.prettierrc delete mode 100644 node_modules/fastest-levenshtein/.travis.yml delete mode 100644 node_modules/fastest-levenshtein/LICENSE.md delete mode 100644 node_modules/fastest-levenshtein/README.md delete mode 100644 node_modules/fastest-levenshtein/bench.js delete mode 100644 node_modules/fastest-levenshtein/esm/mod.d.ts delete mode 100644 node_modules/fastest-levenshtein/esm/mod.d.ts.map delete mode 100644 node_modules/fastest-levenshtein/esm/mod.js delete mode 100644 node_modules/fastest-levenshtein/mod.d.ts delete mode 100644 node_modules/fastest-levenshtein/mod.js delete mode 100644 node_modules/fastest-levenshtein/package.json delete mode 100644 node_modules/fastest-levenshtein/test.js delete mode 100644 node_modules/fastest-levenshtein/test.ts delete mode 100644 node_modules/fastq/.github/dependabot.yml delete mode 100644 node_modules/fastq/.github/workflows/ci.yml delete mode 100644 node_modules/fastq/LICENSE delete mode 100644 node_modules/fastq/README.md delete mode 100644 node_modules/fastq/bench.js delete mode 100644 node_modules/fastq/example.js delete mode 100644 node_modules/fastq/example.mjs delete mode 100644 node_modules/fastq/index.d.ts delete mode 100644 node_modules/fastq/package.json delete mode 100644 node_modules/fastq/queue.js delete mode 100644 node_modules/fastq/test/example.ts delete mode 100644 node_modules/fastq/test/promise.js delete mode 100644 node_modules/fastq/test/test.js delete mode 100644 node_modules/fastq/test/tsconfig.json delete mode 100644 node_modules/file-entry-cache/LICENSE delete mode 100644 node_modules/file-entry-cache/README.md delete mode 100644 node_modules/file-entry-cache/cache.js delete mode 100644 node_modules/file-entry-cache/package.json delete mode 100644 node_modules/fill-range/LICENSE delete mode 100644 node_modules/fill-range/README.md delete mode 100644 node_modules/fill-range/index.js delete mode 100644 node_modules/fill-range/package.json delete mode 100644 node_modules/find-up/index.d.ts delete mode 100644 node_modules/find-up/index.js delete mode 100644 node_modules/find-up/license delete mode 100644 node_modules/find-up/package.json delete mode 100644 node_modules/find-up/readme.md delete mode 100644 node_modules/findup-sync/LICENSE delete mode 100644 node_modules/findup-sync/README.md delete mode 100644 node_modules/findup-sync/index.js delete mode 100644 node_modules/findup-sync/package.json delete mode 100644 node_modules/fined/LICENSE delete mode 100644 node_modules/fined/README.md delete mode 100644 node_modules/fined/index.js delete mode 100644 node_modules/fined/package.json delete mode 100644 node_modules/flagged-respawn/LICENSE delete mode 100644 node_modules/flagged-respawn/README.md delete mode 100644 node_modules/flagged-respawn/index.js delete mode 100644 node_modules/flagged-respawn/lib/is-v8flags.js delete mode 100644 node_modules/flagged-respawn/lib/remover.js delete mode 100644 node_modules/flagged-respawn/lib/reorder.js delete mode 100644 node_modules/flagged-respawn/lib/respawn.js delete mode 100644 node_modules/flagged-respawn/package.json delete mode 100644 node_modules/flat-cache/LICENSE delete mode 100644 node_modules/flat-cache/README.md delete mode 100644 node_modules/flat-cache/changelog.md delete mode 100644 node_modules/flat-cache/package.json delete mode 100644 node_modules/flat-cache/src/cache.js delete mode 100644 node_modules/flat-cache/src/del.js delete mode 100644 node_modules/flat-cache/src/utils.js delete mode 100644 node_modules/flatted/LICENSE delete mode 100644 node_modules/flatted/README.md delete mode 100644 node_modules/flatted/cjs/index.js delete mode 100644 node_modules/flatted/cjs/package.json delete mode 100644 node_modules/flatted/es.js delete mode 100644 node_modules/flatted/esm.js delete mode 100644 node_modules/flatted/esm/index.js delete mode 100644 node_modules/flatted/index.js delete mode 100644 node_modules/flatted/min.js delete mode 100644 node_modules/flatted/package.json delete mode 100644 node_modules/flatted/php/flatted.php delete mode 100644 node_modules/flatted/python/flatted.py delete mode 100644 node_modules/flatted/python/test.py delete mode 100644 node_modules/flatted/types/index.d.ts delete mode 100644 node_modules/for-each/.editorconfig delete mode 100644 node_modules/for-each/.eslintrc delete mode 100644 node_modules/for-each/.travis.yml delete mode 100644 node_modules/for-each/LICENSE delete mode 100644 node_modules/for-each/README.md delete mode 100644 node_modules/for-each/index.js delete mode 100644 node_modules/for-each/package.json delete mode 100644 node_modules/for-each/test/.eslintrc delete mode 100644 node_modules/for-each/test/test.js delete mode 100644 node_modules/for-in/LICENSE delete mode 100644 node_modules/for-in/README.md delete mode 100644 node_modules/for-in/index.js delete mode 100644 node_modules/for-in/package.json delete mode 100644 node_modules/for-own/LICENSE delete mode 100644 node_modules/for-own/README.md delete mode 100644 node_modules/for-own/index.js delete mode 100644 node_modules/for-own/package.json delete mode 100644 node_modules/fs-mkdirp-stream/LICENSE delete mode 100644 node_modules/fs-mkdirp-stream/README.md delete mode 100644 node_modules/fs-mkdirp-stream/index.js delete mode 100644 node_modules/fs-mkdirp-stream/mkdirp.js delete mode 100644 node_modules/fs-mkdirp-stream/package.json delete mode 100644 node_modules/function-bind/.eslintrc delete mode 100644 node_modules/function-bind/.github/FUNDING.yml delete mode 100644 node_modules/function-bind/.github/SECURITY.md delete mode 100644 node_modules/function-bind/.nycrc delete mode 100644 node_modules/function-bind/CHANGELOG.md delete mode 100644 node_modules/function-bind/LICENSE delete mode 100644 node_modules/function-bind/README.md delete mode 100644 node_modules/function-bind/implementation.js delete mode 100644 node_modules/function-bind/index.js delete mode 100644 node_modules/function-bind/package.json delete mode 100644 node_modules/function-bind/test/.eslintrc delete mode 100644 node_modules/function-bind/test/index.js delete mode 100644 node_modules/get-caller-file/LICENSE.md delete mode 100644 node_modules/get-caller-file/README.md delete mode 100644 node_modules/get-caller-file/index.d.ts delete mode 100644 node_modules/get-caller-file/index.js delete mode 100644 node_modules/get-caller-file/index.js.map delete mode 100644 node_modules/get-caller-file/package.json delete mode 100644 node_modules/get-intrinsic/.eslintrc delete mode 100644 node_modules/get-intrinsic/.github/FUNDING.yml delete mode 100644 node_modules/get-intrinsic/.nycrc delete mode 100644 node_modules/get-intrinsic/CHANGELOG.md delete mode 100644 node_modules/get-intrinsic/LICENSE delete mode 100644 node_modules/get-intrinsic/README.md delete mode 100644 node_modules/get-intrinsic/index.js delete mode 100644 node_modules/get-intrinsic/package.json delete mode 100644 node_modules/get-intrinsic/test/GetIntrinsic.js delete mode 100644 node_modules/glob-parent/LICENSE delete mode 100644 node_modules/glob-parent/README.md delete mode 100644 node_modules/glob-parent/index.js delete mode 100644 node_modules/glob-parent/package.json delete mode 100755 node_modules/glob-stream/LICENSE delete mode 100644 node_modules/glob-stream/README.md delete mode 100644 node_modules/glob-stream/index.js delete mode 100644 node_modules/glob-stream/package.json delete mode 100644 node_modules/glob-watcher/LICENSE delete mode 100644 node_modules/glob-watcher/README.md delete mode 100644 node_modules/glob-watcher/index.js delete mode 100644 node_modules/glob-watcher/lib/debounce.js delete mode 100644 node_modules/glob-watcher/lib/normalize-args.js delete mode 100644 node_modules/glob-watcher/package.json delete mode 100644 node_modules/global-modules/LICENSE delete mode 100644 node_modules/global-modules/README.md delete mode 100644 node_modules/global-modules/index.js delete mode 100644 node_modules/global-modules/package.json delete mode 100644 node_modules/global-prefix/LICENSE delete mode 100644 node_modules/global-prefix/README.md delete mode 100644 node_modules/global-prefix/index.js delete mode 120000 node_modules/global-prefix/node_modules/.bin/which delete mode 100644 node_modules/global-prefix/node_modules/which/CHANGELOG.md delete mode 100644 node_modules/global-prefix/node_modules/which/LICENSE delete mode 100644 node_modules/global-prefix/node_modules/which/README.md delete mode 100755 node_modules/global-prefix/node_modules/which/bin/which delete mode 100644 node_modules/global-prefix/node_modules/which/package.json delete mode 100644 node_modules/global-prefix/node_modules/which/which.js delete mode 100644 node_modules/global-prefix/package.json delete mode 100644 node_modules/globals/globals.json delete mode 100644 node_modules/globals/index.d.ts delete mode 100644 node_modules/globals/index.js delete mode 100644 node_modules/globals/license delete mode 100644 node_modules/globals/package.json delete mode 100644 node_modules/globals/readme.md delete mode 100644 node_modules/glogg/LICENSE delete mode 100644 node_modules/glogg/README.md delete mode 100644 node_modules/glogg/index.js delete mode 100644 node_modules/glogg/package.json delete mode 100644 node_modules/gopd/.eslintrc delete mode 100644 node_modules/gopd/.github/FUNDING.yml delete mode 100644 node_modules/gopd/CHANGELOG.md delete mode 100644 node_modules/gopd/LICENSE delete mode 100644 node_modules/gopd/README.md delete mode 100644 node_modules/gopd/index.d.ts delete mode 100644 node_modules/gopd/index.js delete mode 100644 node_modules/gopd/package.json delete mode 100644 node_modules/gopd/test/index.js delete mode 100644 node_modules/gopd/tsconfig.json delete mode 100644 node_modules/graceful-fs/LICENSE delete mode 100644 node_modules/graceful-fs/README.md delete mode 100644 node_modules/graceful-fs/clone.js delete mode 100644 node_modules/graceful-fs/graceful-fs.js delete mode 100644 node_modules/graceful-fs/legacy-streams.js delete mode 100644 node_modules/graceful-fs/package.json delete mode 100644 node_modules/graceful-fs/polyfills.js delete mode 100644 node_modules/gulp-cli/LICENSE delete mode 100644 node_modules/gulp-cli/README.md delete mode 100755 node_modules/gulp-cli/bin/gulp.js delete mode 100644 node_modules/gulp-cli/completion/README.md delete mode 100644 node_modules/gulp-cli/completion/bash delete mode 100644 node_modules/gulp-cli/completion/fish delete mode 100644 node_modules/gulp-cli/completion/powershell delete mode 100644 node_modules/gulp-cli/completion/zsh delete mode 100644 node_modules/gulp-cli/gulp.1 delete mode 100644 node_modules/gulp-cli/index.js delete mode 100644 node_modules/gulp-cli/lib/shared/array-find.js delete mode 100644 node_modules/gulp-cli/lib/shared/completion.js delete mode 100644 node_modules/gulp-cli/lib/shared/config/cli-flags.js delete mode 100644 node_modules/gulp-cli/lib/shared/exit.js delete mode 100644 node_modules/gulp-cli/lib/shared/is-object.js delete mode 100644 node_modules/gulp-cli/lib/shared/log/copy-tree.js delete mode 100644 node_modules/gulp-cli/lib/shared/log/format-hrtime.js delete mode 100644 node_modules/gulp-cli/lib/shared/log/tasks.js delete mode 100644 node_modules/gulp-cli/lib/shared/log/to-console.js delete mode 100644 node_modules/gulp-cli/lib/shared/make-title.js delete mode 100644 node_modules/gulp-cli/lib/shared/options/cli-options.js delete mode 100644 node_modules/gulp-cli/lib/shared/options/make-help.js delete mode 100644 node_modules/gulp-cli/lib/shared/register-exports.js delete mode 100644 node_modules/gulp-cli/lib/shared/require-or-import.js delete mode 100644 node_modules/gulp-cli/lib/shared/tildify.js delete mode 100644 node_modules/gulp-cli/lib/shared/translate.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^3.7.0/format-error.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^3.7.0/index.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^3.7.0/log/events.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^3.7.0/log/tasks-simple.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^3.7.0/task-tree.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/format-error.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/index.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/log/events.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/log/get-task.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/log/sync-task.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/log/tasks-simple.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^4.0.0/normalize-error.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^5.0.0/format-error.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^5.0.0/index.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^5.0.0/log/events.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^5.0.0/log/get-task.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^5.0.0/log/sync-task.js delete mode 100644 node_modules/gulp-cli/lib/versioned/^5.0.0/log/tasks-simple.js delete mode 100644 node_modules/gulp-cli/node_modules/chalk/index.d.ts delete mode 100644 node_modules/gulp-cli/node_modules/chalk/license delete mode 100644 node_modules/gulp-cli/node_modules/chalk/package.json delete mode 100644 node_modules/gulp-cli/node_modules/chalk/readme.md delete mode 100644 node_modules/gulp-cli/node_modules/chalk/source/index.js delete mode 100644 node_modules/gulp-cli/node_modules/chalk/source/templates.js delete mode 100644 node_modules/gulp-cli/node_modules/chalk/source/util.js delete mode 100644 node_modules/gulp-cli/node_modules/cliui/CHANGELOG.md delete mode 100644 node_modules/gulp-cli/node_modules/cliui/LICENSE.txt delete mode 100644 node_modules/gulp-cli/node_modules/cliui/README.md delete mode 100644 node_modules/gulp-cli/node_modules/cliui/build/index.cjs delete mode 100644 node_modules/gulp-cli/node_modules/cliui/build/lib/index.js delete mode 100644 node_modules/gulp-cli/node_modules/cliui/build/lib/string-utils.js delete mode 100644 node_modules/gulp-cli/node_modules/cliui/index.mjs delete mode 100644 node_modules/gulp-cli/node_modules/cliui/package.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/CHANGELOG.md delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/LICENSE.txt delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/README.md delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/browser.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/build/index.cjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/build/lib/index.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/build/lib/string-utils.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/build/lib/tokenize-arg-string.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/build/lib/yargs-parser-types.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/build/lib/yargs-parser.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs-parser/package.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/CHANGELOG.md delete mode 100644 node_modules/gulp-cli/node_modules/yargs/LICENSE delete mode 100644 node_modules/gulp-cli/node_modules/yargs/README.md delete mode 100644 node_modules/gulp-cli/node_modules/yargs/browser.mjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/index.cjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/argsert.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/command.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/completion-templates.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/completion.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/middleware.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/parse-command.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/typings/common-types.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/typings/yargs-parser-types.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/usage.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/apply-extends.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/is-promise.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/levenshtein.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/obj-filter.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/process-argv.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/set-blocking.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/utils/which-module.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/validation.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/yargs-factory.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/build/lib/yerror.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/helpers/helpers.mjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/helpers/index.js delete mode 100644 node_modules/gulp-cli/node_modules/yargs/helpers/package.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/index.cjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/index.mjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/lib/platform-shims/browser.mjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/lib/platform-shims/esm.mjs delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/be.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/de.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/en.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/es.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/fi.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/fr.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/hi.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/hu.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/id.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/it.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/ja.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/ko.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/nb.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/nl.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/nn.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/pirate.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/pl.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/pt.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/pt_BR.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/ru.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/th.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/tr.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/zh_CN.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/locales/zh_TW.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/package.json delete mode 100644 node_modules/gulp-cli/node_modules/yargs/yargs delete mode 100644 node_modules/gulp-cli/package.json delete mode 100644 node_modules/gulp-less/Changelog.md delete mode 100644 node_modules/gulp-less/README.md delete mode 100644 node_modules/gulp-less/index.js delete mode 100644 node_modules/gulp-less/package.json delete mode 100644 node_modules/gulp/LICENSE delete mode 100644 node_modules/gulp/README.md delete mode 100755 node_modules/gulp/bin/gulp.js delete mode 100644 node_modules/gulp/index.js delete mode 100644 node_modules/gulp/index.mjs delete mode 100644 node_modules/gulp/package.json delete mode 100644 node_modules/gulplog/LICENSE delete mode 100644 node_modules/gulplog/README.md delete mode 100644 node_modules/gulplog/index.d.ts delete mode 100644 node_modules/gulplog/index.js delete mode 100644 node_modules/gulplog/package.json delete mode 100644 node_modules/has-flag/index.d.ts delete mode 100644 node_modules/has-flag/index.js delete mode 100644 node_modules/has-flag/license delete mode 100644 node_modules/has-flag/package.json delete mode 100644 node_modules/has-flag/readme.md delete mode 100644 node_modules/has-property-descriptors/.eslintrc delete mode 100644 node_modules/has-property-descriptors/.github/FUNDING.yml delete mode 100644 node_modules/has-property-descriptors/.nycrc delete mode 100644 node_modules/has-property-descriptors/CHANGELOG.md delete mode 100644 node_modules/has-property-descriptors/LICENSE delete mode 100644 node_modules/has-property-descriptors/README.md delete mode 100644 node_modules/has-property-descriptors/index.js delete mode 100644 node_modules/has-property-descriptors/package.json delete mode 100644 node_modules/has-property-descriptors/test/index.js delete mode 100644 node_modules/has-proto/.eslintrc delete mode 100644 node_modules/has-proto/.github/FUNDING.yml delete mode 100644 node_modules/has-proto/CHANGELOG.md delete mode 100644 node_modules/has-proto/LICENSE delete mode 100644 node_modules/has-proto/README.md delete mode 100644 node_modules/has-proto/index.d.ts delete mode 100644 node_modules/has-proto/index.js delete mode 100644 node_modules/has-proto/package.json delete mode 100644 node_modules/has-proto/test/index.js delete mode 100644 node_modules/has-proto/tsconfig.json delete mode 100644 node_modules/has-symbols/.eslintrc delete mode 100644 node_modules/has-symbols/.github/FUNDING.yml delete mode 100644 node_modules/has-symbols/.nycrc delete mode 100644 node_modules/has-symbols/CHANGELOG.md delete mode 100644 node_modules/has-symbols/LICENSE delete mode 100644 node_modules/has-symbols/README.md delete mode 100644 node_modules/has-symbols/index.js delete mode 100644 node_modules/has-symbols/package.json delete mode 100644 node_modules/has-symbols/shams.js delete mode 100644 node_modules/has-symbols/test/index.js delete mode 100644 node_modules/has-symbols/test/shams/core-js.js delete mode 100644 node_modules/has-symbols/test/shams/get-own-property-symbols.js delete mode 100644 node_modules/has-symbols/test/tests.js delete mode 100644 node_modules/has-tostringtag/.eslintrc delete mode 100644 node_modules/has-tostringtag/.github/FUNDING.yml delete mode 100644 node_modules/has-tostringtag/.nycrc delete mode 100644 node_modules/has-tostringtag/CHANGELOG.md delete mode 100644 node_modules/has-tostringtag/LICENSE delete mode 100644 node_modules/has-tostringtag/README.md delete mode 100644 node_modules/has-tostringtag/index.d.ts delete mode 100644 node_modules/has-tostringtag/index.js delete mode 100644 node_modules/has-tostringtag/package.json delete mode 100644 node_modules/has-tostringtag/shams.d.ts delete mode 100644 node_modules/has-tostringtag/shams.js delete mode 100644 node_modules/has-tostringtag/test/index.js delete mode 100644 node_modules/has-tostringtag/test/shams/core-js.js delete mode 100644 node_modules/has-tostringtag/test/shams/get-own-property-symbols.js delete mode 100644 node_modules/has-tostringtag/test/tests.js delete mode 100644 node_modules/has-tostringtag/tsconfig.json delete mode 100644 node_modules/hasown/.eslintrc delete mode 100644 node_modules/hasown/.github/FUNDING.yml delete mode 100644 node_modules/hasown/.nycrc delete mode 100644 node_modules/hasown/CHANGELOG.md delete mode 100644 node_modules/hasown/LICENSE delete mode 100644 node_modules/hasown/README.md delete mode 100644 node_modules/hasown/index.d.ts delete mode 100644 node_modules/hasown/index.js delete mode 100644 node_modules/hasown/package.json delete mode 100644 node_modules/hasown/tsconfig.json delete mode 100644 node_modules/homedir-polyfill/LICENSE delete mode 100644 node_modules/homedir-polyfill/README.md delete mode 100644 node_modules/homedir-polyfill/index.js delete mode 100644 node_modules/homedir-polyfill/package.json delete mode 100644 node_modules/homedir-polyfill/polyfill.js delete mode 100644 node_modules/iconv-lite/.github/dependabot.yml delete mode 100644 node_modules/iconv-lite/.idea/codeStyles/Project.xml delete mode 100644 node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml delete mode 100644 node_modules/iconv-lite/.idea/iconv-lite.iml delete mode 100644 node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml delete mode 100644 node_modules/iconv-lite/.idea/modules.xml delete mode 100644 node_modules/iconv-lite/.idea/vcs.xml delete mode 100644 node_modules/iconv-lite/Changelog.md delete mode 100644 node_modules/iconv-lite/LICENSE delete mode 100644 node_modules/iconv-lite/README.md delete mode 100644 node_modules/iconv-lite/encodings/dbcs-codec.js delete mode 100644 node_modules/iconv-lite/encodings/dbcs-data.js delete mode 100644 node_modules/iconv-lite/encodings/index.js delete mode 100644 node_modules/iconv-lite/encodings/internal.js delete mode 100644 node_modules/iconv-lite/encodings/sbcs-codec.js delete mode 100644 node_modules/iconv-lite/encodings/sbcs-data-generated.js delete mode 100644 node_modules/iconv-lite/encodings/sbcs-data.js delete mode 100644 node_modules/iconv-lite/encodings/tables/big5-added.json delete mode 100644 node_modules/iconv-lite/encodings/tables/cp936.json delete mode 100644 node_modules/iconv-lite/encodings/tables/cp949.json delete mode 100644 node_modules/iconv-lite/encodings/tables/cp950.json delete mode 100644 node_modules/iconv-lite/encodings/tables/eucjp.json delete mode 100644 node_modules/iconv-lite/encodings/tables/gb18030-ranges.json delete mode 100644 node_modules/iconv-lite/encodings/tables/gbk-added.json delete mode 100644 node_modules/iconv-lite/encodings/tables/shiftjis.json delete mode 100644 node_modules/iconv-lite/encodings/utf16.js delete mode 100644 node_modules/iconv-lite/encodings/utf32.js delete mode 100644 node_modules/iconv-lite/encodings/utf7.js delete mode 100644 node_modules/iconv-lite/lib/bom-handling.js delete mode 100644 node_modules/iconv-lite/lib/index.d.ts delete mode 100644 node_modules/iconv-lite/lib/index.js delete mode 100644 node_modules/iconv-lite/lib/streams.js delete mode 100644 node_modules/iconv-lite/package.json delete mode 100644 node_modules/ieee754/LICENSE delete mode 100644 node_modules/ieee754/README.md delete mode 100644 node_modules/ieee754/index.d.ts delete mode 100644 node_modules/ieee754/index.js delete mode 100644 node_modules/ieee754/package.json delete mode 100644 node_modules/ignore/LICENSE-MIT delete mode 100644 node_modules/ignore/README.md delete mode 100644 node_modules/ignore/index.d.ts delete mode 100644 node_modules/ignore/index.js delete mode 100644 node_modules/ignore/legacy.js delete mode 100644 node_modules/ignore/package.json delete mode 100644 node_modules/image-size/LICENSE delete mode 100644 node_modules/image-size/Readme.md delete mode 100755 node_modules/image-size/bin/image-size.js delete mode 100644 node_modules/image-size/lib/detector.js delete mode 100644 node_modules/image-size/lib/index.js delete mode 100644 node_modules/image-size/lib/readUInt.js delete mode 100644 node_modules/image-size/lib/types.js delete mode 100644 node_modules/image-size/lib/types/bmp.js delete mode 100644 node_modules/image-size/lib/types/dds.js delete mode 100644 node_modules/image-size/lib/types/gif.js delete mode 100644 node_modules/image-size/lib/types/jpg.js delete mode 100644 node_modules/image-size/lib/types/png.js delete mode 100644 node_modules/image-size/lib/types/psd.js delete mode 100644 node_modules/image-size/lib/types/svg.js delete mode 100644 node_modules/image-size/lib/types/tiff.js delete mode 100644 node_modules/image-size/lib/types/webp.js delete mode 100644 node_modules/image-size/package.json delete mode 100644 node_modules/immediate/LICENSE.txt delete mode 100644 node_modules/immediate/README.md delete mode 100644 node_modules/immediate/dist/immediate.js delete mode 100644 node_modules/immediate/dist/immediate.min.js delete mode 100644 node_modules/immediate/lib/browser.js delete mode 100644 node_modules/immediate/lib/index.js delete mode 100644 node_modules/immediate/package.json delete mode 100644 node_modules/import-fresh/index.d.ts delete mode 100644 node_modules/import-fresh/index.js delete mode 100644 node_modules/import-fresh/license delete mode 100644 node_modules/import-fresh/package.json delete mode 100644 node_modules/import-fresh/readme.md delete mode 100644 node_modules/imurmurhash/README.md delete mode 100644 node_modules/imurmurhash/imurmurhash.js delete mode 100644 node_modules/imurmurhash/imurmurhash.min.js delete mode 100644 node_modules/imurmurhash/package.json delete mode 100644 node_modules/inherits/LICENSE delete mode 100644 node_modules/inherits/README.md delete mode 100644 node_modules/inherits/inherits.js delete mode 100644 node_modules/inherits/inherits_browser.js delete mode 100644 node_modules/inherits/package.json delete mode 100644 node_modules/ini/LICENSE delete mode 100644 node_modules/ini/README.md delete mode 100644 node_modules/ini/ini.js delete mode 100644 node_modules/ini/package.json delete mode 100644 node_modules/interpret/LICENSE delete mode 100644 node_modules/interpret/README.md delete mode 100644 node_modules/interpret/cjs-stub.js delete mode 100644 node_modules/interpret/index.js delete mode 100644 node_modules/interpret/mjs-stub.js delete mode 100644 node_modules/interpret/package.json delete mode 100644 node_modules/is-absolute/LICENSE delete mode 100644 node_modules/is-absolute/README.md delete mode 100644 node_modules/is-absolute/index.js delete mode 100644 node_modules/is-absolute/package.json delete mode 100644 node_modules/is-arguments/.editorconfig delete mode 100644 node_modules/is-arguments/.eslintignore delete mode 100644 node_modules/is-arguments/.eslintrc delete mode 100644 node_modules/is-arguments/.github/FUNDING.yml delete mode 100644 node_modules/is-arguments/.nycrc delete mode 100644 node_modules/is-arguments/CHANGELOG.md delete mode 100644 node_modules/is-arguments/LICENSE delete mode 100644 node_modules/is-arguments/README.md delete mode 100644 node_modules/is-arguments/index.js delete mode 100644 node_modules/is-arguments/package.json delete mode 100644 node_modules/is-arguments/test/index.js delete mode 100644 node_modules/is-binary-path/index.d.ts delete mode 100644 node_modules/is-binary-path/index.js delete mode 100644 node_modules/is-binary-path/license delete mode 100644 node_modules/is-binary-path/package.json delete mode 100644 node_modules/is-binary-path/readme.md delete mode 100644 node_modules/is-buffer/LICENSE delete mode 100644 node_modules/is-buffer/README.md delete mode 100644 node_modules/is-buffer/index.d.ts delete mode 100644 node_modules/is-buffer/index.js delete mode 100644 node_modules/is-buffer/package.json delete mode 100644 node_modules/is-callable/.editorconfig delete mode 100644 node_modules/is-callable/.eslintrc delete mode 100644 node_modules/is-callable/.github/FUNDING.yml delete mode 100644 node_modules/is-callable/.nycrc delete mode 100644 node_modules/is-callable/CHANGELOG.md delete mode 100644 node_modules/is-callable/LICENSE delete mode 100644 node_modules/is-callable/README.md delete mode 100644 node_modules/is-callable/index.js delete mode 100644 node_modules/is-callable/package.json delete mode 100644 node_modules/is-callable/test/index.js delete mode 100644 node_modules/is-core-module/.eslintrc delete mode 100644 node_modules/is-core-module/.nycrc delete mode 100644 node_modules/is-core-module/CHANGELOG.md delete mode 100644 node_modules/is-core-module/LICENSE delete mode 100644 node_modules/is-core-module/README.md delete mode 100644 node_modules/is-core-module/core.json delete mode 100644 node_modules/is-core-module/index.js delete mode 100644 node_modules/is-core-module/package.json delete mode 100644 node_modules/is-core-module/test/index.js delete mode 100644 node_modules/is-extendable/LICENSE delete mode 100644 node_modules/is-extendable/README.md delete mode 100644 node_modules/is-extendable/index.d.ts delete mode 100644 node_modules/is-extendable/index.js delete mode 100644 node_modules/is-extendable/node_modules/is-plain-object/LICENSE delete mode 100644 node_modules/is-extendable/node_modules/is-plain-object/README.md delete mode 100644 node_modules/is-extendable/node_modules/is-plain-object/index.d.ts delete mode 100644 node_modules/is-extendable/node_modules/is-plain-object/index.js delete mode 100644 node_modules/is-extendable/node_modules/is-plain-object/package.json delete mode 100644 node_modules/is-extendable/package.json delete mode 100644 node_modules/is-extglob/LICENSE delete mode 100644 node_modules/is-extglob/README.md delete mode 100644 node_modules/is-extglob/index.js delete mode 100644 node_modules/is-extglob/package.json delete mode 100644 node_modules/is-fullwidth-code-point/index.d.ts delete mode 100644 node_modules/is-fullwidth-code-point/index.js delete mode 100644 node_modules/is-fullwidth-code-point/license delete mode 100644 node_modules/is-fullwidth-code-point/package.json delete mode 100644 node_modules/is-fullwidth-code-point/readme.md delete mode 100644 node_modules/is-generator-function/.eslintignore delete mode 100644 node_modules/is-generator-function/.eslintrc delete mode 100644 node_modules/is-generator-function/.nvmrc delete mode 100644 node_modules/is-generator-function/.nycrc delete mode 100644 node_modules/is-generator-function/CHANGELOG.md delete mode 100644 node_modules/is-generator-function/LICENSE delete mode 100644 node_modules/is-generator-function/README.md delete mode 100644 node_modules/is-generator-function/index.js delete mode 100644 node_modules/is-generator-function/package.json delete mode 100644 node_modules/is-generator-function/test/corejs.js delete mode 100644 node_modules/is-generator-function/test/index.js delete mode 100644 node_modules/is-generator-function/test/uglified.js delete mode 100644 node_modules/is-glob/LICENSE delete mode 100644 node_modules/is-glob/README.md delete mode 100644 node_modules/is-glob/index.js delete mode 100644 node_modules/is-glob/package.json delete mode 100644 node_modules/is-negated-glob/LICENSE delete mode 100644 node_modules/is-negated-glob/README.md delete mode 100644 node_modules/is-negated-glob/index.js delete mode 100644 node_modules/is-negated-glob/package.json delete mode 100644 node_modules/is-number/LICENSE delete mode 100644 node_modules/is-number/README.md delete mode 100644 node_modules/is-number/index.js delete mode 100644 node_modules/is-number/package.json delete mode 100644 node_modules/is-plain-object/LICENSE delete mode 100644 node_modules/is-plain-object/README.md delete mode 100644 node_modules/is-plain-object/dist/is-plain-object.js delete mode 100644 node_modules/is-plain-object/dist/is-plain-object.mjs delete mode 100644 node_modules/is-plain-object/is-plain-object.d.ts delete mode 100644 node_modules/is-plain-object/package.json delete mode 100644 node_modules/is-relative/LICENSE delete mode 100644 node_modules/is-relative/README.md delete mode 100644 node_modules/is-relative/index.js delete mode 100644 node_modules/is-relative/package.json delete mode 100644 node_modules/is-typed-array/.editorconfig delete mode 100644 node_modules/is-typed-array/.eslintrc delete mode 100644 node_modules/is-typed-array/.github/FUNDING.yml delete mode 100644 node_modules/is-typed-array/.nycrc delete mode 100644 node_modules/is-typed-array/CHANGELOG.md delete mode 100644 node_modules/is-typed-array/LICENSE delete mode 100644 node_modules/is-typed-array/README.md delete mode 100644 node_modules/is-typed-array/index.d.ts delete mode 100644 node_modules/is-typed-array/index.js delete mode 100644 node_modules/is-typed-array/package.json delete mode 100644 node_modules/is-typed-array/test/index.js delete mode 100644 node_modules/is-typed-array/tsconfig.json delete mode 100644 node_modules/is-unc-path/LICENSE delete mode 100644 node_modules/is-unc-path/README.md delete mode 100644 node_modules/is-unc-path/index.js delete mode 100644 node_modules/is-unc-path/package.json delete mode 100644 node_modules/is-valid-glob/LICENSE delete mode 100644 node_modules/is-valid-glob/README.md delete mode 100644 node_modules/is-valid-glob/index.js delete mode 100644 node_modules/is-valid-glob/package.json delete mode 100644 node_modules/is-what/.babelrc delete mode 100644 node_modules/is-what/.eslintignore delete mode 100644 node_modules/is-what/.eslintrc.js delete mode 100644 node_modules/is-what/.github/FUNDING.yml delete mode 100644 node_modules/is-what/.prettierrc delete mode 100644 node_modules/is-what/.vscode/settings.json delete mode 100644 node_modules/is-what/LICENSE delete mode 100644 node_modules/is-what/README.md delete mode 100644 node_modules/is-what/build.js delete mode 100644 node_modules/is-what/dist/index.cjs.js delete mode 100644 node_modules/is-what/dist/index.esm.js delete mode 100644 node_modules/is-what/package.json delete mode 100644 node_modules/is-what/src/index.ts delete mode 100644 node_modules/is-what/test/ava.ts delete mode 100644 node_modules/is-what/test/index.test.js delete mode 100644 node_modules/is-what/tsconfig.json delete mode 100644 node_modules/is-what/types/index.d.ts delete mode 100644 node_modules/is-windows/LICENSE delete mode 100644 node_modules/is-windows/README.md delete mode 100644 node_modules/is-windows/index.js delete mode 100644 node_modules/is-windows/package.json delete mode 100644 node_modules/isexe/.npmignore delete mode 100644 node_modules/isexe/LICENSE delete mode 100644 node_modules/isexe/README.md delete mode 100644 node_modules/isexe/index.js delete mode 100644 node_modules/isexe/mode.js delete mode 100644 node_modules/isexe/package.json delete mode 100644 node_modules/isexe/test/basic.js delete mode 100644 node_modules/isexe/windows.js delete mode 100644 node_modules/isobject/LICENSE delete mode 100644 node_modules/isobject/README.md delete mode 100644 node_modules/isobject/index.d.ts delete mode 100644 node_modules/isobject/index.js delete mode 100644 node_modules/isobject/package.json delete mode 100644 node_modules/js-yaml/CHANGELOG.md delete mode 100644 node_modules/js-yaml/LICENSE delete mode 100644 node_modules/js-yaml/README.md delete mode 100755 node_modules/js-yaml/bin/js-yaml.js delete mode 100644 node_modules/js-yaml/dist/js-yaml.js delete mode 100644 node_modules/js-yaml/dist/js-yaml.min.js delete mode 100644 node_modules/js-yaml/dist/js-yaml.mjs delete mode 100644 node_modules/js-yaml/index.js delete mode 100644 node_modules/js-yaml/lib/common.js delete mode 100644 node_modules/js-yaml/lib/dumper.js delete mode 100644 node_modules/js-yaml/lib/exception.js delete mode 100644 node_modules/js-yaml/lib/loader.js delete mode 100644 node_modules/js-yaml/lib/schema.js delete mode 100644 node_modules/js-yaml/lib/schema/core.js delete mode 100644 node_modules/js-yaml/lib/schema/default.js delete mode 100644 node_modules/js-yaml/lib/schema/failsafe.js delete mode 100644 node_modules/js-yaml/lib/schema/json.js delete mode 100644 node_modules/js-yaml/lib/snippet.js delete mode 100644 node_modules/js-yaml/lib/type.js delete mode 100644 node_modules/js-yaml/lib/type/binary.js delete mode 100644 node_modules/js-yaml/lib/type/bool.js delete mode 100644 node_modules/js-yaml/lib/type/float.js delete mode 100644 node_modules/js-yaml/lib/type/int.js delete mode 100644 node_modules/js-yaml/lib/type/map.js delete mode 100644 node_modules/js-yaml/lib/type/merge.js delete mode 100644 node_modules/js-yaml/lib/type/null.js delete mode 100644 node_modules/js-yaml/lib/type/omap.js delete mode 100644 node_modules/js-yaml/lib/type/pairs.js delete mode 100644 node_modules/js-yaml/lib/type/seq.js delete mode 100644 node_modules/js-yaml/lib/type/set.js delete mode 100644 node_modules/js-yaml/lib/type/str.js delete mode 100644 node_modules/js-yaml/lib/type/timestamp.js delete mode 100644 node_modules/js-yaml/package.json delete mode 100644 node_modules/jsdoc-type-pratt-parser/LICENSE delete mode 100644 node_modules/jsdoc-type-pratt-parser/README.md delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/index.js delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/Parser.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/Precedence.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/assertTypes.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/errors.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/grammars/Grammar.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/grammars/baseGrammar.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/grammars/closureGrammar.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/grammars/jsdocGrammar.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/grammars/pathGrammar.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/grammars/typescriptGrammar.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/index.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/lexer/Lexer.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/lexer/Token.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parse.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ArrayBracketsParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ArrowFunctionParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/FunctionParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/GenericParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ImportParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/IntersectionParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/KeyOfParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/KeyValueParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/NameParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/NamePathParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/NotNullableParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/NullableParslets.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/NumberParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ObjectFieldParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ObjectParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ObjectSquaredPropertyParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/OptionalParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ParameterListParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ParenthesisParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/Parslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/ReadonlyPropertyParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/SpecialNamePathParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/SpecialTypesParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/StringValueParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/SymbolParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/TupleParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/TypeOfParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/UnionParslets.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/VariadicParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/isQuestionMarkUnkownType.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/parslets/predicateParslet.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/result/IntermediateResult.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/result/NonRootResult.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/result/RootResult.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/transforms/catharsisTransform.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/transforms/identityTransformRules.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/transforms/jtpTransform.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/transforms/simplify.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/transforms/stringify.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/transforms/transform.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/traverse.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/src/visitorKeys.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/test/fixtures/Fixture.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/test/fixtures/typescript/namePath.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/dist/test/fuzzer.d.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/package.json delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/Parser.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/Precedence.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/assertTypes.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/errors.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/grammars/Grammar.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/grammars/baseGrammar.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/grammars/closureGrammar.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/grammars/jsdocGrammar.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/grammars/pathGrammar.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/grammars/typescriptGrammar.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/index.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/lexer/Lexer.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/lexer/Token.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parse.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ArrayBracketsParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ArrowFunctionParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/FunctionParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/GenericParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ImportParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/IntersectionParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/KeyOfParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/KeyValueParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/NameParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/NamePathParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/NotNullableParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/NullableParslets.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/NumberParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ObjectFieldParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ObjectParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ObjectSquaredPropertyParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/OptionalParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ParameterListParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ParenthesisParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/Parslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/ReadonlyPropertyParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/SpecialNamePathParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/SpecialTypesParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/StringValueParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/SymbolParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/TupleParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/TypeOfParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/UnionParslets.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/VariadicParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/isQuestionMarkUnkownType.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/parslets/predicateParslet.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/result/IntermediateResult.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/result/NonRootResult.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/result/RootResult.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/transforms/catharsisTransform.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/transforms/identityTransformRules.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/transforms/jtpTransform.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/transforms/simplify.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/transforms/stringify.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/transforms/transform.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/traverse.ts delete mode 100644 node_modules/jsdoc-type-pratt-parser/src/visitorKeys.ts delete mode 100644 node_modules/json-buffer/.travis.yml delete mode 100644 node_modules/json-buffer/LICENSE delete mode 100644 node_modules/json-buffer/README.md delete mode 100644 node_modules/json-buffer/index.js delete mode 100644 node_modules/json-buffer/package.json delete mode 100644 node_modules/json-buffer/test/index.js delete mode 100644 node_modules/json-schema-traverse/.eslintrc.yml delete mode 100644 node_modules/json-schema-traverse/.travis.yml delete mode 100644 node_modules/json-schema-traverse/LICENSE delete mode 100644 node_modules/json-schema-traverse/README.md delete mode 100644 node_modules/json-schema-traverse/index.js delete mode 100644 node_modules/json-schema-traverse/package.json delete mode 100644 node_modules/json-schema-traverse/spec/.eslintrc.yml delete mode 100644 node_modules/json-schema-traverse/spec/fixtures/schema.js delete mode 100644 node_modules/json-schema-traverse/spec/index.spec.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/.npmignore delete mode 100644 node_modules/json-stable-stringify-without-jsonify/.travis.yml delete mode 100644 node_modules/json-stable-stringify-without-jsonify/LICENSE delete mode 100644 node_modules/json-stable-stringify-without-jsonify/example/key_cmp.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/example/nested.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/example/str.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/example/value_cmp.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/index.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/package.json delete mode 100644 node_modules/json-stable-stringify-without-jsonify/readme.markdown delete mode 100644 node_modules/json-stable-stringify-without-jsonify/test/cmp.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/test/nested.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/test/replacer.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/test/space.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/test/str.js delete mode 100644 node_modules/json-stable-stringify-without-jsonify/test/to-json.js delete mode 100644 node_modules/keyv/README.md delete mode 100644 node_modules/keyv/package.json delete mode 100644 node_modules/keyv/src/index.d.ts delete mode 100644 node_modules/keyv/src/index.js delete mode 100644 node_modules/last-run/LICENSE delete mode 100644 node_modules/last-run/README.md delete mode 100644 node_modules/last-run/index.js delete mode 100644 node_modules/last-run/package.json delete mode 100644 node_modules/lead/LICENSE delete mode 100644 node_modules/lead/README.md delete mode 100644 node_modules/lead/index.js delete mode 100644 node_modules/lead/package.json delete mode 100644 node_modules/less/.eslintignore delete mode 100644 node_modules/less/.eslintrc.js delete mode 100644 node_modules/less/Gruntfile.js delete mode 100644 node_modules/less/README.md delete mode 100755 node_modules/less/bin/lessc delete mode 100644 node_modules/less/bower.json delete mode 100644 node_modules/less/dist/less.js delete mode 100644 node_modules/less/dist/less.min.js delete mode 100644 node_modules/less/dist/less.min.js.map delete mode 100644 node_modules/less/index.js delete mode 100644 node_modules/less/lib/less-browser/add-default-options.js delete mode 100644 node_modules/less/lib/less-browser/add-default-options.js.map delete mode 100644 node_modules/less/lib/less-browser/bootstrap.js delete mode 100644 node_modules/less/lib/less-browser/bootstrap.js.map delete mode 100644 node_modules/less/lib/less-browser/browser.js delete mode 100644 node_modules/less/lib/less-browser/browser.js.map delete mode 100644 node_modules/less/lib/less-browser/cache.js delete mode 100644 node_modules/less/lib/less-browser/cache.js.map delete mode 100644 node_modules/less/lib/less-browser/error-reporting.js delete mode 100644 node_modules/less/lib/less-browser/error-reporting.js.map delete mode 100644 node_modules/less/lib/less-browser/file-manager.js delete mode 100644 node_modules/less/lib/less-browser/file-manager.js.map delete mode 100644 node_modules/less/lib/less-browser/image-size.js delete mode 100644 node_modules/less/lib/less-browser/image-size.js.map delete mode 100644 node_modules/less/lib/less-browser/index.js delete mode 100644 node_modules/less/lib/less-browser/index.js.map delete mode 100644 node_modules/less/lib/less-browser/log-listener.js delete mode 100644 node_modules/less/lib/less-browser/log-listener.js.map delete mode 100644 node_modules/less/lib/less-browser/plugin-loader.js delete mode 100644 node_modules/less/lib/less-browser/plugin-loader.js.map delete mode 100644 node_modules/less/lib/less-browser/utils.js delete mode 100644 node_modules/less/lib/less-browser/utils.js.map delete mode 100644 node_modules/less/lib/less-node/environment.js delete mode 100644 node_modules/less/lib/less-node/environment.js.map delete mode 100644 node_modules/less/lib/less-node/file-manager.js delete mode 100644 node_modules/less/lib/less-node/file-manager.js.map delete mode 100644 node_modules/less/lib/less-node/fs.js delete mode 100644 node_modules/less/lib/less-node/fs.js.map delete mode 100644 node_modules/less/lib/less-node/image-size.js delete mode 100644 node_modules/less/lib/less-node/image-size.js.map delete mode 100644 node_modules/less/lib/less-node/index.js delete mode 100644 node_modules/less/lib/less-node/index.js.map delete mode 100644 node_modules/less/lib/less-node/lessc-helper.js delete mode 100644 node_modules/less/lib/less-node/lessc-helper.js.map delete mode 100644 node_modules/less/lib/less-node/plugin-loader.js delete mode 100644 node_modules/less/lib/less-node/plugin-loader.js.map delete mode 100644 node_modules/less/lib/less-node/url-file-manager.js delete mode 100644 node_modules/less/lib/less-node/url-file-manager.js.map delete mode 100644 node_modules/less/lib/less/constants.js delete mode 100644 node_modules/less/lib/less/constants.js.map delete mode 100644 node_modules/less/lib/less/contexts.js delete mode 100644 node_modules/less/lib/less/contexts.js.map delete mode 100644 node_modules/less/lib/less/data/colors.js delete mode 100644 node_modules/less/lib/less/data/colors.js.map delete mode 100644 node_modules/less/lib/less/data/index.js delete mode 100644 node_modules/less/lib/less/data/index.js.map delete mode 100644 node_modules/less/lib/less/data/unit-conversions.js delete mode 100644 node_modules/less/lib/less/data/unit-conversions.js.map delete mode 100644 node_modules/less/lib/less/default-options.js delete mode 100644 node_modules/less/lib/less/default-options.js.map delete mode 100644 node_modules/less/lib/less/environment/abstract-file-manager.js delete mode 100644 node_modules/less/lib/less/environment/abstract-file-manager.js.map delete mode 100644 node_modules/less/lib/less/environment/abstract-plugin-loader.js delete mode 100644 node_modules/less/lib/less/environment/abstract-plugin-loader.js.map delete mode 100644 node_modules/less/lib/less/environment/environment-api.js delete mode 100644 node_modules/less/lib/less/environment/environment-api.js.map delete mode 100644 node_modules/less/lib/less/environment/environment.js delete mode 100644 node_modules/less/lib/less/environment/environment.js.map delete mode 100644 node_modules/less/lib/less/environment/file-manager-api.js delete mode 100644 node_modules/less/lib/less/environment/file-manager-api.js.map delete mode 100644 node_modules/less/lib/less/functions/boolean.js delete mode 100644 node_modules/less/lib/less/functions/boolean.js.map delete mode 100644 node_modules/less/lib/less/functions/color-blending.js delete mode 100644 node_modules/less/lib/less/functions/color-blending.js.map delete mode 100644 node_modules/less/lib/less/functions/color.js delete mode 100644 node_modules/less/lib/less/functions/color.js.map delete mode 100644 node_modules/less/lib/less/functions/data-uri.js delete mode 100644 node_modules/less/lib/less/functions/data-uri.js.map delete mode 100644 node_modules/less/lib/less/functions/default.js delete mode 100644 node_modules/less/lib/less/functions/default.js.map delete mode 100644 node_modules/less/lib/less/functions/function-caller.js delete mode 100644 node_modules/less/lib/less/functions/function-caller.js.map delete mode 100644 node_modules/less/lib/less/functions/function-registry.js delete mode 100644 node_modules/less/lib/less/functions/function-registry.js.map delete mode 100644 node_modules/less/lib/less/functions/index.js delete mode 100644 node_modules/less/lib/less/functions/index.js.map delete mode 100644 node_modules/less/lib/less/functions/list.js delete mode 100644 node_modules/less/lib/less/functions/list.js.map delete mode 100644 node_modules/less/lib/less/functions/math-helper.js delete mode 100644 node_modules/less/lib/less/functions/math-helper.js.map delete mode 100644 node_modules/less/lib/less/functions/math.js delete mode 100644 node_modules/less/lib/less/functions/math.js.map delete mode 100644 node_modules/less/lib/less/functions/number.js delete mode 100644 node_modules/less/lib/less/functions/number.js.map delete mode 100644 node_modules/less/lib/less/functions/string.js delete mode 100644 node_modules/less/lib/less/functions/string.js.map delete mode 100644 node_modules/less/lib/less/functions/style.js delete mode 100644 node_modules/less/lib/less/functions/style.js.map delete mode 100644 node_modules/less/lib/less/functions/svg.js delete mode 100644 node_modules/less/lib/less/functions/svg.js.map delete mode 100644 node_modules/less/lib/less/functions/types.js delete mode 100644 node_modules/less/lib/less/functions/types.js.map delete mode 100644 node_modules/less/lib/less/import-manager.js delete mode 100644 node_modules/less/lib/less/import-manager.js.map delete mode 100644 node_modules/less/lib/less/index.js delete mode 100644 node_modules/less/lib/less/index.js.map delete mode 100644 node_modules/less/lib/less/less-error.js delete mode 100644 node_modules/less/lib/less/less-error.js.map delete mode 100644 node_modules/less/lib/less/logger.js delete mode 100644 node_modules/less/lib/less/logger.js.map delete mode 100644 node_modules/less/lib/less/parse-tree.js delete mode 100644 node_modules/less/lib/less/parse-tree.js.map delete mode 100644 node_modules/less/lib/less/parse.js delete mode 100644 node_modules/less/lib/less/parse.js.map delete mode 100644 node_modules/less/lib/less/parser/chunker.js delete mode 100644 node_modules/less/lib/less/parser/chunker.js.map delete mode 100644 node_modules/less/lib/less/parser/parser-input.js delete mode 100644 node_modules/less/lib/less/parser/parser-input.js.map delete mode 100644 node_modules/less/lib/less/parser/parser.js delete mode 100644 node_modules/less/lib/less/parser/parser.js.map delete mode 100644 node_modules/less/lib/less/plugin-manager.js delete mode 100644 node_modules/less/lib/less/plugin-manager.js.map delete mode 100644 node_modules/less/lib/less/render.js delete mode 100644 node_modules/less/lib/less/render.js.map delete mode 100644 node_modules/less/lib/less/source-map-builder.js delete mode 100644 node_modules/less/lib/less/source-map-builder.js.map delete mode 100644 node_modules/less/lib/less/source-map-output.js delete mode 100644 node_modules/less/lib/less/source-map-output.js.map delete mode 100644 node_modules/less/lib/less/transform-tree.js delete mode 100644 node_modules/less/lib/less/transform-tree.js.map delete mode 100644 node_modules/less/lib/less/tree/anonymous.js delete mode 100644 node_modules/less/lib/less/tree/anonymous.js.map delete mode 100644 node_modules/less/lib/less/tree/assignment.js delete mode 100644 node_modules/less/lib/less/tree/assignment.js.map delete mode 100644 node_modules/less/lib/less/tree/atrule-syntax.js delete mode 100644 node_modules/less/lib/less/tree/atrule-syntax.js.map delete mode 100644 node_modules/less/lib/less/tree/atrule.js delete mode 100644 node_modules/less/lib/less/tree/atrule.js.map delete mode 100644 node_modules/less/lib/less/tree/attribute.js delete mode 100644 node_modules/less/lib/less/tree/attribute.js.map delete mode 100644 node_modules/less/lib/less/tree/call.js delete mode 100644 node_modules/less/lib/less/tree/call.js.map delete mode 100644 node_modules/less/lib/less/tree/color.js delete mode 100644 node_modules/less/lib/less/tree/color.js.map delete mode 100644 node_modules/less/lib/less/tree/combinator.js delete mode 100644 node_modules/less/lib/less/tree/combinator.js.map delete mode 100644 node_modules/less/lib/less/tree/comment.js delete mode 100644 node_modules/less/lib/less/tree/comment.js.map delete mode 100644 node_modules/less/lib/less/tree/condition.js delete mode 100644 node_modules/less/lib/less/tree/condition.js.map delete mode 100644 node_modules/less/lib/less/tree/container.js delete mode 100644 node_modules/less/lib/less/tree/container.js.map delete mode 100644 node_modules/less/lib/less/tree/debug-info.js delete mode 100644 node_modules/less/lib/less/tree/debug-info.js.map delete mode 100644 node_modules/less/lib/less/tree/declaration.js delete mode 100644 node_modules/less/lib/less/tree/declaration.js.map delete mode 100644 node_modules/less/lib/less/tree/detached-ruleset.js delete mode 100644 node_modules/less/lib/less/tree/detached-ruleset.js.map delete mode 100644 node_modules/less/lib/less/tree/dimension.js delete mode 100644 node_modules/less/lib/less/tree/dimension.js.map delete mode 100644 node_modules/less/lib/less/tree/element.js delete mode 100644 node_modules/less/lib/less/tree/element.js.map delete mode 100644 node_modules/less/lib/less/tree/expression.js delete mode 100644 node_modules/less/lib/less/tree/expression.js.map delete mode 100644 node_modules/less/lib/less/tree/extend.js delete mode 100644 node_modules/less/lib/less/tree/extend.js.map delete mode 100644 node_modules/less/lib/less/tree/import.js delete mode 100644 node_modules/less/lib/less/tree/import.js.map delete mode 100644 node_modules/less/lib/less/tree/index.js delete mode 100644 node_modules/less/lib/less/tree/index.js.map delete mode 100644 node_modules/less/lib/less/tree/javascript.js delete mode 100644 node_modules/less/lib/less/tree/javascript.js.map delete mode 100644 node_modules/less/lib/less/tree/js-eval-node.js delete mode 100644 node_modules/less/lib/less/tree/js-eval-node.js.map delete mode 100644 node_modules/less/lib/less/tree/keyword.js delete mode 100644 node_modules/less/lib/less/tree/keyword.js.map delete mode 100644 node_modules/less/lib/less/tree/media.js delete mode 100644 node_modules/less/lib/less/tree/media.js.map delete mode 100644 node_modules/less/lib/less/tree/mixin-call.js delete mode 100644 node_modules/less/lib/less/tree/mixin-call.js.map delete mode 100644 node_modules/less/lib/less/tree/mixin-definition.js delete mode 100644 node_modules/less/lib/less/tree/mixin-definition.js.map delete mode 100644 node_modules/less/lib/less/tree/namespace-value.js delete mode 100644 node_modules/less/lib/less/tree/namespace-value.js.map delete mode 100644 node_modules/less/lib/less/tree/negative.js delete mode 100644 node_modules/less/lib/less/tree/negative.js.map delete mode 100644 node_modules/less/lib/less/tree/nested-at-rule.js delete mode 100644 node_modules/less/lib/less/tree/nested-at-rule.js.map delete mode 100644 node_modules/less/lib/less/tree/node.js delete mode 100644 node_modules/less/lib/less/tree/node.js.map delete mode 100644 node_modules/less/lib/less/tree/operation.js delete mode 100644 node_modules/less/lib/less/tree/operation.js.map delete mode 100644 node_modules/less/lib/less/tree/paren.js delete mode 100644 node_modules/less/lib/less/tree/paren.js.map delete mode 100644 node_modules/less/lib/less/tree/property.js delete mode 100644 node_modules/less/lib/less/tree/property.js.map delete mode 100644 node_modules/less/lib/less/tree/query-in-parens.js delete mode 100644 node_modules/less/lib/less/tree/query-in-parens.js.map delete mode 100644 node_modules/less/lib/less/tree/quoted.js delete mode 100644 node_modules/less/lib/less/tree/quoted.js.map delete mode 100644 node_modules/less/lib/less/tree/ruleset.js delete mode 100644 node_modules/less/lib/less/tree/ruleset.js.map delete mode 100644 node_modules/less/lib/less/tree/selector.js delete mode 100644 node_modules/less/lib/less/tree/selector.js.map delete mode 100644 node_modules/less/lib/less/tree/unicode-descriptor.js delete mode 100644 node_modules/less/lib/less/tree/unicode-descriptor.js.map delete mode 100644 node_modules/less/lib/less/tree/unit.js delete mode 100644 node_modules/less/lib/less/tree/unit.js.map delete mode 100644 node_modules/less/lib/less/tree/url.js delete mode 100644 node_modules/less/lib/less/tree/url.js.map delete mode 100644 node_modules/less/lib/less/tree/value.js delete mode 100644 node_modules/less/lib/less/tree/value.js.map delete mode 100644 node_modules/less/lib/less/tree/variable-call.js delete mode 100644 node_modules/less/lib/less/tree/variable-call.js.map delete mode 100644 node_modules/less/lib/less/tree/variable.js delete mode 100644 node_modules/less/lib/less/tree/variable.js.map delete mode 100644 node_modules/less/lib/less/utils.js delete mode 100644 node_modules/less/lib/less/utils.js.map delete mode 100644 node_modules/less/lib/less/visitors/extend-visitor.js delete mode 100644 node_modules/less/lib/less/visitors/extend-visitor.js.map delete mode 100644 node_modules/less/lib/less/visitors/import-sequencer.js delete mode 100644 node_modules/less/lib/less/visitors/import-sequencer.js.map delete mode 100644 node_modules/less/lib/less/visitors/import-visitor.js delete mode 100644 node_modules/less/lib/less/visitors/import-visitor.js.map delete mode 100644 node_modules/less/lib/less/visitors/index.js delete mode 100644 node_modules/less/lib/less/visitors/index.js.map delete mode 100644 node_modules/less/lib/less/visitors/join-selector-visitor.js delete mode 100644 node_modules/less/lib/less/visitors/join-selector-visitor.js.map delete mode 100644 node_modules/less/lib/less/visitors/set-tree-visibility-visitor.js delete mode 100644 node_modules/less/lib/less/visitors/set-tree-visibility-visitor.js.map delete mode 100644 node_modules/less/lib/less/visitors/to-css-visitor.js delete mode 100644 node_modules/less/lib/less/visitors/to-css-visitor.js.map delete mode 100644 node_modules/less/lib/less/visitors/visitor.js delete mode 100644 node_modules/less/lib/less/visitors/visitor.js.map delete mode 100644 node_modules/less/package.json delete mode 100644 node_modules/less/test/.eslintrc.json delete mode 100644 node_modules/less/test/README.md delete mode 100644 node_modules/less/test/browser/common.js delete mode 100644 node_modules/less/test/browser/css/global-vars/simple.css delete mode 100644 node_modules/less/test/browser/css/modify-vars/simple.css delete mode 100644 node_modules/less/test/browser/css/plugin/plugin.css delete mode 100644 node_modules/less/test/browser/css/postProcessor/postProcessor.css delete mode 100644 node_modules/less/test/browser/css/relative-urls/urls.css delete mode 100644 node_modules/less/test/browser/css/rewrite-urls/urls.css delete mode 100644 node_modules/less/test/browser/css/rootpath-relative/urls.css delete mode 100644 node_modules/less/test/browser/css/rootpath-rewrite-urls/urls.css delete mode 100644 node_modules/less/test/browser/css/rootpath/urls.css delete mode 100644 node_modules/less/test/browser/css/urls.css delete mode 100644 node_modules/less/test/browser/generator/benchmark.config.js delete mode 100644 node_modules/less/test/browser/generator/generate.js delete mode 100644 node_modules/less/test/browser/generator/runner.config.js delete mode 100644 node_modules/less/test/browser/generator/runner.js delete mode 100644 node_modules/less/test/browser/generator/template.js delete mode 100644 node_modules/less/test/browser/generator/utils.js delete mode 100644 node_modules/less/test/browser/less/console-errors/test-error.less delete mode 100644 node_modules/less/test/browser/less/console-errors/test-error.txt delete mode 100644 node_modules/less/test/browser/less/errors/image-height-error.less delete mode 100644 node_modules/less/test/browser/less/errors/image-height-error.txt delete mode 100644 node_modules/less/test/browser/less/errors/image-size-error.less delete mode 100644 node_modules/less/test/browser/less/errors/image-size-error.txt delete mode 100644 node_modules/less/test/browser/less/errors/image-width-error.less delete mode 100644 node_modules/less/test/browser/less/errors/image-width-error.txt delete mode 100644 node_modules/less/test/browser/less/global-vars/simple.less delete mode 100644 node_modules/less/test/browser/less/imports/urls.less delete mode 100644 node_modules/less/test/browser/less/imports/urls2.less delete mode 100644 node_modules/less/test/browser/less/modify-vars/imports/simple2.less delete mode 100644 node_modules/less/test/browser/less/modify-vars/simple.less delete mode 100644 node_modules/less/test/browser/less/nested-gradient-with-svg-gradient/mixin-consumer.less delete mode 100644 node_modules/less/test/browser/less/nested-gradient-with-svg-gradient/svg-gradient-mixin.less delete mode 100644 node_modules/less/test/browser/less/plugin/plugin.js delete mode 100644 node_modules/less/test/browser/less/plugin/plugin.less delete mode 100644 node_modules/less/test/browser/less/postProcessor/postProcessor.less delete mode 100644 node_modules/less/test/browser/less/relative-urls/urls.less delete mode 100644 node_modules/less/test/browser/less/rewrite-urls/urls.less delete mode 100644 node_modules/less/test/browser/less/rootpath-relative/urls.less delete mode 100644 node_modules/less/test/browser/less/rootpath-rewrite-urls/urls.less delete mode 100644 node_modules/less/test/browser/less/rootpath/urls.less delete mode 100644 node_modules/less/test/browser/less/urls.less delete mode 100644 node_modules/less/test/browser/runner-VisitorPlugin-options.js delete mode 100644 node_modules/less/test/browser/runner-VisitorPlugin.js delete mode 100644 node_modules/less/test/browser/runner-browser-options.js delete mode 100644 node_modules/less/test/browser/runner-browser-spec.js delete mode 100644 node_modules/less/test/browser/runner-console-errors.js delete mode 100644 node_modules/less/test/browser/runner-errors-options.js delete mode 100644 node_modules/less/test/browser/runner-errors-spec.js delete mode 100644 node_modules/less/test/browser/runner-filemanagerPlugin-options.js delete mode 100644 node_modules/less/test/browser/runner-filemanagerPlugin.js delete mode 100644 node_modules/less/test/browser/runner-global-vars-options.js delete mode 100644 node_modules/less/test/browser/runner-global-vars-spec.js delete mode 100644 node_modules/less/test/browser/runner-legacy-options.js delete mode 100644 node_modules/less/test/browser/runner-legacy-spec.js delete mode 100644 node_modules/less/test/browser/runner-main-options.js delete mode 100644 node_modules/less/test/browser/runner-main-spec.js delete mode 100644 node_modules/less/test/browser/runner-modify-vars-options.js delete mode 100644 node_modules/less/test/browser/runner-modify-vars-spec.js delete mode 100644 node_modules/less/test/browser/runner-no-js-errors-options.js delete mode 100644 node_modules/less/test/browser/runner-no-js-errors-spec.js delete mode 100644 node_modules/less/test/browser/runner-postProcessorPlugin-options.js delete mode 100644 node_modules/less/test/browser/runner-postProcessorPlugin.js delete mode 100644 node_modules/less/test/browser/runner-preProcessorPlugin-options.js delete mode 100644 node_modules/less/test/browser/runner-preProcessorPlugin.js delete mode 100644 node_modules/less/test/browser/runner-production-options.js delete mode 100644 node_modules/less/test/browser/runner-production-spec.js delete mode 100644 node_modules/less/test/browser/runner-relative-urls-options.js delete mode 100644 node_modules/less/test/browser/runner-relative-urls-spec.js delete mode 100644 node_modules/less/test/browser/runner-rewrite-urls-options.js delete mode 100644 node_modules/less/test/browser/runner-rewrite-urls-spec.js delete mode 100644 node_modules/less/test/browser/runner-rootpath-options.js delete mode 100644 node_modules/less/test/browser/runner-rootpath-relative-options.js delete mode 100644 node_modules/less/test/browser/runner-rootpath-relative-spec.js delete mode 100644 node_modules/less/test/browser/runner-rootpath-rewrite-urls-options.js delete mode 100644 node_modules/less/test/browser/runner-rootpath-rewrite-urls-spec.js delete mode 100644 node_modules/less/test/browser/runner-rootpath-spec.js delete mode 100644 node_modules/less/test/browser/runner-strict-units-options.js delete mode 100644 node_modules/less/test/browser/runner-strict-units-spec.js delete mode 100644 node_modules/less/test/index.js delete mode 100644 node_modules/less/test/less-test.js delete mode 100644 node_modules/less/test/modify-vars.js delete mode 100644 node_modules/less/test/plugins/filemanager/index.js delete mode 100644 node_modules/less/test/plugins/postprocess/index.js delete mode 100644 node_modules/less/test/plugins/preprocess/index.js delete mode 100644 node_modules/less/test/plugins/visitor/index.js delete mode 100644 node_modules/less/test/sourcemaps-disable-annotation/basic.json delete mode 100644 node_modules/less/test/sourcemaps-variable-selector/basic.json delete mode 100644 node_modules/less/test/sourcemaps/basic.json delete mode 100644 node_modules/less/test/sourcemaps/custom-props.json delete mode 100644 node_modules/less/test/sourcemaps/index.html delete mode 100644 node_modules/less/test/test-es6.ts delete mode 100644 node_modules/less/tsconfig.build.json delete mode 100644 node_modules/less/tsconfig.json delete mode 100644 node_modules/level-supports/CHANGELOG.md delete mode 100644 node_modules/level-supports/LICENSE delete mode 100644 node_modules/level-supports/README.md delete mode 100644 node_modules/level-supports/index.d.ts delete mode 100644 node_modules/level-supports/index.js delete mode 100644 node_modules/level-supports/package.json delete mode 100644 node_modules/level-supports/test/cloneable.js delete mode 100644 node_modules/level-supports/test/index.js delete mode 100644 node_modules/level-supports/test/self.js delete mode 100644 node_modules/level-supports/test/shape.js delete mode 100644 node_modules/level-transcoder/CHANGELOG.md delete mode 100644 node_modules/level-transcoder/LICENSE delete mode 100644 node_modules/level-transcoder/README.md delete mode 100644 node_modules/level-transcoder/UPGRADING.md delete mode 100644 node_modules/level-transcoder/index.d.ts delete mode 100644 node_modules/level-transcoder/index.js delete mode 100644 node_modules/level-transcoder/lib/encoding.d.ts delete mode 100644 node_modules/level-transcoder/lib/encoding.js delete mode 100644 node_modules/level-transcoder/lib/encodings.d.ts delete mode 100644 node_modules/level-transcoder/lib/encodings.js delete mode 100644 node_modules/level-transcoder/lib/formats.d.ts delete mode 100644 node_modules/level-transcoder/lib/formats.js delete mode 100644 node_modules/level-transcoder/lib/text-endec.d.ts delete mode 100644 node_modules/level-transcoder/lib/text-endec.js delete mode 100644 node_modules/level-transcoder/package.json delete mode 100644 node_modules/levn/LICENSE delete mode 100644 node_modules/levn/README.md delete mode 100644 node_modules/levn/lib/cast.js delete mode 100644 node_modules/levn/lib/index.js delete mode 100644 node_modules/levn/lib/parse-string.js delete mode 100644 node_modules/levn/package.json delete mode 100644 node_modules/lie/README.md delete mode 100644 node_modules/lie/dist/lie.js delete mode 100644 node_modules/lie/dist/lie.min.js delete mode 100644 node_modules/lie/dist/lie.polyfill.js delete mode 100644 node_modules/lie/dist/lie.polyfill.min.js delete mode 100644 node_modules/lie/lib/browser.js delete mode 100644 node_modules/lie/lib/index.js delete mode 100644 node_modules/lie/license.md delete mode 100644 node_modules/lie/package.json delete mode 100644 node_modules/lie/polyfill.js delete mode 100644 node_modules/liftoff/LICENSE delete mode 100644 node_modules/liftoff/README.md delete mode 100644 node_modules/liftoff/index.js delete mode 100644 node_modules/liftoff/lib/array_find.js delete mode 100644 node_modules/liftoff/lib/build_config_name.js delete mode 100644 node_modules/liftoff/lib/file_search.js delete mode 100644 node_modules/liftoff/lib/find_config.js delete mode 100644 node_modules/liftoff/lib/find_cwd.js delete mode 100644 node_modules/liftoff/lib/get_node_flags.js delete mode 100644 node_modules/liftoff/lib/needs_lookup.js delete mode 100644 node_modules/liftoff/lib/parse_options.js delete mode 100644 node_modules/liftoff/lib/register_loader.js delete mode 100644 node_modules/liftoff/lib/silent_require.js delete mode 100644 node_modules/liftoff/package.json delete mode 100644 node_modules/localforage/.huskyrc delete mode 100644 node_modules/localforage/.lintstagedrc delete mode 100644 node_modules/localforage/CHANGELOG.md delete mode 100644 node_modules/localforage/CONTRIBUTING.md delete mode 100644 node_modules/localforage/LICENSE delete mode 100644 node_modules/localforage/README.md delete mode 100644 node_modules/localforage/bower.json delete mode 100644 node_modules/localforage/build/es5src/drivers/indexeddb.js delete mode 100644 node_modules/localforage/build/es5src/drivers/localstorage.js delete mode 100644 node_modules/localforage/build/es5src/drivers/websql.js delete mode 100644 node_modules/localforage/build/es5src/localforage.js delete mode 100644 node_modules/localforage/build/es5src/utils/serializer.js delete mode 100644 node_modules/localforage/component.json delete mode 100644 node_modules/localforage/contribute.json delete mode 100644 node_modules/localforage/dist/localforage.js delete mode 100644 node_modules/localforage/dist/localforage.min.js delete mode 100644 node_modules/localforage/dist/localforage.nopromises.js delete mode 100644 node_modules/localforage/dist/localforage.nopromises.min.js delete mode 100644 node_modules/localforage/package.json delete mode 100644 node_modules/localforage/src/drivers/indexeddb.js delete mode 100644 node_modules/localforage/src/drivers/localstorage.js delete mode 100644 node_modules/localforage/src/drivers/websql.js delete mode 100644 node_modules/localforage/src/localforage.js delete mode 100644 node_modules/localforage/src/utils/createBlob.js delete mode 100644 node_modules/localforage/src/utils/executeCallback.js delete mode 100644 node_modules/localforage/src/utils/executeTwoCallbacks.js delete mode 100644 node_modules/localforage/src/utils/getCallback.js delete mode 100644 node_modules/localforage/src/utils/idb.js delete mode 100644 node_modules/localforage/src/utils/includes.js delete mode 100644 node_modules/localforage/src/utils/isArray.js delete mode 100644 node_modules/localforage/src/utils/isIndexedDBValid.js delete mode 100644 node_modules/localforage/src/utils/isLocalStorageValid.js delete mode 100644 node_modules/localforage/src/utils/isWebSQLValid.js delete mode 100644 node_modules/localforage/src/utils/normalizeKey.js delete mode 100644 node_modules/localforage/src/utils/promise.js delete mode 100644 node_modules/localforage/src/utils/serializer.js delete mode 100644 node_modules/localforage/typings/localforage.d.ts delete mode 100644 node_modules/locate-path/index.d.ts delete mode 100644 node_modules/locate-path/index.js delete mode 100644 node_modules/locate-path/license delete mode 100644 node_modules/locate-path/package.json delete mode 100644 node_modules/locate-path/readme.md delete mode 100644 node_modules/lodash.merge/LICENSE delete mode 100644 node_modules/lodash.merge/README.md delete mode 100644 node_modules/lodash.merge/index.js delete mode 100644 node_modules/lodash.merge/package.json delete mode 100644 node_modules/make-dir/index.d.ts delete mode 100644 node_modules/make-dir/index.js delete mode 100644 node_modules/make-dir/license delete mode 120000 node_modules/make-dir/node_modules/.bin/semver delete mode 100644 node_modules/make-dir/node_modules/semver/LICENSE delete mode 100644 node_modules/make-dir/node_modules/semver/README.md delete mode 100755 node_modules/make-dir/node_modules/semver/bin/semver delete mode 100644 node_modules/make-dir/node_modules/semver/package.json delete mode 100644 node_modules/make-dir/node_modules/semver/range.bnf delete mode 100644 node_modules/make-dir/node_modules/semver/semver.js delete mode 100644 node_modules/make-dir/package.json delete mode 100644 node_modules/make-dir/readme.md delete mode 100644 node_modules/map-cache/LICENSE delete mode 100644 node_modules/map-cache/README.md delete mode 100644 node_modules/map-cache/index.js delete mode 100644 node_modules/map-cache/package.json delete mode 100755 node_modules/micromatch/LICENSE delete mode 100644 node_modules/micromatch/README.md delete mode 100644 node_modules/micromatch/index.js delete mode 100644 node_modules/micromatch/package.json delete mode 100644 node_modules/mime/.npmignore delete mode 100644 node_modules/mime/CHANGELOG.md delete mode 100644 node_modules/mime/LICENSE delete mode 100644 node_modules/mime/README.md delete mode 100755 node_modules/mime/cli.js delete mode 100644 node_modules/mime/mime.js delete mode 100644 node_modules/mime/package.json delete mode 100755 node_modules/mime/src/build.js delete mode 100644 node_modules/mime/src/test.js delete mode 100644 node_modules/mime/types.json delete mode 100644 node_modules/minimatch/LICENSE delete mode 100644 node_modules/minimatch/README.md delete mode 100644 node_modules/minimatch/minimatch.js delete mode 100644 node_modules/minimatch/package.json delete mode 100644 node_modules/mkdirp/LICENSE delete mode 100644 node_modules/mkdirp/dist/cjs/package.json delete mode 100644 node_modules/mkdirp/dist/cjs/src/bin.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/bin.d.ts.map delete mode 100755 node_modules/mkdirp/dist/cjs/src/bin.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/bin.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/find-made.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/find-made.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/find-made.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/find-made.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/index.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/index.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/index.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/index.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-manual.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-manual.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-native.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-native.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/mkdirp-native.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/opts-arg.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/opts-arg.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/opts-arg.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/path-arg.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/path-arg.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/path-arg.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/path-arg.js.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/use-native.d.ts delete mode 100644 node_modules/mkdirp/dist/cjs/src/use-native.d.ts.map delete mode 100644 node_modules/mkdirp/dist/cjs/src/use-native.js delete mode 100644 node_modules/mkdirp/dist/cjs/src/use-native.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/find-made.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/find-made.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/find-made.js delete mode 100644 node_modules/mkdirp/dist/mjs/find-made.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/index.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/index.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/index.js delete mode 100644 node_modules/mkdirp/dist/mjs/index.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-manual.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-manual.js delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-manual.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-native.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-native.js delete mode 100644 node_modules/mkdirp/dist/mjs/mkdirp-native.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/opts-arg.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/opts-arg.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/opts-arg.js delete mode 100644 node_modules/mkdirp/dist/mjs/opts-arg.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/package.json delete mode 100644 node_modules/mkdirp/dist/mjs/path-arg.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/path-arg.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/path-arg.js delete mode 100644 node_modules/mkdirp/dist/mjs/path-arg.js.map delete mode 100644 node_modules/mkdirp/dist/mjs/use-native.d.ts delete mode 100644 node_modules/mkdirp/dist/mjs/use-native.d.ts.map delete mode 100644 node_modules/mkdirp/dist/mjs/use-native.js delete mode 100644 node_modules/mkdirp/dist/mjs/use-native.js.map delete mode 100644 node_modules/mkdirp/package.json delete mode 100644 node_modules/mkdirp/readme.markdown delete mode 100644 node_modules/module-error/CHANGELOG.md delete mode 100644 node_modules/module-error/LICENSE delete mode 100644 node_modules/module-error/README.md delete mode 100644 node_modules/module-error/index.d.ts delete mode 100644 node_modules/module-error/index.js delete mode 100644 node_modules/module-error/package.json delete mode 100644 node_modules/ms/index.js delete mode 100644 node_modules/ms/license.md delete mode 100644 node_modules/ms/package.json delete mode 100644 node_modules/ms/readme.md delete mode 100644 node_modules/mute-stdout/LICENSE delete mode 100644 node_modules/mute-stdout/README.md delete mode 100644 node_modules/mute-stdout/index.js delete mode 100644 node_modules/mute-stdout/package.json delete mode 100644 node_modules/napi-macros/LICENSE delete mode 100644 node_modules/napi-macros/README.md delete mode 100644 node_modules/napi-macros/index.js delete mode 100644 node_modules/napi-macros/napi-macros.h delete mode 100644 node_modules/napi-macros/package.json delete mode 100644 node_modules/natural-compare/README.md delete mode 100644 node_modules/natural-compare/index.js delete mode 100644 node_modules/natural-compare/package.json delete mode 100644 node_modules/nedb-promises/.eslintrc.js delete mode 100644 node_modules/nedb-promises/.github/stale.yml delete mode 100644 node_modules/nedb-promises/CHANGELOG.md delete mode 100644 node_modules/nedb-promises/LICENSE delete mode 100644 node_modules/nedb-promises/README.md delete mode 100644 node_modules/nedb-promises/docs.md delete mode 100644 node_modules/nedb-promises/index.d.ts delete mode 100644 node_modules/nedb-promises/index.js delete mode 100644 node_modules/nedb-promises/logo.svg delete mode 100644 node_modules/nedb-promises/package.json delete mode 100644 node_modules/nedb-promises/src/Cursor.js delete mode 100644 node_modules/nedb-promises/src/Datastore.js delete mode 100644 node_modules/nedb-promises/test/a.create.test.js delete mode 100644 node_modules/nedb-promises/test/b.insert.test.js delete mode 100644 node_modules/nedb-promises/test/c.find.test.js delete mode 100644 node_modules/nedb-promises/test/d.update.test.js delete mode 100644 node_modules/nedb-promises/test/e.count.test.js delete mode 100644 node_modules/nedb-promises/test/f.proxy.test.js delete mode 100644 node_modules/nedb-promises/test/g.mongocompat.test.js delete mode 100644 node_modules/needle/.github/workflows/nodejs.yml delete mode 100644 node_modules/needle/README.md delete mode 100755 node_modules/needle/bin/needle delete mode 100644 node_modules/needle/examples/deflated-stream.js delete mode 100644 node_modules/needle/examples/digest-auth.js delete mode 100644 node_modules/needle/examples/download-to-file.js delete mode 100644 node_modules/needle/examples/multipart-stream.js delete mode 100644 node_modules/needle/examples/parsed-stream.js delete mode 100644 node_modules/needle/examples/parsed-stream2.js delete mode 100644 node_modules/needle/examples/stream-events.js delete mode 100644 node_modules/needle/examples/stream-multiple/app.js delete mode 100644 node_modules/needle/examples/stream-multiple/env.js delete mode 100644 node_modules/needle/examples/stream-multiple/package.json delete mode 100644 node_modules/needle/examples/stream-multiple/stream-multiple.js delete mode 100644 node_modules/needle/examples/stream-to-file.js delete mode 100644 node_modules/needle/examples/upload-image.js delete mode 100644 node_modules/needle/lib/auth.js delete mode 100644 node_modules/needle/lib/cookies.js delete mode 100644 node_modules/needle/lib/decoder.js delete mode 100644 node_modules/needle/lib/multipart.js delete mode 100644 node_modules/needle/lib/needle.js delete mode 100644 node_modules/needle/lib/parsers.js delete mode 100644 node_modules/needle/lib/querystring.js delete mode 100644 node_modules/needle/lib/utils.js delete mode 100644 node_modules/needle/license.txt delete mode 100644 node_modules/needle/package.json delete mode 100644 node_modules/needle/test/auth_digest_spec.js delete mode 100644 node_modules/needle/test/basic_auth_spec.js delete mode 100644 node_modules/needle/test/compression_spec.js delete mode 100644 node_modules/needle/test/cookies_spec.js delete mode 100644 node_modules/needle/test/decoder_spec.js delete mode 100644 node_modules/needle/test/errors_spec.js delete mode 100644 node_modules/needle/test/files/Appalachia.html delete mode 100644 node_modules/needle/test/files/tomcat_charset.html delete mode 100644 node_modules/needle/test/headers_spec.js delete mode 100644 node_modules/needle/test/helpers.js delete mode 100644 node_modules/needle/test/long_string_spec.js delete mode 100644 node_modules/needle/test/mimetype.js delete mode 100644 node_modules/needle/test/output_spec.js delete mode 100644 node_modules/needle/test/parsing_spec.js delete mode 100644 node_modules/needle/test/post_data_spec.js delete mode 100644 node_modules/needle/test/proxy_spec.js delete mode 100644 node_modules/needle/test/querystring_spec.js delete mode 100644 node_modules/needle/test/redirect_spec.js delete mode 100644 node_modules/needle/test/redirect_with_timeout.js delete mode 100644 node_modules/needle/test/request_stream_spec.js delete mode 100644 node_modules/needle/test/response_stream_spec.js delete mode 100644 node_modules/needle/test/socket_cleanup_spec.js delete mode 100644 node_modules/needle/test/socket_pool_spec.js delete mode 100644 node_modules/needle/test/stream_events_spec.js delete mode 100644 node_modules/needle/test/tls_options_spec.js delete mode 100644 node_modules/needle/test/uri_modifier_spec.js delete mode 100644 node_modules/needle/test/url_spec.js delete mode 100644 node_modules/needle/test/utils/formidable.js delete mode 100644 node_modules/needle/test/utils/proxy.js delete mode 100644 node_modules/needle/test/utils/test.js delete mode 100644 node_modules/needle/test/utils_spec.js delete mode 100644 node_modules/node-gyp-build/LICENSE delete mode 100644 node_modules/node-gyp-build/README.md delete mode 100644 node_modules/node-gyp-build/SECURITY.md delete mode 100755 node_modules/node-gyp-build/bin.js delete mode 100755 node_modules/node-gyp-build/build-test.js delete mode 100644 node_modules/node-gyp-build/index.js delete mode 100644 node_modules/node-gyp-build/node-gyp-build.js delete mode 100755 node_modules/node-gyp-build/optional.js delete mode 100644 node_modules/node-gyp-build/package.json delete mode 100644 node_modules/normalize-path/LICENSE delete mode 100644 node_modules/normalize-path/README.md delete mode 100644 node_modules/normalize-path/index.js delete mode 100644 node_modules/normalize-path/package.json delete mode 100644 node_modules/now-and-later/LICENSE delete mode 100644 node_modules/now-and-later/README.md delete mode 100644 node_modules/now-and-later/index.js delete mode 100644 node_modules/now-and-later/lib/helpers.js delete mode 100644 node_modules/now-and-later/lib/map.js delete mode 100644 node_modules/now-and-later/lib/mapSeries.js delete mode 100644 node_modules/now-and-later/package.json delete mode 100644 node_modules/object-assign/index.js delete mode 100644 node_modules/object-assign/license delete mode 100644 node_modules/object-assign/package.json delete mode 100644 node_modules/object-assign/readme.md delete mode 100644 node_modules/object.defaults/LICENSE delete mode 100644 node_modules/object.defaults/README.md delete mode 100644 node_modules/object.defaults/immutable.js delete mode 100644 node_modules/object.defaults/index.js delete mode 100644 node_modules/object.defaults/mutable.js delete mode 100644 node_modules/object.defaults/package.json delete mode 100644 node_modules/object.pick/LICENSE delete mode 100644 node_modules/object.pick/README.md delete mode 100644 node_modules/object.pick/index.js delete mode 100644 node_modules/object.pick/package.json delete mode 100644 node_modules/once/LICENSE delete mode 100644 node_modules/once/README.md delete mode 100644 node_modules/once/once.js delete mode 100644 node_modules/once/package.json delete mode 100644 node_modules/optionator/CHANGELOG.md delete mode 100644 node_modules/optionator/LICENSE delete mode 100644 node_modules/optionator/README.md delete mode 100644 node_modules/optionator/lib/help.js delete mode 100644 node_modules/optionator/lib/index.js delete mode 100644 node_modules/optionator/lib/util.js delete mode 100644 node_modules/optionator/package.json delete mode 100644 node_modules/p-limit/index.d.ts delete mode 100644 node_modules/p-limit/index.js delete mode 100644 node_modules/p-limit/license delete mode 100644 node_modules/p-limit/package.json delete mode 100644 node_modules/p-limit/readme.md delete mode 100644 node_modules/p-locate/index.d.ts delete mode 100644 node_modules/p-locate/index.js delete mode 100644 node_modules/p-locate/license delete mode 100644 node_modules/p-locate/package.json delete mode 100644 node_modules/p-locate/readme.md delete mode 100644 node_modules/parent-module/index.js delete mode 100644 node_modules/parent-module/license delete mode 100644 node_modules/parent-module/package.json delete mode 100644 node_modules/parent-module/readme.md delete mode 100644 node_modules/parse-filepath/LICENSE delete mode 100644 node_modules/parse-filepath/README.md delete mode 100644 node_modules/parse-filepath/index.js delete mode 100644 node_modules/parse-filepath/package.json delete mode 100644 node_modules/parse-imports/dist/index.cjs delete mode 100644 node_modules/parse-imports/dist/index.d.ts delete mode 100644 node_modules/parse-imports/dist/index.js delete mode 100644 node_modules/parse-imports/license-apache delete mode 100644 node_modules/parse-imports/license-mit delete mode 100644 node_modules/parse-imports/notice-apache delete mode 100644 node_modules/parse-imports/package.json delete mode 100644 node_modules/parse-imports/readme.md delete mode 100644 node_modules/parse-node-version/LICENSE delete mode 100644 node_modules/parse-node-version/README.md delete mode 100644 node_modules/parse-node-version/index.js delete mode 100644 node_modules/parse-node-version/package.json delete mode 100644 node_modules/parse-passwd/LICENSE delete mode 100644 node_modules/parse-passwd/README.md delete mode 100644 node_modules/parse-passwd/index.js delete mode 100644 node_modules/parse-passwd/package.json delete mode 100644 node_modules/path-exists/index.d.ts delete mode 100644 node_modules/path-exists/index.js delete mode 100644 node_modules/path-exists/license delete mode 100644 node_modules/path-exists/package.json delete mode 100644 node_modules/path-exists/readme.md delete mode 100644 node_modules/path-key/index.d.ts delete mode 100644 node_modules/path-key/index.js delete mode 100644 node_modules/path-key/license delete mode 100644 node_modules/path-key/package.json delete mode 100644 node_modules/path-key/readme.md delete mode 100644 node_modules/path-parse/LICENSE delete mode 100644 node_modules/path-parse/README.md delete mode 100644 node_modules/path-parse/index.js delete mode 100644 node_modules/path-parse/package.json delete mode 100644 node_modules/path-root-regex/LICENSE delete mode 100644 node_modules/path-root-regex/README.md delete mode 100644 node_modules/path-root-regex/index.js delete mode 100644 node_modules/path-root-regex/package.json delete mode 100644 node_modules/path-root/LICENSE delete mode 100644 node_modules/path-root/README.md delete mode 100644 node_modules/path-root/index.js delete mode 100644 node_modules/path-root/package.json delete mode 100644 node_modules/picomatch/CHANGELOG.md delete mode 100644 node_modules/picomatch/LICENSE delete mode 100644 node_modules/picomatch/README.md delete mode 100644 node_modules/picomatch/index.js delete mode 100644 node_modules/picomatch/lib/constants.js delete mode 100644 node_modules/picomatch/lib/parse.js delete mode 100644 node_modules/picomatch/lib/picomatch.js delete mode 100644 node_modules/picomatch/lib/scan.js delete mode 100644 node_modules/picomatch/lib/utils.js delete mode 100644 node_modules/picomatch/package.json delete mode 100644 node_modules/pify/index.js delete mode 100644 node_modules/pify/license delete mode 100644 node_modules/pify/package.json delete mode 100644 node_modules/pify/readme.md delete mode 100644 node_modules/plugin-error/LICENSE delete mode 100644 node_modules/plugin-error/README.md delete mode 100644 node_modules/plugin-error/index.d.ts delete mode 100644 node_modules/plugin-error/index.js delete mode 100644 node_modules/plugin-error/package.json delete mode 100644 node_modules/possible-typed-array-names/.eslintrc delete mode 100644 node_modules/possible-typed-array-names/.github/FUNDING.yml delete mode 100644 node_modules/possible-typed-array-names/CHANGELOG.md delete mode 100644 node_modules/possible-typed-array-names/LICENSE delete mode 100644 node_modules/possible-typed-array-names/README.md delete mode 100644 node_modules/possible-typed-array-names/index.d.ts delete mode 100644 node_modules/possible-typed-array-names/index.js delete mode 100644 node_modules/possible-typed-array-names/package.json delete mode 100644 node_modules/possible-typed-array-names/test/index.js delete mode 100644 node_modules/possible-typed-array-names/tsconfig.json delete mode 100644 node_modules/prelude-ls/CHANGELOG.md delete mode 100644 node_modules/prelude-ls/LICENSE delete mode 100644 node_modules/prelude-ls/README.md delete mode 100644 node_modules/prelude-ls/lib/Func.js delete mode 100644 node_modules/prelude-ls/lib/List.js delete mode 100644 node_modules/prelude-ls/lib/Num.js delete mode 100644 node_modules/prelude-ls/lib/Obj.js delete mode 100644 node_modules/prelude-ls/lib/Str.js delete mode 100644 node_modules/prelude-ls/lib/index.js delete mode 100644 node_modules/prelude-ls/package.json delete mode 100644 node_modules/prettier-linter-helpers/.editorconfig delete mode 100644 node_modules/prettier-linter-helpers/.eslintignore delete mode 100644 node_modules/prettier-linter-helpers/.eslintrc.js delete mode 100644 node_modules/prettier-linter-helpers/.github/CONTRIBUTING.md delete mode 100644 node_modules/prettier-linter-helpers/.prettierignore delete mode 100644 node_modules/prettier-linter-helpers/.prettierrc delete mode 100644 node_modules/prettier-linter-helpers/.vscode/settings.json delete mode 100644 node_modules/prettier-linter-helpers/LICENSE.md delete mode 100644 node_modules/prettier-linter-helpers/README.md delete mode 100644 node_modules/prettier-linter-helpers/index.js delete mode 100644 node_modules/prettier-linter-helpers/package.json delete mode 100644 node_modules/prettier-linter-helpers/test/index.test.js delete mode 100644 node_modules/prettier/LICENSE delete mode 100644 node_modules/prettier/README.md delete mode 100755 node_modules/prettier/bin/prettier.cjs delete mode 100644 node_modules/prettier/doc.d.ts delete mode 100644 node_modules/prettier/doc.js delete mode 100644 node_modules/prettier/doc.mjs delete mode 100644 node_modules/prettier/index.cjs delete mode 100644 node_modules/prettier/index.d.ts delete mode 100644 node_modules/prettier/index.mjs delete mode 100644 node_modules/prettier/internal/cli.mjs delete mode 100644 node_modules/prettier/package.json delete mode 100644 node_modules/prettier/plugins/acorn.d.ts delete mode 100644 node_modules/prettier/plugins/acorn.js delete mode 100644 node_modules/prettier/plugins/acorn.mjs delete mode 100644 node_modules/prettier/plugins/angular.d.ts delete mode 100644 node_modules/prettier/plugins/angular.js delete mode 100644 node_modules/prettier/plugins/angular.mjs delete mode 100644 node_modules/prettier/plugins/babel.d.ts delete mode 100644 node_modules/prettier/plugins/babel.js delete mode 100644 node_modules/prettier/plugins/babel.mjs delete mode 100644 node_modules/prettier/plugins/estree.d.ts delete mode 100644 node_modules/prettier/plugins/estree.js delete mode 100644 node_modules/prettier/plugins/estree.mjs delete mode 100644 node_modules/prettier/plugins/flow.d.ts delete mode 100644 node_modules/prettier/plugins/flow.js delete mode 100644 node_modules/prettier/plugins/flow.mjs delete mode 100644 node_modules/prettier/plugins/glimmer.d.ts delete mode 100644 node_modules/prettier/plugins/glimmer.js delete mode 100644 node_modules/prettier/plugins/glimmer.mjs delete mode 100644 node_modules/prettier/plugins/graphql.d.ts delete mode 100644 node_modules/prettier/plugins/graphql.js delete mode 100644 node_modules/prettier/plugins/graphql.mjs delete mode 100644 node_modules/prettier/plugins/html.d.ts delete mode 100644 node_modules/prettier/plugins/html.js delete mode 100644 node_modules/prettier/plugins/html.mjs delete mode 100644 node_modules/prettier/plugins/markdown.d.ts delete mode 100644 node_modules/prettier/plugins/markdown.js delete mode 100644 node_modules/prettier/plugins/markdown.mjs delete mode 100644 node_modules/prettier/plugins/meriyah.d.ts delete mode 100644 node_modules/prettier/plugins/meriyah.js delete mode 100644 node_modules/prettier/plugins/meriyah.mjs delete mode 100644 node_modules/prettier/plugins/postcss.d.ts delete mode 100644 node_modules/prettier/plugins/postcss.js delete mode 100644 node_modules/prettier/plugins/postcss.mjs delete mode 100644 node_modules/prettier/plugins/typescript.d.ts delete mode 100644 node_modules/prettier/plugins/typescript.js delete mode 100644 node_modules/prettier/plugins/typescript.mjs delete mode 100644 node_modules/prettier/plugins/yaml.d.ts delete mode 100644 node_modules/prettier/plugins/yaml.js delete mode 100644 node_modules/prettier/plugins/yaml.mjs delete mode 100644 node_modules/prettier/standalone.d.ts delete mode 100644 node_modules/prettier/standalone.js delete mode 100644 node_modules/prettier/standalone.mjs delete mode 100644 node_modules/prr/.jshintrc delete mode 100644 node_modules/prr/.npmignore delete mode 100644 node_modules/prr/.travis.yml delete mode 100644 node_modules/prr/LICENSE.md delete mode 100644 node_modules/prr/README.md delete mode 100644 node_modules/prr/package.json delete mode 100644 node_modules/prr/prr.js delete mode 100644 node_modules/prr/test.js delete mode 100644 node_modules/punycode/LICENSE-MIT.txt delete mode 100644 node_modules/punycode/README.md delete mode 100644 node_modules/punycode/package.json delete mode 100644 node_modules/punycode/punycode.es6.js delete mode 100644 node_modules/punycode/punycode.js delete mode 100755 node_modules/queue-microtask/LICENSE delete mode 100644 node_modules/queue-microtask/README.md delete mode 100644 node_modules/queue-microtask/index.d.ts delete mode 100644 node_modules/queue-microtask/index.js delete mode 100644 node_modules/queue-microtask/package.json delete mode 100644 node_modules/queue-tick/.github/workflows/test-node.yml delete mode 100644 node_modules/queue-tick/LICENSE delete mode 100644 node_modules/queue-tick/README.md delete mode 100644 node_modules/queue-tick/package.json delete mode 100644 node_modules/queue-tick/process-next-tick.js delete mode 100644 node_modules/queue-tick/queue-microtask.js delete mode 100644 node_modules/queue-tick/test.js delete mode 100644 node_modules/readable-stream/CONTRIBUTING.md delete mode 100644 node_modules/readable-stream/GOVERNANCE.md delete mode 100644 node_modules/readable-stream/LICENSE delete mode 100644 node_modules/readable-stream/README.md delete mode 100644 node_modules/readable-stream/errors-browser.js delete mode 100644 node_modules/readable-stream/errors.js delete mode 100644 node_modules/readable-stream/experimentalWarning.js delete mode 100644 node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/async_iterator.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/buffer_list.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/destroy.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/end-of-stream.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/from-browser.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/from.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/pipeline.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/state.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/stream-browser.js delete mode 100644 node_modules/readable-stream/lib/internal/streams/stream.js delete mode 100644 node_modules/readable-stream/package.json delete mode 100644 node_modules/readable-stream/readable-browser.js delete mode 100644 node_modules/readable-stream/readable.js delete mode 100644 node_modules/readdirp/LICENSE delete mode 100644 node_modules/readdirp/README.md delete mode 100644 node_modules/readdirp/index.d.ts delete mode 100644 node_modules/readdirp/index.js delete mode 100644 node_modules/readdirp/package.json delete mode 100644 node_modules/rechoir/CHANGELOG.md delete mode 100644 node_modules/rechoir/LICENSE delete mode 100644 node_modules/rechoir/README.md delete mode 100644 node_modules/rechoir/index.js delete mode 100644 node_modules/rechoir/lib/extension.js delete mode 100644 node_modules/rechoir/lib/normalize.js delete mode 100644 node_modules/rechoir/lib/register.js delete mode 100644 node_modules/rechoir/package.json delete mode 100644 node_modules/remove-trailing-separator/history.md delete mode 100644 node_modules/remove-trailing-separator/index.js delete mode 100644 node_modules/remove-trailing-separator/license delete mode 100644 node_modules/remove-trailing-separator/package.json delete mode 100644 node_modules/remove-trailing-separator/readme.md delete mode 100644 node_modules/replace-ext/LICENSE delete mode 100644 node_modules/replace-ext/README.md delete mode 100644 node_modules/replace-ext/index.js delete mode 100644 node_modules/replace-ext/package.json delete mode 100644 node_modules/replace-homedir/LICENSE delete mode 100644 node_modules/replace-homedir/README.md delete mode 100644 node_modules/replace-homedir/index.js delete mode 100644 node_modules/replace-homedir/package.json delete mode 100644 node_modules/require-directory/.jshintrc delete mode 100644 node_modules/require-directory/.npmignore delete mode 100644 node_modules/require-directory/.travis.yml delete mode 100644 node_modules/require-directory/LICENSE delete mode 100644 node_modules/require-directory/README.markdown delete mode 100644 node_modules/require-directory/index.js delete mode 100644 node_modules/require-directory/package.json delete mode 100644 node_modules/resolve-dir/LICENSE delete mode 100644 node_modules/resolve-dir/README.md delete mode 100644 node_modules/resolve-dir/index.js delete mode 100644 node_modules/resolve-dir/package.json delete mode 100644 node_modules/resolve-from/index.js delete mode 100644 node_modules/resolve-from/license delete mode 100644 node_modules/resolve-from/package.json delete mode 100644 node_modules/resolve-from/readme.md delete mode 100644 node_modules/resolve-options/LICENSE delete mode 100644 node_modules/resolve-options/README.md delete mode 100644 node_modules/resolve-options/index.js delete mode 100644 node_modules/resolve-options/package.json delete mode 100644 node_modules/resolve/.editorconfig delete mode 100644 node_modules/resolve/.eslintrc delete mode 100644 node_modules/resolve/.github/FUNDING.yml delete mode 100644 node_modules/resolve/LICENSE delete mode 100644 node_modules/resolve/SECURITY.md delete mode 100644 node_modules/resolve/async.js delete mode 100755 node_modules/resolve/bin/resolve delete mode 100644 node_modules/resolve/example/async.js delete mode 100644 node_modules/resolve/example/sync.js delete mode 100644 node_modules/resolve/index.js delete mode 100644 node_modules/resolve/lib/async.js delete mode 100644 node_modules/resolve/lib/caller.js delete mode 100644 node_modules/resolve/lib/core.js delete mode 100644 node_modules/resolve/lib/core.json delete mode 100644 node_modules/resolve/lib/homedir.js delete mode 100644 node_modules/resolve/lib/is-core.js delete mode 100644 node_modules/resolve/lib/node-modules-paths.js delete mode 100644 node_modules/resolve/lib/normalize-options.js delete mode 100644 node_modules/resolve/lib/sync.js delete mode 100644 node_modules/resolve/package.json delete mode 100644 node_modules/resolve/readme.markdown delete mode 100644 node_modules/resolve/sync.js delete mode 100644 node_modules/resolve/test/core.js delete mode 100644 node_modules/resolve/test/dotdot.js delete mode 100644 node_modules/resolve/test/dotdot/abc/index.js delete mode 100644 node_modules/resolve/test/dotdot/index.js delete mode 100644 node_modules/resolve/test/faulty_basedir.js delete mode 100644 node_modules/resolve/test/filter.js delete mode 100644 node_modules/resolve/test/filter_sync.js delete mode 100644 node_modules/resolve/test/home_paths.js delete mode 100644 node_modules/resolve/test/home_paths_sync.js delete mode 100644 node_modules/resolve/test/mock.js delete mode 100644 node_modules/resolve/test/mock_sync.js delete mode 100644 node_modules/resolve/test/module_dir.js delete mode 100644 node_modules/resolve/test/module_dir/xmodules/aaa/index.js delete mode 100644 node_modules/resolve/test/module_dir/ymodules/aaa/index.js delete mode 100644 node_modules/resolve/test/module_dir/zmodules/bbb/main.js delete mode 100644 node_modules/resolve/test/module_dir/zmodules/bbb/package.json delete mode 100644 node_modules/resolve/test/node-modules-paths.js delete mode 100644 node_modules/resolve/test/node_path.js delete mode 100644 node_modules/resolve/test/node_path/x/aaa/index.js delete mode 100644 node_modules/resolve/test/node_path/x/ccc/index.js delete mode 100644 node_modules/resolve/test/node_path/y/bbb/index.js delete mode 100644 node_modules/resolve/test/node_path/y/ccc/index.js delete mode 100644 node_modules/resolve/test/nonstring.js delete mode 100644 node_modules/resolve/test/pathfilter.js delete mode 100644 node_modules/resolve/test/pathfilter/deep_ref/main.js delete mode 100644 node_modules/resolve/test/precedence.js delete mode 100644 node_modules/resolve/test/precedence/aaa.js delete mode 100644 node_modules/resolve/test/precedence/aaa/index.js delete mode 100644 node_modules/resolve/test/precedence/aaa/main.js delete mode 100644 node_modules/resolve/test/precedence/bbb.js delete mode 100644 node_modules/resolve/test/precedence/bbb/main.js delete mode 100644 node_modules/resolve/test/resolver.js delete mode 100644 node_modules/resolve/test/resolver/baz/doom.js delete mode 100644 node_modules/resolve/test/resolver/baz/package.json delete mode 100644 node_modules/resolve/test/resolver/baz/quux.js delete mode 100644 node_modules/resolve/test/resolver/browser_field/a.js delete mode 100644 node_modules/resolve/test/resolver/browser_field/b.js delete mode 100644 node_modules/resolve/test/resolver/browser_field/package.json delete mode 100644 node_modules/resolve/test/resolver/cup.coffee delete mode 100644 node_modules/resolve/test/resolver/dot_main/index.js delete mode 100644 node_modules/resolve/test/resolver/dot_main/package.json delete mode 100644 node_modules/resolve/test/resolver/dot_slash_main/index.js delete mode 100644 node_modules/resolve/test/resolver/dot_slash_main/package.json delete mode 100644 node_modules/resolve/test/resolver/false_main/index.js delete mode 100644 node_modules/resolve/test/resolver/false_main/package.json delete mode 100644 node_modules/resolve/test/resolver/foo.js delete mode 100644 node_modules/resolve/test/resolver/incorrect_main/index.js delete mode 100644 node_modules/resolve/test/resolver/incorrect_main/package.json delete mode 100644 node_modules/resolve/test/resolver/invalid_main/package.json delete mode 100644 node_modules/resolve/test/resolver/mug.coffee delete mode 100644 node_modules/resolve/test/resolver/mug.js delete mode 100644 node_modules/resolve/test/resolver/multirepo/lerna.json delete mode 100644 node_modules/resolve/test/resolver/multirepo/package.json delete mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js delete mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json delete mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js delete mode 100644 node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json delete mode 100644 node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js delete mode 100644 node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json delete mode 100644 node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js delete mode 100644 node_modules/resolve/test/resolver/other_path/lib/other-lib.js delete mode 100644 node_modules/resolve/test/resolver/other_path/root.js delete mode 100644 node_modules/resolve/test/resolver/quux/foo/index.js delete mode 100644 node_modules/resolve/test/resolver/same_names/foo.js delete mode 100644 node_modules/resolve/test/resolver/same_names/foo/index.js delete mode 100644 node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js delete mode 100644 node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep delete mode 100644 node_modules/resolve/test/resolver/symlinked/package/bar.js delete mode 100644 node_modules/resolve/test/resolver/symlinked/package/package.json delete mode 100644 node_modules/resolve/test/resolver/without_basedir/main.js delete mode 100644 node_modules/resolve/test/resolver_sync.js delete mode 100644 node_modules/resolve/test/shadowed_core.js delete mode 100644 node_modules/resolve/test/shadowed_core/node_modules/util/index.js delete mode 100644 node_modules/resolve/test/subdirs.js delete mode 100644 node_modules/resolve/test/symlinks.js delete mode 100644 node_modules/reusify/.coveralls.yml delete mode 100644 node_modules/reusify/.travis.yml delete mode 100644 node_modules/reusify/LICENSE delete mode 100644 node_modules/reusify/README.md delete mode 100644 node_modules/reusify/benchmarks/createNoCodeFunction.js delete mode 100644 node_modules/reusify/benchmarks/fib.js delete mode 100644 node_modules/reusify/benchmarks/reuseNoCodeFunction.js delete mode 100644 node_modules/reusify/package.json delete mode 100644 node_modules/reusify/reusify.js delete mode 100644 node_modules/reusify/test.js delete mode 100644 node_modules/safe-buffer/LICENSE delete mode 100644 node_modules/safe-buffer/README.md delete mode 100644 node_modules/safe-buffer/index.d.ts delete mode 100644 node_modules/safe-buffer/index.js delete mode 100644 node_modules/safe-buffer/package.json delete mode 100644 node_modules/safer-buffer/LICENSE delete mode 100644 node_modules/safer-buffer/Porting-Buffer.md delete mode 100644 node_modules/safer-buffer/Readme.md delete mode 100644 node_modules/safer-buffer/dangerous.js delete mode 100644 node_modules/safer-buffer/package.json delete mode 100644 node_modules/safer-buffer/safer.js delete mode 100644 node_modules/safer-buffer/tests.js delete mode 100644 node_modules/sax/LICENSE delete mode 100644 node_modules/sax/README.md delete mode 100644 node_modules/sax/lib/sax.js delete mode 100644 node_modules/sax/package.json delete mode 100644 node_modules/semver-greatest-satisfied-range/LICENSE delete mode 100644 node_modules/semver-greatest-satisfied-range/README.md delete mode 100644 node_modules/semver-greatest-satisfied-range/index.js delete mode 100644 node_modules/semver-greatest-satisfied-range/package.json delete mode 100644 node_modules/semver/LICENSE delete mode 100644 node_modules/semver/README.md delete mode 100755 node_modules/semver/bin/semver.js delete mode 100644 node_modules/semver/classes/comparator.js delete mode 100644 node_modules/semver/classes/index.js delete mode 100644 node_modules/semver/classes/range.js delete mode 100644 node_modules/semver/classes/semver.js delete mode 100644 node_modules/semver/functions/clean.js delete mode 100644 node_modules/semver/functions/cmp.js delete mode 100644 node_modules/semver/functions/coerce.js delete mode 100644 node_modules/semver/functions/compare-build.js delete mode 100644 node_modules/semver/functions/compare-loose.js delete mode 100644 node_modules/semver/functions/compare.js delete mode 100644 node_modules/semver/functions/diff.js delete mode 100644 node_modules/semver/functions/eq.js delete mode 100644 node_modules/semver/functions/gt.js delete mode 100644 node_modules/semver/functions/gte.js delete mode 100644 node_modules/semver/functions/inc.js delete mode 100644 node_modules/semver/functions/lt.js delete mode 100644 node_modules/semver/functions/lte.js delete mode 100644 node_modules/semver/functions/major.js delete mode 100644 node_modules/semver/functions/minor.js delete mode 100644 node_modules/semver/functions/neq.js delete mode 100644 node_modules/semver/functions/parse.js delete mode 100644 node_modules/semver/functions/patch.js delete mode 100644 node_modules/semver/functions/prerelease.js delete mode 100644 node_modules/semver/functions/rcompare.js delete mode 100644 node_modules/semver/functions/rsort.js delete mode 100644 node_modules/semver/functions/satisfies.js delete mode 100644 node_modules/semver/functions/sort.js delete mode 100644 node_modules/semver/functions/valid.js delete mode 100644 node_modules/semver/index.js delete mode 100644 node_modules/semver/internal/constants.js delete mode 100644 node_modules/semver/internal/debug.js delete mode 100644 node_modules/semver/internal/identifiers.js delete mode 100644 node_modules/semver/internal/lrucache.js delete mode 100644 node_modules/semver/internal/parse-options.js delete mode 100644 node_modules/semver/internal/re.js delete mode 100644 node_modules/semver/package.json delete mode 100644 node_modules/semver/preload.js delete mode 100644 node_modules/semver/range.bnf delete mode 100644 node_modules/semver/ranges/gtr.js delete mode 100644 node_modules/semver/ranges/intersects.js delete mode 100644 node_modules/semver/ranges/ltr.js delete mode 100644 node_modules/semver/ranges/max-satisfying.js delete mode 100644 node_modules/semver/ranges/min-satisfying.js delete mode 100644 node_modules/semver/ranges/min-version.js delete mode 100644 node_modules/semver/ranges/outside.js delete mode 100644 node_modules/semver/ranges/simplify.js delete mode 100644 node_modules/semver/ranges/subset.js delete mode 100644 node_modules/semver/ranges/to-comparators.js delete mode 100644 node_modules/semver/ranges/valid.js delete mode 100644 node_modules/set-function-length/.eslintrc delete mode 100644 node_modules/set-function-length/.github/FUNDING.yml delete mode 100644 node_modules/set-function-length/.nycrc delete mode 100644 node_modules/set-function-length/CHANGELOG.md delete mode 100644 node_modules/set-function-length/LICENSE delete mode 100644 node_modules/set-function-length/README.md delete mode 100644 node_modules/set-function-length/env.d.ts delete mode 100644 node_modules/set-function-length/env.js delete mode 100644 node_modules/set-function-length/index.d.ts delete mode 100644 node_modules/set-function-length/index.js delete mode 100644 node_modules/set-function-length/package.json delete mode 100644 node_modules/set-function-length/tsconfig.json delete mode 100644 node_modules/shebang-command/index.js delete mode 100644 node_modules/shebang-command/license delete mode 100644 node_modules/shebang-command/package.json delete mode 100644 node_modules/shebang-command/readme.md delete mode 100644 node_modules/shebang-regex/index.d.ts delete mode 100644 node_modules/shebang-regex/index.js delete mode 100644 node_modules/shebang-regex/license delete mode 100644 node_modules/shebang-regex/package.json delete mode 100644 node_modules/shebang-regex/readme.md delete mode 100644 node_modules/slashes/LICENSE delete mode 100644 node_modules/slashes/README.md delete mode 100644 node_modules/slashes/lib/cjs/add-slashes.js delete mode 100644 node_modules/slashes/lib/cjs/add-slashes.js.map delete mode 100644 node_modules/slashes/lib/cjs/get-escaped-any.js delete mode 100644 node_modules/slashes/lib/cjs/get-escaped-any.js.map delete mode 100644 node_modules/slashes/lib/cjs/get-escaped-json-unsafe.js delete mode 100644 node_modules/slashes/lib/cjs/get-escaped-json-unsafe.js.map delete mode 100644 node_modules/slashes/lib/cjs/get-unescaped-any.js delete mode 100644 node_modules/slashes/lib/cjs/get-unescaped-any.js.map delete mode 100644 node_modules/slashes/lib/cjs/index.js delete mode 100644 node_modules/slashes/lib/cjs/index.js.map delete mode 100644 node_modules/slashes/lib/cjs/package.json delete mode 100644 node_modules/slashes/lib/cjs/remove-slashes.js delete mode 100644 node_modules/slashes/lib/cjs/remove-slashes.js.map delete mode 100644 node_modules/slashes/lib/cjs/types/escape-sequence.js delete mode 100644 node_modules/slashes/lib/cjs/types/escape-sequence.js.map delete mode 100644 node_modules/slashes/lib/esm/add-slashes.js delete mode 100644 node_modules/slashes/lib/esm/add-slashes.js.map delete mode 100644 node_modules/slashes/lib/esm/get-escaped-any.js delete mode 100644 node_modules/slashes/lib/esm/get-escaped-any.js.map delete mode 100644 node_modules/slashes/lib/esm/get-escaped-json-unsafe.js delete mode 100644 node_modules/slashes/lib/esm/get-escaped-json-unsafe.js.map delete mode 100644 node_modules/slashes/lib/esm/get-unescaped-any.js delete mode 100644 node_modules/slashes/lib/esm/get-unescaped-any.js.map delete mode 100644 node_modules/slashes/lib/esm/index.js delete mode 100644 node_modules/slashes/lib/esm/index.js.map delete mode 100644 node_modules/slashes/lib/esm/remove-slashes.js delete mode 100644 node_modules/slashes/lib/esm/remove-slashes.js.map delete mode 100644 node_modules/slashes/lib/esm/types/escape-sequence.js delete mode 100644 node_modules/slashes/lib/esm/types/escape-sequence.js.map delete mode 100644 node_modules/slashes/lib/types/add-slashes.d.ts delete mode 100644 node_modules/slashes/lib/types/get-escaped-any.d.ts delete mode 100644 node_modules/slashes/lib/types/get-escaped-json-unsafe.d.ts delete mode 100644 node_modules/slashes/lib/types/get-unescaped-any.d.ts delete mode 100644 node_modules/slashes/lib/types/index.d.ts delete mode 100644 node_modules/slashes/lib/types/remove-slashes.d.ts delete mode 100644 node_modules/slashes/lib/types/types/escape-sequence.d.ts delete mode 100644 node_modules/slashes/package.json delete mode 100644 node_modules/source-map/CHANGELOG.md delete mode 100644 node_modules/source-map/LICENSE delete mode 100644 node_modules/source-map/README.md delete mode 100644 node_modules/source-map/dist/source-map.debug.js delete mode 100644 node_modules/source-map/dist/source-map.js delete mode 100644 node_modules/source-map/dist/source-map.min.js delete mode 100644 node_modules/source-map/dist/source-map.min.js.map delete mode 100644 node_modules/source-map/lib/array-set.js delete mode 100644 node_modules/source-map/lib/base64-vlq.js delete mode 100644 node_modules/source-map/lib/base64.js delete mode 100644 node_modules/source-map/lib/binary-search.js delete mode 100644 node_modules/source-map/lib/mapping-list.js delete mode 100644 node_modules/source-map/lib/quick-sort.js delete mode 100644 node_modules/source-map/lib/source-map-consumer.js delete mode 100644 node_modules/source-map/lib/source-map-generator.js delete mode 100644 node_modules/source-map/lib/source-node.js delete mode 100644 node_modules/source-map/lib/util.js delete mode 100644 node_modules/source-map/package.json delete mode 100644 node_modules/source-map/source-map.d.ts delete mode 100644 node_modules/source-map/source-map.js delete mode 100644 node_modules/sparkles/LICENSE delete mode 100644 node_modules/sparkles/README.md delete mode 100644 node_modules/sparkles/index.js delete mode 100644 node_modules/sparkles/legacy.js delete mode 100644 node_modules/sparkles/package.json delete mode 100644 node_modules/spdx-exceptions/README.md delete mode 100644 node_modules/spdx-exceptions/deprecated.json delete mode 100644 node_modules/spdx-exceptions/index.json delete mode 100644 node_modules/spdx-exceptions/package.json delete mode 100644 node_modules/spdx-expression-parse/AUTHORS delete mode 100644 node_modules/spdx-expression-parse/LICENSE delete mode 100644 node_modules/spdx-expression-parse/README.md delete mode 100644 node_modules/spdx-expression-parse/index.js delete mode 100644 node_modules/spdx-expression-parse/package.json delete mode 100644 node_modules/spdx-expression-parse/parse.js delete mode 100644 node_modules/spdx-expression-parse/scan.js delete mode 100644 node_modules/spdx-license-ids/README.md delete mode 100644 node_modules/spdx-license-ids/deprecated.json delete mode 100644 node_modules/spdx-license-ids/index.json delete mode 100644 node_modules/spdx-license-ids/package.json delete mode 100644 node_modules/stream-composer/.github/workflows/test-node.yml delete mode 100644 node_modules/stream-composer/LICENSE delete mode 100644 node_modules/stream-composer/README.md delete mode 100644 node_modules/stream-composer/index.js delete mode 100644 node_modules/stream-composer/package.json delete mode 100644 node_modules/stream-composer/test.js delete mode 100644 node_modules/stream-exhaust/README.md delete mode 100644 node_modules/stream-exhaust/index.js delete mode 100644 node_modules/stream-exhaust/package.json delete mode 100644 node_modules/stream-exhaust/test.js delete mode 100644 node_modules/streamx/LICENSE delete mode 100644 node_modules/streamx/README.md delete mode 100644 node_modules/streamx/index.js delete mode 100644 node_modules/streamx/package.json delete mode 100644 node_modules/string-width/index.d.ts delete mode 100644 node_modules/string-width/index.js delete mode 100644 node_modules/string-width/license delete mode 100644 node_modules/string-width/package.json delete mode 100644 node_modules/string-width/readme.md delete mode 100644 node_modules/string_decoder/LICENSE delete mode 100644 node_modules/string_decoder/README.md delete mode 100644 node_modules/string_decoder/lib/string_decoder.js delete mode 100644 node_modules/string_decoder/package.json delete mode 100644 node_modules/strip-ansi/index.d.ts delete mode 100644 node_modules/strip-ansi/index.js delete mode 100644 node_modules/strip-ansi/license delete mode 100644 node_modules/strip-ansi/package.json delete mode 100644 node_modules/strip-ansi/readme.md delete mode 100644 node_modules/strip-json-comments/index.d.ts delete mode 100644 node_modules/strip-json-comments/index.js delete mode 100644 node_modules/strip-json-comments/license delete mode 100644 node_modules/strip-json-comments/package.json delete mode 100644 node_modules/strip-json-comments/readme.md delete mode 100644 node_modules/supports-color/browser.js delete mode 100644 node_modules/supports-color/index.js delete mode 100644 node_modules/supports-color/license delete mode 100644 node_modules/supports-color/package.json delete mode 100644 node_modules/supports-color/readme.md delete mode 100644 node_modules/supports-preserve-symlinks-flag/.eslintrc delete mode 100644 node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml delete mode 100644 node_modules/supports-preserve-symlinks-flag/.nycrc delete mode 100644 node_modules/supports-preserve-symlinks-flag/CHANGELOG.md delete mode 100644 node_modules/supports-preserve-symlinks-flag/LICENSE delete mode 100644 node_modules/supports-preserve-symlinks-flag/README.md delete mode 100644 node_modules/supports-preserve-symlinks-flag/browser.js delete mode 100644 node_modules/supports-preserve-symlinks-flag/index.js delete mode 100644 node_modules/supports-preserve-symlinks-flag/package.json delete mode 100644 node_modules/supports-preserve-symlinks-flag/test/index.js delete mode 100644 node_modules/sver/.travis.yml delete mode 100644 node_modules/sver/LICENSE delete mode 100644 node_modules/sver/README.md delete mode 100644 node_modules/sver/convert-range.js delete mode 120000 node_modules/sver/node_modules/.bin/semver delete mode 100644 node_modules/sver/node_modules/semver/LICENSE delete mode 100644 node_modules/sver/node_modules/semver/README.md delete mode 100755 node_modules/sver/node_modules/semver/bin/semver.js delete mode 100644 node_modules/sver/node_modules/semver/package.json delete mode 100644 node_modules/sver/node_modules/semver/range.bnf delete mode 100644 node_modules/sver/node_modules/semver/semver.js delete mode 100644 node_modules/sver/package.json delete mode 100644 node_modules/sver/sver.js delete mode 100644 node_modules/synckit/LICENSE delete mode 100644 node_modules/synckit/README.md delete mode 100644 node_modules/synckit/lib/index.cjs delete mode 100644 node_modules/synckit/lib/index.d.ts delete mode 100644 node_modules/synckit/lib/index.js delete mode 100644 node_modules/synckit/lib/index.js.map delete mode 100644 node_modules/synckit/lib/types.d.ts delete mode 100644 node_modules/synckit/lib/types.js delete mode 100644 node_modules/synckit/lib/types.js.map delete mode 100644 node_modules/synckit/package.json delete mode 100644 node_modules/teex/LICENSE delete mode 100644 node_modules/teex/README.md delete mode 100644 node_modules/teex/example.js delete mode 100644 node_modules/teex/index.js delete mode 100644 node_modules/teex/package.json delete mode 100644 node_modules/teex/test.js delete mode 100644 node_modules/text-decoder/LICENSE delete mode 100644 node_modules/text-decoder/README.md delete mode 100644 node_modules/text-decoder/index.js delete mode 100644 node_modules/text-decoder/lib/browser-decoder.js delete mode 100644 node_modules/text-decoder/lib/pass-through-decoder.js delete mode 100644 node_modules/text-decoder/lib/utf8-decoder.js delete mode 100644 node_modules/text-decoder/package.json delete mode 100644 node_modules/through2/LICENSE.md delete mode 100644 node_modules/through2/README.md delete mode 100644 node_modules/through2/package.json delete mode 100644 node_modules/through2/through2.js delete mode 100644 node_modules/to-regex-range/LICENSE delete mode 100644 node_modules/to-regex-range/README.md delete mode 100644 node_modules/to-regex-range/index.js delete mode 100644 node_modules/to-regex-range/package.json delete mode 100644 node_modules/to-through/LICENSE delete mode 100644 node_modules/to-through/README.md delete mode 100644 node_modules/to-through/index.js delete mode 100644 node_modules/to-through/package.json delete mode 100644 node_modules/tslib/CopyrightNotice.txt delete mode 100644 node_modules/tslib/LICENSE.txt delete mode 100644 node_modules/tslib/README.md delete mode 100644 node_modules/tslib/SECURITY.md delete mode 100644 node_modules/tslib/modules/index.d.ts delete mode 100644 node_modules/tslib/modules/index.js delete mode 100644 node_modules/tslib/modules/package.json delete mode 100644 node_modules/tslib/package.json delete mode 100644 node_modules/tslib/tslib.d.ts delete mode 100644 node_modules/tslib/tslib.es6.html delete mode 100644 node_modules/tslib/tslib.es6.js delete mode 100644 node_modules/tslib/tslib.es6.mjs delete mode 100644 node_modules/tslib/tslib.html delete mode 100644 node_modules/tslib/tslib.js delete mode 100644 node_modules/type-check/LICENSE delete mode 100644 node_modules/type-check/README.md delete mode 100644 node_modules/type-check/lib/check.js delete mode 100644 node_modules/type-check/lib/index.js delete mode 100644 node_modules/type-check/lib/parse-type.js delete mode 100644 node_modules/type-check/package.json delete mode 100644 node_modules/unc-path-regex/LICENSE delete mode 100644 node_modules/unc-path-regex/README.md delete mode 100644 node_modules/unc-path-regex/index.js delete mode 100644 node_modules/unc-path-regex/package.json delete mode 100644 node_modules/undertaker-registry/LICENSE delete mode 100644 node_modules/undertaker-registry/README.md delete mode 100644 node_modules/undertaker-registry/index.js delete mode 100644 node_modules/undertaker-registry/package.json delete mode 100644 node_modules/undertaker/LICENSE delete mode 100644 node_modules/undertaker/README.md delete mode 100644 node_modules/undertaker/index.js delete mode 100644 node_modules/undertaker/lib/get-task.js delete mode 100644 node_modules/undertaker/lib/helpers/buildTree.js delete mode 100644 node_modules/undertaker/lib/helpers/createExtensions.js delete mode 100644 node_modules/undertaker/lib/helpers/metadata.js delete mode 100644 node_modules/undertaker/lib/helpers/normalizeArgs.js delete mode 100644 node_modules/undertaker/lib/helpers/validateRegistry.js delete mode 100644 node_modules/undertaker/lib/last-run.js delete mode 100644 node_modules/undertaker/lib/parallel.js delete mode 100644 node_modules/undertaker/lib/registry.js delete mode 100644 node_modules/undertaker/lib/series.js delete mode 100644 node_modules/undertaker/lib/set-task.js delete mode 100644 node_modules/undertaker/lib/task.js delete mode 100644 node_modules/undertaker/lib/tree.js delete mode 100644 node_modules/undertaker/node_modules/fast-levenshtein/LICENSE.md delete mode 100644 node_modules/undertaker/node_modules/fast-levenshtein/README.md delete mode 100644 node_modules/undertaker/node_modules/fast-levenshtein/levenshtein.js delete mode 100644 node_modules/undertaker/node_modules/fast-levenshtein/package.json delete mode 100644 node_modules/undertaker/package.json delete mode 100755 node_modules/uri-js/LICENSE delete mode 100755 node_modules/uri-js/README.md delete mode 100755 node_modules/uri-js/dist/es5/uri.all.d.ts delete mode 100755 node_modules/uri-js/dist/es5/uri.all.js delete mode 100755 node_modules/uri-js/dist/es5/uri.all.js.map delete mode 100755 node_modules/uri-js/dist/es5/uri.all.min.d.ts delete mode 100755 node_modules/uri-js/dist/es5/uri.all.min.js delete mode 100755 node_modules/uri-js/dist/es5/uri.all.min.js.map delete mode 100755 node_modules/uri-js/dist/esnext/index.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/index.js delete mode 100755 node_modules/uri-js/dist/esnext/index.js.map delete mode 100755 node_modules/uri-js/dist/esnext/regexps-iri.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/regexps-iri.js delete mode 100755 node_modules/uri-js/dist/esnext/regexps-iri.js.map delete mode 100755 node_modules/uri-js/dist/esnext/regexps-uri.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/regexps-uri.js delete mode 100755 node_modules/uri-js/dist/esnext/regexps-uri.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/http.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/http.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/http.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/https.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/https.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/https.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/mailto.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/mailto.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/mailto.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/urn-uuid.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/urn.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/urn.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/urn.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/ws.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/ws.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/ws.js.map delete mode 100755 node_modules/uri-js/dist/esnext/schemes/wss.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/schemes/wss.js delete mode 100755 node_modules/uri-js/dist/esnext/schemes/wss.js.map delete mode 100755 node_modules/uri-js/dist/esnext/uri.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/uri.js delete mode 100755 node_modules/uri-js/dist/esnext/uri.js.map delete mode 100755 node_modules/uri-js/dist/esnext/util.d.ts delete mode 100755 node_modules/uri-js/dist/esnext/util.js delete mode 100755 node_modules/uri-js/dist/esnext/util.js.map delete mode 100755 node_modules/uri-js/package.json delete mode 100755 node_modules/uri-js/yarn.lock delete mode 100644 node_modules/util-deprecate/History.md delete mode 100644 node_modules/util-deprecate/LICENSE delete mode 100644 node_modules/util-deprecate/README.md delete mode 100644 node_modules/util-deprecate/browser.js delete mode 100644 node_modules/util-deprecate/node.js delete mode 100644 node_modules/util-deprecate/package.json delete mode 100644 node_modules/util/LICENSE delete mode 100644 node_modules/util/README.md delete mode 100644 node_modules/util/package.json delete mode 100644 node_modules/util/support/isBuffer.js delete mode 100644 node_modules/util/support/isBufferBrowser.js delete mode 100644 node_modules/util/support/types.js delete mode 100644 node_modules/util/util.js delete mode 100644 node_modules/v8flags/LICENSE delete mode 100644 node_modules/v8flags/README.md delete mode 100644 node_modules/v8flags/config-path.js delete mode 100644 node_modules/v8flags/index.js delete mode 100644 node_modules/v8flags/package.json delete mode 100644 node_modules/value-or-function/LICENSE delete mode 100644 node_modules/value-or-function/README.md delete mode 100644 node_modules/value-or-function/index.js delete mode 100644 node_modules/value-or-function/package.json delete mode 100644 node_modules/vinyl-contents/LICENSE delete mode 100644 node_modules/vinyl-contents/README.md delete mode 100644 node_modules/vinyl-contents/index.js delete mode 100644 node_modules/vinyl-contents/package.json delete mode 100644 node_modules/vinyl-fs/LICENSE delete mode 100644 node_modules/vinyl-fs/README.md delete mode 100644 node_modules/vinyl-fs/index.js delete mode 100644 node_modules/vinyl-fs/lib/codecs.js delete mode 100644 node_modules/vinyl-fs/lib/constants.js delete mode 100644 node_modules/vinyl-fs/lib/dest/index.js delete mode 100644 node_modules/vinyl-fs/lib/dest/options.js delete mode 100644 node_modules/vinyl-fs/lib/dest/prepare.js delete mode 100644 node_modules/vinyl-fs/lib/dest/sourcemap.js delete mode 100644 node_modules/vinyl-fs/lib/dest/write-contents/index.js delete mode 100644 node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js delete mode 100644 node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js delete mode 100644 node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js delete mode 100644 node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js delete mode 100644 node_modules/vinyl-fs/lib/file-operations.js delete mode 100644 node_modules/vinyl-fs/lib/src/index.js delete mode 100644 node_modules/vinyl-fs/lib/src/options.js delete mode 100644 node_modules/vinyl-fs/lib/src/prepare.js delete mode 100644 node_modules/vinyl-fs/lib/src/read-contents/index.js delete mode 100644 node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js delete mode 100644 node_modules/vinyl-fs/lib/src/read-contents/read-dir.js delete mode 100644 node_modules/vinyl-fs/lib/src/read-contents/read-stream.js delete mode 100644 node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js delete mode 100644 node_modules/vinyl-fs/lib/src/resolve-symlinks.js delete mode 100644 node_modules/vinyl-fs/lib/src/sourcemap.js delete mode 100644 node_modules/vinyl-fs/lib/src/wrap-vinyl.js delete mode 100644 node_modules/vinyl-fs/lib/symlink/index.js delete mode 100644 node_modules/vinyl-fs/lib/symlink/link-file.js delete mode 100644 node_modules/vinyl-fs/lib/symlink/options.js delete mode 100644 node_modules/vinyl-fs/lib/symlink/prepare.js delete mode 100644 node_modules/vinyl-fs/package.json delete mode 100644 node_modules/vinyl-sourcemap/LICENSE delete mode 100644 node_modules/vinyl-sourcemap/README.md delete mode 100644 node_modules/vinyl-sourcemap/index.js delete mode 100644 node_modules/vinyl-sourcemap/lib/helpers.js delete mode 100644 node_modules/vinyl-sourcemap/package.json delete mode 100644 node_modules/vinyl-sourcemaps-apply/.jshintrc delete mode 100644 node_modules/vinyl-sourcemaps-apply/.npmignore delete mode 100644 node_modules/vinyl-sourcemaps-apply/README.md delete mode 100644 node_modules/vinyl-sourcemaps-apply/index.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/CHANGELOG.md delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/LICENSE delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/README.md delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.debug.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.min.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.min.js.map delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/array-set.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64-vlq.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/binary-search.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/mapping-list.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/quick-sort.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-consumer.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-generator.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-node.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/util.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/package.json delete mode 100644 node_modules/vinyl-sourcemaps-apply/node_modules/source-map/source-map.js delete mode 100644 node_modules/vinyl-sourcemaps-apply/package.json delete mode 100644 node_modules/vinyl/LICENSE delete mode 100644 node_modules/vinyl/README.md delete mode 100644 node_modules/vinyl/index.js delete mode 100644 node_modules/vinyl/lib/inspect-stream.js delete mode 100644 node_modules/vinyl/lib/is-stream.js delete mode 100644 node_modules/vinyl/lib/normalize.js delete mode 100644 node_modules/vinyl/package.json delete mode 100644 node_modules/which-typed-array/.editorconfig delete mode 100644 node_modules/which-typed-array/.eslintrc delete mode 100644 node_modules/which-typed-array/.github/FUNDING.yml delete mode 100644 node_modules/which-typed-array/.nycrc delete mode 100644 node_modules/which-typed-array/CHANGELOG.md delete mode 100644 node_modules/which-typed-array/LICENSE delete mode 100644 node_modules/which-typed-array/README.md delete mode 100644 node_modules/which-typed-array/index.d.ts delete mode 100644 node_modules/which-typed-array/index.js delete mode 100644 node_modules/which-typed-array/package.json delete mode 100644 node_modules/which-typed-array/test/index.js delete mode 100644 node_modules/which-typed-array/tsconfig.json delete mode 100644 node_modules/which/CHANGELOG.md delete mode 100644 node_modules/which/LICENSE delete mode 100644 node_modules/which/README.md delete mode 100755 node_modules/which/bin/node-which delete mode 100644 node_modules/which/package.json delete mode 100644 node_modules/which/which.js delete mode 100644 node_modules/word-wrap/LICENSE delete mode 100644 node_modules/word-wrap/README.md delete mode 100644 node_modules/word-wrap/index.d.ts delete mode 100644 node_modules/word-wrap/index.js delete mode 100644 node_modules/word-wrap/package.json delete mode 100755 node_modules/wrap-ansi/index.js delete mode 100644 node_modules/wrap-ansi/license delete mode 100644 node_modules/wrap-ansi/package.json delete mode 100644 node_modules/wrap-ansi/readme.md delete mode 100644 node_modules/wrappy/LICENSE delete mode 100644 node_modules/wrappy/README.md delete mode 100644 node_modules/wrappy/package.json delete mode 100644 node_modules/wrappy/wrappy.js delete mode 100644 node_modules/y18n/CHANGELOG.md delete mode 100644 node_modules/y18n/LICENSE delete mode 100644 node_modules/y18n/README.md delete mode 100644 node_modules/y18n/build/index.cjs delete mode 100644 node_modules/y18n/build/lib/cjs.js delete mode 100644 node_modules/y18n/build/lib/index.js delete mode 100644 node_modules/y18n/build/lib/platform-shims/node.js delete mode 100644 node_modules/y18n/index.mjs delete mode 100644 node_modules/y18n/package.json delete mode 100644 node_modules/yargs-parser/CHANGELOG.md delete mode 100644 node_modules/yargs-parser/LICENSE.txt delete mode 100644 node_modules/yargs-parser/README.md delete mode 100644 node_modules/yargs-parser/browser.js delete mode 100644 node_modules/yargs-parser/build/index.cjs delete mode 100644 node_modules/yargs-parser/build/lib/index.js delete mode 100644 node_modules/yargs-parser/build/lib/string-utils.js delete mode 100644 node_modules/yargs-parser/build/lib/tokenize-arg-string.js delete mode 100644 node_modules/yargs-parser/build/lib/yargs-parser-types.js delete mode 100644 node_modules/yargs-parser/build/lib/yargs-parser.js delete mode 100644 node_modules/yargs-parser/package.json delete mode 100644 node_modules/yargs/LICENSE delete mode 100644 node_modules/yargs/README.md delete mode 100644 node_modules/yargs/browser.d.ts delete mode 100644 node_modules/yargs/browser.mjs delete mode 100644 node_modules/yargs/build/index.cjs delete mode 100644 node_modules/yargs/build/lib/argsert.js delete mode 100644 node_modules/yargs/build/lib/command.js delete mode 100644 node_modules/yargs/build/lib/completion-templates.js delete mode 100644 node_modules/yargs/build/lib/completion.js delete mode 100644 node_modules/yargs/build/lib/middleware.js delete mode 100644 node_modules/yargs/build/lib/parse-command.js delete mode 100644 node_modules/yargs/build/lib/typings/common-types.js delete mode 100644 node_modules/yargs/build/lib/typings/yargs-parser-types.js delete mode 100644 node_modules/yargs/build/lib/usage.js delete mode 100644 node_modules/yargs/build/lib/utils/apply-extends.js delete mode 100644 node_modules/yargs/build/lib/utils/is-promise.js delete mode 100644 node_modules/yargs/build/lib/utils/levenshtein.js delete mode 100644 node_modules/yargs/build/lib/utils/maybe-async-result.js delete mode 100644 node_modules/yargs/build/lib/utils/obj-filter.js delete mode 100644 node_modules/yargs/build/lib/utils/process-argv.js delete mode 100644 node_modules/yargs/build/lib/utils/set-blocking.js delete mode 100644 node_modules/yargs/build/lib/utils/which-module.js delete mode 100644 node_modules/yargs/build/lib/validation.js delete mode 100644 node_modules/yargs/build/lib/yargs-factory.js delete mode 100644 node_modules/yargs/build/lib/yerror.js delete mode 100644 node_modules/yargs/helpers/helpers.mjs delete mode 100644 node_modules/yargs/helpers/index.js delete mode 100644 node_modules/yargs/helpers/package.json delete mode 100644 node_modules/yargs/index.cjs delete mode 100644 node_modules/yargs/index.mjs delete mode 100644 node_modules/yargs/lib/platform-shims/browser.mjs delete mode 100644 node_modules/yargs/lib/platform-shims/esm.mjs delete mode 100644 node_modules/yargs/locales/be.json delete mode 100644 node_modules/yargs/locales/cs.json delete mode 100644 node_modules/yargs/locales/de.json delete mode 100644 node_modules/yargs/locales/en.json delete mode 100644 node_modules/yargs/locales/es.json delete mode 100644 node_modules/yargs/locales/fi.json delete mode 100644 node_modules/yargs/locales/fr.json delete mode 100644 node_modules/yargs/locales/hi.json delete mode 100644 node_modules/yargs/locales/hu.json delete mode 100644 node_modules/yargs/locales/id.json delete mode 100644 node_modules/yargs/locales/it.json delete mode 100644 node_modules/yargs/locales/ja.json delete mode 100644 node_modules/yargs/locales/ko.json delete mode 100644 node_modules/yargs/locales/nb.json delete mode 100644 node_modules/yargs/locales/nl.json delete mode 100644 node_modules/yargs/locales/nn.json delete mode 100644 node_modules/yargs/locales/pirate.json delete mode 100644 node_modules/yargs/locales/pl.json delete mode 100644 node_modules/yargs/locales/pt.json delete mode 100644 node_modules/yargs/locales/pt_BR.json delete mode 100644 node_modules/yargs/locales/ru.json delete mode 100644 node_modules/yargs/locales/th.json delete mode 100644 node_modules/yargs/locales/tr.json delete mode 100644 node_modules/yargs/locales/uk_UA.json delete mode 100644 node_modules/yargs/locales/uz.json delete mode 100644 node_modules/yargs/locales/zh_CN.json delete mode 100644 node_modules/yargs/locales/zh_TW.json delete mode 100644 node_modules/yargs/package.json delete mode 100644 node_modules/yargs/yargs delete mode 100644 node_modules/yargs/yargs.mjs delete mode 100644 node_modules/yocto-queue/index.d.ts delete mode 100644 node_modules/yocto-queue/index.js delete mode 100644 node_modules/yocto-queue/license delete mode 100644 node_modules/yocto-queue/package.json delete mode 100644 node_modules/yocto-queue/readme.md diff --git a/node_modules/.bin/acorn b/node_modules/.bin/acorn deleted file mode 120000 index cf76760..0000000 --- a/node_modules/.bin/acorn +++ /dev/null @@ -1 +0,0 @@ -../acorn/bin/acorn \ No newline at end of file diff --git a/node_modules/.bin/errno b/node_modules/.bin/errno deleted file mode 120000 index 5a98e53..0000000 --- a/node_modules/.bin/errno +++ /dev/null @@ -1 +0,0 @@ -../errno/cli.js \ No newline at end of file diff --git a/node_modules/.bin/eslint b/node_modules/.bin/eslint deleted file mode 120000 index 810e4bc..0000000 --- a/node_modules/.bin/eslint +++ /dev/null @@ -1 +0,0 @@ -../eslint/bin/eslint.js \ No newline at end of file diff --git a/node_modules/.bin/eslint-config-prettier b/node_modules/.bin/eslint-config-prettier deleted file mode 120000 index 7d29baa..0000000 --- a/node_modules/.bin/eslint-config-prettier +++ /dev/null @@ -1 +0,0 @@ -../eslint-config-prettier/bin/cli.js \ No newline at end of file diff --git a/node_modules/.bin/fvtt b/node_modules/.bin/fvtt deleted file mode 120000 index e67e833..0000000 --- a/node_modules/.bin/fvtt +++ /dev/null @@ -1 +0,0 @@ -../@foundryvtt/foundryvtt-cli/fvtt.mjs \ No newline at end of file diff --git a/node_modules/.bin/gulp b/node_modules/.bin/gulp deleted file mode 120000 index 5de7332..0000000 --- a/node_modules/.bin/gulp +++ /dev/null @@ -1 +0,0 @@ -../gulp/bin/gulp.js \ No newline at end of file diff --git a/node_modules/.bin/image-size b/node_modules/.bin/image-size deleted file mode 120000 index f575317..0000000 --- a/node_modules/.bin/image-size +++ /dev/null @@ -1 +0,0 @@ -../image-size/bin/image-size.js \ No newline at end of file diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml deleted file mode 120000 index 9dbd010..0000000 --- a/node_modules/.bin/js-yaml +++ /dev/null @@ -1 +0,0 @@ -../js-yaml/bin/js-yaml.js \ No newline at end of file diff --git a/node_modules/.bin/lessc b/node_modules/.bin/lessc deleted file mode 120000 index 87a5294..0000000 --- a/node_modules/.bin/lessc +++ /dev/null @@ -1 +0,0 @@ -../less/bin/lessc \ No newline at end of file diff --git a/node_modules/.bin/mime b/node_modules/.bin/mime deleted file mode 120000 index fbb7ee0..0000000 --- a/node_modules/.bin/mime +++ /dev/null @@ -1 +0,0 @@ -../mime/cli.js \ No newline at end of file diff --git a/node_modules/.bin/mkdirp b/node_modules/.bin/mkdirp deleted file mode 120000 index 0fd5193..0000000 --- a/node_modules/.bin/mkdirp +++ /dev/null @@ -1 +0,0 @@ -../mkdirp/dist/cjs/src/bin.js \ No newline at end of file diff --git a/node_modules/.bin/needle b/node_modules/.bin/needle deleted file mode 120000 index 8280969..0000000 --- a/node_modules/.bin/needle +++ /dev/null @@ -1 +0,0 @@ -../needle/bin/needle \ No newline at end of file diff --git a/node_modules/.bin/node-gyp-build b/node_modules/.bin/node-gyp-build deleted file mode 120000 index 671c6eb..0000000 --- a/node_modules/.bin/node-gyp-build +++ /dev/null @@ -1 +0,0 @@ -../node-gyp-build/bin.js \ No newline at end of file diff --git a/node_modules/.bin/node-gyp-build-optional b/node_modules/.bin/node-gyp-build-optional deleted file mode 120000 index 46d347e..0000000 --- a/node_modules/.bin/node-gyp-build-optional +++ /dev/null @@ -1 +0,0 @@ -../node-gyp-build/optional.js \ No newline at end of file diff --git a/node_modules/.bin/node-gyp-build-test b/node_modules/.bin/node-gyp-build-test deleted file mode 120000 index d11de1b..0000000 --- a/node_modules/.bin/node-gyp-build-test +++ /dev/null @@ -1 +0,0 @@ -../node-gyp-build/build-test.js \ No newline at end of file diff --git a/node_modules/.bin/node-which b/node_modules/.bin/node-which deleted file mode 120000 index 6f8415e..0000000 --- a/node_modules/.bin/node-which +++ /dev/null @@ -1 +0,0 @@ -../which/bin/node-which \ No newline at end of file diff --git a/node_modules/.bin/prettier b/node_modules/.bin/prettier deleted file mode 120000 index 92267ed..0000000 --- a/node_modules/.bin/prettier +++ /dev/null @@ -1 +0,0 @@ -../prettier/bin/prettier.cjs \ No newline at end of file diff --git a/node_modules/.bin/resolve b/node_modules/.bin/resolve deleted file mode 120000 index b6afda6..0000000 --- a/node_modules/.bin/resolve +++ /dev/null @@ -1 +0,0 @@ -../resolve/bin/resolve \ No newline at end of file diff --git a/node_modules/.bin/semver b/node_modules/.bin/semver deleted file mode 120000 index 5aaadf4..0000000 --- a/node_modules/.bin/semver +++ /dev/null @@ -1 +0,0 @@ -../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json deleted file mode 100644 index c0e9678..0000000 --- a/node_modules/.package-lock.json +++ /dev/null @@ -1,3465 +0,0 @@ -{ - "name": "fvtt-lethal-fantasy", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "node_modules/@es-joy/jsdoccomment": { - "version": "0.46.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.46.0.tgz", - "integrity": "sha512-C3Axuq1xd/9VqFZpW4YAzOx5O9q/LP46uIQy/iNDpHG3fmPa6TBtvfglMCs3RBiBxAIi0Go97r8+jvTt55XMyQ==", - "dev": true, - "dependencies": { - "comment-parser": "1.4.1", - "esquery": "^1.6.0", - "jsdoc-type-pratt-parser": "~4.0.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", - "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", - "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", - "dev": true, - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/config-array": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", - "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", - "dev": true, - "dependencies": { - "@eslint/object-schema": "^2.1.4", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/core": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", - "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", - "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", - "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.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": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "9.16.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.16.0.tgz", - "integrity": "sha512-tw2HxzQkrbeuvyj1tG2Yqq+0H9wGoI2IMk4EOsQeX+vmd75FtJAzf+gTA69WF+baUKRYQ3x2kbLE08js5OsTVg==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", - "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", - "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", - "dev": true, - "dependencies": { - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@foundryvtt/foundryvtt-cli": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@foundryvtt/foundryvtt-cli/-/foundryvtt-cli-1.0.3.tgz", - "integrity": "sha512-M8NrMXFYpOEsLAbgRWfuMvUa9F6HwrROLtqhhBljqfVS1lgm0RJJY/7MObuXsTJOC6+Uu+QOPZTlw4k+hguG7w==", - "dev": true, - "dependencies": { - "chalk": "^5.2.0", - "classic-level": "^1.2.0", - "esm": "^3.2.25", - "js-yaml": "^4.1.0", - "mkdirp": "^3.0.0", - "nedb-promises": "^6.2.1", - "yargs": "^17.7.1" - }, - "bin": { - "fvtt": "fvtt.mjs" - }, - "engines": { - "node": ">17.0.0" - } - }, - "node_modules/@gulpjs/messages": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@gulpjs/messages/-/messages-1.1.0.tgz", - "integrity": "sha512-Ys9sazDatyTgZVb4xPlDufLweJ/Os2uHWOv+Caxvy2O85JcnT4M3vc73bi8pdLWlv3fdWQz3pdI9tVwo8rQQSg==", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/@gulpjs/to-absolute-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@gulpjs/to-absolute-glob/-/to-absolute-glob-4.0.0.tgz", - "integrity": "sha512-kjotm7XJrJ6v+7knhPaRgaT6q8F8K2jiafwYdNHLzmV0uGLuZY43FK6smNSHUPrhq5kX2slCUy+RGG/xGqmIKA==", - "dependencies": { - "is-negated-glob": "^1.0.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", - "dev": true, - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", - "dev": true, - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", - "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", - "dev": true, - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@pkgr/core": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", - "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, - "node_modules/@seald-io/binary-search-tree": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@seald-io/binary-search-tree/-/binary-search-tree-1.0.3.tgz", - "integrity": "sha512-qv3jnwoakeax2razYaMsGI/luWdliBLHTdC6jU55hQt1hcFqzauH/HsBollQ7IR4ySTtYhT+xyHoijpA16C+tA==", - "dev": true - }, - "node_modules/@seald-io/nedb": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/@seald-io/nedb/-/nedb-4.0.4.tgz", - "integrity": "sha512-CUNcMio7QUHTA+sIJ/DC5JzVNNsHe743TPmC4H5Gij9zDLMbmrCT2li3eVB72/gF63BPS8pWEZrjlAMRKA8FDw==", - "dev": true, - "dependencies": { - "@seald-io/binary-search-tree": "^1.0.3", - "localforage": "^1.9.0", - "util": "^0.12.4" - } - }, - "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", - "dev": true - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, - "node_modules/abstract-level": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.4.tgz", - "integrity": "sha512-eUP/6pbXBkMbXFdx4IH2fVgvB7M0JvR7/lIL33zcs0IBcwjdzSSl31TOJsaCzmKSSDF9h8QYSOJux4Nd4YJqFg==", - "dev": true, - "dependencies": { - "buffer": "^6.0.3", - "catering": "^2.1.0", - "is-buffer": "^2.0.5", - "level-supports": "^4.0.0", - "level-transcoder": "^1.0.1", - "module-error": "^1.0.1", - "queue-microtask": "^1.2.3" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "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-colors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", - "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", - "dependencies": { - "ansi-wrap": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "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==", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/ansi-wrap": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", - "integrity": "sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/are-docs-informative": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/are-docs-informative/-/are-docs-informative-0.0.2.tgz", - "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==", - "dev": true, - "engines": { - "node": ">=14" - } - }, - "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/arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-slice": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/async-done": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/async-done/-/async-done-2.0.0.tgz", - "integrity": "sha512-j0s3bzYq9yKIVLKGE/tWlCpa3PfFLcrDZLTSVdnnCTGagXuXBJO4SsY9Xdk/fQBirCkH4evW5xOeJXqlAQFdsw==", - "dependencies": { - "end-of-stream": "^1.4.4", - "once": "^1.4.0", - "stream-exhaust": "^1.0.2" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/async-settle": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-2.0.0.tgz", - "integrity": "sha512-Obu/KE8FurfQRN6ODdHN9LuXqwC+JFIM9NRyZqJJ4ZfLJmIYN9Rg0/kb+wF70VV5+fJusTMQlJ1t5rF7J/ETdg==", - "dependencies": { - "async-done": "^2.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/available-typed-arrays": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", - "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", - "dev": true, - "dependencies": { - "possible-typed-array-names": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/bach": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/bach/-/bach-2.0.1.tgz", - "integrity": "sha512-A7bvGMGiTOxGMpNupYl9HQTf0FFDNF4VCmks4PJpFyN1AX2pdKuxuwdvUz2Hu388wcgp+OvGFNsumBfFNkR7eg==", - "dependencies": { - "async-done": "^2.0.0", - "async-settle": "^2.0.0", - "now-and-later": "^3.0.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/bare-events": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.5.0.tgz", - "integrity": "sha512-/E8dDe9dsbLyh2qrZ64PEPadOQ0F4gbl1sUJOrmph7xOiIxfY8vwab/4bFLh4Y88/Hk/ujKcrQKc+ps0mv873A==", - "optional": true - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/bl": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", - "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", - "dependencies": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "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/catering": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", - "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/classic-level": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.4.1.tgz", - "integrity": "sha512-qGx/KJl3bvtOHrGau2WklEZuXhS3zme+jf+fsu6Ej7W7IP/C49v7KNlWIsT1jZu0YnfzSIYDGcEWpCa1wKGWXQ==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "abstract-level": "^1.0.2", - "catering": "^2.1.0", - "module-error": "^1.0.1", - "napi-macros": "^2.2.2", - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==" - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", - "dev": true, - "engines": { - "node": ">=16" - } - }, - "node_modules/comment-parser": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.4.1.tgz", - "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==", - "dev": true, - "engines": { - "node": ">= 12.0.0" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" - }, - "node_modules/copy-anything": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz", - "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==", - "dependencies": { - "is-what": "^3.14.1" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, - "node_modules/copy-props": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/copy-props/-/copy-props-4.0.0.tgz", - "integrity": "sha512-bVWtw1wQLzzKiYROtvNlbJgxgBYt2bMJpkCbKmXM3xyijvcjjWXEk5nyrrT3bgJ7ODb19ZohE2T0Y3FgNPyoTw==", - "dependencies": { - "each-props": "^3.0.0", - "is-plain-object": "^5.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "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-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/each-props": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/each-props/-/each-props-3.0.0.tgz", - "integrity": "sha512-IYf1hpuWrdzse/s/YJOrFmU15lyhSzxelNVAHTEG3DtP4QsLTWZUzcUL3HMXmKQxXpa4EIrBPpwRgj0aehdvAw==", - "dependencies": { - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/errno": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", - "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", - "optional": true, - "dependencies": { - "prr": "~1.0.1" - }, - "bin": { - "errno": "cli.js" - } - }, - "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-module-lexer": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", - "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "engines": { - "node": ">=6" - } - }, - "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": "9.16.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.16.0.tgz", - "integrity": "sha512-whp8mSQI4C8VXd+fLgSM0lh3UlmcFtVwUQjyKCFfsp+2ItAIYhlq/hqGahGqHE6cv9unM41VlqKk2VtKYR2TaA==", - "dev": true, - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.19.0", - "@eslint/core": "^0.9.0", - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "9.16.0", - "@eslint/plugin-kit": "^0.2.3", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.1", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.5", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.2.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-config-prettier": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", - "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", - "dev": true, - "bin": { - "eslint-config-prettier": "bin/cli.js" - }, - "peerDependencies": { - "eslint": ">=7.0.0" - } - }, - "node_modules/eslint-plugin-jsdoc": { - "version": "48.11.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.11.0.tgz", - "integrity": "sha512-d12JHJDPNo7IFwTOAItCeJY1hcqoIxE0lHA8infQByLilQ9xkqrRa6laWCnsuCrf+8rUnvxXY1XuTbibRBNylA==", - "dev": true, - "dependencies": { - "@es-joy/jsdoccomment": "~0.46.0", - "are-docs-informative": "^0.0.2", - "comment-parser": "1.4.1", - "debug": "^4.3.5", - "escape-string-regexp": "^4.0.0", - "espree": "^10.1.0", - "esquery": "^1.6.0", - "parse-imports": "^2.1.1", - "semver": "^7.6.3", - "spdx-expression-parse": "^4.0.0", - "synckit": "^0.9.1" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0" - } - }, - "node_modules/eslint-plugin-prettier": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", - "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", - "dev": true, - "dependencies": { - "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.9.1" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint-plugin-prettier" - }, - "peerDependencies": { - "@types/eslint": ">=8.0.0", - "eslint": ">=8.0.0", - "eslint-config-prettier": "*", - "prettier": ">=3.0.0" - }, - "peerDependenciesMeta": { - "@types/eslint": { - "optional": true - }, - "eslint-config-prettier": { - "optional": true - } - } - }, - "node_modules/eslint-scope": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", - "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", - "dev": true, - "dependencies": { - "acorn": "^8.14.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", - "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/expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==", - "dependencies": { - "homedir-polyfill": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "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-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true - }, - "node_modules/fast-fifo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", - "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==" - }, - "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/fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", - "engines": { - "node": ">= 4.9.1" - } - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/findup-sync": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-5.0.0.tgz", - "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", - "dependencies": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.3", - "micromatch": "^4.0.4", - "resolve-dir": "^1.0.1" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/fined": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-2.0.0.tgz", - "integrity": "sha512-OFRzsL6ZMHz5s0JrsEr+TpdGNCtrVtnuG3x1yzGNiQHT0yaDnXAj8V/lWcpJVrnoDpcwXcASxAZYbuXda2Y82A==", - "dependencies": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^5.0.0", - "object.defaults": "^1.1.0", - "object.pick": "^1.3.0", - "parse-filepath": "^1.0.2" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/flagged-respawn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-2.0.0.tgz", - "integrity": "sha512-Gq/a6YCi8zexmGHMuJwahTGzXlAZAOsbCVKduWXC6TlLCjjFRlExMJc4GC2NYPYZ0r/brw9P7CpRgQmlPVeOoA==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/flatted": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", - "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", - "dev": true - }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "dependencies": { - "is-callable": "^1.1.3" - } - }, - "node_modules/for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/for-own": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", - "integrity": "sha512-0OABksIGrxKK8K4kynWkQ7y1zounQxP+CWnyclVwj81KW3vlLlGUx57DKGcP/LH216GzqnstnPocF16Nxs0Ycg==", - "dependencies": { - "for-in": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fs-mkdirp-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-2.0.1.tgz", - "integrity": "sha512-UTOY+59K6IA94tec8Wjqm0FSh5OVudGNB0NL/P6fB3HiE3bYOY3VYBGijsnOHNkQSwC1FKkU77pmq7xp9CskLw==", - "dependencies": { - "graceful-fs": "^4.2.8", - "streamx": "^2.12.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", - "dev": true, - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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==", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/glob-stream": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-8.0.2.tgz", - "integrity": "sha512-R8z6eTB55t3QeZMmU1C+Gv+t5UnNRkA55c5yo67fAVfxODxieTwsjNG7utxS/73NdP1NbDgCrhVEg2h00y4fFw==", - "dependencies": { - "@gulpjs/to-absolute-glob": "^4.0.0", - "anymatch": "^3.1.3", - "fastq": "^1.13.0", - "glob-parent": "^6.0.2", - "is-glob": "^4.0.3", - "is-negated-glob": "^1.0.0", - "normalize-path": "^3.0.0", - "streamx": "^2.12.5" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/glob-watcher": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-6.0.0.tgz", - "integrity": "sha512-wGM28Ehmcnk2NqRORXFOTOR064L4imSw3EeOqU5bIwUf62eXGwg89WivH6VMahL8zlQHeodzvHpXplrqzrz3Nw==", - "dependencies": { - "async-done": "^2.0.0", - "chokidar": "^3.5.3" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dependencies": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha512-5lsx1NUDHtSjfg0eHlmYvZKv8/nVqX4ckFbM+FrGcQ+04KWcWFo9P5MxPZYSzUvyzmdTbI7Eix8Q4IbELDqzKg==", - "dependencies": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/global-prefix/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/globals": { - "version": "15.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.12.0.tgz", - "integrity": "sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glogg": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/glogg/-/glogg-2.2.0.tgz", - "integrity": "sha512-eWv1ds/zAlz+M1ioHsyKJomfY7jbDDPpwSkv14KQj89bycx1nvK5/2Cj/T9g7kzJcX5Bc7Yv22FjfBZS/jl94A==", - "dependencies": { - "sparkles": "^2.1.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/gopd": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.1.0.tgz", - "integrity": "sha512-FQoVQnqcdk4hVM4JN1eromaun4iuS34oStkdlLENLdpULsuQcTyXj8w7ayhuUfPwEYZ1ZOooOTT6fdA9Vmx/RA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" - }, - "node_modules/gulp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gulp/-/gulp-5.0.0.tgz", - "integrity": "sha512-S8Z8066SSileaYw1S2N1I64IUc/myI2bqe2ihOBzO6+nKpvNSg7ZcWJt/AwF8LC/NVN+/QZ560Cb/5OPsyhkhg==", - "dependencies": { - "glob-watcher": "^6.0.0", - "gulp-cli": "^3.0.0", - "undertaker": "^2.0.0", - "vinyl-fs": "^4.0.0" - }, - "bin": { - "gulp": "bin/gulp.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/gulp-cli": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-3.0.0.tgz", - "integrity": "sha512-RtMIitkT8DEMZZygHK2vEuLPqLPAFB4sntSxg4NoDta7ciwGZ18l7JuhCTiS5deOJi2IoK0btE+hs6R4sfj7AA==", - "dependencies": { - "@gulpjs/messages": "^1.1.0", - "chalk": "^4.1.2", - "copy-props": "^4.0.0", - "gulplog": "^2.2.0", - "interpret": "^3.1.1", - "liftoff": "^5.0.0", - "mute-stdout": "^2.0.0", - "replace-homedir": "^2.0.0", - "semver-greatest-satisfied-range": "^2.0.0", - "string-width": "^4.2.3", - "v8flags": "^4.0.0", - "yargs": "^16.2.0" - }, - "bin": { - "gulp": "bin/gulp.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/gulp-cli/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/gulp-cli/node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/gulp-cli/node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/gulp-cli/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "engines": { - "node": ">=10" - } - }, - "node_modules/gulp-less": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/gulp-less/-/gulp-less-5.0.0.tgz", - "integrity": "sha512-W2I3TewO/By6UZsM/wJG3pyK5M6J0NYmJAAhwYXQHR+38S0iDtZasmUgFCH3CQj+pQYw/PAIzxvFvwtEXz1HhQ==", - "dependencies": { - "less": "^3.7.1 || ^4.0.0", - "object-assign": "^4.0.1", - "plugin-error": "^1.0.0", - "replace-ext": "^2.0.0", - "through2": "^4.0.0", - "vinyl-sourcemaps-apply": "^0.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/gulplog": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-2.2.0.tgz", - "integrity": "sha512-V2FaKiOhpR3DRXZuYdRLn/qiY0yI5XmqbTKrYbdemJ+xOh2d2MOweI/XFgMzd/9+1twdvMwllnZbWZNJ+BOm4A==", - "dependencies": { - "glogg": "^2.2.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dev": true, - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "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", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "dependencies": { - "parse-passwd": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/image-size": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", - "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", - "optional": true, - "bin": { - "image-size": "bin/image-size.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "dev": true - }, - "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/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" - }, - "node_modules/interpret": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", - "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "dependencies": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "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-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "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" - } - ], - "engines": { - "node": ">=4" - } - }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-core-module": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", - "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-extendable/node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "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==", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha512-czXVVn/QEmgvej1f50BZ648vUI+em0xqMq2Sn+QncCLN4zj1UAxlT+kw/6ggQTOaZPd1HqKQGEqbpQVtJucWug==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "dependencies": { - "is-unc-path": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", - "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", - "dev": true, - "dependencies": { - "which-typed-array": "^1.1.14" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "dependencies": { - "unc-path-regex": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-valid-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", - "integrity": "sha512-AhiROmoEFDSsjx8hW+5sGwgKVIORcXnrlAx/R0ZSeaPw70Vw0CqkGBBhHGL58Uox2eXnU1AnvXJl1XlyedO5bA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-what": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", - "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==" - }, - "node_modules/is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" - }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "engines": { - "node": ">=0.10.0" - } - }, - "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/jsdoc-type-pratt-parser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-4.0.0.tgz", - "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==", - "dev": true, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true - }, - "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/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/last-run": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/last-run/-/last-run-2.0.0.tgz", - "integrity": "sha512-j+y6WhTLN4Itnf9j5ZQos1BGPCS8DAwmgMroR3OzfxAsBxam0hMw7J8M3KqZl0pLQJ1jNnwIexg5DYpC/ctwEQ==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/lead": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/lead/-/lead-4.0.0.tgz", - "integrity": "sha512-DpMa59o5uGUWWjruMp71e6knmwKU3jRBBn1kjuLWN9EeIOxNeSAwvHf03WIl8g/ZMR2oSQC9ej3yeLBwdDc/pg==", - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/less": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/less/-/less-4.2.1.tgz", - "integrity": "sha512-CasaJidTIhWmjcqv0Uj5vccMI7pJgfD9lMkKtlnTHAdJdYK/7l8pM9tumLyJ0zhbD4KJLo/YvTj+xznQd5NBhg==", - "dependencies": { - "copy-anything": "^2.0.1", - "parse-node-version": "^1.0.1", - "tslib": "^2.3.0" - }, - "bin": { - "lessc": "bin/lessc" - }, - "engines": { - "node": ">=6" - }, - "optionalDependencies": { - "errno": "^0.1.1", - "graceful-fs": "^4.1.2", - "image-size": "~0.5.0", - "make-dir": "^2.1.0", - "mime": "^1.4.1", - "needle": "^3.1.0", - "source-map": "~0.6.0" - } - }, - "node_modules/level-supports": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz", - "integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dev": true, - "dependencies": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" - }, - "engines": { - "node": ">=12" - } - }, - "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/lie": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz", - "integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==", - "dev": true, - "dependencies": { - "immediate": "~3.0.5" - } - }, - "node_modules/liftoff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-5.0.0.tgz", - "integrity": "sha512-a5BQjbCHnB+cy+gsro8lXJ4kZluzOijzJ1UVVfyJYZC+IP2pLv1h4+aysQeKuTmyO8NAqfyQAk4HWaP/HjcKTg==", - "dependencies": { - "extend": "^3.0.2", - "findup-sync": "^5.0.0", - "fined": "^2.0.0", - "flagged-respawn": "^2.0.0", - "is-plain-object": "^5.0.0", - "rechoir": "^0.8.0", - "resolve": "^1.20.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/localforage": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", - "integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==", - "dev": true, - "dependencies": { - "lie": "3.1.1" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "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/make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "optional": true, - "dependencies": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "optional": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "optional": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mkdirp": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", - "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", - "dev": true, - "bin": { - "mkdirp": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "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/mute-stdout": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mute-stdout/-/mute-stdout-2.0.0.tgz", - "integrity": "sha512-32GSKM3Wyc8dg/p39lWPKYu8zci9mJFzV1Np9Of0ZEpe6Fhssn/FbI7ywAMd40uX+p3ZKh3T5EeCFv81qS3HmQ==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/napi-macros": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", - "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==", - "dev": true - }, - "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/nedb-promises": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/nedb-promises/-/nedb-promises-6.2.3.tgz", - "integrity": "sha512-enq0IjNyBz9Qy9W/QPCcLGh/QORGBjXbIeZeWvIjO3OMLyAvlKT3hiJubP2BKEiFniUlR3L01o18ktqgn5jxqA==", - "dev": true, - "dependencies": { - "@seald-io/nedb": "^4.0.2" - } - }, - "node_modules/needle": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz", - "integrity": "sha512-6k0YULvhpw+RoLNiQCRKOl09Rv1dPLr8hHnVjHqdolKwDrdNyk+Hmrthi4lIGPPz3r39dLx0hsF5s40sZ3Us4Q==", - "optional": true, - "dependencies": { - "iconv-lite": "^0.6.3", - "sax": "^1.2.4" - }, - "bin": { - "needle": "bin/needle" - }, - "engines": { - "node": ">= 4.4.x" - } - }, - "node_modules/node-gyp-build": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", - "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", - "dev": true, - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/now-and-later": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-3.0.0.tgz", - "integrity": "sha512-pGO4pzSdaxhWTGkfSfHx3hVzJVslFPwBp2Myq9MYN/ChfJZF87ochMAXnvz6/58RJSf5ik2q9tXprBBrk2cpcg==", - "dependencies": { - "once": "^1.4.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.defaults": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", - "integrity": "sha512-c/K0mw/F11k4dEUBMW8naXUuBuhxRCfG7W+yFy8EcijU/rSmazOUd1XAEEe6bC0OuXY4HUKjTJv7xbxIMqdxrA==", - "dependencies": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "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==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "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.5" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "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/parse-filepath": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", - "integrity": "sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q==", - "dependencies": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/parse-imports": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.2.1.tgz", - "integrity": "sha512-OL/zLggRp8mFhKL0rNORUTR4yBYujK/uU+xZL+/0Rgm2QE4nLO9v8PzEweSJEbMGKmDRjJE4R3IMJlL2di4JeQ==", - "dev": true, - "dependencies": { - "es-module-lexer": "^1.5.3", - "slashes": "^3.0.12" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/parse-node-version": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "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==" - }, - "node_modules/path-root": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", - "integrity": "sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg==", - "dependencies": { - "path-root-regex": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-root-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", - "integrity": "sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "optional": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/plugin-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", - "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", - "dependencies": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/possible-typed-array-names": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", - "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "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/prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", - "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", - "dev": true, - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "dependencies": { - "fast-diff": "^1.1.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", - "optional": true - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "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" - } - ] - }, - "node_modules/queue-tick": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", - "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==" - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/rechoir": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", - "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", - "dependencies": { - "resolve": "^1.20.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==" - }, - "node_modules/replace-ext": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-2.0.0.tgz", - "integrity": "sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==", - "engines": { - "node": ">= 10" - } - }, - "node_modules/replace-homedir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/replace-homedir/-/replace-homedir-2.0.0.tgz", - "integrity": "sha512-bgEuQQ/BHW0XkkJtawzrfzHFSN70f/3cNOiHa2QsYxqrjaC30X1k74FJ6xswVBP0sr0SpGIdVFuPwfrYziVeyw==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dependencies": { - "is-core-module": "^2.13.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-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha512-R7uiTjECzvOsWSfdM0QKFNBVFcK27aHOUwdvK53BcW8zqnGdYp0Fbj82cy54+2A4P2tFM22J5kRfe1R+lM/1yg==", - "dependencies": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "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/resolve-options": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-2.0.0.tgz", - "integrity": "sha512-/FopbmmFOQCfsCx77BRFdKOniglTiHumLgwvd6IDPihy1GKkadZbgQJBcTb2lMzSR1pndzd96b1nZrreZ7+9/A==", - "dependencies": { - "value-or-function": "^4.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/sax": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", - "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", - "optional": true - }, - "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/semver-greatest-satisfied-range": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-greatest-satisfied-range/-/semver-greatest-satisfied-range-2.0.0.tgz", - "integrity": "sha512-lH3f6kMbwyANB7HuOWRMlLCa2itaCrZJ+SAqqkSZrZKO/cAsk2EOyaKHUtNkVLFyFW9pct22SFesFp3Z7zpA0g==", - "dependencies": { - "sver": "^1.8.3" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "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/slashes": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/slashes/-/slashes-3.0.12.tgz", - "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==", - "dev": true - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sparkles": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-2.1.0.tgz", - "integrity": "sha512-r7iW1bDw8R/cFifrD3JnQJX0K1jqT0kprL48BiBpLZLJPmAm34zsVBsK5lc7HirZYZqMW65dOXZgbAGt/I6frg==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-4.0.0.tgz", - "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", - "dev": true, - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.20", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz", - "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==", - "dev": true - }, - "node_modules/stream-composer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-composer/-/stream-composer-1.0.2.tgz", - "integrity": "sha512-bnBselmwfX5K10AH6L4c8+S5lgZMWI7ZYrz2rvYjCPB2DIMC4Ig8OpxGpNJSxRZ58oti7y1IcNvjBAz9vW5m4w==", - "dependencies": { - "streamx": "^2.13.2" - } - }, - "node_modules/stream-exhaust": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/stream-exhaust/-/stream-exhaust-1.0.2.tgz", - "integrity": "sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw==" - }, - "node_modules/streamx": { - "version": "2.20.2", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz", - "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==", - "dependencies": { - "fast-fifo": "^1.3.2", - "queue-tick": "^1.0.1", - "text-decoder": "^1.1.0" - }, - "optionalDependencies": { - "bare-events": "^2.2.0" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "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==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "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", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "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==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sver": { - "version": "1.8.4", - "resolved": "https://registry.npmjs.org/sver/-/sver-1.8.4.tgz", - "integrity": "sha512-71o1zfzyawLfIWBOmw8brleKyvnbn73oVHNCsu51uPMz/HWiKkkXsI31JjHW5zqXEqnPYkIiHd8ZmL7FCimLEA==", - "optionalDependencies": { - "semver": "^6.3.0" - } - }, - "node_modules/sver/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "optional": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/synckit": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", - "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", - "dev": true, - "dependencies": { - "@pkgr/core": "^0.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, - "node_modules/teex": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", - "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", - "dependencies": { - "streamx": "^2.12.5" - } - }, - "node_modules/text-decoder": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.1.tgz", - "integrity": "sha512-x9v3H/lTKIJKQQe7RPQkLfKAnc9lUTkWDypIQgTzPJAq+5/GCDHonmshfvlsNSj58yyshbIJJDLmU15qNERrXQ==" - }, - "node_modules/through2": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz", - "integrity": "sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==", - "dependencies": { - "readable-stream": "3" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/to-through": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/to-through/-/to-through-3.0.0.tgz", - "integrity": "sha512-y8MN937s/HVhEoBU1SxfHC+wxCHkV1a9gW8eAdTadYh/bGyesZIVcbjI+mSpFbSVwQici/XjBjuUyri1dnXwBw==", - "dependencies": { - "streamx": "^2.12.5" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" - }, - "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/unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/undertaker": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-2.0.0.tgz", - "integrity": "sha512-tO/bf30wBbTsJ7go80j0RzA2rcwX6o7XPBpeFcb+jzoeb4pfMM2zUeSDIkY1AWqeZabWxaQZ/h8N9t35QKDLPQ==", - "dependencies": { - "bach": "^2.0.1", - "fast-levenshtein": "^3.0.0", - "last-run": "^2.0.0", - "undertaker-registry": "^2.0.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/undertaker-registry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/undertaker-registry/-/undertaker-registry-2.0.0.tgz", - "integrity": "sha512-+hhVICbnp+rlzZMgxXenpvTxpuvA67Bfgtt+O9WOE5jo7w/dyiF1VmoZVIHvP2EkUjsyKyTwYKlLhA+j47m1Ew==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/undertaker/node_modules/fast-levenshtein": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-3.0.0.tgz", - "integrity": "sha512-hKKNajm46uNmTlhHSyZkmToAc56uZJwYq7yrciZjqOxnlfQwERDQJmHPUp7m1m9wx8vgOe8IaCKZ5Kv2k1DdCQ==", - "dependencies": { - "fastest-levenshtein": "^1.0.7" - } - }, - "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/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" - }, - "node_modules/v8flags": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-4.0.1.tgz", - "integrity": "sha512-fcRLaS4H/hrZk9hYwbdRM35D0U8IYMfEClhXxCivOojl+yTRAZH3Zy2sSy6qVCiGbV9YAtPssP6jaChqC9vPCg==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/value-or-function": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-4.0.0.tgz", - "integrity": "sha512-aeVK81SIuT6aMJfNo9Vte8Dw0/FZINGBV8BfCraGtqVxIeLAEhJyoWs8SmvRVmXfGss2PmmOwZCuBPbZR+IYWg==", - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/vinyl": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-3.0.0.tgz", - "integrity": "sha512-rC2VRfAVVCGEgjnxHUnpIVh3AGuk62rP3tqVrn+yab0YH7UULisC085+NYH+mnqf3Wx4SpSi1RQMwudL89N03g==", - "dependencies": { - "clone": "^2.1.2", - "clone-stats": "^1.0.0", - "remove-trailing-separator": "^1.1.0", - "replace-ext": "^2.0.0", - "teex": "^1.0.1" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/vinyl-contents": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-contents/-/vinyl-contents-2.0.0.tgz", - "integrity": "sha512-cHq6NnGyi2pZ7xwdHSW1v4Jfnho4TEGtxZHw01cmnc8+i7jgR6bRnED/LbrKan/Q7CvVLbnvA5OepnhbpjBZ5Q==", - "dependencies": { - "bl": "^5.0.0", - "vinyl": "^3.0.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/vinyl-fs": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-4.0.0.tgz", - "integrity": "sha512-7GbgBnYfaquMk3Qu9g22x000vbYkOex32930rBnc3qByw6HfMEAoELjCjoJv4HuEQxHAurT+nvMHm6MnJllFLw==", - "dependencies": { - "fs-mkdirp-stream": "^2.0.1", - "glob-stream": "^8.0.0", - "graceful-fs": "^4.2.11", - "iconv-lite": "^0.6.3", - "is-valid-glob": "^1.0.0", - "lead": "^4.0.0", - "normalize-path": "3.0.0", - "resolve-options": "^2.0.0", - "stream-composer": "^1.0.2", - "streamx": "^2.14.0", - "to-through": "^3.0.0", - "value-or-function": "^4.0.0", - "vinyl": "^3.0.0", - "vinyl-sourcemap": "^2.0.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/vinyl-sourcemap": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-2.0.0.tgz", - "integrity": "sha512-BAEvWxbBUXvlNoFQVFVHpybBbjW1r03WhohJzJDSfgrrK5xVYIDTan6xN14DlyImShgDRv2gl9qhM6irVMsV0Q==", - "dependencies": { - "convert-source-map": "^2.0.0", - "graceful-fs": "^4.2.10", - "now-and-later": "^3.0.0", - "streamx": "^2.12.5", - "vinyl": "^3.0.0", - "vinyl-contents": "^2.0.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha512-+oDh3KYZBoZC8hfocrbrxbLUeaYtQK7J5WU5Br9VqWqmCll3tFJqKp97GC9GmMsVIL0qnx2DgEDVxdo5EZ5sSw==", - "dependencies": { - "source-map": "^0.5.1" - } - }, - "node_modules/vinyl-sourcemaps-apply/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", - "engines": { - "node": ">=0.10.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-typed-array": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.16.tgz", - "integrity": "sha512-g+N+GAWiRj66DngFwHvISJd+ITsyphZvD1vChfVg6cEdnzy53GzB3oy0fUNlvhz7H7+MiqhYr26qxQShCpKTTQ==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "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==" - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/node_modules/@es-joy/jsdoccomment/CHANGES.md b/node_modules/@es-joy/jsdoccomment/CHANGES.md deleted file mode 100644 index c44c581..0000000 --- a/node_modules/@es-joy/jsdoccomment/CHANGES.md +++ /dev/null @@ -1,589 +0,0 @@ -# CHANGES for `@es-joy/jsdoccomment` - -## 0.46.0 - -- chore: update esquery, drop bundling of types, update devDeps - -## 0.45.0 - -- feat: get following comment (experimental) - -## 0.44.0 - -- feat: add `getNonJsdocComment` for getting non-JSDoc comments above node - -## 0.43.1 - -- fix: for `@template` name parsing, ensure (default-)bracketed name is not broken with internal spaces. - -## 0.43.0 - -This release brings surgical round trip parsing to generated AST and reconstruction of JSDoc comment blocks via: `parseComment` -> -`commentParserToESTree` -> `estreeToString`. - -- feat: new option `spacing` for `commentParserToESTree`; the default is `compact` removing empty description lines. -Set to `preserve` to retain empty description lines. -- feat: new properties in the `JsdocBlock` generated AST `delimiterLineBreak` and `preterminalLineBreak` that encode -any line break after the opening `delimiter` and before the closing `terminal` string. Values are either `\n` or an -empty string. - -- chore: update devDeps / switch to Vitest. - -- New [API documentation](https://es-joy.github.io/jsdoccomment/). - -Thanks: -- [@typhonrt](https://github.com/typhonrt) - -## 0.42.0 - -- feat: expand argument for `parseComment` to accept a comment token string ([@typhonrt](https://github.com/typhonrt)) -- chore: update devDeps. - -## 0.41.0 - -- feat: look above surrounding parenthesis tokens for comment blocks, even if on a higher line than the corresponding AST structure -- chore: update comment-parser and devDeps. - -## 0.40.1 - -- chore(TS): fix path issue - -## 0.40.0 - -- chore: update comment-parser and devDeps. -- chore(TS): switch to NodeNext - -## 0.39.4 - -- fix: include type exports for full inlineTags (and line) property support on blocks and tags - -## 0.39.3 - -- fix: add type details for Node range and settings - -## 0.39.2 - -- fix: export additional typedefs from index.js - -## 0.39.1 - -- fix: typing export - -## 0.39.0 - -- feat: types for test files and emit declaration files -- fix(estreeToString): add `JsdodInlineTag` stringify support -- refactor: lint -- docs: add `JsdocInlineTag` to README -- chore: update devDeps. - -## 0.38.0 - -- feat: add parsing inline tags (#12); fixes #11 - -## 0.37.1 - -- chore: support Node 20 -- chore: update esquery, devDeps. - -## 0.37.0 -## 0.37.0-pre.0 - -- fix: update `jsdoc-type-pratt-parser` (supports bracket indexes) - -## 0.36.1 - -- fix(`getReducedASTNode`): stop checking for comment blocks at return - statement - -## 0.36.0 - -- feat: add `hasPreterminalTagDescription` property -- fix: avoid description line properties if tag is present -- fix: ensure description and description lines added to terminal multi-line tag - -## 0.35.0 - -- feat: add `hasPreterminalDescription` property -- fix: allow newline even for 1st line (after 0th) - -## 0.34.0 - -- feat: add `descriptionStartLine` and `descriptionEndLine` properties -- fix: avoid duplication with 0 line comments -- chore: update devDeps. - -## 0.33.4 - -- chore: republish as npm seems to have missed the release - -## 0.33.3 - -- fix: ensure multi-line `description` includes newline except for - initial line descriptions - -## 0.33.2 - -- fix: avoid repetition within multi-line descriptions - -## 0.33.1 - -- fix: add to default no types: `description`, `example`, `file`, - `fileoverview`, `license`, `overview`, `see`, `summary` -- fix: add to no names: `file`, `fileoverview, `overview` - -## 0.33.0 - -- chore: add Node 19 to `engines` (@RodEsp) -- chore: update devDeps. and build file accordingly - -## 0.32.0 - -- feat: have comment checking stop at assignment patterns (comments for - defaults should not rise to function itself) -- chore: bump devDeps. - -## 0.31.0 - -- feat: support default values with `@template` per - - -## 0.30.0 - -- chore: bump `jsdoc-type-pratt-parser` and devDeps. - -## 0.29.0 - -- fix: update `engines` as per current `getJSDocComment` behavior -- chore: update devDeps. - -## 0.28.1 - -- fix(`getReducedASTNode`): token checking -- build: add Node 18 support (@WikiRik) - -## 0.28.0 - -- chore: bump `engines` to support Node 18 - -## 0.27.0 - -- chore: bump `jsdoc-type-pratt-parser` and devDeps. - -## 0.26.1 - -- fix(`estreeToString`): ensure `typeLines` may be picked up - -## 0.26.0 - -- feat(`getJSDocComment`): allow function to detect comments just preceding a - parenthesized expression (these have no special AST but their tokens - have to be overpassed) - -## 0.25.0 - -- feat(`parseComment`): properly support whitespace -- fix(`estreeToString`): carriage return placement for ending of JSDoc block -- fix(`commentParserToESTree`): avoid adding initial space before a tag if on - a single line -- test: make tests more accurate to jsdoc semantically - -## 0.24.0 - -- feat(`estreeToString`): support stringification of `parsedType` but with - a new `preferRawType` option allowing the old behavior of using `rawType` - -## 0.23.6 - -- fix(`commentParserToESTree`): ensure `postType` added after multi-line type -- fix(`estreeToString`): ensure `JsdocTypeLine` stringified with `initial` and - that they are joined together with newlines - -## 0.23.5 - -- fix(`commentParserToESTree`): avoid duplicating tag names - -## 0.23.4 - -- fix(`estreeToString`): add `delimiter`, etc. if adding `JsdocDescriptionLine` - for `JsdocBlock` -- fix(`estreeToString`): add line break when tags are present (unless already - ending in newline) - -## 0.23.3 - -- fix(`estreeToString`): handle multi-line block descriptions followed by - tags with line break - -## 0.23.2 - -- fix: ensure JsdocBlock stringifier has any initial whitespace on end line - -## 0.23.1 - -- docs(README): update - -## 0.23.0 - -- BREAKING CHANGE(`commentParserToESTree`): rename `start` and `end` to - `initial` and `terminal` to avoid any conflicts with Acorn-style parsers -- feat: add `initial` and `terminal` on `JsdocBlock` - -## 0.22.2 - -- fix: preserve type tokens -- perf: cache tokenizers - -## 0.22.1 - -- fix: ensure `getJSDocComment` does not treat block comments as JSDoc unless - their first asterisk is followed by whitespace - -## 0.22.0 - -- fix: update dep. `jsdoc-type-pratt-parser` -- chore: update `comment-parser` and simplify as possible - -## 0.21.2 - -- fix: only throw if the raw type is not empty - -## 0.21.1 - -- fix: provide clearer error message for `throwOnTypeParsingErrors` - -## 0.21.0 - -- feat: add `throwOnTypeParsingErrors` to receive run-time type parsing errors - for `parsedType` -- chore: update jsdoc-type-pratt-parser and devDeps.; also lints - -## 0.20.1 - -- fix: resume catching bad parsed type (at least until - `jsdoc-type-pratt-parser` may support all expected types) - -## 0.20.0 - -- feat: add estree stringifer -- fix: properly supports `name`/`postName` for multi-line type -- fix: allow pratt parser to fail (unless empty) -- fix: don't add tag postDelimiter when on 0 description line -- fix: avoid adding extra line when only name and no succeeding description -- docs: clarify re: `kind` -- test: add `parsedType` with correct mode; add tests -- chore: updates jsdoc-type-pratt-parser -- chore: updates devDeps. - -## 0.19.0 - -### User-impacting - -- feat: treat `@kind` as having no name - -### Dev-impacting - -- docs: jsdoc -- test: begin checking `jsdoccomment` -- test: adds lcov reporter and open script for it -- chore: update devDeps. - -## 0.18.0 - -### User-impacting - -- feat: add non-visitable `endLine` property (so can detect line number - when no description present) -- feat: supply `indent` default for `parseComment` -- fix: ensure `postName` gets a space for `@template` with a description -- fix: converting JSDoc comment with tag on same line as end (e.g., single - line) to AST -- chore: update `jsdoc-type-pratt-parser` - -### Dev-impacting - -- docs: add jsdoc blocks internally -- chore: update devDeps. -- test: avoid need for `expect` -- test: complete coverage for `commentHandler`, `parseComment` tests - -## 0.17.0 - -### User-impacting - -- Enhancement: Re-export `jsdoc-type-pratt-parser` -- Update: `jsdoc-type-pratt-parser` to 2.2.1 - -### Dev-impacting - -- npm: Update devDeps. - -## 0.16.0 - -### User-impacting - -- Update: `jsdoc-type-pratt-parser` to 2.2.0 - -### Dev-impacting - -- npm: Update devDeps. - -## 0.15.0 - -### User-impacting - -- Update: `jsdoc-type-pratt-parser` to 2.1.0 - -### Dev-impacting - -- npm: Update devDeps. - -## 0.14.2 - -### User-impacting - -- Fix: Find comments previous to parentheses (used commonly in TypeScript) - -### Dev-impacting - -- npm: Update devDeps. - -## 0.14.1 - -### User-impacting - -- Update: `jsdoc-type-pratt-parser` to 2.0.2 - -## 0.14.0 - -### User-impacting - -- Update: `jsdoc-type-pratt-parser` to 2.0.1 - -### Dev-impacting - -- npm: Update devDeps. - -## 0.13.0 - -### User-impacting - -- Update: `comment-parser` to 1.3.0 -- Fix: Allow comment on `ExportDefaultDeclaration` - -## 0.12.0 - -### User-impacting - -- Update: `jsdoc-type-pratt-parser` to 2.0.0 -- Enhancement: Support Node 17 (@timgates42) -- Docs: Typo (@timgates42) - -### Dev-impacting - -- Linting: As per latest ash-nazg -- npm: Update devDeps. - -## 0.11.0 - -- Update: For `@typescript/eslint-parser@5`, add `PropertyDefinition` - -## 0.10.8 - -### User-impacting - -- npm: Liberalize `engines` as per `comment-parser` change -- npm: Bump `comment-parser` - -### Dev-impacting - -- Linting: As per latest ash-nazg -- npm: Update devDeps. - -## 0.10.7 - -- npm: Update comment-parser with CJS fix and re-exports -- npm: Update devDeps. - -## 0.10.6 - -- Fix: Ensure copying latest build of `comment-parser`'s ESM utils - -## 0.10.5 - -- npm: Bump fixed `jsdoc-type-pratt-parser` and devDeps. - -## 0.10.4 - -- Fix: Bundle `comment-parser` nested imports so that IDEs (like Atom) - bundling older Node versions can still work. Still mirroring the - stricter `comment-parser` `engines` for now, however. - -## 0.10.3 - -- npm: Avoid exporting nested subpaths for sake of older Node versions - -## 0.10.2 - -- npm: Specify exact supported range: `^12.20 || ^14.14.0 || ^16` - -## 0.10.1 - -- npm: Apply patch version of `comment-parser` - -## 0.10.0 - -- npm: Point to stable `comment-parser` - -## 0.9.0-alpha.6 - -### User-impacting - -- Update: For `comment-parser` update, add `lineEnd` - -## 0.9.0-alpha.5 - -### User-impacting - -- npm: Bump `comment-parser` (for true ESM) -- Update: Remove extensions for packages for native ESM in `comment-parser` fix - -### Dev-impacting - -- npm: Update devDeps. - -## 0.9.0-alpha.4 - -- Docs: Update repo info in `package.json` - -## 0.9.0-alpha.3 - -- Fix: Due to `comment-parser` still needing changes, revert for now to alpha.1 - -## 0.9.0-alpha.2 - -### User-impacting - -- npm: Bump `comment-parser` (for true ESM) -- Update: Remove extensions for packages for native ESM in `comment-parser` fix - -### Dev-impacting - -- npm: Update devDeps. - -## 0.9.0-alpha.1 - -### User-impacting - -- Breaking change: Indicate minimum for `engines` as Node >= 12 -- npm: Bump `comment-parser` - -### Dev-impacting - -- npm: Lint cjs files -- npm: Fix eslint script -- npm: Update devDeps. - -## 0.8.0 - -### User-impacting - -- npm: Update `jsdoc-type-pratt-parser` (prerelease to stable patch) - -### Dev-impacting - -- npm: Update devDeps. - -## 0.8.0-alpha.2 - -- Fix: Avoid erring with missing `typeLines` - -## 0.8.0-alpha.1 - -- Breaking change: Export globally as `JsdocComment` -- Breaking change: Change `JSDoc` prefixes of all node types to `Jsdoc` -- Breaking change: Drop `jsdoctypeparserToESTree` -- Breaking enhancement: Switch to `jsdoc-type-pratt-parser` (toward greater - TypeScript expressivity and compatibility/support with catharsis) -- Enhancement: Export `jsdocTypeVisitorKeys` (from `jsdoc-type-pratt-parser`) - -## 0.7.2 - -- Fix: Add `@description` to `noNames` - -## 0.7.1 - -- Fix: Add `@summary` to `noNames` - -## 0.7.0 - -- Enhancement: Allow specifying `noNames` and `noTypes` on `parseComment` - to override (or add to) tags which should have no names or types. -- Enhancement: Export `hasSeeWithLink` utility and `defaultNoTypes` and - `defaultNoNames`. - -## 0.6.0 - -- Change `comment-parser` `tag` AST to avoid initial `@` - -## 0.5.1 - -- Fix: Avoid setting `variation` name (just the description) (including in - dist) -- npm: Add `prepublishOnly` script - -## 0.5.0 - -- Fix: Avoid setting `variation` name (just the description) - -## 0.4.4 - -- Fix: Avoid setting `name` and `description` for simple `@template SomeName` - -## 0.4.3 - -- npm: Ignores Github file - -## 0.4.2 - -- Fix: Ensure replacement of camel-casing (used in `jsdoctypeparser` nodes and - visitor keys is global. The practical effect is that - `JSDocTypeNamed_parameter` -> `JSDocTypeNamedParameter`, - `JSDocTypeRecord_entry` -> `JSDocTypeRecordEntry` - `JSDocTypeNot_nullable` -> `JSDocTypeNotNullable` - `JSDocTypeInner_member` -> `JSDocTypeInnerMember` - `JSDocTypeInstance_member` -> `JSDocTypeInstanceMember` - `JSDocTypeString_value` -> `JSDocTypeStringValue` - `JSDocTypeNumber_value` -> `JSDocTypeNumberValue` - `JSDocTypeFile_path` -> `JSDocTypeFilePath` - `JSDocTypeType_query` -> `JSDocTypeTypeQuery` - `JSDocTypeKey_query` -> `JSDocTypeKeyQuery` -- Fix: Add missing `JSDocTypeLine` to visitor keys -- Docs: Explain AST structure/differences - -## 0.4.1 - -- Docs: Indicate available methods with brief summary on README - -## 0.4.0 - -- Enhancement: Expose `parseComment` and `getTokenizers`. - -## 0.3.0 - -- Enhancement: Expose `toCamelCase` as new method rather than within a - utility file. - -## 0.2.0 - -- Enhancement: Exposes new methods: `commentHandler`, - `commentParserToESTree`, `jsdocVisitorKeys`, `jsdoctypeparserToESTree`, - `jsdocTypeVisitorKeys`, - -## 0.1.1 - -- Build: Add Babel to work with earlier Node - -## 0.1.0 - -- Initial version diff --git a/node_modules/@es-joy/jsdoccomment/LICENSE-MIT.txt b/node_modules/@es-joy/jsdoccomment/LICENSE-MIT.txt deleted file mode 100644 index bdc5f00..0000000 --- a/node_modules/@es-joy/jsdoccomment/LICENSE-MIT.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright JS Foundation and other contributors, https://js.foundation -Copyright (c) 2021 Brett Zamir - -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/@es-joy/jsdoccomment/README.md b/node_modules/@es-joy/jsdoccomment/README.md deleted file mode 100644 index 1bd607b..0000000 --- a/node_modules/@es-joy/jsdoccomment/README.md +++ /dev/null @@ -1,241 +0,0 @@ -# @es-joy/jsdoccomment - -[![NPM](https://img.shields.io/npm/v/@es-joy/jsdoccomment.svg?label=npm)](https://www.npmjs.com/package/@es-joy/jsdoccomment) -[![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat)](https://github.com/es-joy/jsdoccomment/blob/main/LICENSE-MIT.txt) -[![Build Status](https://github.com/es-joy/jsdoccomment/workflows/CI/CD/badge.svg)](#) -[![API Docs](https://img.shields.io/badge/API%20Documentation-476ff0)](https://es-joy.github.io/jsdoccomment/) - - -This project aims to preserve and expand upon the -`SourceCode#getJSDocComment` functionality of the deprecated ESLint method. - -It also exports a number of functions currently for working with JSDoc: - -## API - -### `parseComment` - -For parsing `comment-parser` in a JSDoc-specific manner. -Might wish to have tags with or without tags, etc. derived from a split off -JSON file. - -### `commentParserToESTree` - -Converts [comment-parser](https://github.com/syavorsky/comment-parser) -AST to ESTree/ESLint/Babel friendly AST. See the "ESLint AST..." section below. - -### `estreeToString` - -Stringifies. In addition to the node argument, it accepts an optional second -options object with a single `preferRawType` key. If you don't need to modify -JSDoc type AST, you might wish to set this to `true` to get the benefits of -preserving the raw form, but for AST-based stringification of JSDoc types, -keep it `false` (the default). - -### `jsdocVisitorKeys` - -The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys) -for `JsdocBlock`, `JsdocDescriptionLine`, and `JsdocTag`. More likely to be -subject to change or dropped in favor of another type parser. - -### `jsdocTypeVisitorKeys` - -Just a re-export of [VisitorKeys](https://github.com/eslint/eslint-visitor-keys) -from [`jsdoc-type-pratt-parser`](https://github.com/simonseyock/jsdoc-type-pratt-parser/). - -### `getDefaultTagStructureForMode` - -Provides info on JSDoc tags: - -- `nameContents` ('namepath-referencing'|'namepath-defining'| - 'dual-namepath-referencing'|false) - Whether and how a name is allowed - following any type. Tags without a proper name (value `false`) may still - have a description (which can appear like a name); `descriptionAllowed` - in such cases would be `true`. - The presence of a truthy `nameContents` value is therefore only intended - to signify whether separate parsing should occur for a name vs. a - description, and what its nature should be. -- `nameRequired` (boolean) - Whether a name must be present following any type. -- `descriptionAllowed` (boolean) - Whether a description (following any name) - is allowed. -- `typeAllowed` (boolean) - Whether the tag accepts a curly bracketed portion. - Even without a type, a tag may still have a name and/or description. -- `typeRequired` (boolean) - Whether a curly bracketed type must be present. -- `typeOrNameRequired` (boolean) - Whether either a curly bracketed type is - required or a name, but not necessarily both. - -### Miscellaneous - -Also currently exports these utilities: - -- `getTokenizers` - Used with `parseComment` (its main core). -- `hasSeeWithLink` - A utility to detect if a tag is `@see` and has a `@link`. -- `commentHandler` - Used by `eslint-plugin-jsdoc`. -- `commentParserToESTree`- Converts [comment-parser](https://github.com/syavorsky/comment-parser) - AST to ESTree/ESLint/Babel friendly AST. -- `jsdocVisitorKeys` - The [VisitorKeys](https://github.com/eslint/eslint-visitor-keys) - for `JSDocBlock`, `JSDocDescriptionLine`, and `JSDocTag`. -- `jsdocTypeVisitorKeys` - [VisitorKeys](https://github.com/eslint/eslint-visitor-keys) - for `jsdoc-type-pratt-parser`. -- `defaultNoTypes` = The tags which allow no types by default: - `default`, `defaultvalue`, `description`, `example`, `file`, - `fileoverview`, `license`, `overview`, `see`, `summary` -- `defaultNoNames` - The tags which allow no names by default: - `access`, `author`, `default`, `defaultvalue`, `description`, `example`, - `exception`, `file`, `fileoverview`, `kind`, `license`, `overview`, - `return`, `returns`, `since`, `summary`, `throws`, `version`, `variation` - -## ESLint AST produced for `comment-parser` nodes (`JsdocBlock`, `JsdocTag`, and `JsdocDescriptionLine`) - -Note: Although not added in this package, `@es-joy/jsdoc-eslint-parser` adds -a `jsdoc` property to other ES nodes (using this project's `getJSDocComment` -to determine the specific comment-block that will be attached as AST). - -### `JsdocBlock` - -Has the following visitable properties: - -1. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline - descriptions). -2. `tags` (an array of `JsdocTag`; see below) -3. `inlineTags` (an array of `JsdocInlineTag`; see below) - -Has the following custom non-visitable property: - -1. `delimiterLineBreak` - A string containing any line break after `delimiter`. -2. `lastDescriptionLine` - A number -3. `endLine` - A number representing the line number with `end`/`terminal` -4. `descriptionStartLine` - A 0+ number indicating the line where any - description begins -5. `descriptionEndLine` - A 0+ number indicating the line where the description - ends -6. `hasPreterminalDescription` - Set to 0 or 1. On if has a block description - on the same line as the terminal `*/`. -7. `hasPreterminalTagDescription` - Set to 0 or 1. On if has a tag description - on the same line as the terminal `*/`. -8. `preterminalLineBreak` - A string containing any line break before `terminal`. - -May also have the following non-visitable properties from `comment-parser`: - -1. `description` - Same as `descriptionLines` but as a string with newlines. -2. `delimiter` -3. `postDelimiter` -4. `lineEnd` -5. `initial` (from `start`) -6. `terminal` (from `end`) - -### `JsdocTag` - -Has the following visitable properties: - -1. `parsedType` (the `jsdoc-type-pratt-parser` AST representation of the tag's - type (see the `jsdoc-type-pratt-parser` section below)). -2. `typeLines` (an array of `JsdocTypeLine` for multiline type strings) -3. `descriptionLines` (an array of `JsdocDescriptionLine` for multiline - descriptions) -4. `inlineTags` (an array of `JsdocInlineTag`) - -May also have the following non-visitable properties from `comment-parser` -(note that all are included from `comment-parser` except `end` as that is only -for JSDoc blocks and note that `type` is renamed to `rawType` and `start` to -`initial`): - -1. `description` - Same as `descriptionLines` but as a string with newlines. -2. `rawType` - `comment-parser` has this named as `type`, but because of a - conflict with ESTree using `type` for Node type, we renamed it to - `rawType`. It is otherwise the same as in `comment-parser`, i.e., a string - with newlines, though with the initial `{` and final `}` stripped out. - See `typeLines` for the array version of this property. -3. `initial` - Renamed from `start` to avoid potential conflicts with - Acorn-style parser processing tools -4. `delimiter` -5. `postDelimiter` -6. `tag` (this does differ from `comment-parser` now in terms of our stripping - the initial `@`) -7. `postTag` -8. `name` -9. `postName` -10. `postType` - -### `JsdocDescriptionLine` - -No visitable properties. - -May also have the following non-visitable properties from `comment-parser`: - -1. `delimiter` -2. `postDelimiter` -3. `initial` (from `start`) -4. `description` - -### `JsdocTypeLine` - -No visitable properties. - -May also have the following non-visitable properties from `comment-parser`: - -1. `delimiter` -2. `postDelimiter` -3. `initial` (from `start`) -4. `rawType` - Renamed from `comment-parser` to avoid a conflict. See - explanation under `JsdocTag` - -### `JsdocInlineTag` - -No visitable properties. - -Has the following non-visitable properties: - -1. `format`: 'pipe' | 'plain' | 'prefix' | 'space'. These follow the styles of [link](https://jsdoc.app/tags-inline-link.html) or [tutorial](https://jsdoc.app/tags-inline-tutorial.html). - 1. `pipe`: `{@link namepathOrURL|link text}` - 2. `plain`: `{@link namepathOrURL}` - 3. `prefix`: `[link text]{@link namepathOrURL}` - 4. `space`: `{@link namepathOrURL link text (after the first space)}` -2. `namepathOrURL`: string -3. `tag`: string. The standard allows `tutorial` or `link` -4. `text`: string - -## ESLint AST produced for `jsdoc-type-pratt-parser` - -The AST, including `type`, remains as is from [jsdoc-type-pratt-parser](https://github.com/simonseyock/jsdoc-type-pratt-parser/). - -The type will always begin with a `JsdocType` prefix added, along with a -camel-cased type name, e.g., `JsdocTypeUnion`. - -The `jsdoc-type-pratt-parser` visitor keys are also preserved without change. - -You can get a sense of the structure of these types using the parser's -[tester](https://jsdoc-type-pratt-parser.github.io/jsdoc-type-pratt-parser/). - -## Installation - -```shell -npm i @es-joy/jsdoccomment -``` - -## Changelog - -The changelog can be found on the [CHANGES.md](https://github.com/es-joy/jsdoccomment/blob/main/CHANGES.md). - -## Authors and license - -[Brett Zamir](http://brett-zamir.me/) and -[contributors](https://github.com/es-joy/jsdoccomment/graphs/contributors). - -MIT License, see the included [LICENSE-MIT.txt](https://github.com/es-joy/jsdoccomment/blob/main/LICENSE-MIT.txt) file. - -## To-dos - -1. Get complete code coverage -1. Given that `esquery` expects a `right` property to search for `>` (the - child selector), we should perhaps insist, for example, that params are - the child property for `JsdocBlock` or such. Where `:has()` is currently - needed, one could thus instead just use `>`. -1. Might add `trailing` for `JsdocBlock` to know whether it is followed by a - line break or what not; `comment-parser` does not provide, however -1. Fix and properly utilize `indent` argument (challenging for - `eslint-plugin-jsdoc` but needed for `jsdoc-eslint-parser` stringifiers - to be more faithful); should also then use the proposed `trailing` as well diff --git a/node_modules/@es-joy/jsdoccomment/dist/index.cjs.cjs b/node_modules/@es-joy/jsdoccomment/dist/index.cjs.cjs deleted file mode 100644 index 777b590..0000000 --- a/node_modules/@es-joy/jsdoccomment/dist/index.cjs.cjs +++ /dev/null @@ -1,1333 +0,0 @@ -'use strict'; - -var jsdocTypePrattParser = require('jsdoc-type-pratt-parser'); -var esquery = require('esquery'); -var commentParser = require('comment-parser'); - -/** - * Removes initial and ending brackets from `rawType` - * @param {JsdocTypeLine[]|JsdocTag} container - * @param {boolean} [isArr] - * @returns {void} - */ -const stripEncapsulatingBrackets = (container, isArr) => { - if (isArr) { - const firstItem = /** @type {JsdocTypeLine[]} */container[0]; - firstItem.rawType = firstItem.rawType.replace(/^\{/u, ''); - const lastItem = /** @type {JsdocTypeLine} */ - /** @type {JsdocTypeLine[]} */container.at(-1); - lastItem.rawType = lastItem.rawType.replace(/\}$/u, ''); - return; - } - /** @type {JsdocTag} */ - container.rawType = /** @type {JsdocTag} */container.rawType.replace(/^\{/u, '').replace(/\}$/u, ''); -}; - -/** - * @typedef {{ - * delimiter: string, - * postDelimiter: string, - * rawType: string, - * initial: string, - * type: "JsdocTypeLine" - * }} JsdocTypeLine - */ - -/** - * @typedef {{ - * delimiter: string, - * description: string, - * postDelimiter: string, - * initial: string, - * type: "JsdocDescriptionLine" - * }} JsdocDescriptionLine - */ - -/** - * @typedef {{ - * format: 'pipe' | 'plain' | 'prefix' | 'space', - * namepathOrURL: string, - * tag: string, - * text: string, - * }} JsdocInlineTagNoType - */ -/** - * @typedef {JsdocInlineTagNoType & { - * type: "JsdocInlineTag" - * }} JsdocInlineTag - */ - -/** - * @typedef {{ - * delimiter: string, - * description: string, - * descriptionLines: JsdocDescriptionLine[], - * initial: string, - * inlineTags: JsdocInlineTag[] - * name: string, - * postDelimiter: string, - * postName: string, - * postTag: string, - * postType: string, - * rawType: string, - * parsedType: import('jsdoc-type-pratt-parser').RootResult|null - * tag: string, - * type: "JsdocTag", - * typeLines: JsdocTypeLine[], - * }} JsdocTag - */ - -/** - * @typedef {number} Integer - */ - -/** - * @typedef {{ - * delimiter: string, - * delimiterLineBreak: string, - * description: string, - * descriptionEndLine?: Integer, - * descriptionLines: JsdocDescriptionLine[], - * descriptionStartLine?: Integer, - * hasPreterminalDescription: 0|1, - * hasPreterminalTagDescription?: 1, - * initial: string, - * inlineTags: JsdocInlineTag[] - * lastDescriptionLine?: Integer, - * endLine: Integer, - * lineEnd: string, - * postDelimiter: string, - * tags: JsdocTag[], - * terminal: string, - * preterminalLineBreak: string, - * type: "JsdocBlock", - * }} JsdocBlock - */ - -/** - * @param {object} cfg - * @param {string} cfg.text - * @param {string} cfg.tag - * @param {'pipe' | 'plain' | 'prefix' | 'space'} cfg.format - * @param {string} cfg.namepathOrURL - * @returns {JsdocInlineTag} - */ -const inlineTagToAST = ({ - text, - tag, - format, - namepathOrURL -}) => ({ - text, - tag, - format, - namepathOrURL, - type: 'JsdocInlineTag' -}); - -/** - * Converts comment parser AST to ESTree format. - * @param {import('.').JsdocBlockWithInline} jsdoc - * @param {import('jsdoc-type-pratt-parser').ParseMode} mode - * @param {object} opts - * @param {'compact'|'preserve'} [opts.spacing] By default, empty lines are - * compacted; set to 'preserve' to preserve empty comment lines. - * @param {boolean} [opts.throwOnTypeParsingErrors] - * @returns {JsdocBlock} - */ -const commentParserToESTree = (jsdoc, mode, { - spacing = 'compact', - throwOnTypeParsingErrors = false -} = {}) => { - /** - * Strips brackets from a tag's `rawType` values and adds `parsedType` - * @param {JsdocTag} lastTag - * @returns {void} - */ - const cleanUpLastTag = lastTag => { - // Strip out `}` that encapsulates and is not part of - // the type - stripEncapsulatingBrackets(lastTag); - if (lastTag.typeLines.length) { - stripEncapsulatingBrackets(lastTag.typeLines, true); - } - - // Remove single empty line description. - if (lastTag.descriptionLines.length === 1 && lastTag.descriptionLines[0].description === '') { - lastTag.descriptionLines.length = 0; - } - - // With even a multiline type now in full, add parsing - let parsedType = null; - try { - parsedType = jsdocTypePrattParser.parse(lastTag.rawType, mode); - } catch (err) { - // Ignore - if (lastTag.rawType && throwOnTypeParsingErrors) { - /** @type {Error} */err.message = `Tag @${lastTag.tag} with raw type ` + `\`${lastTag.rawType}\` had parsing error: ${/** @type {Error} */err.message}`; - throw err; - } - } - lastTag.parsedType = parsedType; - }; - const { - source, - inlineTags: blockInlineTags - } = jsdoc; - const { - tokens: { - delimiter: delimiterRoot, - lineEnd: lineEndRoot, - postDelimiter: postDelimiterRoot, - start: startRoot, - end: endRoot - } - } = source[0]; - const endLine = source.length - 1; - - /** @type {JsdocBlock} */ - const ast = { - delimiter: delimiterRoot, - delimiterLineBreak: '\n', - description: '', - descriptionLines: [], - inlineTags: blockInlineTags.map(t => inlineTagToAST(t)), - initial: startRoot, - tags: [], - // `terminal` will be overwritten if there are other entries - terminal: endRoot, - preterminalLineBreak: '\n', - hasPreterminalDescription: 0, - endLine, - postDelimiter: postDelimiterRoot, - lineEnd: lineEndRoot, - type: 'JsdocBlock' - }; - - /** - * @type {JsdocTag[]} - */ - const tags = []; - - /** @type {Integer|undefined} */ - let lastDescriptionLine; - - /** @type {JsdocTag|null} */ - let lastTag = null; - - // Tracks when first valid tag description line is seen. - let tagDescriptionSeen = false; - let descLineStateOpen = true; - source.forEach((info, idx) => { - const { - tokens - } = info; - const { - delimiter, - description, - postDelimiter, - start: initial, - tag, - end, - type: rawType - } = tokens; - if (!tag && description && descLineStateOpen) { - if (ast.descriptionStartLine === undefined) { - ast.descriptionStartLine = idx; - } - ast.descriptionEndLine = idx; - } - if (tag || end) { - descLineStateOpen = false; - if (lastDescriptionLine === undefined) { - lastDescriptionLine = idx; - } - - // Clean-up with last tag before end or new tag - if (lastTag) { - cleanUpLastTag(lastTag); - } - - // Stop the iteration when we reach the end - // but only when there is no tag earlier in the line - // to still process - if (end && !tag) { - ast.terminal = end; - - // Check if there are any description lines and if not then this is a - // one line comment block. - const isDelimiterLine = ast.descriptionLines.length === 0 && delimiter === '/**'; - - // Remove delimiter line break for one line comments blocks. - if (isDelimiterLine) { - ast.delimiterLineBreak = ''; - } - if (description) { - // Remove terminal line break at end when description is defined. - if (ast.terminal === '*/') { - ast.preterminalLineBreak = ''; - } - if (lastTag) { - ast.hasPreterminalTagDescription = 1; - } else { - ast.hasPreterminalDescription = 1; - } - const holder = lastTag || ast; - holder.description += (holder.description ? '\n' : '') + description; - - // Do not include `delimiter` / `postDelimiter` for opening - // delimiter line. - - holder.descriptionLines.push({ - delimiter: isDelimiterLine ? '' : delimiter, - description, - postDelimiter: isDelimiterLine ? '' : postDelimiter, - initial, - type: 'JsdocDescriptionLine' - }); - } - return; - } - const { - // eslint-disable-next-line no-unused-vars -- Discarding - end: ed, - delimiter: de, - postDelimiter: pd, - start: init, - ...tkns - } = tokens; - if (!tokens.name) { - let i = 1; - while (source[idx + i]) { - const { - tokens: { - name, - postName, - postType, - tag: tg - } - } = source[idx + i]; - if (tg) { - break; - } - if (name) { - tkns.postType = postType; - tkns.name = name; - tkns.postName = postName; - break; - } - i++; - } - } - - /** - * @type {JsdocInlineTag[]} - */ - let tagInlineTags = []; - if (tag) { - // Assuming the tags from `source` are in the same order as `jsdoc.tags` - // we can use the `tags` length as index into the parser result tags. - tagInlineTags = - /** - * @type {import('comment-parser').Spec & { - * inlineTags: JsdocInlineTagNoType[] - * }} - */ - jsdoc.tags[tags.length].inlineTags.map(t => inlineTagToAST(t)); - } - - /** @type {JsdocTag} */ - const tagObj = { - ...tkns, - initial: endLine ? init : '', - postDelimiter: lastDescriptionLine ? pd : '', - delimiter: lastDescriptionLine ? de : '', - descriptionLines: [], - inlineTags: tagInlineTags, - parsedType: null, - rawType: '', - type: 'JsdocTag', - typeLines: [] - }; - tagObj.tag = tagObj.tag.replace(/^@/u, ''); - lastTag = tagObj; - tagDescriptionSeen = false; - tags.push(tagObj); - } - if (rawType) { - // Will strip rawType brackets after this tag - /** @type {JsdocTag} */ - lastTag.typeLines.push( /** @type {JsdocTag} */lastTag.typeLines.length ? { - delimiter, - postDelimiter, - rawType, - initial, - type: 'JsdocTypeLine' - } : { - delimiter: '', - postDelimiter: '', - rawType, - initial: '', - type: 'JsdocTypeLine' - }); - /** @type {JsdocTag} */ - lastTag.rawType += /** @type {JsdocTag} */lastTag.rawType ? '\n' + rawType : rawType; - } - - // In `compact` mode skip processing if `description` is an empty string - // unless lastTag is being processed. - // - // In `preserve` mode process when `description` is not the `empty string - // or the `delimiter` is not `/**` ensuring empty lines are preserved. - if (spacing === 'compact' && description || lastTag || spacing === 'preserve' && (description || delimiter !== '/**')) { - const holder = lastTag || ast; - - // Check if there are any description lines and if not then this is a - // multi-line comment block with description on 0th line. Treat - // `delimiter` / `postDelimiter` / `initial` as being on a new line. - const isDelimiterLine = holder.descriptionLines.length === 0 && delimiter === '/**'; - - // Remove delimiter line break for one line comments blocks. - if (isDelimiterLine) { - ast.delimiterLineBreak = ''; - } - - // Track when the first description line is seen to avoid adding empty - // description lines for tag type lines. - tagDescriptionSeen || (tagDescriptionSeen = Boolean(lastTag && (rawType === '' || (rawType === null || rawType === void 0 ? void 0 : rawType.endsWith('}'))))); - if (lastTag) { - if (tagDescriptionSeen) { - // The first tag description line is a continuation after type / - // name parsing. - const isFirstDescriptionLine = holder.descriptionLines.length === 0; - - // For `compact` spacing must allow through first description line. - if (spacing === 'compact' && (description || isFirstDescriptionLine) || spacing === 'preserve') { - holder.descriptionLines.push({ - delimiter: isFirstDescriptionLine ? '' : delimiter, - description, - postDelimiter: isFirstDescriptionLine ? '' : postDelimiter, - initial: isFirstDescriptionLine ? '' : initial, - type: 'JsdocDescriptionLine' - }); - } - } - } else { - holder.descriptionLines.push({ - delimiter: isDelimiterLine ? '' : delimiter, - description, - postDelimiter: isDelimiterLine ? '' : postDelimiter, - initial: isDelimiterLine ? `` : initial, - type: 'JsdocDescriptionLine' - }); - } - if (!tag) { - if (lastTag) { - // For `compact` spacing must filter out any empty description lines - // after the initial `holder.description` has content. - if (tagDescriptionSeen && !(spacing === 'compact' && holder.description && description === '')) { - holder.description += !holder.description ? description : '\n' + description; - } - } else { - holder.description += !holder.description ? description : '\n' + description; - } - } - } - - // Clean-up where last line itself has tag content - if (end && tag) { - ast.terminal = end; - ast.hasPreterminalTagDescription = 1; - - // Remove terminal line break at end when tag is defined on last line. - if (ast.terminal === '*/') { - ast.preterminalLineBreak = ''; - } - cleanUpLastTag( /** @type {JsdocTag} */lastTag); - } - }); - ast.lastDescriptionLine = lastDescriptionLine; - ast.tags = tags; - return ast; -}; -const jsdocVisitorKeys = { - JsdocBlock: ['descriptionLines', 'tags', 'inlineTags'], - JsdocDescriptionLine: [], - JsdocTypeLine: [], - JsdocTag: ['parsedType', 'typeLines', 'descriptionLines', 'inlineTags'], - JsdocInlineTag: [] -}; - -/** - * @param {{[name: string]: any}} settings - * @returns {import('.').CommentHandler} - */ -const commentHandler = settings => { - /** - * @type {import('.').CommentHandler} - */ - return (commentSelector, jsdoc) => { - const { - mode - } = settings; - const selector = esquery.parse(commentSelector); - const ast = commentParserToESTree(jsdoc, mode); - const _ast = /** @type {unknown} */ast; - return esquery.matches( /** @type {import('estree').Node} */ - _ast, selector, undefined, { - visitorKeys: { - ...jsdocTypePrattParser.visitorKeys, - ...jsdocVisitorKeys - } - }); - }; -}; - -/** @type {Record} */ -const stringifiers = { - JsdocBlock, - /** - * @param {import('./commentParserToESTree').JsdocDescriptionLine} node - * @returns {string} - */ - JsdocDescriptionLine({ - initial, - delimiter, - postDelimiter, - description - }) { - return `${initial}${delimiter}${postDelimiter}${description}`; - }, - /** - * @param {import('./commentParserToESTree').JsdocTypeLine} node - * @returns {string} - */ - JsdocTypeLine({ - initial, - delimiter, - postDelimiter, - rawType - }) { - return `${initial}${delimiter}${postDelimiter}${rawType}`; - }, - /** - * @param {import('./commentParserToESTree').JsdocInlineTag} node - */ - JsdocInlineTag({ - format, - namepathOrURL, - tag, - text - }) { - return format === 'pipe' ? `{@${tag} ${namepathOrURL}|${text}}` : format === 'plain' ? `{@${tag} ${namepathOrURL}}` : format === 'prefix' ? `[${text}]{@${tag} ${namepathOrURL}}` - // "space" - : `{@${tag} ${namepathOrURL} ${text}}`; - }, - JsdocTag -}; - -/** - * @todo convert for use by escodegen (until may be patched to support - * custom entries?). - * @param {import('./commentParserToESTree').JsdocBlock| - * import('./commentParserToESTree').JsdocDescriptionLine| - * import('./commentParserToESTree').JsdocTypeLine| - * import('./commentParserToESTree').JsdocTag| - * import('./commentParserToESTree').JsdocInlineTag| - * import('jsdoc-type-pratt-parser').RootResult - * } node - * @param {import('.').ESTreeToStringOptions} opts - * @throws {Error} - * @returns {string} - */ -function estreeToString(node, opts = {}) { - if (Object.prototype.hasOwnProperty.call(stringifiers, node.type)) { - return stringifiers[ - /** - * @type {import('./commentParserToESTree').JsdocBlock| - * import('./commentParserToESTree').JsdocDescriptionLine| - * import('./commentParserToESTree').JsdocTypeLine| - * import('./commentParserToESTree').JsdocTag} - */ - node.type](node, opts); - } - - // We use raw type instead but it is a key as other apps may wish to traverse - if (node.type.startsWith('JsdocType')) { - return opts.preferRawType ? '' : `{${jsdocTypePrattParser.stringify( /** @type {import('jsdoc-type-pratt-parser').RootResult} */ - node)}}`; - } - throw new Error(`Unhandled node type: ${node.type}`); -} - -/** - * @param {import('./commentParserToESTree').JsdocBlock} node - * @param {import('.').ESTreeToStringOptions} opts - * @returns {string} - */ -function JsdocBlock(node, opts) { - const { - delimiter, - delimiterLineBreak, - descriptionLines, - initial, - postDelimiter, - preterminalLineBreak, - tags, - terminal - } = node; - const terminalPrepend = preterminalLineBreak !== '' ? `${preterminalLineBreak}${initial} ` : ''; - let result = `${initial}${delimiter}${postDelimiter}${delimiterLineBreak}`; - for (let i = 0; i < descriptionLines.length; i++) { - result += estreeToString(descriptionLines[i]); - if (i !== descriptionLines.length - 1 || tags.length) { - result += '\n'; - } - } - for (let i = 0; i < tags.length; i++) { - result += estreeToString(tags[i], opts); - if (i !== tags.length - 1) { - result += '\n'; - } - } - result += `${terminalPrepend}${terminal}`; - return result; -} - -/** - * @param {import('./commentParserToESTree').JsdocTag} node - * @param {import('.').ESTreeToStringOptions} opts - * @returns {string} - */ -function JsdocTag(node, opts) { - const { - delimiter, - descriptionLines, - initial, - name, - parsedType, - postDelimiter, - postName, - postTag, - postType, - tag, - typeLines - } = node; - let result = `${initial}${delimiter}${postDelimiter}@${tag}${postTag}`; - - // Could do `rawType` but may have been changed; could also do - // `typeLines` but not as likely to be changed - // parsedType - // Comment this out later in favor of `parsedType` - // We can't use raw `typeLines` as first argument has delimiter on it - if (opts.preferRawType || !parsedType) { - if (typeLines.length) { - result += '{'; - for (let i = 0; i < typeLines.length; i++) { - result += estreeToString(typeLines[i]); - if (i !== typeLines.length - 1) { - result += '\n'; - } - } - result += '}'; - } - } else if (parsedType !== null && parsedType !== void 0 && parsedType.type.startsWith('JsdocType')) { - result += `{${jsdocTypePrattParser.stringify( /** @type {import('jsdoc-type-pratt-parser').RootResult} */ - parsedType)}}`; - } - result += name ? `${postType}${name}${postName}` : postType; - for (let i = 0; i < descriptionLines.length; i++) { - const descriptionLine = descriptionLines[i]; - result += estreeToString(descriptionLine); - if (i !== descriptionLines.length - 1) { - result += '\n'; - } - } - return result; -} - -/** - * Obtained originally from {@link https://github.com/eslint/eslint/blob/master/lib/util/source-code.js#L313}. - * - * @license MIT - */ - -/** - * @typedef {import('eslint').AST.Token | import('estree').Comment | { - * type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang", - * range: [number, number], - * value: string - * }} Token - */ - -/** - * @typedef {import('eslint').Rule.Node| - * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode - */ - -/** - * @typedef {number} int - */ - -/** - * 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. - */ -const isCommentToken = token => { - return token.type === 'Line' || token.type === 'Block' || token.type === 'Shebang'; -}; - -/** - * @param {(ESLintOrTSNode|import('estree').Comment) & { - * declaration?: any, - * decorators?: any[], - * parent?: import('eslint').Rule.Node & { - * decorators?: any[] - * } - * }} node - * @returns {import('@typescript-eslint/types').TSESTree.Decorator|undefined} - */ -const getDecorator = node => { - var _node$declaration, _node$decorators, _node$parent; - return (node === null || node === void 0 || (_node$declaration = node.declaration) === null || _node$declaration === void 0 || (_node$declaration = _node$declaration.decorators) === null || _node$declaration === void 0 ? void 0 : _node$declaration[0]) || (node === null || node === void 0 || (_node$decorators = node.decorators) === null || _node$decorators === void 0 ? void 0 : _node$decorators[0]) || (node === null || node === void 0 || (_node$parent = node.parent) === null || _node$parent === void 0 || (_node$parent = _node$parent.decorators) === null || _node$parent === void 0 ? void 0 : _node$parent[0]); -}; - -/** - * Check to see if it is a ES6 export declaration. - * - * @param {ESLintOrTSNode} astNode An AST node. - * @returns {boolean} whether the given node represents an export declaration. - * @private - */ -const looksLikeExport = function (astNode) { - return astNode.type === 'ExportDefaultDeclaration' || astNode.type === 'ExportNamedDeclaration' || astNode.type === 'ExportAllDeclaration' || astNode.type === 'ExportSpecifier'; -}; - -/** - * @param {ESLintOrTSNode} astNode - * @returns {ESLintOrTSNode} - */ -const getTSFunctionComment = function (astNode) { - const { - parent - } = astNode; - /* v8 ignore next 3 */ - if (!parent) { - return astNode; - } - const grandparent = parent.parent; - /* v8 ignore next 3 */ - if (!grandparent) { - return astNode; - } - const greatGrandparent = grandparent.parent; - const greatGreatGrandparent = greatGrandparent && greatGrandparent.parent; - - /* v8 ignore next 3 */ - if ( /** @type {ESLintOrTSNode} */parent.type !== 'TSTypeAnnotation') { - return astNode; - } - switch ( /** @type {ESLintOrTSNode} */grandparent.type) { - // @ts-expect-error -- For `ClassProperty`. - case 'PropertyDefinition': - case 'ClassProperty': - case 'TSDeclareFunction': - case 'TSMethodSignature': - case 'TSPropertySignature': - return grandparent; - case 'ArrowFunctionExpression': - /* v8 ignore next 3 */ - if (!greatGrandparent) { - return astNode; - } - if (greatGrandparent.type === 'VariableDeclarator' - - // && greatGreatGrandparent.parent.type === 'VariableDeclaration' - ) { - /* v8 ignore next 3 */ - if (!greatGreatGrandparent || !greatGreatGrandparent.parent) { - return astNode; - } - return greatGreatGrandparent.parent; - } - /* v8 ignore next */ - return astNode; - case 'FunctionExpression': - /* v8 ignore next 3 */ - if (!greatGreatGrandparent) { - return astNode; - } - if (greatGrandparent.type === 'MethodDefinition') { - return greatGrandparent; - } - - // Fallthrough - default: - /* v8 ignore next 3 */ - if (grandparent.type !== 'Identifier') { - return astNode; - } - } - - /* v8 ignore next 3 */ - if (!greatGreatGrandparent) { - return astNode; - } - switch (greatGrandparent.type) { - case 'ArrowFunctionExpression': - if (greatGreatGrandparent.type === 'VariableDeclarator' && greatGreatGrandparent.parent.type === 'VariableDeclaration') { - return greatGreatGrandparent.parent; - } - return astNode; - case 'FunctionDeclaration': - return greatGrandparent; - case 'VariableDeclarator': - if (greatGreatGrandparent.type === 'VariableDeclaration') { - return greatGreatGrandparent; - } - /* v8 ignore next 2 */ - // Fallthrough - default: - /* v8 ignore next 3 */ - return astNode; - } -}; -const invokedExpression = new Set(['CallExpression', 'OptionalCallExpression', 'NewExpression']); -const allowableCommentNode = new Set(['AssignmentPattern', 'VariableDeclaration', 'ExpressionStatement', 'MethodDefinition', 'Property', 'ObjectProperty', 'ClassProperty', 'PropertyDefinition', 'ExportDefaultDeclaration', 'ReturnStatement']); - -/** - * Reduces the provided node to the appropriate node for evaluating - * JSDoc comment status. - * - * @param {ESLintOrTSNode} node An AST node. - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode. - * @returns {ESLintOrTSNode} The AST node that - * can be evaluated for appropriate JSDoc comments. - */ -const getReducedASTNode = function (node, sourceCode) { - let { - parent - } = node; - switch ( /** @type {ESLintOrTSNode} */node.type) { - case 'TSFunctionType': - return getTSFunctionComment(node); - case 'TSInterfaceDeclaration': - case 'TSTypeAliasDeclaration': - case 'TSEnumDeclaration': - case 'ClassDeclaration': - case 'FunctionDeclaration': - /* v8 ignore next 3 */ - if (!parent) { - return node; - } - return looksLikeExport(parent) ? parent : node; - case 'TSDeclareFunction': - case 'ClassExpression': - case 'ObjectExpression': - case 'ArrowFunctionExpression': - case 'TSEmptyBodyFunctionExpression': - case 'FunctionExpression': - /* v8 ignore next 3 */ - if (!parent) { - return node; - } - if (!invokedExpression.has(parent.type)) { - /** - * @type {ESLintOrTSNode|Token|null} - */ - let token = node; - do { - token = sourceCode.getTokenBefore( /** @type {import('eslint').Rule.Node|import('eslint').AST.Token} */ - token, { - includeComments: true - }); - } while (token && token.type === 'Punctuator' && token.value === '('); - if (token && token.type === 'Block') { - return node; - } - if (sourceCode.getCommentsBefore( /** @type {import('eslint').Rule.Node} */ - node).length) { - return node; - } - while (!sourceCode.getCommentsBefore( /** @type {import('eslint').Rule.Node} */ - parent).length && !/Function/u.test(parent.type) && !allowableCommentNode.has(parent.type)) { - ({ - parent - } = parent); - if (!parent) { - break; - } - } - if (parent && parent.type !== 'FunctionDeclaration' && parent.type !== 'Program') { - if (parent.parent && parent.parent.type === 'ExportNamedDeclaration') { - return parent.parent; - } - return parent; - } - } - return node; - default: - return node; - } -}; - -/** - * Checks for the presence of a JSDoc comment for the given node and returns it. - * - * @param {ESLintOrTSNode} astNode The AST node to get - * the comment for. - * @param {import('eslint').SourceCode} sourceCode - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings - * @param {{nonJSDoc?: boolean}} [opts] - * @returns {Token|null} The Block comment token containing the JSDoc comment - * for the given node or null if not found. - */ -const findJSDocComment = (astNode, sourceCode, settings, opts = {}) => { - var _parenthesisToken, _parenthesisToken2; - const { - nonJSDoc - } = opts; - const { - minLines, - maxLines - } = settings; - - /** @type {ESLintOrTSNode|import('estree').Comment} */ - let currentNode = astNode; - let tokenBefore = null; - let parenthesisToken = null; - while (currentNode) { - const decorator = getDecorator( /** @type {import('eslint').Rule.Node} */ - currentNode); - if (decorator) { - const dec = /** @type {unknown} */decorator; - currentNode = /** @type {import('eslint').Rule.Node} */dec; - } - tokenBefore = sourceCode.getTokenBefore( /** @type {import('eslint').Rule.Node} */ - currentNode, { - includeComments: true - }); - if (tokenBefore && tokenBefore.type === 'Punctuator' && tokenBefore.value === '(') { - parenthesisToken = tokenBefore; - [tokenBefore] = sourceCode.getTokensBefore( /** @type {import('eslint').Rule.Node} */ - currentNode, { - count: 2, - includeComments: true - }); - } - if (!tokenBefore || !isCommentToken(tokenBefore)) { - return null; - } - if (!nonJSDoc && tokenBefore.type === 'Line') { - currentNode = tokenBefore; - continue; - } - break; - } - - /* v8 ignore next 3 */ - if (!tokenBefore || !currentNode.loc || !tokenBefore.loc) { - return null; - } - if ((nonJSDoc && (tokenBefore.type !== 'Block' || !/^\*\s/u.test(tokenBefore.value)) || !nonJSDoc && tokenBefore.type === 'Block' && /^\*\s/u.test(tokenBefore.value)) && currentNode.loc.start.line - ( /** @type {import('eslint').AST.Token} */(_parenthesisToken = parenthesisToken) !== null && _parenthesisToken !== void 0 ? _parenthesisToken : tokenBefore).loc.end.line >= minLines && currentNode.loc.start.line - ( /** @type {import('eslint').AST.Token} */(_parenthesisToken2 = parenthesisToken) !== null && _parenthesisToken2 !== void 0 ? _parenthesisToken2 : tokenBefore).loc.end.line <= maxLines) { - return tokenBefore; - } - return null; -}; - -/** - * Retrieves the JSDoc comment for a given node. - * - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode - * @param {import('eslint').Rule.Node} node The AST node to get - * the comment for. - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The - * settings in context - * @returns {Token|null} The Block comment - * token containing the JSDoc comment for the given node or - * null if not found. - * @public - */ -const getJSDocComment = function (sourceCode, node, settings) { - const reducedNode = getReducedASTNode(node, sourceCode); - return findJSDocComment(reducedNode, sourceCode, settings); -}; - -/** - * Retrieves the comment preceding a given node. - * - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode - * @param {ESLintOrTSNode} node The AST node to get - * the comment for. - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The - * settings in context - * @returns {Token|null} The Block comment - * token containing the JSDoc comment for the given node or - * null if not found. - * @public - */ -const getNonJsdocComment = function (sourceCode, node, settings) { - const reducedNode = getReducedASTNode(node, sourceCode); - return findJSDocComment(reducedNode, sourceCode, settings, { - nonJSDoc: true - }); -}; - -/** - * @param {ESLintOrTSNode|import('eslint').AST.Token| - * import('estree').Comment - * } nodeA The AST node or token to compare - * @param {ESLintOrTSNode|import('eslint').AST.Token| - * import('estree').Comment} nodeB The - * AST node or token to compare - */ -const compareLocEndToStart = (nodeA, nodeB) => { - var _nodeA$loc$end$line, _nodeA$loc, _nodeB$loc$start$line, _nodeB$loc; - /* v8 ignore next */ - return ((_nodeA$loc$end$line = (_nodeA$loc = nodeA.loc) === null || _nodeA$loc === void 0 ? void 0 : _nodeA$loc.end.line) !== null && _nodeA$loc$end$line !== void 0 ? _nodeA$loc$end$line : 0) === ((_nodeB$loc$start$line = (_nodeB$loc = nodeB.loc) === null || _nodeB$loc === void 0 ? void 0 : _nodeB$loc.start.line) !== null && _nodeB$loc$start$line !== void 0 ? _nodeB$loc$start$line : 0); -}; - -/** - * Checks for the presence of a comment following the given node and - * returns it. - * - * This method is experimental. - * - * @param {import('eslint').SourceCode} sourceCode - * @param {ESLintOrTSNode} astNode The AST node to get - * the comment for. - * @returns {Token|null} The comment token containing the comment - * for the given node or null if not found. - */ -const getFollowingComment = function (sourceCode, astNode) { - /** - * @param {ESLintOrTSNode} node The - * AST node to get the comment for. - */ - const getTokensAfterIgnoringSemis = node => { - let tokenAfter = sourceCode.getTokenAfter( /** @type {import('eslint').Rule.Node} */ - node, { - includeComments: true - }); - while (tokenAfter && tokenAfter.type === 'Punctuator' && - // tokenAfter.value === ')' // Don't apparently need to ignore - tokenAfter.value === ';') { - [tokenAfter] = sourceCode.getTokensAfter(tokenAfter, { - includeComments: true - }); - } - return tokenAfter; - }; - - /** - * @param {ESLintOrTSNode} node The - * AST node to get the comment for. - */ - const tokenAfterIgnoringSemis = node => { - const tokenAfter = getTokensAfterIgnoringSemis(node); - return tokenAfter && isCommentToken(tokenAfter) && compareLocEndToStart(node, tokenAfter) ? tokenAfter : null; - }; - let tokenAfter = tokenAfterIgnoringSemis(astNode); - if (!tokenAfter) { - switch (astNode.type) { - case 'FunctionDeclaration': - tokenAfter = tokenAfterIgnoringSemis( /** @type {ESLintOrTSNode} */ - astNode.body); - break; - case 'ExpressionStatement': - tokenAfter = tokenAfterIgnoringSemis( /** @type {ESLintOrTSNode} */ - astNode.expression); - break; - } - } - return tokenAfter; -}; - -/** - * @param {RegExpMatchArray & { - * indices: { - * groups: { - * [key: string]: [number, number] - * } - * } - * groups: {[key: string]: string} - * }} match An inline tag regexp match. - * @returns {'pipe' | 'plain' | 'prefix' | 'space'} - */ -function determineFormat(match) { - const { - separator, - text - } = match.groups; - const [, textEnd] = match.indices.groups.text; - const [tagStart] = match.indices.groups.tag; - if (!text) { - return 'plain'; - } else if (separator === '|') { - return 'pipe'; - } else if (textEnd < tagStart) { - return 'prefix'; - } - return 'space'; -} - -/** - * Extracts inline tags from a description. - * @param {string} description - * @returns {import('.').InlineTag[]} Array of inline tags from the description. - */ -function parseDescription(description) { - /** @type {import('.').InlineTag[]} */ - const result = []; - - // This could have been expressed in a single pattern, - // but having two avoids a potentially exponential time regex. - - const prefixedTextPattern = new RegExp(/(?:\[(?[^\]]+)\])\{@(?[^}\s]+)\s?(?[^}\s|]*)\}/gu, 'gud'); - // The pattern used to match for text after tag uses a negative lookbehind - // on the ']' char to avoid matching the prefixed case too. - const suffixedAfterPattern = new RegExp(/(?[^}\s]+)\s?(?[^}\s|]*)\s*(?[\s|])?\s*(?[^}]*)\}/gu, 'gud'); - const matches = [...description.matchAll(prefixedTextPattern), ...description.matchAll(suffixedAfterPattern)]; - for (const mtch of matches) { - const match = - /** - * @type {RegExpMatchArray & { - * indices: { - * groups: { - * [key: string]: [number, number] - * } - * } - * groups: {[key: string]: string} - * }} - */ - mtch; - const { - tag, - namepathOrURL, - text - } = match.groups; - const [start, end] = match.indices[0]; - const format = determineFormat(match); - result.push({ - tag, - namepathOrURL, - text, - format, - start, - end - }); - } - return result; -} - -/** - * Splits the `{@prefix}` from remaining `Spec.lines[].token.description` - * into the `inlineTags` tokens, and populates `spec.inlineTags` - * @param {import('comment-parser').Block} block - * @returns {import('.').JsdocBlockWithInline} - */ -function parseInlineTags(block) { - const inlineTags = - /** - * @type {(import('./commentParserToESTree').JsdocInlineTagNoType & { - * line?: import('./commentParserToESTree').Integer - * })[]} - */ - parseDescription(block.description); - - /** @type {import('.').JsdocBlockWithInline} */ - block.inlineTags = inlineTags; - for (const tag of block.tags) { - /** - * @type {import('.').JsdocTagWithInline} - */ - tag.inlineTags = parseDescription(tag.description); - } - return ( - /** - * @type {import('.').JsdocBlockWithInline} - */ - block - ); -} - -/* eslint-disable prefer-named-capture-group -- Temporary */ -const { - name: nameTokenizer, - tag: tagTokenizer, - type: typeTokenizer, - description: descriptionTokenizer -} = commentParser.tokenizers; - -/** - * @param {import('comment-parser').Spec} spec - * @returns {boolean} - */ -const hasSeeWithLink = spec => { - return spec.tag === 'see' && /\{@link.+?\}/u.test(spec.source[0].source); -}; -const defaultNoTypes = ['default', 'defaultvalue', 'description', 'example', 'file', 'fileoverview', 'license', 'overview', 'see', 'summary']; -const defaultNoNames = ['access', 'author', 'default', 'defaultvalue', 'description', 'example', 'exception', 'file', 'fileoverview', 'kind', 'license', 'overview', 'return', 'returns', 'since', 'summary', 'throws', 'version', 'variation']; -const optionalBrackets = /^\[(?[^=]*)=[^\]]*\]/u; -const preserveTypeTokenizer = typeTokenizer('preserve'); -const preserveDescriptionTokenizer = descriptionTokenizer('preserve'); -const plainNameTokenizer = nameTokenizer(); - -/** - * Can't import `comment-parser/es6/parser/tokenizers/index.js`, - * so we redefine here. - * @typedef {(spec: import('comment-parser').Spec) => - * import('comment-parser').Spec} CommentParserTokenizer - */ - -/** - * @param {object} [cfg] - * @param {string[]} [cfg.noTypes] - * @param {string[]} [cfg.noNames] - * @returns {CommentParserTokenizer[]} - */ -const getTokenizers = ({ - noTypes = defaultNoTypes, - noNames = defaultNoNames -} = {}) => { - // trim - return [ - // Tag - tagTokenizer(), - /** - * Type tokenizer. - * @param {import('comment-parser').Spec} spec - * @returns {import('comment-parser').Spec} - */ - spec => { - if (noTypes.includes(spec.tag)) { - return spec; - } - return preserveTypeTokenizer(spec); - }, - /** - * Name tokenizer. - * @param {import('comment-parser').Spec} spec - * @returns {import('comment-parser').Spec} - */ - spec => { - if (spec.tag === 'template') { - // const preWS = spec.postTag; - const remainder = spec.source[0].tokens.description; - let pos; - if (remainder.startsWith('[') && remainder.includes(']')) { - const endingBracketPos = remainder.indexOf(']'); - pos = remainder.slice(endingBracketPos).search(/(? -1) { - // Add offset to starting point if space found - pos += endingBracketPos; - } - } else { - pos = remainder.search(/(? -1) { - [, postName, description, lineEnd] = /** @type {RegExpMatchArray} */ - extra.match(/(\s*)([^\r]*)(\r)?/u); - } - if (optionalBrackets.test(name)) { - var _name$match; - name = - /** @type {string} */ - /** @type {RegExpMatchArray} */ - (_name$match = name.match(optionalBrackets)) === null || _name$match === void 0 || (_name$match = _name$match.groups) === null || _name$match === void 0 ? void 0 : _name$match.name; - spec.optional = true; - } else { - spec.optional = false; - } - spec.name = name; - const { - tokens - } = spec.source[0]; - tokens.name = name; - tokens.postName = postName; - tokens.description = description; - tokens.lineEnd = lineEnd || ''; - return spec; - } - if (noNames.includes(spec.tag) || hasSeeWithLink(spec)) { - return spec; - } - return plainNameTokenizer(spec); - }, - /** - * Description tokenizer. - * @param {import('comment-parser').Spec} spec - * @returns {import('comment-parser').Spec} - */ - spec => { - return preserveDescriptionTokenizer(spec); - }]; -}; - -/** - * Accepts a comment token or complete comment string and converts it into - * `comment-parser` AST. - * @param {string | {value: string}} commentOrNode - * @param {string} [indent] Whitespace - * @returns {import('.').JsdocBlockWithInline} - */ -const parseComment = (commentOrNode, indent = '') => { - let block; - switch (typeof commentOrNode) { - case 'string': - // Preserve JSDoc block start/end indentation. - [block] = commentParser.parse(`${indent}${commentOrNode}`, { - // @see https://github.com/yavorskiy/comment-parser/issues/21 - tokenizers: getTokenizers() - }); - break; - case 'object': - if (commentOrNode === null) { - throw new TypeError(`'commentOrNode' is not a string or object.`); - } - - // Preserve JSDoc block start/end indentation. - [block] = commentParser.parse(`${indent}/*${commentOrNode.value}*/`, { - // @see https://github.com/yavorskiy/comment-parser/issues/21 - tokenizers: getTokenizers() - }); - break; - default: - throw new TypeError(`'commentOrNode' is not a string or object.`); - } - return parseInlineTags(block); -}; - -Object.defineProperty(exports, "jsdocTypeVisitorKeys", { - enumerable: true, - get: function () { return jsdocTypePrattParser.visitorKeys; } -}); -exports.commentHandler = commentHandler; -exports.commentParserToESTree = commentParserToESTree; -exports.defaultNoNames = defaultNoNames; -exports.defaultNoTypes = defaultNoTypes; -exports.estreeToString = estreeToString; -exports.findJSDocComment = findJSDocComment; -exports.getDecorator = getDecorator; -exports.getFollowingComment = getFollowingComment; -exports.getJSDocComment = getJSDocComment; -exports.getNonJsdocComment = getNonJsdocComment; -exports.getReducedASTNode = getReducedASTNode; -exports.getTokenizers = getTokenizers; -exports.hasSeeWithLink = hasSeeWithLink; -exports.jsdocVisitorKeys = jsdocVisitorKeys; -exports.parseComment = parseComment; -exports.parseInlineTags = parseInlineTags; -Object.keys(jsdocTypePrattParser).forEach(function (k) { - if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { - enumerable: true, - get: function () { return jsdocTypePrattParser[k]; } - }); -}); diff --git a/node_modules/@es-joy/jsdoccomment/dist/index.d.ts b/node_modules/@es-joy/jsdoccomment/dist/index.d.ts deleted file mode 100644 index 9e6567f..0000000 --- a/node_modules/@es-joy/jsdoccomment/dist/index.d.ts +++ /dev/null @@ -1,361 +0,0 @@ -import * as comment_parser from 'comment-parser'; -import * as jsdoc_type_pratt_parser from 'jsdoc-type-pratt-parser'; -export * from 'jsdoc-type-pratt-parser'; -export { visitorKeys as jsdocTypeVisitorKeys } from 'jsdoc-type-pratt-parser'; -import * as _typescript_eslint_types from '@typescript-eslint/types'; -import * as estree from 'estree'; -import * as eslint from 'eslint'; - -type JsdocTypeLine = { - delimiter: string; - postDelimiter: string; - rawType: string; - initial: string; - type: 'JsdocTypeLine'; -}; -type JsdocDescriptionLine = { - delimiter: string; - description: string; - postDelimiter: string; - initial: string; - type: 'JsdocDescriptionLine'; -}; -type JsdocInlineTagNoType = { - format: 'pipe' | 'plain' | 'prefix' | 'space'; - namepathOrURL: string; - tag: string; - text: string; -}; -type JsdocInlineTag = JsdocInlineTagNoType & { - type: 'JsdocInlineTag'; -}; -type JsdocTag = { - delimiter: string; - description: string; - descriptionLines: JsdocDescriptionLine[]; - initial: string; - inlineTags: JsdocInlineTag[]; - name: string; - postDelimiter: string; - postName: string; - postTag: string; - postType: string; - rawType: string; - parsedType: jsdoc_type_pratt_parser.RootResult | null; - tag: string; - type: 'JsdocTag'; - typeLines: JsdocTypeLine[]; -}; -type Integer = number; -type JsdocBlock = { - delimiter: string; - delimiterLineBreak: string; - description: string; - descriptionEndLine?: Integer; - descriptionLines: JsdocDescriptionLine[]; - descriptionStartLine?: Integer; - hasPreterminalDescription: 0 | 1; - hasPreterminalTagDescription?: 1; - initial: string; - inlineTags: JsdocInlineTag[]; - lastDescriptionLine?: Integer; - endLine: Integer; - lineEnd: string; - postDelimiter: string; - tags: JsdocTag[]; - terminal: string; - preterminalLineBreak: string; - type: 'JsdocBlock'; -}; -/** - * Converts comment parser AST to ESTree format. - * @param {import('.').JsdocBlockWithInline} jsdoc - * @param {import('jsdoc-type-pratt-parser').ParseMode} mode - * @param {object} opts - * @param {'compact'|'preserve'} [opts.spacing] By default, empty lines are - * compacted; set to 'preserve' to preserve empty comment lines. - * @param {boolean} [opts.throwOnTypeParsingErrors] - * @returns {JsdocBlock} - */ -declare function commentParserToESTree( - jsdoc: JsdocBlockWithInline, - mode: jsdoc_type_pratt_parser.ParseMode, - { - spacing, - throwOnTypeParsingErrors, - }?: { - spacing?: 'compact' | 'preserve'; - throwOnTypeParsingErrors?: boolean; - }, -): JsdocBlock; -declare namespace jsdocVisitorKeys { - let JsdocBlock: string[]; - let JsdocDescriptionLine: any[]; - let JsdocTypeLine: any[]; - let JsdocTag: string[]; - let JsdocInlineTag: any[]; -} - -/** - * @param {{[name: string]: any}} settings - * @returns {import('.').CommentHandler} - */ -declare function commentHandler(settings: { [name: string]: any }): CommentHandler; - -/** - * @todo convert for use by escodegen (until may be patched to support - * custom entries?). - * @param {import('./commentParserToESTree').JsdocBlock| - * import('./commentParserToESTree').JsdocDescriptionLine| - * import('./commentParserToESTree').JsdocTypeLine| - * import('./commentParserToESTree').JsdocTag| - * import('./commentParserToESTree').JsdocInlineTag| - * import('jsdoc-type-pratt-parser').RootResult - * } node - * @param {import('.').ESTreeToStringOptions} opts - * @throws {Error} - * @returns {string} - */ -declare function estreeToString( - node: - | JsdocBlock - | JsdocDescriptionLine - | JsdocTypeLine - | JsdocTag - | JsdocInlineTag - | jsdoc_type_pratt_parser.RootResult, - opts?: ESTreeToStringOptions, -): string; - -type Token = - | eslint.AST.Token - | estree.Comment - | { - type: eslint.AST.TokenType | 'Line' | 'Block' | 'Shebang'; - range: [number, number]; - value: string; - }; -type ESLintOrTSNode = eslint.Rule.Node | _typescript_eslint_types.TSESTree.Node; -type int = number; -/** - * Reduces the provided node to the appropriate node for evaluating - * JSDoc comment status. - * - * @param {ESLintOrTSNode} node An AST node. - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode. - * @returns {ESLintOrTSNode} The AST node that - * can be evaluated for appropriate JSDoc comments. - */ -declare function getReducedASTNode(node: ESLintOrTSNode, sourceCode: eslint.SourceCode): ESLintOrTSNode; -/** - * Retrieves the JSDoc comment for a given node. - * - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode - * @param {import('eslint').Rule.Node} node The AST node to get - * the comment for. - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The - * settings in context - * @returns {Token|null} The Block comment - * token containing the JSDoc comment for the given node or - * null if not found. - * @public - */ -declare function getJSDocComment( - sourceCode: eslint.SourceCode, - node: eslint.Rule.Node, - settings: { - maxLines: int; - minLines: int; - [name: string]: any; - }, -): Token | null; -/** - * Retrieves the comment preceding a given node. - * - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode - * @param {ESLintOrTSNode} node The AST node to get - * the comment for. - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The - * settings in context - * @returns {Token|null} The Block comment - * token containing the JSDoc comment for the given node or - * null if not found. - * @public - */ -declare function getNonJsdocComment( - sourceCode: eslint.SourceCode, - node: ESLintOrTSNode, - settings: { - maxLines: int; - minLines: int; - [name: string]: any; - }, -): Token | null; -/** - * @param {(ESLintOrTSNode|import('estree').Comment) & { - * declaration?: any, - * decorators?: any[], - * parent?: import('eslint').Rule.Node & { - * decorators?: any[] - * } - * }} node - * @returns {import('@typescript-eslint/types').TSESTree.Decorator|undefined} - */ -declare function getDecorator( - node: (ESLintOrTSNode | estree.Comment) & { - declaration?: any; - decorators?: any[]; - parent?: eslint.Rule.Node & { - decorators?: any[]; - }; - }, -): _typescript_eslint_types.TSESTree.Decorator | undefined; -/** - * Checks for the presence of a JSDoc comment for the given node and returns it. - * - * @param {ESLintOrTSNode} astNode The AST node to get - * the comment for. - * @param {import('eslint').SourceCode} sourceCode - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings - * @param {{nonJSDoc?: boolean}} [opts] - * @returns {Token|null} The Block comment token containing the JSDoc comment - * for the given node or null if not found. - */ -declare function findJSDocComment( - astNode: ESLintOrTSNode, - sourceCode: eslint.SourceCode, - settings: { - maxLines: int; - minLines: int; - [name: string]: any; - }, - opts?: { - nonJSDoc?: boolean; - }, -): Token | null; -/** - * Checks for the presence of a comment following the given node and - * returns it. - * - * This method is experimental. - * - * @param {import('eslint').SourceCode} sourceCode - * @param {ESLintOrTSNode} astNode The AST node to get - * the comment for. - * @returns {Token|null} The comment token containing the comment - * for the given node or null if not found. - */ -declare function getFollowingComment(sourceCode: eslint.SourceCode, astNode: ESLintOrTSNode): Token | null; - -declare function hasSeeWithLink(spec: comment_parser.Spec): boolean; -declare const defaultNoTypes: string[]; -declare const defaultNoNames: string[]; -/** - * Can't import `comment-parser/es6/parser/tokenizers/index.js`, - * so we redefine here. - */ -type CommentParserTokenizer = (spec: comment_parser.Spec) => comment_parser.Spec; -/** - * Can't import `comment-parser/es6/parser/tokenizers/index.js`, - * so we redefine here. - * @typedef {(spec: import('comment-parser').Spec) => - * import('comment-parser').Spec} CommentParserTokenizer - */ -/** - * @param {object} [cfg] - * @param {string[]} [cfg.noTypes] - * @param {string[]} [cfg.noNames] - * @returns {CommentParserTokenizer[]} - */ -declare function getTokenizers({ - noTypes, - noNames, -}?: { - noTypes?: string[]; - noNames?: string[]; -}): CommentParserTokenizer[]; -/** - * Accepts a comment token or complete comment string and converts it into - * `comment-parser` AST. - * @param {string | {value: string}} commentOrNode - * @param {string} [indent] Whitespace - * @returns {import('.').JsdocBlockWithInline} - */ -declare function parseComment( - commentOrNode: - | string - | { - value: string; - }, - indent?: string, -): JsdocBlockWithInline; - -/** - * Splits the `{@prefix}` from remaining `Spec.lines[].token.description` - * into the `inlineTags` tokens, and populates `spec.inlineTags` - * @param {import('comment-parser').Block} block - * @returns {import('.').JsdocBlockWithInline} - */ -declare function parseInlineTags(block: comment_parser.Block): JsdocBlockWithInline; - -type InlineTag = JsdocInlineTagNoType & { - start: number; - end: number; -}; -type JsdocTagWithInline = comment_parser.Spec & { - line?: Integer; - inlineTags: (JsdocInlineTagNoType & { - line?: Integer; - })[]; -}; -/** - * Expands on comment-parser's `Block` interface. - */ -type JsdocBlockWithInline = { - description: string; - source: comment_parser.Line[]; - problems: comment_parser.Problem[]; - tags: JsdocTagWithInline[]; - inlineTags: (JsdocInlineTagNoType & { - line?: Integer; - })[]; -}; -type ESTreeToStringOptions = { - preferRawType?: boolean; -}; -type CommentHandler = (commentSelector: string, jsdoc: JsdocBlockWithInline) => boolean; - -export { - type CommentHandler, - type CommentParserTokenizer, - type ESLintOrTSNode, - type ESTreeToStringOptions, - type InlineTag, - type Integer, - JsdocBlock, - type JsdocBlockWithInline, - JsdocDescriptionLine, - JsdocInlineTag, - type JsdocInlineTagNoType, - JsdocTag, - type JsdocTagWithInline, - JsdocTypeLine, - type Token, - commentHandler, - commentParserToESTree, - defaultNoNames, - defaultNoTypes, - estreeToString, - findJSDocComment, - getDecorator, - getFollowingComment, - getJSDocComment, - getNonJsdocComment, - getReducedASTNode, - getTokenizers, - hasSeeWithLink, - type int, - jsdocVisitorKeys, - parseComment, - parseInlineTags, -}; diff --git a/node_modules/@es-joy/jsdoccomment/package.json b/node_modules/@es-joy/jsdoccomment/package.json deleted file mode 100644 index 0056da2..0000000 --- a/node_modules/@es-joy/jsdoccomment/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "name": "@es-joy/jsdoccomment", - "version": "0.46.0", - "author": "Brett Zamir ", - "contributors": [], - "description": "Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment along with other jsdoc utilities", - "license": "MIT", - "keywords": [ - "ast", - "comment", - "estree", - "jsdoc", - "parser", - "eslint", - "sourcecode" - ], - "type": "module", - "types": "./dist/index.d.ts", - "exports": { - "types": "./dist/index.d.ts", - "import": "./src/index.js", - "require": "./dist/index.cjs.cjs" - }, - "browserslist": [ - "cover 100%" - ], - "typedocOptions": { - "dmtLinksService": { - "GitHub": "https://github.com/es-joy/jsdoccomment", - "NPM": "https://www.npmjs.com/package/@es-joy/jsdoccomment" - } - }, - "repository": { - "type": "git", - "url": "git+https://github.com/es-joy/jsdoccomment.git" - }, - "bugs": { - "url": "https://github.com/es-joy/jsdoccomment/issues" - }, - "homepage": "https://github.com/es-joy/jsdoccomment", - "engines": { - "node": ">=16" - }, - "dependencies": { - "comment-parser": "1.4.1", - "esquery": "^1.6.0", - "jsdoc-type-pratt-parser": "~4.0.0" - }, - "devDependencies": { - "@babel/core": "^7.24.7", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/preset-env": "^7.24.7", - "@brettz9/eslint-plugin": "^1.0.4", - "@rollup/plugin-babel": "^6.0.4", - "@types/eslint": "^8.56.10", - "@types/esquery": "^1.5.4", - "@types/estraverse": "^5.1.7", - "@types/estree": "^1.0.5", - "@typescript-eslint/types": "^7.16.0", - "@typescript-eslint/visitor-keys": "^7.16.0", - "@typhonjs-build-test/esm-d-ts": "0.3.0-next.1", - "@typhonjs-typedoc/typedoc-pkg": "^0.0.5", - "@vitest/coverage-v8": "^2.0.1", - "@vitest/ui": "^2.0.1", - "eslint": "^8.56.0", - "eslint-config-ash-nazg": "35.3.0", - "eslint-config-standard": "^17.1.0", - "eslint-plugin-array-func": "^4.0.0", - "eslint-plugin-compat": "^4.2.0", - "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-html": "^7.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsdoc": "^48.0.4", - "eslint-plugin-markdown": "^3.0.1", - "eslint-plugin-n": "^16.6.2", - "eslint-plugin-no-unsanitized": "^4.0.2", - "eslint-plugin-no-use-extend-native": "^0.5.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-sonarjs": "^0.23.0", - "eslint-plugin-unicorn": "^50.0.1", - "espree": "^10.1.0", - "estraverse": "^5.3.0", - "rollup": "^4.18.1", - "typescript": "^5.5.3", - "typescript-eslint": "^7.16.0", - "vitest": "^2.0.1" - }, - "files": [ - "/dist", - "/src", - "CHANGES.md", - "LICENSE-MIT.txt" - ], - "scripts": { - "build": "rollup -c && npm run types", - "docs": "typedoc-pkg --api-link es", - "eslint": "eslint --ext=js,cjs,md,html .", - "lint": "npm run eslint --", - "open": "open ./coverage/index.html", - "test": "npm run lint && npm run build && npm run test-ui", - "test-ui": "vitest --ui --coverage", - "test-cov": "vitest --coverage", - "tsc": "tsc", - "types": "esm-d-ts gen ./src/index.js --output ./dist/index.d.ts" - } -} \ No newline at end of file diff --git a/node_modules/@es-joy/jsdoccomment/src/commentHandler.js b/node_modules/@es-joy/jsdoccomment/src/commentHandler.js deleted file mode 100644 index 455afdd..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/commentHandler.js +++ /dev/null @@ -1,39 +0,0 @@ -import esquery from 'esquery'; - -import { - visitorKeys as jsdocTypePrattParserVisitorKeys -} from 'jsdoc-type-pratt-parser'; - -import { - commentParserToESTree, jsdocVisitorKeys -} from './commentParserToESTree.js'; - -/** - * @param {{[name: string]: any}} settings - * @returns {import('.').CommentHandler} - */ -const commentHandler = (settings) => { - /** - * @type {import('.').CommentHandler} - */ - return (commentSelector, jsdoc) => { - const {mode} = settings; - - const selector = esquery.parse(commentSelector); - - const ast = commentParserToESTree(jsdoc, mode); - - const _ast = /** @type {unknown} */ (ast); - - return esquery.matches(/** @type {import('estree').Node} */ ( - _ast - ), selector, undefined, { - visitorKeys: { - ...jsdocTypePrattParserVisitorKeys, - ...jsdocVisitorKeys - } - }); - }; -}; - -export {commentHandler}; diff --git a/node_modules/@es-joy/jsdoccomment/src/commentParserToESTree.js b/node_modules/@es-joy/jsdoccomment/src/commentParserToESTree.js deleted file mode 100644 index ba4c898..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/commentParserToESTree.js +++ /dev/null @@ -1,504 +0,0 @@ -import {parse as jsdocTypePrattParse} from 'jsdoc-type-pratt-parser'; - -/** - * Removes initial and ending brackets from `rawType` - * @param {JsdocTypeLine[]|JsdocTag} container - * @param {boolean} [isArr] - * @returns {void} - */ -const stripEncapsulatingBrackets = (container, isArr) => { - if (isArr) { - const firstItem = /** @type {JsdocTypeLine[]} */ (container)[0]; - firstItem.rawType = firstItem.rawType.replace( - /^\{/u, '' - ); - - const lastItem = /** @type {JsdocTypeLine} */ ( - /** @type {JsdocTypeLine[]} */ ( - container - ).at(-1) - ); - lastItem.rawType = lastItem.rawType.replace(/\}$/u, ''); - - return; - } - /** @type {JsdocTag} */ (container).rawType = - /** @type {JsdocTag} */ (container).rawType.replace( - /^\{/u, '' - ).replace(/\}$/u, ''); -}; - -/** - * @typedef {{ - * delimiter: string, - * postDelimiter: string, - * rawType: string, - * initial: string, - * type: "JsdocTypeLine" - * }} JsdocTypeLine - */ - -/** - * @typedef {{ - * delimiter: string, - * description: string, - * postDelimiter: string, - * initial: string, - * type: "JsdocDescriptionLine" - * }} JsdocDescriptionLine - */ - -/** - * @typedef {{ - * format: 'pipe' | 'plain' | 'prefix' | 'space', - * namepathOrURL: string, - * tag: string, - * text: string, - * }} JsdocInlineTagNoType - */ -/** - * @typedef {JsdocInlineTagNoType & { - * type: "JsdocInlineTag" - * }} JsdocInlineTag - */ - -/** - * @typedef {{ - * delimiter: string, - * description: string, - * descriptionLines: JsdocDescriptionLine[], - * initial: string, - * inlineTags: JsdocInlineTag[] - * name: string, - * postDelimiter: string, - * postName: string, - * postTag: string, - * postType: string, - * rawType: string, - * parsedType: import('jsdoc-type-pratt-parser').RootResult|null - * tag: string, - * type: "JsdocTag", - * typeLines: JsdocTypeLine[], - * }} JsdocTag - */ - -/** - * @typedef {number} Integer - */ - -/** - * @typedef {{ - * delimiter: string, - * delimiterLineBreak: string, - * description: string, - * descriptionEndLine?: Integer, - * descriptionLines: JsdocDescriptionLine[], - * descriptionStartLine?: Integer, - * hasPreterminalDescription: 0|1, - * hasPreterminalTagDescription?: 1, - * initial: string, - * inlineTags: JsdocInlineTag[] - * lastDescriptionLine?: Integer, - * endLine: Integer, - * lineEnd: string, - * postDelimiter: string, - * tags: JsdocTag[], - * terminal: string, - * preterminalLineBreak: string, - * type: "JsdocBlock", - * }} JsdocBlock - */ - -/** - * @param {object} cfg - * @param {string} cfg.text - * @param {string} cfg.tag - * @param {'pipe' | 'plain' | 'prefix' | 'space'} cfg.format - * @param {string} cfg.namepathOrURL - * @returns {JsdocInlineTag} - */ -const inlineTagToAST = ({text, tag, format, namepathOrURL}) => ({ - text, - tag, - format, - namepathOrURL, - type: 'JsdocInlineTag' -}); - -/** - * Converts comment parser AST to ESTree format. - * @param {import('.').JsdocBlockWithInline} jsdoc - * @param {import('jsdoc-type-pratt-parser').ParseMode} mode - * @param {object} opts - * @param {'compact'|'preserve'} [opts.spacing] By default, empty lines are - * compacted; set to 'preserve' to preserve empty comment lines. - * @param {boolean} [opts.throwOnTypeParsingErrors] - * @returns {JsdocBlock} - */ -const commentParserToESTree = (jsdoc, mode, { - spacing = 'compact', - throwOnTypeParsingErrors = false -} = {}) => { - /** - * Strips brackets from a tag's `rawType` values and adds `parsedType` - * @param {JsdocTag} lastTag - * @returns {void} - */ - const cleanUpLastTag = (lastTag) => { - // Strip out `}` that encapsulates and is not part of - // the type - stripEncapsulatingBrackets(lastTag); - - if (lastTag.typeLines.length) { - stripEncapsulatingBrackets(lastTag.typeLines, true); - } - - // Remove single empty line description. - if (lastTag.descriptionLines.length === 1 && - lastTag.descriptionLines[0].description === '') { - lastTag.descriptionLines.length = 0; - } - - // With even a multiline type now in full, add parsing - let parsedType = null; - - try { - parsedType = jsdocTypePrattParse(lastTag.rawType, mode); - } catch (err) { - // Ignore - if (lastTag.rawType && throwOnTypeParsingErrors) { - /** @type {Error} */ ( - err - ).message = `Tag @${lastTag.tag} with raw type ` + - `\`${lastTag.rawType}\` had parsing error: ${ - /** @type {Error} */ (err).message}`; - throw err; - } - } - - lastTag.parsedType = parsedType; - }; - - const {source, inlineTags: blockInlineTags} = jsdoc; - - const {tokens: { - delimiter: delimiterRoot, - lineEnd: lineEndRoot, - postDelimiter: postDelimiterRoot, - start: startRoot, - end: endRoot - }} = source[0]; - - const endLine = source.length - 1; - - /** @type {JsdocBlock} */ - const ast = { - delimiter: delimiterRoot, - delimiterLineBreak: '\n', - description: '', - - descriptionLines: [], - inlineTags: blockInlineTags.map((t) => inlineTagToAST(t)), - - initial: startRoot, - tags: [], - // `terminal` will be overwritten if there are other entries - terminal: endRoot, - preterminalLineBreak: '\n', - hasPreterminalDescription: 0, - endLine, - postDelimiter: postDelimiterRoot, - lineEnd: lineEndRoot, - - type: 'JsdocBlock' - }; - - /** - * @type {JsdocTag[]} - */ - const tags = []; - - /** @type {Integer|undefined} */ - let lastDescriptionLine; - - /** @type {JsdocTag|null} */ - let lastTag = null; - - // Tracks when first valid tag description line is seen. - let tagDescriptionSeen = false; - - let descLineStateOpen = true; - - source.forEach((info, idx) => { - const {tokens} = info; - const { - delimiter, - description, - postDelimiter, - start: initial, - tag, - end, - type: rawType - } = tokens; - - if (!tag && description && descLineStateOpen) { - if (ast.descriptionStartLine === undefined) { - ast.descriptionStartLine = idx; - } - ast.descriptionEndLine = idx; - } - - if (tag || end) { - descLineStateOpen = false; - if (lastDescriptionLine === undefined) { - lastDescriptionLine = idx; - } - - // Clean-up with last tag before end or new tag - if (lastTag) { - cleanUpLastTag(lastTag); - } - - // Stop the iteration when we reach the end - // but only when there is no tag earlier in the line - // to still process - if (end && !tag) { - ast.terminal = end; - - // Check if there are any description lines and if not then this is a - // one line comment block. - const isDelimiterLine = ast.descriptionLines.length === 0 && - delimiter === '/**'; - - // Remove delimiter line break for one line comments blocks. - if (isDelimiterLine) { - ast.delimiterLineBreak = ''; - } - - if (description) { - // Remove terminal line break at end when description is defined. - if (ast.terminal === '*/') { - ast.preterminalLineBreak = ''; - } - - if (lastTag) { - ast.hasPreterminalTagDescription = 1; - } else { - ast.hasPreterminalDescription = 1; - } - - const holder = lastTag || ast; - holder.description += (holder.description ? '\n' : '') + description; - - // Do not include `delimiter` / `postDelimiter` for opening - // delimiter line. - - holder.descriptionLines.push({ - delimiter: isDelimiterLine ? '' : delimiter, - description, - postDelimiter: isDelimiterLine ? '' : postDelimiter, - initial, - type: 'JsdocDescriptionLine' - }); - } - return; - } - - const { - // eslint-disable-next-line no-unused-vars -- Discarding - end: ed, - delimiter: de, - postDelimiter: pd, - start: init, - ...tkns - } = tokens; - - if (!tokens.name) { - let i = 1; - while (source[idx + i]) { - const {tokens: { - name, - postName, - postType, - tag: tg - }} = source[idx + i]; - if (tg) { - break; - } - if (name) { - tkns.postType = postType; - tkns.name = name; - tkns.postName = postName; - break; - } - i++; - } - } - - /** - * @type {JsdocInlineTag[]} - */ - let tagInlineTags = []; - if (tag) { - // Assuming the tags from `source` are in the same order as `jsdoc.tags` - // we can use the `tags` length as index into the parser result tags. - tagInlineTags = - /** - * @type {import('comment-parser').Spec & { - * inlineTags: JsdocInlineTagNoType[] - * }} - */ ( - jsdoc.tags[tags.length] - ).inlineTags.map( - (t) => inlineTagToAST(t) - ); - } - - /** @type {JsdocTag} */ - const tagObj = { - ...tkns, - initial: endLine ? init : '', - postDelimiter: lastDescriptionLine ? pd : '', - delimiter: lastDescriptionLine ? de : '', - descriptionLines: [], - inlineTags: tagInlineTags, - parsedType: null, - rawType: '', - type: 'JsdocTag', - typeLines: [] - }; - tagObj.tag = tagObj.tag.replace(/^@/u, ''); - - lastTag = tagObj; - tagDescriptionSeen = false; - - tags.push(tagObj); - } - - if (rawType) { - // Will strip rawType brackets after this tag - /** @type {JsdocTag} */ (lastTag).typeLines.push( - /** @type {JsdocTag} */ (lastTag).typeLines.length - ? { - delimiter, - postDelimiter, - rawType, - initial, - type: 'JsdocTypeLine' - } - : { - delimiter: '', - postDelimiter: '', - rawType, - initial: '', - type: 'JsdocTypeLine' - } - ); - /** @type {JsdocTag} */ (lastTag).rawType += /** @type {JsdocTag} */ ( - lastTag - ).rawType - ? '\n' + rawType - : rawType; - } - - // In `compact` mode skip processing if `description` is an empty string - // unless lastTag is being processed. - // - // In `preserve` mode process when `description` is not the `empty string - // or the `delimiter` is not `/**` ensuring empty lines are preserved. - if (((spacing === 'compact' && description) || lastTag) || - (spacing === 'preserve' && (description || delimiter !== '/**'))) { - const holder = lastTag || ast; - - // Check if there are any description lines and if not then this is a - // multi-line comment block with description on 0th line. Treat - // `delimiter` / `postDelimiter` / `initial` as being on a new line. - const isDelimiterLine = holder.descriptionLines.length === 0 && - delimiter === '/**'; - - // Remove delimiter line break for one line comments blocks. - if (isDelimiterLine) { - ast.delimiterLineBreak = ''; - } - - // Track when the first description line is seen to avoid adding empty - // description lines for tag type lines. - tagDescriptionSeen ||= Boolean(lastTag && - (rawType === '' || rawType?.endsWith('}'))); - - if (lastTag) { - if (tagDescriptionSeen) { - // The first tag description line is a continuation after type / - // name parsing. - const isFirstDescriptionLine = holder.descriptionLines.length === 0; - - // For `compact` spacing must allow through first description line. - if ((spacing === 'compact' && - (description || isFirstDescriptionLine)) || - spacing === 'preserve') { - holder.descriptionLines.push({ - delimiter: isFirstDescriptionLine ? '' : delimiter, - description, - postDelimiter: isFirstDescriptionLine ? '' : postDelimiter, - initial: isFirstDescriptionLine ? '' : initial, - type: 'JsdocDescriptionLine' - }); - } - } - } else { - holder.descriptionLines.push({ - delimiter: isDelimiterLine ? '' : delimiter, - description, - postDelimiter: isDelimiterLine ? '' : postDelimiter, - initial: isDelimiterLine ? `` : initial, - type: 'JsdocDescriptionLine' - }); - } - - if (!tag) { - if (lastTag) { - // For `compact` spacing must filter out any empty description lines - // after the initial `holder.description` has content. - if (tagDescriptionSeen && !(spacing === 'compact' && - holder.description && description === '')) { - holder.description += !holder.description - ? description - : '\n' + description; - } - } else { - holder.description += !holder.description - ? description - : '\n' + description; - } - } - } - - // Clean-up where last line itself has tag content - if (end && tag) { - ast.terminal = end; - ast.hasPreterminalTagDescription = 1; - - // Remove terminal line break at end when tag is defined on last line. - if (ast.terminal === '*/') { - ast.preterminalLineBreak = ''; - } - - cleanUpLastTag(/** @type {JsdocTag} */ (lastTag)); - } - }); - - ast.lastDescriptionLine = lastDescriptionLine; - ast.tags = tags; - - return ast; -}; - -const jsdocVisitorKeys = { - JsdocBlock: ['descriptionLines', 'tags', 'inlineTags'], - JsdocDescriptionLine: [], - JsdocTypeLine: [], - JsdocTag: ['parsedType', 'typeLines', 'descriptionLines', 'inlineTags'], - JsdocInlineTag: [] -}; - -export {commentParserToESTree, jsdocVisitorKeys}; diff --git a/node_modules/@es-joy/jsdoccomment/src/estreeToString.js b/node_modules/@es-joy/jsdoccomment/src/estreeToString.js deleted file mode 100644 index 2926880..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/estreeToString.js +++ /dev/null @@ -1,179 +0,0 @@ -import {stringify as prattStringify} from 'jsdoc-type-pratt-parser'; - -/** @type {Record} */ -const stringifiers = { - JsdocBlock, - - /** - * @param {import('./commentParserToESTree').JsdocDescriptionLine} node - * @returns {string} - */ - JsdocDescriptionLine ({ - initial, delimiter, postDelimiter, description - }) { - return `${initial}${delimiter}${postDelimiter}${description}`; - }, - - /** - * @param {import('./commentParserToESTree').JsdocTypeLine} node - * @returns {string} - */ - JsdocTypeLine ({ - initial, delimiter, postDelimiter, rawType - }) { - return `${initial}${delimiter}${postDelimiter}${rawType}`; - }, - - /** - * @param {import('./commentParserToESTree').JsdocInlineTag} node - */ - JsdocInlineTag ({format, namepathOrURL, tag, text}) { - return format === 'pipe' - ? `{@${tag} ${namepathOrURL}|${text}}` - : format === 'plain' - ? `{@${tag} ${namepathOrURL}}` - : format === 'prefix' - ? `[${text}]{@${tag} ${namepathOrURL}}` - // "space" - : `{@${tag} ${namepathOrURL} ${text}}`; - }, - - JsdocTag -}; - -/** - * @todo convert for use by escodegen (until may be patched to support - * custom entries?). - * @param {import('./commentParserToESTree').JsdocBlock| - * import('./commentParserToESTree').JsdocDescriptionLine| - * import('./commentParserToESTree').JsdocTypeLine| - * import('./commentParserToESTree').JsdocTag| - * import('./commentParserToESTree').JsdocInlineTag| - * import('jsdoc-type-pratt-parser').RootResult - * } node - * @param {import('.').ESTreeToStringOptions} opts - * @throws {Error} - * @returns {string} - */ -function estreeToString (node, opts = {}) { - if (Object.prototype.hasOwnProperty.call(stringifiers, node.type)) { - return stringifiers[ - /** - * @type {import('./commentParserToESTree').JsdocBlock| - * import('./commentParserToESTree').JsdocDescriptionLine| - * import('./commentParserToESTree').JsdocTypeLine| - * import('./commentParserToESTree').JsdocTag} - */ - (node).type - ]( - node, - opts - ); - } - - // We use raw type instead but it is a key as other apps may wish to traverse - if (node.type.startsWith('JsdocType')) { - return opts.preferRawType - ? '' - : `{${prattStringify( - /** @type {import('jsdoc-type-pratt-parser').RootResult} */ ( - node - ) - )}}`; - } - - throw new Error(`Unhandled node type: ${node.type}`); -} - -/** - * @param {import('./commentParserToESTree').JsdocBlock} node - * @param {import('.').ESTreeToStringOptions} opts - * @returns {string} - */ -function JsdocBlock (node, opts) { - const {delimiter, delimiterLineBreak, descriptionLines, - initial, postDelimiter, preterminalLineBreak, tags, terminal} = node; - - const terminalPrepend = preterminalLineBreak !== '' - ? `${preterminalLineBreak}${initial} ` - : ''; - - let result = `${initial}${delimiter}${postDelimiter}${delimiterLineBreak}`; - - for (let i = 0; i < descriptionLines.length; i++) { - result += estreeToString(descriptionLines[i]); - - if (i !== descriptionLines.length - 1 || tags.length) { - result += '\n'; - } - } - - for (let i = 0; i < tags.length; i++) { - result += estreeToString(tags[i], opts); - - if (i !== tags.length - 1) { - result += '\n'; - } - } - - result += `${terminalPrepend}${terminal}`; - - return result; -} - -/** - * @param {import('./commentParserToESTree').JsdocTag} node - * @param {import('.').ESTreeToStringOptions} opts - * @returns {string} - */ -function JsdocTag (node, opts) { - const { - delimiter, descriptionLines, initial, name, parsedType, postDelimiter, - postName, postTag, postType, tag, typeLines - } = node; - - let result = `${initial}${delimiter}${postDelimiter}@${tag}${postTag}`; - - // Could do `rawType` but may have been changed; could also do - // `typeLines` but not as likely to be changed - // parsedType - // Comment this out later in favor of `parsedType` - // We can't use raw `typeLines` as first argument has delimiter on it - if (opts.preferRawType || !parsedType) { - if (typeLines.length) { - result += '{'; - - for (let i = 0; i < typeLines.length; i++) { - result += estreeToString(typeLines[i]); - - if (i !== typeLines.length - 1) { - result += '\n'; - } - } - - result += '}'; - } - } else if (parsedType?.type.startsWith('JsdocType')) { - result += `{${prattStringify( - /** @type {import('jsdoc-type-pratt-parser').RootResult} */ ( - parsedType - ) - )}}`; - } - - result += name ? `${postType}${name}${postName}` : postType; - - for (let i = 0; i < descriptionLines.length; i++) { - const descriptionLine = descriptionLines[i]; - - result += estreeToString(descriptionLine); - - if (i !== descriptionLines.length - 1) { - result += '\n'; - } - } - - return result; -} - -export {estreeToString}; diff --git a/node_modules/@es-joy/jsdoccomment/src/index.js b/node_modules/@es-joy/jsdoccomment/src/index.js deleted file mode 100644 index cd68852..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @typedef {import('./commentParserToESTree').JsdocInlineTagNoType & { - * start: number, - * end: number, - * }} InlineTag - */ - -/** - * @typedef {import('comment-parser').Spec & { - * line?: import('./commentParserToESTree').Integer, - * inlineTags: (import('./commentParserToESTree').JsdocInlineTagNoType & { - * line?: import('./commentParserToESTree').Integer - * })[] - * }} JsdocTagWithInline - */ - -/** - * Expands on comment-parser's `Block` interface. - * @typedef {{ - * description: string, - * source: import('comment-parser').Line[], - * problems: import('comment-parser').Problem[], - * tags: JsdocTagWithInline[], - * inlineTags: (import('./commentParserToESTree').JsdocInlineTagNoType & { - * line?: import('./commentParserToESTree').Integer - * })[] - * }} JsdocBlockWithInline - */ - -/** - * @typedef {{preferRawType?: boolean}} ESTreeToStringOptions - */ - -/** - * @callback CommentHandler - * @param {string} commentSelector - * @param {import('.').JsdocBlockWithInline} jsdoc - * @returns {boolean} - */ - -export {visitorKeys as jsdocTypeVisitorKeys} from 'jsdoc-type-pratt-parser'; - -export * from 'jsdoc-type-pratt-parser'; - -export * from './commentHandler.js'; -export * from './commentParserToESTree.js'; -export * from './estreeToString.js'; -export * from './jsdoccomment.js'; -export * from './parseComment.js'; -export * from './parseInlineTags.js'; diff --git a/node_modules/@es-joy/jsdoccomment/src/jsdoccomment.js b/node_modules/@es-joy/jsdoccomment/src/jsdoccomment.js deleted file mode 100644 index a810cbd..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/jsdoccomment.js +++ /dev/null @@ -1,487 +0,0 @@ -/** - * Obtained originally from {@link https://github.com/eslint/eslint/blob/master/lib/util/source-code.js#L313}. - * - * @license MIT - */ - -/** - * @typedef {import('eslint').AST.Token | import('estree').Comment | { - * type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang", - * range: [number, number], - * value: string - * }} Token - */ - -/** - * @typedef {import('eslint').Rule.Node| - * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode - */ - -/** - * @typedef {number} int - */ - -/** - * 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. - */ -const isCommentToken = (token) => { - return token.type === 'Line' || token.type === 'Block' || - token.type === 'Shebang'; -}; - -/** - * @param {(ESLintOrTSNode|import('estree').Comment) & { - * declaration?: any, - * decorators?: any[], - * parent?: import('eslint').Rule.Node & { - * decorators?: any[] - * } - * }} node - * @returns {import('@typescript-eslint/types').TSESTree.Decorator|undefined} - */ -const getDecorator = (node) => { - return node?.declaration?.decorators?.[0] || node?.decorators?.[0] || - node?.parent?.decorators?.[0]; -}; - -/** - * Check to see if it is a ES6 export declaration. - * - * @param {ESLintOrTSNode} astNode An AST node. - * @returns {boolean} whether the given node represents an export declaration. - * @private - */ -const looksLikeExport = function (astNode) { - return astNode.type === 'ExportDefaultDeclaration' || - astNode.type === 'ExportNamedDeclaration' || - astNode.type === 'ExportAllDeclaration' || - astNode.type === 'ExportSpecifier'; -}; - -/** - * @param {ESLintOrTSNode} astNode - * @returns {ESLintOrTSNode} - */ -const getTSFunctionComment = function (astNode) { - const {parent} = astNode; - /* v8 ignore next 3 */ - if (!parent) { - return astNode; - } - const grandparent = parent.parent; - /* v8 ignore next 3 */ - if (!grandparent) { - return astNode; - } - const greatGrandparent = grandparent.parent; - const greatGreatGrandparent = greatGrandparent && greatGrandparent.parent; - - /* v8 ignore next 3 */ - if (/** @type {ESLintOrTSNode} */ (parent).type !== 'TSTypeAnnotation') { - return astNode; - } - - switch (/** @type {ESLintOrTSNode} */ (grandparent).type) { - // @ts-expect-error -- For `ClassProperty`. - case 'PropertyDefinition': case 'ClassProperty': - case 'TSDeclareFunction': - case 'TSMethodSignature': - case 'TSPropertySignature': - return grandparent; - case 'ArrowFunctionExpression': - /* v8 ignore next 3 */ - if (!greatGrandparent) { - return astNode; - } - - if ( - greatGrandparent.type === 'VariableDeclarator' - - // && greatGreatGrandparent.parent.type === 'VariableDeclaration' - ) { - /* v8 ignore next 3 */ - if (!greatGreatGrandparent || !greatGreatGrandparent.parent) { - return astNode; - } - return greatGreatGrandparent.parent; - } - /* v8 ignore next */ - return astNode; - case 'FunctionExpression': - /* v8 ignore next 3 */ - if (!greatGreatGrandparent) { - return astNode; - } - if (greatGrandparent.type === 'MethodDefinition') { - return greatGrandparent; - } - - // Fallthrough - default: - /* v8 ignore next 3 */ - if (grandparent.type !== 'Identifier') { - return astNode; - } - } - - /* v8 ignore next 3 */ - if (!greatGreatGrandparent) { - return astNode; - } - - switch (greatGrandparent.type) { - case 'ArrowFunctionExpression': - if ( - greatGreatGrandparent.type === 'VariableDeclarator' && - greatGreatGrandparent.parent.type === 'VariableDeclaration' - ) { - return greatGreatGrandparent.parent; - } - - return astNode; - case 'FunctionDeclaration': - return greatGrandparent; - case 'VariableDeclarator': - if (greatGreatGrandparent.type === 'VariableDeclaration') { - return greatGreatGrandparent; - } - /* v8 ignore next 2 */ - // Fallthrough - default: - /* v8 ignore next 3 */ - return astNode; - } -}; - -const invokedExpression = new Set( - ['CallExpression', 'OptionalCallExpression', 'NewExpression'] -); -const allowableCommentNode = new Set([ - 'AssignmentPattern', - 'VariableDeclaration', - 'ExpressionStatement', - 'MethodDefinition', - 'Property', - 'ObjectProperty', - 'ClassProperty', - 'PropertyDefinition', - 'ExportDefaultDeclaration', - 'ReturnStatement' -]); - -/** - * Reduces the provided node to the appropriate node for evaluating - * JSDoc comment status. - * - * @param {ESLintOrTSNode} node An AST node. - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode. - * @returns {ESLintOrTSNode} The AST node that - * can be evaluated for appropriate JSDoc comments. - */ -const getReducedASTNode = function (node, sourceCode) { - let {parent} = node; - - switch (/** @type {ESLintOrTSNode} */ (node).type) { - case 'TSFunctionType': - return getTSFunctionComment(node); - case 'TSInterfaceDeclaration': - case 'TSTypeAliasDeclaration': - case 'TSEnumDeclaration': - case 'ClassDeclaration': - case 'FunctionDeclaration': - /* v8 ignore next 3 */ - if (!parent) { - return node; - } - return looksLikeExport(parent) ? parent : node; - - case 'TSDeclareFunction': - case 'ClassExpression': - case 'ObjectExpression': - case 'ArrowFunctionExpression': - case 'TSEmptyBodyFunctionExpression': - case 'FunctionExpression': - /* v8 ignore next 3 */ - if (!parent) { - return node; - } - if ( - !invokedExpression.has(parent.type) - ) { - /** - * @type {ESLintOrTSNode|Token|null} - */ - let token = node; - do { - token = sourceCode.getTokenBefore( - /** @type {import('eslint').Rule.Node|import('eslint').AST.Token} */ ( - token - ), - {includeComments: true} - ); - } while (token && token.type === 'Punctuator' && token.value === '('); - if (token && token.type === 'Block') { - return node; - } - - if (sourceCode.getCommentsBefore( - /** @type {import('eslint').Rule.Node} */ - (node) - ).length) { - return node; - } - - while ( - !sourceCode.getCommentsBefore( - /** @type {import('eslint').Rule.Node} */ - (parent) - ).length && - !(/Function/u).test(parent.type) && - !allowableCommentNode.has(parent.type) - ) { - ({parent} = parent); - - if (!parent) { - break; - } - } - if (parent && parent.type !== 'FunctionDeclaration' && - parent.type !== 'Program' - ) { - if (parent.parent && parent.parent.type === 'ExportNamedDeclaration') { - return parent.parent; - } - - return parent; - } - } - - return node; - - default: - return node; - } -}; - -/** - * Checks for the presence of a JSDoc comment for the given node and returns it. - * - * @param {ESLintOrTSNode} astNode The AST node to get - * the comment for. - * @param {import('eslint').SourceCode} sourceCode - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings - * @param {{nonJSDoc?: boolean}} [opts] - * @returns {Token|null} The Block comment token containing the JSDoc comment - * for the given node or null if not found. - */ -const findJSDocComment = (astNode, sourceCode, settings, opts = {}) => { - const {nonJSDoc} = opts; - const {minLines, maxLines} = settings; - - /** @type {ESLintOrTSNode|import('estree').Comment} */ - let currentNode = astNode; - let tokenBefore = null; - let parenthesisToken = null; - - while (currentNode) { - const decorator = getDecorator( - /** @type {import('eslint').Rule.Node} */ - (currentNode) - ); - if (decorator) { - const dec = /** @type {unknown} */ (decorator); - currentNode = /** @type {import('eslint').Rule.Node} */ (dec); - } - tokenBefore = sourceCode.getTokenBefore( - /** @type {import('eslint').Rule.Node} */ - (currentNode), - {includeComments: true} - ); - if ( - tokenBefore && tokenBefore.type === 'Punctuator' && - tokenBefore.value === '(' - ) { - parenthesisToken = tokenBefore; - [tokenBefore] = sourceCode.getTokensBefore( - /** @type {import('eslint').Rule.Node} */ - (currentNode), - { - count: 2, - includeComments: true - } - ); - } - if (!tokenBefore || !isCommentToken(tokenBefore)) { - return null; - } - if (!nonJSDoc && tokenBefore.type === 'Line') { - currentNode = tokenBefore; - continue; - } - break; - } - - /* v8 ignore next 3 */ - if (!tokenBefore || !currentNode.loc || !tokenBefore.loc) { - return null; - } - - if ( - ( - (nonJSDoc && (tokenBefore.type !== 'Block' || - !(/^\*\s/u).test(tokenBefore.value))) || - (!nonJSDoc && tokenBefore.type === 'Block' && - (/^\*\s/u).test(tokenBefore.value)) - ) && - currentNode.loc.start.line - ( - /** @type {import('eslint').AST.Token} */ - (parenthesisToken ?? tokenBefore) - ).loc.end.line >= minLines && - currentNode.loc.start.line - ( - /** @type {import('eslint').AST.Token} */ - (parenthesisToken ?? tokenBefore) - ).loc.end.line <= maxLines - ) { - return tokenBefore; - } - - return null; -}; - -/** - * Retrieves the JSDoc comment for a given node. - * - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode - * @param {import('eslint').Rule.Node} node The AST node to get - * the comment for. - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The - * settings in context - * @returns {Token|null} The Block comment - * token containing the JSDoc comment for the given node or - * null if not found. - * @public - */ -const getJSDocComment = function (sourceCode, node, settings) { - const reducedNode = getReducedASTNode(node, sourceCode); - - return findJSDocComment(reducedNode, sourceCode, settings); -}; - -/** - * Retrieves the comment preceding a given node. - * - * @param {import('eslint').SourceCode} sourceCode The ESLint SourceCode - * @param {ESLintOrTSNode} node The AST node to get - * the comment for. - * @param {{maxLines: int, minLines: int, [name: string]: any}} settings The - * settings in context - * @returns {Token|null} The Block comment - * token containing the JSDoc comment for the given node or - * null if not found. - * @public - */ -const getNonJsdocComment = function (sourceCode, node, settings) { - const reducedNode = getReducedASTNode(node, sourceCode); - - return findJSDocComment(reducedNode, sourceCode, settings, { - nonJSDoc: true - }); -}; - -/** - * @param {ESLintOrTSNode|import('eslint').AST.Token| - * import('estree').Comment - * } nodeA The AST node or token to compare - * @param {ESLintOrTSNode|import('eslint').AST.Token| - * import('estree').Comment} nodeB The - * AST node or token to compare - */ -const compareLocEndToStart = (nodeA, nodeB) => { - /* v8 ignore next */ - return (nodeA.loc?.end.line ?? 0) === (nodeB.loc?.start.line ?? 0); -}; - -/** - * Checks for the presence of a comment following the given node and - * returns it. - * - * This method is experimental. - * - * @param {import('eslint').SourceCode} sourceCode - * @param {ESLintOrTSNode} astNode The AST node to get - * the comment for. - * @returns {Token|null} The comment token containing the comment - * for the given node or null if not found. - */ -const getFollowingComment = function (sourceCode, astNode) { - /** - * @param {ESLintOrTSNode} node The - * AST node to get the comment for. - */ - const getTokensAfterIgnoringSemis = (node) => { - let tokenAfter = sourceCode.getTokenAfter( - /** @type {import('eslint').Rule.Node} */ - (node), - {includeComments: true} - ); - - while ( - tokenAfter && tokenAfter.type === 'Punctuator' && - // tokenAfter.value === ')' // Don't apparently need to ignore - tokenAfter.value === ';' - ) { - [tokenAfter] = sourceCode.getTokensAfter(tokenAfter, { - includeComments: true - }); - } - return tokenAfter; - }; - - /** - * @param {ESLintOrTSNode} node The - * AST node to get the comment for. - */ - const tokenAfterIgnoringSemis = (node) => { - const tokenAfter = getTokensAfterIgnoringSemis(node); - return ( - tokenAfter && - isCommentToken(tokenAfter) && - compareLocEndToStart(node, tokenAfter) - ) - ? tokenAfter - : null; - }; - - let tokenAfter = tokenAfterIgnoringSemis(astNode); - - if (!tokenAfter) { - switch (astNode.type) { - case 'FunctionDeclaration': - tokenAfter = tokenAfterIgnoringSemis( - /** @type {ESLintOrTSNode} */ - (astNode.body) - ); - break; - case 'ExpressionStatement': - tokenAfter = tokenAfterIgnoringSemis( - /** @type {ESLintOrTSNode} */ - (astNode.expression) - ); - break; - - /* v8 ignore next 3 */ - default: - break; - } - } - - return tokenAfter; -}; - -export { - getReducedASTNode, getJSDocComment, getNonJsdocComment, - getDecorator, findJSDocComment, getFollowingComment -}; diff --git a/node_modules/@es-joy/jsdoccomment/src/parseComment.js b/node_modules/@es-joy/jsdoccomment/src/parseComment.js deleted file mode 100644 index 385f851..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/parseComment.js +++ /dev/null @@ -1,190 +0,0 @@ -/* eslint-disable prefer-named-capture-group -- Temporary */ -import { - parse as commentParser, - tokenizers -} from 'comment-parser'; - -import {parseInlineTags} from './parseInlineTags.js'; - -const { - name: nameTokenizer, - tag: tagTokenizer, - type: typeTokenizer, - description: descriptionTokenizer -} = tokenizers; - -/** - * @param {import('comment-parser').Spec} spec - * @returns {boolean} - */ -export const hasSeeWithLink = (spec) => { - return spec.tag === 'see' && (/\{@link.+?\}/u).test(spec.source[0].source); -}; - -export const defaultNoTypes = [ - 'default', 'defaultvalue', 'description', 'example', - 'file', 'fileoverview', 'license', - 'overview', 'see', 'summary' -]; - -export const defaultNoNames = [ - 'access', 'author', - 'default', 'defaultvalue', - 'description', - 'example', 'exception', 'file', 'fileoverview', - 'kind', - 'license', 'overview', - 'return', 'returns', - 'since', 'summary', - 'throws', - 'version', 'variation' -]; - -const optionalBrackets = /^\[(?[^=]*)=[^\]]*\]/u; -const preserveTypeTokenizer = typeTokenizer('preserve'); -const preserveDescriptionTokenizer = descriptionTokenizer('preserve'); -const plainNameTokenizer = nameTokenizer(); - -/** - * Can't import `comment-parser/es6/parser/tokenizers/index.js`, - * so we redefine here. - * @typedef {(spec: import('comment-parser').Spec) => - * import('comment-parser').Spec} CommentParserTokenizer - */ - -/** - * @param {object} [cfg] - * @param {string[]} [cfg.noTypes] - * @param {string[]} [cfg.noNames] - * @returns {CommentParserTokenizer[]} - */ -const getTokenizers = ({ - noTypes = defaultNoTypes, - noNames = defaultNoNames -} = {}) => { - // trim - return [ - // Tag - tagTokenizer(), - - /** - * Type tokenizer. - * @param {import('comment-parser').Spec} spec - * @returns {import('comment-parser').Spec} - */ - (spec) => { - if (noTypes.includes(spec.tag)) { - return spec; - } - - return preserveTypeTokenizer(spec); - }, - - /** - * Name tokenizer. - * @param {import('comment-parser').Spec} spec - * @returns {import('comment-parser').Spec} - */ - (spec) => { - if (spec.tag === 'template') { - // const preWS = spec.postTag; - const remainder = spec.source[0].tokens.description; - - let pos; - if (remainder.startsWith('[') && remainder.includes(']')) { - const endingBracketPos = remainder.indexOf(']'); - pos = remainder.slice(endingBracketPos).search(/(? -1) { // Add offset to starting point if space found - pos += endingBracketPos; - } - } else { - pos = remainder.search(/(? -1) { - [, postName, description, lineEnd] = /** @type {RegExpMatchArray} */ ( - extra.match(/(\s*)([^\r]*)(\r)?/u) - ); - } - - if (optionalBrackets.test(name)) { - name = /** @type {string} */ ( - /** @type {RegExpMatchArray} */ ( - name.match(optionalBrackets) - )?.groups?.name - ); - spec.optional = true; - } else { - spec.optional = false; - } - - spec.name = name; - const {tokens} = spec.source[0]; - tokens.name = name; - tokens.postName = postName; - tokens.description = description; - tokens.lineEnd = lineEnd || ''; - - return spec; - } - - if (noNames.includes(spec.tag) || hasSeeWithLink(spec)) { - return spec; - } - - return plainNameTokenizer(spec); - }, - - /** - * Description tokenizer. - * @param {import('comment-parser').Spec} spec - * @returns {import('comment-parser').Spec} - */ - (spec) => { - return preserveDescriptionTokenizer(spec); - } - ]; -}; - -/** - * Accepts a comment token or complete comment string and converts it into - * `comment-parser` AST. - * @param {string | {value: string}} commentOrNode - * @param {string} [indent] Whitespace - * @returns {import('.').JsdocBlockWithInline} - */ -const parseComment = (commentOrNode, indent = '') => { - let block; - - switch (typeof commentOrNode) { - case 'string': - // Preserve JSDoc block start/end indentation. - [block] = commentParser(`${indent}${commentOrNode}`, { - // @see https://github.com/yavorskiy/comment-parser/issues/21 - tokenizers: getTokenizers() - }); - break; - - case 'object': - if (commentOrNode === null) { - throw new TypeError(`'commentOrNode' is not a string or object.`); - } - - // Preserve JSDoc block start/end indentation. - [block] = commentParser(`${indent}/*${commentOrNode.value}*/`, { - // @see https://github.com/yavorskiy/comment-parser/issues/21 - tokenizers: getTokenizers() - }); - break; - - default: - throw new TypeError(`'commentOrNode' is not a string or object.`); - } - - return parseInlineTags(block); -}; - -export {getTokenizers, parseComment}; diff --git a/node_modules/@es-joy/jsdoccomment/src/parseInlineTags.js b/node_modules/@es-joy/jsdoccomment/src/parseInlineTags.js deleted file mode 100644 index bd9868c..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/parseInlineTags.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @param {RegExpMatchArray & { - * indices: { - * groups: { - * [key: string]: [number, number] - * } - * } - * groups: {[key: string]: string} - * }} match An inline tag regexp match. - * @returns {'pipe' | 'plain' | 'prefix' | 'space'} - */ -function determineFormat (match) { - const {separator, text} = match.groups; - const [, textEnd] = match.indices.groups.text; - const [tagStart] = match.indices.groups.tag; - if (!text) { - return 'plain'; - } else if (separator === '|') { - return 'pipe'; - } else if (textEnd < tagStart) { - return 'prefix'; - } - return 'space'; -} - -/** - * Extracts inline tags from a description. - * @param {string} description - * @returns {import('.').InlineTag[]} Array of inline tags from the description. - */ -function parseDescription (description) { - /** @type {import('.').InlineTag[]} */ - const result = []; - - // This could have been expressed in a single pattern, - // but having two avoids a potentially exponential time regex. - - const prefixedTextPattern = new RegExp(/(?:\[(?[^\]]+)\])\{@(?[^}\s]+)\s?(?[^}\s|]*)\}/gu, 'gud'); - // The pattern used to match for text after tag uses a negative lookbehind - // on the ']' char to avoid matching the prefixed case too. - const suffixedAfterPattern = new RegExp(/(?[^}\s]+)\s?(?[^}\s|]*)\s*(?[\s|])?\s*(?[^}]*)\}/gu, 'gud'); - - const matches = [ - ...description.matchAll(prefixedTextPattern), - ...description.matchAll(suffixedAfterPattern) - ]; - - for (const mtch of matches) { - const match = /** - * @type {RegExpMatchArray & { - * indices: { - * groups: { - * [key: string]: [number, number] - * } - * } - * groups: {[key: string]: string} - * }} - */ ( - mtch - ); - const {tag, namepathOrURL, text} = match.groups; - const [start, end] = match.indices[0]; - const format = determineFormat(match); - - result.push({ - tag, - namepathOrURL, - text, - format, - start, - end - }); - } - - return result; -} - -/** - * Splits the `{@prefix}` from remaining `Spec.lines[].token.description` - * into the `inlineTags` tokens, and populates `spec.inlineTags` - * @param {import('comment-parser').Block} block - * @returns {import('.').JsdocBlockWithInline} - */ -export function parseInlineTags (block) { - const inlineTags = - /** - * @type {(import('./commentParserToESTree').JsdocInlineTagNoType & { - * line?: import('./commentParserToESTree').Integer - * })[]} - */ ( - parseDescription(block.description) - ); - - /** @type {import('.').JsdocBlockWithInline} */ ( - block - ).inlineTags = inlineTags; - - for (const tag of block.tags) { - /** - * @type {import('.').JsdocTagWithInline} - */ (tag).inlineTags = parseDescription(tag.description); - } - return ( - /** - * @type {import('.').JsdocBlockWithInline} - */ (block) - ); -} diff --git a/node_modules/@es-joy/jsdoccomment/src/toCamelCase.js b/node_modules/@es-joy/jsdoccomment/src/toCamelCase.js deleted file mode 100644 index 0526f02..0000000 --- a/node_modules/@es-joy/jsdoccomment/src/toCamelCase.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @param {string} str - * @returns {string} - */ -const toCamelCase = (str) => { - return str.toLowerCase().replaceAll(/^[a-z]/gu, (init) => { - return init.toUpperCase(); - }).replaceAll(/_(?[a-z])/gu, (_, n1, o, s, {wordInit}) => { - return wordInit.toUpperCase(); - }); -}; - -export {toCamelCase}; diff --git a/node_modules/@eslint-community/eslint-utils/LICENSE b/node_modules/@eslint-community/eslint-utils/LICENSE deleted file mode 100644 index 883ee1f..0000000 --- a/node_modules/@eslint-community/eslint-utils/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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-community/eslint-utils/README.md b/node_modules/@eslint-community/eslint-utils/README.md deleted file mode 100644 index 90552a9..0000000 --- a/node_modules/@eslint-community/eslint-utils/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# @eslint-community/eslint-utils - -[![npm version](https://img.shields.io/npm/v/@eslint-community/eslint-utils.svg)](https://www.npmjs.com/package/@eslint-community/eslint-utils) -[![Downloads/month](https://img.shields.io/npm/dm/@eslint-community/eslint-utils.svg)](http://www.npmtrends.com/@eslint-community/eslint-utils) -[![Build Status](https://github.com/eslint-community/eslint-utils/workflows/CI/badge.svg)](https://github.com/eslint-community/eslint-utils/actions) -[![Coverage Status](https://codecov.io/gh/eslint-community/eslint-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/eslint-community/eslint-utils) - -## 🏁 Goal - -This package provides utility functions and classes for make ESLint custom rules. - -For examples: - -- [`getStaticValue`](https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstaticvalue) evaluates static value on AST. -- [`ReferenceTracker`](https://eslint-community.github.io/eslint-utils/api/scope-utils.html#referencetracker-class) checks the members of modules/globals as handling assignments and destructuring. - -## 📖 Usage - -See [documentation](https://eslint-community.github.io/eslint-utils). - -## 📰 Changelog - -See [releases](https://github.com/eslint-community/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-community/eslint-utils/index.js b/node_modules/@eslint-community/eslint-utils/index.js deleted file mode 100644 index 7221c82..0000000 --- a/node_modules/@eslint-community/eslint-utils/index.js +++ /dev/null @@ -1,2059 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var eslintVisitorKeys = 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 -} - -/** - * 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 (token) => !f(token) -} - -/** - * 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, - Array.of, - Array.prototype.at, - Array.prototype.concat, - Array.prototype.entries, - Array.prototype.every, - Array.prototype.filter, - Array.prototype.find, - Array.prototype.findIndex, - Array.prototype.flat, - Array.prototype.includes, - Array.prototype.indexOf, - Array.prototype.join, - Array.prototype.keys, - Array.prototype.lastIndexOf, - Array.prototype.slice, - Array.prototype.some, - Array.prototype.toString, - Array.prototype.values, - typeof BigInt === "function" ? BigInt : undefined, - Boolean, - Date, - Date.parse, - decodeURI, - decodeURIComponent, - encodeURI, - encodeURIComponent, - escape, - isFinite, - isNaN, - isPrototypeOf, - Map, - Map.prototype.entries, - Map.prototype.get, - Map.prototype.has, - Map.prototype.keys, - Map.prototype.values, - ...Object.getOwnPropertyNames(Math) - .filter((k) => k !== "random") - .map((k) => Math[k]) - .filter((f) => typeof f === "function"), - Number, - Number.isFinite, - Number.isNaN, - Number.parseFloat, - Number.parseInt, - Number.prototype.toExponential, - Number.prototype.toFixed, - Number.prototype.toPrecision, - Number.prototype.toString, - Object, - Object.entries, - Object.is, - Object.isExtensible, - Object.isFrozen, - Object.isSealed, - Object.keys, - Object.values, - parseFloat, - parseInt, - RegExp, - Set, - Set.prototype.entries, - Set.prototype.has, - Set.prototype.keys, - Set.prototype.values, - String, - String.fromCharCode, - String.fromCodePoint, - String.raw, - String.prototype.at, - String.prototype.charAt, - String.prototype.charCodeAt, - String.prototype.codePointAt, - String.prototype.concat, - String.prototype.endsWith, - String.prototype.includes, - String.prototype.indexOf, - String.prototype.lastIndexOf, - String.prototype.normalize, - String.prototype.padEnd, - String.prototype.padStart, - String.prototype.slice, - String.prototype.startsWith, - String.prototype.substr, - String.prototype.substring, - String.prototype.toLowerCase, - String.prototype.toString, - String.prototype.toUpperCase, - String.prototype.trim, - String.prototype.trimEnd, - String.prototype.trimLeft, - String.prototype.trimRight, - String.prototype.trimStart, - Symbol.for, - Symbol.keyFor, - unescape, - ].filter((f) => typeof f === "function"), -); -const callPassThrough = new Set([ - Object.freeze, - Object.preventExtensions, - Object.seal, -]); - -/** @type {ReadonlyArray]>} */ -const getterAllowed = [ - [Map, new Set(["size"])], - [ - RegExp, - new Set([ - "dotAll", - "flags", - "global", - "hasIndices", - "ignoreCase", - "multiline", - "source", - "sticky", - "unicode", - ]), - ], - [Set, new Set(["size"])], -]; - -/** - * 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 -} - -/** - * Returns whether the given variable is never written to after initialization. - * @param {import("eslint").Scope.Variable} variable - * @returns {boolean} - */ -function isEffectivelyConst(variable) { - const refs = variable.references; - - const inits = refs.filter((r) => r.init).length; - const reads = refs.filter((r) => r.isReadOnly()).length; - if (inits === 1 && reads + inits === refs.length) { - // there is only one init and all other references only read - return true - } - return false -} - -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: 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.type === "Variable" && - (def.parent.kind === "const" || - isEffectivelyConst(variable)) && - // 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) { - if (!isGetter(object.value, property.value)) { - return { value: object.value[property.value] } - } - - for (const [classFn, allowed] of getterAllowed) { - if ( - object.value instanceof classFn && - allowed.has(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}'`); - } else if ( - parent.type === "ExportDefaultDeclaration" && - parent.declaration === node - ) { - tokens.push("'default'"); - } - - 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] || eslintVisitorKeys.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=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 || eslintVisitorKeys.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 || - // `Program` can't be parenthesized - node.parent == 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-community/eslint-utils/index.js.map b/node_modules/@eslint-community/eslint-utils/index.js.map deleted file mode 100644 index 7f3d789..0000000 --- a/node_modules/@eslint-community/eslint-utils/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sources":["src/get-innermost-scope.mjs","src/find-variable.mjs","src/token-predicate.mjs","src/get-function-head-location.mjs","src/get-static-value.mjs","src/get-string-if-constant.mjs","src/get-property-name.mjs","src/get-function-name-with-kind.mjs","src/has-side-effect.mjs","src/is-parenthesized.mjs","src/pattern-matcher.mjs","src/reference-tracker.mjs","src/index.mjs"],"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.mjs\"\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 * 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 (token) => !f(token)\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.mjs\"\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.mjs\"\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 Array.of,\n Array.prototype.at,\n Array.prototype.concat,\n Array.prototype.entries,\n Array.prototype.every,\n Array.prototype.filter,\n Array.prototype.find,\n Array.prototype.findIndex,\n Array.prototype.flat,\n Array.prototype.includes,\n Array.prototype.indexOf,\n Array.prototype.join,\n Array.prototype.keys,\n Array.prototype.lastIndexOf,\n Array.prototype.slice,\n Array.prototype.some,\n Array.prototype.toString,\n Array.prototype.values,\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 Map,\n Map.prototype.entries,\n Map.prototype.get,\n Map.prototype.has,\n Map.prototype.keys,\n Map.prototype.values,\n ...Object.getOwnPropertyNames(Math)\n .filter((k) => k !== \"random\")\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 Number.prototype.toExponential,\n Number.prototype.toFixed,\n Number.prototype.toPrecision,\n Number.prototype.toString,\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 Set,\n Set.prototype.entries,\n Set.prototype.has,\n Set.prototype.keys,\n Set.prototype.values,\n String,\n String.fromCharCode,\n String.fromCodePoint,\n String.raw,\n String.prototype.at,\n String.prototype.charAt,\n String.prototype.charCodeAt,\n String.prototype.codePointAt,\n String.prototype.concat,\n String.prototype.endsWith,\n String.prototype.includes,\n String.prototype.indexOf,\n String.prototype.lastIndexOf,\n String.prototype.normalize,\n String.prototype.padEnd,\n String.prototype.padStart,\n String.prototype.slice,\n String.prototype.startsWith,\n String.prototype.substr,\n String.prototype.substring,\n String.prototype.toLowerCase,\n String.prototype.toString,\n String.prototype.toUpperCase,\n String.prototype.trim,\n String.prototype.trimEnd,\n String.prototype.trimLeft,\n String.prototype.trimRight,\n String.prototype.trimStart,\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/** @type {ReadonlyArray]>} */\nconst getterAllowed = [\n [Map, new Set([\"size\"])],\n [\n RegExp,\n new Set([\n \"dotAll\",\n \"flags\",\n \"global\",\n \"hasIndices\",\n \"ignoreCase\",\n \"multiline\",\n \"source\",\n \"sticky\",\n \"unicode\",\n ]),\n ],\n [Set, new Set([\"size\"])],\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\n/**\n * Returns whether the given variable is never written to after initialization.\n * @param {import(\"eslint\").Scope.Variable} variable\n * @returns {boolean}\n */\nfunction isEffectivelyConst(variable) {\n const refs = variable.references\n\n const inits = refs.filter((r) => r.init).length\n const reads = refs.filter((r) => r.isReadOnly()).length\n if (inits === 1 && reads + inits === refs.length) {\n // there is only one init and all other references only read\n return true\n }\n return false\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: 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.type === \"Variable\" &&\n (def.parent.kind === \"const\" ||\n isEffectivelyConst(variable)) &&\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) {\n if (!isGetter(object.value, property.value)) {\n return { value: object.value[property.value] }\n }\n\n for (const [classFn, allowed] of getterAllowed) {\n if (\n object.value instanceof classFn &&\n allowed.has(property.value)\n ) {\n return { value: object.value[property.value] }\n }\n }\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.mjs\"\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.mjs\"\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.mjs\"\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 } else if (\n parent.type === \"ExportDefaultDeclaration\" &&\n parent.declaration === node\n ) {\n tokens.push(\"'default'\")\n }\n\n return tokens.join(\" \")\n}\n","import { getKeys, KEYS } 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] || 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=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 || KEYS,\n )\n}\n","import { isClosingParenToken, isOpeningParenToken } from \"./token-predicate.mjs\"\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 // `Program` can't be parenthesized\n node.parent == 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.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\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.mjs\"\nimport { getFunctionHeadLocation } from \"./get-function-head-location.mjs\"\nimport { getFunctionNameWithKind } from \"./get-function-name-with-kind.mjs\"\nimport { getInnermostScope } from \"./get-innermost-scope.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStaticValue } from \"./get-static-value.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\nimport { hasSideEffect } from \"./has-side-effect.mjs\"\nimport { isParenthesized } from \"./is-parenthesized.mjs\"\nimport { PatternMatcher } from \"./pattern-matcher.mjs\"\nimport {\n CALL,\n CONSTRUCT,\n ESM,\n READ,\n ReferenceTracker,\n} from \"./reference-tracker.mjs\"\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.mjs\"\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":["getKeys","KEYS"],"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;AACpD,YAAY,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,MAAK;AAChD;AACA,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE;AAC7D,gBAAgB,KAAK,G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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/index.mjs b/node_modules/@eslint-community/eslint-utils/index.mjs deleted file mode 100644 index b96d3c9..0000000 --- a/node_modules/@eslint-community/eslint-utils/index.mjs +++ /dev/null @@ -1,2018 +0,0 @@ -import { getKeys, KEYS } 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 -} - -/** - * 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 (token) => !f(token) -} - -/** - * 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, - Array.of, - Array.prototype.at, - Array.prototype.concat, - Array.prototype.entries, - Array.prototype.every, - Array.prototype.filter, - Array.prototype.find, - Array.prototype.findIndex, - Array.prototype.flat, - Array.prototype.includes, - Array.prototype.indexOf, - Array.prototype.join, - Array.prototype.keys, - Array.prototype.lastIndexOf, - Array.prototype.slice, - Array.prototype.some, - Array.prototype.toString, - Array.prototype.values, - typeof BigInt === "function" ? BigInt : undefined, - Boolean, - Date, - Date.parse, - decodeURI, - decodeURIComponent, - encodeURI, - encodeURIComponent, - escape, - isFinite, - isNaN, - isPrototypeOf, - Map, - Map.prototype.entries, - Map.prototype.get, - Map.prototype.has, - Map.prototype.keys, - Map.prototype.values, - ...Object.getOwnPropertyNames(Math) - .filter((k) => k !== "random") - .map((k) => Math[k]) - .filter((f) => typeof f === "function"), - Number, - Number.isFinite, - Number.isNaN, - Number.parseFloat, - Number.parseInt, - Number.prototype.toExponential, - Number.prototype.toFixed, - Number.prototype.toPrecision, - Number.prototype.toString, - Object, - Object.entries, - Object.is, - Object.isExtensible, - Object.isFrozen, - Object.isSealed, - Object.keys, - Object.values, - parseFloat, - parseInt, - RegExp, - Set, - Set.prototype.entries, - Set.prototype.has, - Set.prototype.keys, - Set.prototype.values, - String, - String.fromCharCode, - String.fromCodePoint, - String.raw, - String.prototype.at, - String.prototype.charAt, - String.prototype.charCodeAt, - String.prototype.codePointAt, - String.prototype.concat, - String.prototype.endsWith, - String.prototype.includes, - String.prototype.indexOf, - String.prototype.lastIndexOf, - String.prototype.normalize, - String.prototype.padEnd, - String.prototype.padStart, - String.prototype.slice, - String.prototype.startsWith, - String.prototype.substr, - String.prototype.substring, - String.prototype.toLowerCase, - String.prototype.toString, - String.prototype.toUpperCase, - String.prototype.trim, - String.prototype.trimEnd, - String.prototype.trimLeft, - String.prototype.trimRight, - String.prototype.trimStart, - Symbol.for, - Symbol.keyFor, - unescape, - ].filter((f) => typeof f === "function"), -); -const callPassThrough = new Set([ - Object.freeze, - Object.preventExtensions, - Object.seal, -]); - -/** @type {ReadonlyArray]>} */ -const getterAllowed = [ - [Map, new Set(["size"])], - [ - RegExp, - new Set([ - "dotAll", - "flags", - "global", - "hasIndices", - "ignoreCase", - "multiline", - "source", - "sticky", - "unicode", - ]), - ], - [Set, new Set(["size"])], -]; - -/** - * 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 -} - -/** - * Returns whether the given variable is never written to after initialization. - * @param {import("eslint").Scope.Variable} variable - * @returns {boolean} - */ -function isEffectivelyConst(variable) { - const refs = variable.references; - - const inits = refs.filter((r) => r.init).length; - const reads = refs.filter((r) => r.isReadOnly()).length; - if (inits === 1 && reads + inits === refs.length) { - // there is only one init and all other references only read - return true - } - return false -} - -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: 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.type === "Variable" && - (def.parent.kind === "const" || - isEffectivelyConst(variable)) && - // 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) { - if (!isGetter(object.value, property.value)) { - return { value: object.value[property.value] } - } - - for (const [classFn, allowed] of getterAllowed) { - if ( - object.value instanceof classFn && - allowed.has(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}'`); - } else if ( - parent.type === "ExportDefaultDeclaration" && - parent.declaration === node - ) { - tokens.push("'default'"); - } - - 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] || 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=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 || 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 || - // `Program` can't be parenthesized - node.parent == 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 { CALL, CONSTRUCT, ESM, PatternMatcher, READ, ReferenceTracker, index as default, 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-community/eslint-utils/index.mjs.map b/node_modules/@eslint-community/eslint-utils/index.mjs.map deleted file mode 100644 index 8b9cf9a..0000000 --- a/node_modules/@eslint-community/eslint-utils/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["src/get-innermost-scope.mjs","src/find-variable.mjs","src/token-predicate.mjs","src/get-function-head-location.mjs","src/get-static-value.mjs","src/get-string-if-constant.mjs","src/get-property-name.mjs","src/get-function-name-with-kind.mjs","src/has-side-effect.mjs","src/is-parenthesized.mjs","src/pattern-matcher.mjs","src/reference-tracker.mjs","src/index.mjs"],"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.mjs\"\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 * 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 (token) => !f(token)\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.mjs\"\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.mjs\"\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 Array.of,\n Array.prototype.at,\n Array.prototype.concat,\n Array.prototype.entries,\n Array.prototype.every,\n Array.prototype.filter,\n Array.prototype.find,\n Array.prototype.findIndex,\n Array.prototype.flat,\n Array.prototype.includes,\n Array.prototype.indexOf,\n Array.prototype.join,\n Array.prototype.keys,\n Array.prototype.lastIndexOf,\n Array.prototype.slice,\n Array.prototype.some,\n Array.prototype.toString,\n Array.prototype.values,\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 Map,\n Map.prototype.entries,\n Map.prototype.get,\n Map.prototype.has,\n Map.prototype.keys,\n Map.prototype.values,\n ...Object.getOwnPropertyNames(Math)\n .filter((k) => k !== \"random\")\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 Number.prototype.toExponential,\n Number.prototype.toFixed,\n Number.prototype.toPrecision,\n Number.prototype.toString,\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 Set,\n Set.prototype.entries,\n Set.prototype.has,\n Set.prototype.keys,\n Set.prototype.values,\n String,\n String.fromCharCode,\n String.fromCodePoint,\n String.raw,\n String.prototype.at,\n String.prototype.charAt,\n String.prototype.charCodeAt,\n String.prototype.codePointAt,\n String.prototype.concat,\n String.prototype.endsWith,\n String.prototype.includes,\n String.prototype.indexOf,\n String.prototype.lastIndexOf,\n String.prototype.normalize,\n String.prototype.padEnd,\n String.prototype.padStart,\n String.prototype.slice,\n String.prototype.startsWith,\n String.prototype.substr,\n String.prototype.substring,\n String.prototype.toLowerCase,\n String.prototype.toString,\n String.prototype.toUpperCase,\n String.prototype.trim,\n String.prototype.trimEnd,\n String.prototype.trimLeft,\n String.prototype.trimRight,\n String.prototype.trimStart,\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/** @type {ReadonlyArray]>} */\nconst getterAllowed = [\n [Map, new Set([\"size\"])],\n [\n RegExp,\n new Set([\n \"dotAll\",\n \"flags\",\n \"global\",\n \"hasIndices\",\n \"ignoreCase\",\n \"multiline\",\n \"source\",\n \"sticky\",\n \"unicode\",\n ]),\n ],\n [Set, new Set([\"size\"])],\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\n/**\n * Returns whether the given variable is never written to after initialization.\n * @param {import(\"eslint\").Scope.Variable} variable\n * @returns {boolean}\n */\nfunction isEffectivelyConst(variable) {\n const refs = variable.references\n\n const inits = refs.filter((r) => r.init).length\n const reads = refs.filter((r) => r.isReadOnly()).length\n if (inits === 1 && reads + inits === refs.length) {\n // there is only one init and all other references only read\n return true\n }\n return false\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: 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.type === \"Variable\" &&\n (def.parent.kind === \"const\" ||\n isEffectivelyConst(variable)) &&\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) {\n if (!isGetter(object.value, property.value)) {\n return { value: object.value[property.value] }\n }\n\n for (const [classFn, allowed] of getterAllowed) {\n if (\n object.value instanceof classFn &&\n allowed.has(property.value)\n ) {\n return { value: object.value[property.value] }\n }\n }\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.mjs\"\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.mjs\"\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.mjs\"\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 } else if (\n parent.type === \"ExportDefaultDeclaration\" &&\n parent.declaration === node\n ) {\n tokens.push(\"'default'\")\n }\n\n return tokens.join(\" \")\n}\n","import { getKeys, KEYS } 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] || 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=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 || KEYS,\n )\n}\n","import { isClosingParenToken, isOpeningParenToken } from \"./token-predicate.mjs\"\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 // `Program` can't be parenthesized\n node.parent == 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.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\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.mjs\"\nimport { getFunctionHeadLocation } from \"./get-function-head-location.mjs\"\nimport { getFunctionNameWithKind } from \"./get-function-name-with-kind.mjs\"\nimport { getInnermostScope } from \"./get-innermost-scope.mjs\"\nimport { getPropertyName } from \"./get-property-name.mjs\"\nimport { getStaticValue } from \"./get-static-value.mjs\"\nimport { getStringIfConstant } from \"./get-string-if-constant.mjs\"\nimport { hasSideEffect } from \"./has-side-effect.mjs\"\nimport { isParenthesized } from \"./is-parenthesized.mjs\"\nimport { PatternMatcher } from \"./pattern-matcher.mjs\"\nimport {\n CALL,\n CONSTRUCT,\n ESM,\n READ,\n ReferenceTracker,\n} from \"./reference-tracker.mjs\"\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.mjs\"\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;AACpD,YAAY,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,MAAK;AAChD;AACA,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,QAAQ,IAAI,QAAQ,GAAG,KAAK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AI,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;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE deleted file mode 100644 index 17a2553..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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-community/eslint-utils/node_modules/eslint-visitor-keys/README.md b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md deleted file mode 100644 index cab8103..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/README.md +++ /dev/null @@ -1,105 +0,0 @@ -# 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://github.com/eslint/eslint-visitor-keys/workflows/CI/badge.svg)](https://github.com/eslint/eslint-visitor-keys/actions) - -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 test:open-coverage` opens the code coverage report of the previous test with your default browser. - - -[npm]: https://www.npmjs.com/ -[Node.js]: https://nodejs.org/ -[ESTree]: https://github.com/estree/estree diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs deleted file mode 100644 index 00f91bc..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs +++ /dev/null @@ -1,384 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/** - * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys - */ - -/** - * @type {VisitorKeys} - */ -const KEYS = { - ArrayExpression: [ - "elements" - ], - ArrayPattern: [ - "elements" - ], - ArrowFunctionExpression: [ - "params", - "body" - ], - AssignmentExpression: [ - "left", - "right" - ], - AssignmentPattern: [ - "left", - "right" - ], - AwaitExpression: [ - "argument" - ], - BinaryExpression: [ - "left", - "right" - ], - BlockStatement: [ - "body" - ], - 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: [], - ExperimentalRestProperty: [ - "argument" - ], - ExperimentalSpreadProperty: [ - "argument" - ], - ExportAllDeclaration: [ - "exported", - "source" - ], - ExportDefaultDeclaration: [ - "declaration" - ], - ExportNamedDeclaration: [ - "declaration", - "specifiers", - "source" - ], - ExportSpecifier: [ - "exported", - "local" - ], - ExpressionStatement: [ - "expression" - ], - ForInStatement: [ - "left", - "right", - "body" - ], - ForOfStatement: [ - "left", - "right", - "body" - ], - ForStatement: [ - "init", - "test", - "update", - "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" - ], - JSXClosingFragment: [], - JSXElement: [ - "openingElement", - "children", - "closingElement" - ], - JSXEmptyExpression: [], - JSXExpressionContainer: [ - "expression" - ], - JSXFragment: [ - "openingFragment", - "children", - "closingFragment" - ], - JSXIdentifier: [], - JSXMemberExpression: [ - "object", - "property" - ], - JSXNamespacedName: [ - "namespace", - "name" - ], - JSXOpeningElement: [ - "name", - "attributes" - ], - JSXOpeningFragment: [], - JSXSpreadAttribute: [ - "argument" - ], - JSXSpreadChild: [ - "expression" - ], - JSXText: [], - LabeledStatement: [ - "label", - "body" - ], - Literal: [], - 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: [], - SwitchCase: [ - "test", - "consequent" - ], - SwitchStatement: [ - "discriminant", - "cases" - ], - 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 {import('./visitor-keys.js').VisitorKeys} 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; diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts deleted file mode 100644 index c7c28ed..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +++ /dev/null @@ -1,27 +0,0 @@ -type VisitorKeys$1 = { - readonly [type: string]: readonly string[]; -}; -/** - * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys - */ -/** - * @type {VisitorKeys} - */ -declare const KEYS: VisitorKeys$1; - -/** - * Get visitor keys of a given node. - * @param {object} node The AST node to get keys. - * @returns {readonly string[]} Visitor keys of the node. - */ -declare 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. - */ -declare function unionWith(additionalKeys: VisitorKeys): VisitorKeys; - -type VisitorKeys = VisitorKeys$1; - -export { KEYS, VisitorKeys, getKeys, unionWith }; diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts deleted file mode 100644 index 46bd87e..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/index.d.ts +++ /dev/null @@ -1,16 +0,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: 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 = import('./visitor-keys.js').VisitorKeys; -import KEYS from "./visitor-keys.js"; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts deleted file mode 100644 index 57a952c..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/dist/visitor-keys.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default KEYS; -export type VisitorKeys = { - readonly [type: string]: readonly string[]; -}; -/** - * @typedef {{ readonly [type: string]: ReadonlyArray }} 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-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js deleted file mode 100644 index 3622816..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */ -import KEYS from "./visitor-keys.js"; - -/** - * @typedef {import('./visitor-keys.js').VisitorKeys} 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-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js deleted file mode 100644 index ccf2b1f..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/lib/visitor-keys.js +++ /dev/null @@ -1,315 +0,0 @@ -/** - * @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys - */ - -/** - * @type {VisitorKeys} - */ -const KEYS = { - ArrayExpression: [ - "elements" - ], - ArrayPattern: [ - "elements" - ], - ArrowFunctionExpression: [ - "params", - "body" - ], - AssignmentExpression: [ - "left", - "right" - ], - AssignmentPattern: [ - "left", - "right" - ], - AwaitExpression: [ - "argument" - ], - BinaryExpression: [ - "left", - "right" - ], - BlockStatement: [ - "body" - ], - 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: [], - ExperimentalRestProperty: [ - "argument" - ], - ExperimentalSpreadProperty: [ - "argument" - ], - ExportAllDeclaration: [ - "exported", - "source" - ], - ExportDefaultDeclaration: [ - "declaration" - ], - ExportNamedDeclaration: [ - "declaration", - "specifiers", - "source" - ], - ExportSpecifier: [ - "exported", - "local" - ], - ExpressionStatement: [ - "expression" - ], - ForInStatement: [ - "left", - "right", - "body" - ], - ForOfStatement: [ - "left", - "right", - "body" - ], - ForStatement: [ - "init", - "test", - "update", - "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" - ], - JSXClosingFragment: [], - JSXElement: [ - "openingElement", - "children", - "closingElement" - ], - JSXEmptyExpression: [], - JSXExpressionContainer: [ - "expression" - ], - JSXFragment: [ - "openingFragment", - "children", - "closingFragment" - ], - JSXIdentifier: [], - JSXMemberExpression: [ - "object", - "property" - ], - JSXNamespacedName: [ - "namespace", - "name" - ], - JSXOpeningElement: [ - "name", - "attributes" - ], - JSXOpeningFragment: [], - JSXSpreadAttribute: [ - "argument" - ], - JSXSpreadChild: [ - "expression" - ], - JSXText: [], - LabeledStatement: [ - "label", - "body" - ], - Literal: [], - 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: [], - SwitchCase: [ - "test", - "consequent" - ], - SwitchStatement: [ - "discriminant", - "cases" - ], - 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-community/eslint-utils/node_modules/eslint-visitor-keys/package.json b/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json deleted file mode 100644 index b9d51ce..0000000 --- a/node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "eslint-visitor-keys", - "version": "3.4.3", - "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", - "dist/eslint-visitor-keys.d.cts", - "lib" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "devDependencies": { - "@types/estree": "^0.0.51", - "@types/estree-jsx": "^0.0.1", - "@typescript-eslint/parser": "^5.14.0", - "c8": "^7.11.0", - "chai": "^4.3.6", - "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", - "esquery": "^1.4.0", - "json-diff": "^0.7.3", - "mocha": "^9.2.1", - "opener": "^1.5.2", - "rollup": "^2.70.0", - "rollup-plugin-dts": "^4.2.3", - "tsd": "^0.19.1", - "typescript": "^4.6.2" - }, - "scripts": { - "build": "npm run build:cjs && npm run build:types", - "build:cjs": "rollup -c", - "build:debug": "npm run build:cjs -- -m && npm run build:types", - "build:keys": "node tools/build-keys-from-ts", - "build:types": "tsc", - "lint": "eslint .", - "prepare": "npm run build", - "release:generate:latest": "eslint-generate-release", - "release:generate:alpha": "eslint-generate-prerelease alpha", - "release:generate:beta": "eslint-generate-prerelease beta", - "release:generate:rc": "eslint-generate-prerelease rc", - "release:publish": "eslint-publish-release", - "test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run test:types", - "test:open-coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html", - "test:types": "tsd" - }, - "repository": "eslint/eslint-visitor-keys", - "funding": "https://opencollective.com/eslint", - "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-community/eslint-utils/package.json b/node_modules/@eslint-community/eslint-utils/package.json deleted file mode 100644 index 1addaa9..0000000 --- a/node_modules/@eslint-community/eslint-utils/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "@eslint-community/eslint-utils", - "version": "4.4.1", - "description": "Utilities for ESLint plugins.", - "keywords": [ - "eslint" - ], - "homepage": "https://github.com/eslint-community/eslint-utils#readme", - "bugs": { - "url": "https://github.com/eslint-community/eslint-utils/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/eslint-community/eslint-utils" - }, - "license": "MIT", - "author": "Toru Nagashima", - "sideEffects": false, - "exports": { - ".": { - "import": "./index.mjs", - "require": "./index.js" - }, - "./package.json": "./package.json" - }, - "main": "index", - "module": "index.mjs", - "files": [ - "index.*" - ], - "scripts": { - "prebuild": "npm run -s clean", - "build": "rollup -c", - "clean": "rimraf .nyc_output coverage index.*", - "coverage": "opener ./coverage/lcov-report/index.html", - "docs:build": "vitepress build docs", - "docs:watch": "vitepress dev docs", - "format": "npm run -s format:prettier -- --write", - "format:prettier": "prettier .", - "format:check": "npm run -s format:prettier -- --check", - "lint:eslint": "eslint .", - "lint:format": "npm run -s format:check", - "lint:installed-check": "installed-check -v -i installed-check -i npm-run-all2 -i knip", - "lint:knip": "knip", - "lint": "run-p lint:*", - "test": "c8 mocha --reporter dot \"test/*.mjs\"", - "preversion": "npm test && npm run -s build", - "postversion": "git push && git push --tags", - "prewatch": "npm run -s clean", - "watch": "warun \"{src,test}/**/*.mjs\" -- npm run -s test:mocha" - }, - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "devDependencies": { - "@eslint-community/eslint-plugin-mysticatea": "^15.6.1", - "c8": "^8.0.1", - "dot-prop": "^7.2.0", - "eslint": "^8.57.1", - "installed-check": "^8.0.1", - "knip": "^5.33.3", - "mocha": "^9.2.2", - "npm-run-all2": "^6.2.3", - "opener": "^1.5.2", - "prettier": "2.8.8", - "rimraf": "^3.0.2", - "rollup": "^2.79.2", - "rollup-plugin-sourcemaps": "^0.6.3", - "semver": "^7.6.3", - "vitepress": "^1.4.1", - "warun": "^1.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": "https://opencollective.com/eslint" -} diff --git a/node_modules/@eslint-community/regexpp/LICENSE b/node_modules/@eslint-community/regexpp/LICENSE deleted file mode 100644 index 883ee1f..0000000 --- a/node_modules/@eslint-community/regexpp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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-community/regexpp/README.md b/node_modules/@eslint-community/regexpp/README.md deleted file mode 100644 index 9728af5..0000000 --- a/node_modules/@eslint-community/regexpp/README.md +++ /dev/null @@ -1,177 +0,0 @@ -# @eslint-community/regexpp - -[![npm version](https://img.shields.io/npm/v/@eslint-community/regexpp.svg)](https://www.npmjs.com/package/@eslint-community/regexpp) -[![Downloads/month](https://img.shields.io/npm/dm/@eslint-community/regexpp.svg)](http://www.npmtrends.com/@eslint-community/regexpp) -[![Build Status](https://github.com/eslint-community/regexpp/workflows/CI/badge.svg)](https://github.com/eslint-community/regexpp/actions) -[![codecov](https://codecov.io/gh/eslint-community/regexpp/branch/main/graph/badge.svg)](https://codecov.io/gh/eslint-community/regexpp) - -A regular expression parser for ECMAScript. - -## 💿 Installation - -```bash -$ npm install @eslint-community/regexpp -``` - -- require Node@^12.0.0 || ^14.0.0 || >=16.0.0. - -## 📖 Usage - -```ts -import { - AST, - RegExpParser, - RegExpValidator, - RegExpVisitor, - parseRegExpLiteral, - validateRegExpLiteral, - visitRegExpAST -} from "@eslint-community/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?, flags?) - -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`. - - `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set 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, flags) - -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`. - - `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set 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/eslint-community/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#L743 -[`RegExpValidator.Options`]: src/validator.ts#L220 -[`RegExpVisitor.Handlers`]: src/visitor.ts#L291 diff --git a/node_modules/@eslint-community/regexpp/index.d.ts b/node_modules/@eslint-community/regexpp/index.d.ts deleted file mode 100644 index c75657a..0000000 --- a/node_modules/@eslint-community/regexpp/index.d.ts +++ /dev/null @@ -1,1163 +0,0 @@ -// Generated by dts-bundle v0.7.3 - -declare module "@eslint-community/regexpp" { - import * as AST from "@eslint-community/regexpp/ast"; - import { RegExpParser } from "@eslint-community/regexpp/parser"; - import { RegExpValidator } from "@eslint-community/regexpp/validator"; - import { RegExpVisitor } from "@eslint-community/regexpp/visitor"; - export { RegExpSyntaxError } from "@eslint-community/regexpp/regexp-syntax-error"; - export { AST, RegExpParser, RegExpValidator }; - /** - * Parse a given regular expression literal then make AST object. - * @param source The source code to parse. - * @param options The options to parse. - * @returns The AST of the regular expression. - */ - export function parseRegExpLiteral( - source: RegExp | string, - options?: RegExpParser.Options - ): AST.RegExpLiteral; - /** - * Validate a given regular expression literal. - * @param source The source code to validate. - * @param options The options to validate. - */ - export function validateRegExpLiteral( - source: string, - options?: RegExpValidator.Options - ): void; - export function visitRegExpAST( - node: AST.Node, - handlers: RegExpVisitor.Handlers - ): void; -} - -declare module "@eslint-community/regexpp/ast" { - /** - * The type which includes all nodes. - */ - export type Node = BranchNode | LeafNode; - /** - * The type which includes all branch nodes. - */ - export type BranchNode = - | Alternative - | CapturingGroup - | CharacterClass - | CharacterClassRange - | ClassIntersection - | ClassStringDisjunction - | ClassSubtraction - | ExpressionCharacterClass - | Group - | LookaroundAssertion - | Modifiers - | Pattern - | Quantifier - | RegExpLiteral - | StringAlternative; - /** - * The type which includes all leaf nodes. - */ - export type LeafNode = - | Backreference - | BoundaryAssertion - | Character - | CharacterSet - | Flags - | ModifierFlags; - /** - * The type which includes all atom nodes. - */ - export type Element = Assertion | QuantifiableElement | Quantifier; - /** - * The type which includes all atom nodes that Quantifier node can have as children. - */ - export type QuantifiableElement = - | Backreference - | CapturingGroup - | Character - | CharacterClass - | CharacterSet - | ExpressionCharacterClass - | Group - | LookaheadAssertion; - /** - * The type which includes all character class atom nodes. - */ - export type CharacterClassElement = - | ClassRangesCharacterClassElement - | UnicodeSetsCharacterClassElement; - export type ClassRangesCharacterClassElement = - | Character - | CharacterClassRange - | CharacterUnicodePropertyCharacterSet - | EscapeCharacterSet; - export type UnicodeSetsCharacterClassElement = - | Character - | CharacterClassRange - | ClassStringDisjunction - | EscapeCharacterSet - | ExpressionCharacterClass - | UnicodePropertyCharacterSet - | UnicodeSetsCharacterClass; - /** - * The type which defines common properties for all node types. - */ - export interface NodeBase { - /** The node type. */ - type: Node["type"]; - /** The parent node. */ - parent: Node["parent"]; - /** The 0-based index that this node starts. */ - start: number; - /** The 0-based index that this node ends. */ - end: number; - /** The raw text of this node. */ - raw: string; - } - /** - * The root node. - */ - export interface RegExpLiteral extends NodeBase { - type: "RegExpLiteral"; - parent: null; - pattern: Pattern; - flags: Flags; - } - /** - * The pattern. - */ - export interface Pattern extends NodeBase { - type: "Pattern"; - parent: RegExpLiteral | null; - alternatives: Alternative[]; - } - /** - * The alternative. - * E.g. `a|b` - */ - export interface Alternative extends NodeBase { - type: "Alternative"; - parent: CapturingGroup | Group | LookaroundAssertion | Pattern; - elements: Element[]; - } - /** - * The uncapturing group. - * E.g. `(?:ab)` - */ - export interface Group extends NodeBase { - type: "Group"; - parent: Alternative | Quantifier; - modifiers: Modifiers | null; - alternatives: Alternative[]; - } - /** - * The capturing group. - * E.g. `(ab)`, `(?ab)` - */ - export interface CapturingGroup extends NodeBase { - type: "CapturingGroup"; - parent: Alternative | Quantifier; - name: string | null; - alternatives: Alternative[]; - references: Backreference[]; - } - /** - * The lookaround assertion. - */ - export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion; - /** - * The lookahead assertion. - * E.g. `(?=ab)`, `(?!ab)` - */ - export interface LookaheadAssertion extends NodeBase { - type: "Assertion"; - parent: Alternative | Quantifier; - kind: "lookahead"; - negate: boolean; - alternatives: Alternative[]; - } - /** - * The lookbehind assertion. - * E.g. `(?<=ab)`, `(?` - */ - export type Backreference = AmbiguousBackreference | UnambiguousBackreference; - interface BaseBackreference extends NodeBase { - type: "Backreference"; - parent: Alternative | Quantifier; - ref: number | string; - ambiguous: boolean; - resolved: CapturingGroup | CapturingGroup[]; - } - export interface AmbiguousBackreference extends BaseBackreference { - ref: string; - ambiguous: true; - resolved: CapturingGroup[]; - } - export interface UnambiguousBackreference extends BaseBackreference { - ambiguous: false; - resolved: CapturingGroup; - } - /** - * The modifiers. - */ - export interface Modifiers extends NodeBase { - type: "Modifiers"; - parent: Group; - /** - * The add modifier flags. - */ - add: ModifierFlags; - /** - * The remove modifier flags. - * - * `null` means no remove modifier flags. e.g. `(?ims:x)` - * The reason for `null` is that there is no position where the remove modifier flags appears. Must be behind the minus mark. - */ - remove: ModifierFlags | null; - } - /** - * The modifier flags. - */ - export interface ModifierFlags extends NodeBase { - type: "ModifierFlags"; - parent: Modifiers; - dotAll: boolean; - ignoreCase: boolean; - multiline: boolean; - } - /** - * The flags. - */ - export interface Flags extends NodeBase { - type: "Flags"; - parent: RegExpLiteral | null; - dotAll: boolean; - global: boolean; - hasIndices: boolean; - ignoreCase: boolean; - multiline: boolean; - sticky: boolean; - unicode: boolean; - unicodeSets: boolean; - } - export {}; -} - -declare module "@eslint-community/regexpp/parser" { - import type { - Flags, - RegExpLiteral, - Pattern, - } from "@eslint-community/regexpp/ast"; - import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions"; - export namespace RegExpParser { - /** - * The options for RegExpParser construction. - */ - interface Options { - /** - * The flag to disable Annex B syntax. Default is `false`. - */ - strict?: boolean; - /** - * ECMAScript version. Default is `2025`. - * - `2015` added `u` and `y` flags. - * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion, - * and Unicode Property Escape. - * - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes. - * - `2022` added `d` flag. - * - `2023` added more valid Unicode Property Escapes. - * - `2024` added `v` flag. - * - `2025` added duplicate named capturing groups, modifiers. - */ - ecmaVersion?: EcmaVersion; - } - } - export class RegExpParser { - /** - * Initialize this parser. - * @param options The options of parser. - */ - constructor(options?: RegExpParser.Options); - /** - * Parse a regular expression literal. E.g. "/abc/g" - * @param source The source code to parse. - * @param start The start index in the source code. - * @param end The end index in the source code. - * @returns The AST of the given regular expression. - */ - parseLiteral(source: string, start?: number, end?: number): RegExpLiteral; - /** - * Parse a regular expression flags. E.g. "gim" - * @param source The source code to parse. - * @param start The start index in the source code. - * @param end The end index in the source code. - * @returns The AST of the given flags. - */ - parseFlags(source: string, start?: number, end?: number): Flags; - /** - * Parse a regular expression pattern. E.g. "abc" - * @param source The source code to parse. - * @param start The start index in the source code. - * @param end The end index in the source code. - * @param flags The flags. - * @returns The AST of the given pattern. - */ - parsePattern( - source: string, - start?: number, - end?: number, - flags?: { - unicode?: boolean; - unicodeSets?: boolean; - } - ): Pattern; - /** - * @deprecated Backward compatibility - * Use object `flags` instead of boolean `uFlag`. - * - * @param source The source code to parse. - * @param start The start index in the source code. - * @param end The end index in the source code. - * @param uFlag The flag to set unicode mode. - * @returns The AST of the given pattern. - */ - parsePattern( - source: string, - start?: number, - end?: number, - uFlag?: boolean - ): Pattern; - } -} - -declare module "@eslint-community/regexpp/validator" { - import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions"; - export type RegExpValidatorSourceContext = { - readonly source: string; - readonly start: number; - readonly end: number; - readonly kind: "flags" | "literal" | "pattern"; - }; - export namespace RegExpValidator { - /** - * The options for RegExpValidator construction. - */ - interface Options { - /** - * The flag to disable Annex B syntax. Default is `false`. - */ - strict?: boolean; - /** - * ECMAScript version. Default is `2025`. - * - `2015` added `u` and `y` flags. - * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion, - * and Unicode Property Escape. - * - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes. - * - `2022` added `d` flag. - * - `2023` added more valid Unicode Property Escapes. - * - `2024` added `v` flag. - * - `2025` added duplicate named capturing groups, modifiers. - */ - ecmaVersion?: EcmaVersion; - /** - * A function that is called when the validator entered a RegExp literal. - * @param start The 0-based index of the first character. - */ - onLiteralEnter?: (start: number) => void; - /** - * A function that is called when the validator left a RegExp literal. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onLiteralLeave?: (start: number, end: number) => void; - /** - * A function that is called when the validator found flags. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param flags.global `g` flag. - * @param flags.ignoreCase `i` flag. - * @param flags.multiline `m` flag. - * @param flags.unicode `u` flag. - * @param flags.sticky `y` flag. - * @param flags.dotAll `s` flag. - * @param flags.hasIndices `d` flag. - * @param flags.unicodeSets `v` flag. - */ - onRegExpFlags?: ( - start: number, - end: number, - flags: { - global: boolean; - ignoreCase: boolean; - multiline: boolean; - unicode: boolean; - sticky: boolean; - dotAll: boolean; - hasIndices: boolean; - unicodeSets: boolean; - } - ) => void; - /** - * A function that is called when the validator found flags. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param global `g` flag. - * @param ignoreCase `i` flag. - * @param multiline `m` flag. - * @param unicode `u` flag. - * @param sticky `y` flag. - * @param dotAll `s` flag. - * @param hasIndices `d` flag. - * - * @deprecated Use `onRegExpFlags` instead. - */ - onFlags?: ( - start: number, - end: number, - global: boolean, - ignoreCase: boolean, - multiline: boolean, - unicode: boolean, - sticky: boolean, - dotAll: boolean, - hasIndices: boolean - ) => void; - /** - * A function that is called when the validator entered a pattern. - * @param start The 0-based index of the first character. - */ - onPatternEnter?: (start: number) => void; - /** - * A function that is called when the validator left a pattern. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onPatternLeave?: (start: number, end: number) => void; - /** - * A function that is called when the validator entered a disjunction. - * @param start The 0-based index of the first character. - */ - onDisjunctionEnter?: (start: number) => void; - /** - * A function that is called when the validator left a disjunction. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onDisjunctionLeave?: (start: number, end: number) => void; - /** - * A function that is called when the validator entered an alternative. - * @param start The 0-based index of the first character. - * @param index The 0-based index of alternatives in a disjunction. - */ - onAlternativeEnter?: (start: number, index: number) => void; - /** - * A function that is called when the validator left an alternative. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param index The 0-based index of alternatives in a disjunction. - */ - onAlternativeLeave?: (start: number, end: number, index: number) => void; - /** - * A function that is called when the validator entered an uncapturing group. - * @param start The 0-based index of the first character. - */ - onGroupEnter?: (start: number) => void; - /** - * A function that is called when the validator left an uncapturing group. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onGroupLeave?: (start: number, end: number) => void; - /** - * A function that is called when the validator entered a modifiers. - * @param start The 0-based index of the first character. - */ - onModifiersEnter?: (start: number) => void; - /** - * A function that is called when the validator left a modifiers. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onModifiersLeave?: (start: number, end: number) => void; - /** - * A function that is called when the validator found an add modifiers. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param flags flags. - * @param flags.ignoreCase `i` flag. - * @param flags.multiline `m` flag. - * @param flags.dotAll `s` flag. - */ - onAddModifiers?: ( - start: number, - end: number, - flags: { - ignoreCase: boolean; - multiline: boolean; - dotAll: boolean; - } - ) => void; - /** - * A function that is called when the validator found a remove modifiers. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param flags flags. - * @param flags.ignoreCase `i` flag. - * @param flags.multiline `m` flag. - * @param flags.dotAll `s` flag. - */ - onRemoveModifiers?: ( - start: number, - end: number, - flags: { - ignoreCase: boolean; - multiline: boolean; - dotAll: boolean; - } - ) => void; - /** - * A function that is called when the validator entered a capturing group. - * @param start The 0-based index of the first character. - * @param name The group name. - */ - onCapturingGroupEnter?: (start: number, name: string | null) => void; - /** - * A function that is called when the validator left a capturing group. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param name The group name. - */ - onCapturingGroupLeave?: ( - start: number, - end: number, - name: string | null - ) => void; - /** - * A function that is called when the validator found a quantifier. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param min The minimum number of repeating. - * @param max The maximum number of repeating. - * @param greedy The flag to choose the longest matching. - */ - onQuantifier?: ( - start: number, - end: number, - min: number, - max: number, - greedy: boolean - ) => void; - /** - * A function that is called when the validator entered a lookahead/lookbehind assertion. - * @param start The 0-based index of the first character. - * @param kind The kind of the assertion. - * @param negate The flag which represents that the assertion is negative. - */ - onLookaroundAssertionEnter?: ( - start: number, - kind: "lookahead" | "lookbehind", - negate: boolean - ) => void; - /** - * A function that is called when the validator left a lookahead/lookbehind assertion. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param kind The kind of the assertion. - * @param negate The flag which represents that the assertion is negative. - */ - onLookaroundAssertionLeave?: ( - start: number, - end: number, - kind: "lookahead" | "lookbehind", - negate: boolean - ) => void; - /** - * A function that is called when the validator found an edge boundary assertion. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param kind The kind of the assertion. - */ - onEdgeAssertion?: ( - start: number, - end: number, - kind: "end" | "start" - ) => void; - /** - * A function that is called when the validator found a word boundary assertion. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param kind The kind of the assertion. - * @param negate The flag which represents that the assertion is negative. - */ - onWordBoundaryAssertion?: ( - start: number, - end: number, - kind: "word", - negate: boolean - ) => void; - /** - * A function that is called when the validator found a dot. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param kind The kind of the character set. - */ - onAnyCharacterSet?: (start: number, end: number, kind: "any") => void; - /** - * A function that is called when the validator found a character set escape. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param kind The kind of the character set. - * @param negate The flag which represents that the character set is negative. - */ - onEscapeCharacterSet?: ( - start: number, - end: number, - kind: "digit" | "space" | "word", - negate: boolean - ) => void; - /** - * A function that is called when the validator found a Unicode proerty escape. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param kind The kind of the character set. - * @param key The property name. - * @param value The property value. - * @param negate The flag which represents that the character set is negative. - * @param strings If true, the given property is property of strings. - */ - onUnicodePropertyCharacterSet?: ( - start: number, - end: number, - kind: "property", - key: string, - value: string | null, - negate: boolean, - strings: boolean - ) => void; - /** - * A function that is called when the validator found a character. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param value The code point of the character. - */ - onCharacter?: (start: number, end: number, value: number) => void; - /** - * A function that is called when the validator found a backreference. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param ref The key of the referred capturing group. - */ - onBackreference?: ( - start: number, - end: number, - ref: number | string - ) => void; - /** - * A function that is called when the validator entered a character class. - * @param start The 0-based index of the first character. - * @param negate The flag which represents that the character class is negative. - * @param unicodeSets `true` if unicodeSets mode. - */ - onCharacterClassEnter?: ( - start: number, - negate: boolean, - unicodeSets: boolean - ) => void; - /** - * A function that is called when the validator left a character class. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param negate The flag which represents that the character class is negative. - */ - onCharacterClassLeave?: ( - start: number, - end: number, - negate: boolean - ) => void; - /** - * A function that is called when the validator found a character class range. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param min The minimum code point of the range. - * @param max The maximum code point of the range. - */ - onCharacterClassRange?: ( - start: number, - end: number, - min: number, - max: number - ) => void; - /** - * A function that is called when the validator found a class intersection. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onClassIntersection?: (start: number, end: number) => void; - /** - * A function that is called when the validator found a class subtraction. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onClassSubtraction?: (start: number, end: number) => void; - /** - * A function that is called when the validator entered a class string disjunction. - * @param start The 0-based index of the first character. - */ - onClassStringDisjunctionEnter?: (start: number) => void; - /** - * A function that is called when the validator left a class string disjunction. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - */ - onClassStringDisjunctionLeave?: (start: number, end: number) => void; - /** - * A function that is called when the validator entered a string alternative. - * @param start The 0-based index of the first character. - * @param index The 0-based index of alternatives in a disjunction. - */ - onStringAlternativeEnter?: (start: number, index: number) => void; - /** - * A function that is called when the validator left a string alternative. - * @param start The 0-based index of the first character. - * @param end The next 0-based index of the last character. - * @param index The 0-based index of alternatives in a disjunction. - */ - onStringAlternativeLeave?: ( - start: number, - end: number, - index: number - ) => void; - } - } - /** - * The regular expression validator. - */ - export class RegExpValidator { - /** - * Initialize this validator. - * @param options The options of validator. - */ - constructor(options?: RegExpValidator.Options); - /** - * Validate a regular expression literal. E.g. "/abc/g" - * @param source The source code to validate. - * @param start The start index in the source code. - * @param end The end index in the source code. - */ - validateLiteral(source: string, start?: number, end?: number): void; - /** - * Validate a regular expression flags. E.g. "gim" - * @param source The source code to validate. - * @param start The start index in the source code. - * @param end The end index in the source code. - */ - validateFlags(source: string, start?: number, end?: number): void; - /** - * Validate a regular expression pattern. E.g. "abc" - * @param source The source code to validate. - * @param start The start index in the source code. - * @param end The end index in the source code. - * @param flags The flags. - */ - validatePattern( - source: string, - start?: number, - end?: number, - flags?: { - unicode?: boolean; - unicodeSets?: boolean; - } - ): void; - /** - * @deprecated Backward compatibility - * Use object `flags` instead of boolean `uFlag`. - * @param source The source code to validate. - * @param start The start index in the source code. - * @param end The end index in the source code. - * @param uFlag The flag to set unicode mode. - */ - validatePattern( - source: string, - start?: number, - end?: number, - uFlag?: boolean - ): void; - } -} - -declare module "@eslint-community/regexpp/visitor" { - import type { - Alternative, - Assertion, - Backreference, - CapturingGroup, - Character, - CharacterClass, - CharacterClassRange, - CharacterSet, - ClassIntersection, - ClassStringDisjunction, - ClassSubtraction, - ExpressionCharacterClass, - Flags, - Group, - ModifierFlags, - Modifiers, - Node, - Pattern, - Quantifier, - RegExpLiteral, - StringAlternative, - } from "@eslint-community/regexpp/ast"; - /** - * The visitor to walk on AST. - */ - export class RegExpVisitor { - /** - * Initialize this visitor. - * @param handlers Callbacks for each node. - */ - constructor(handlers: RegExpVisitor.Handlers); - /** - * Visit a given node and descendant nodes. - * @param node The root node to visit tree. - */ - 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; - onClassIntersectionEnter?: (node: ClassIntersection) => void; - onClassIntersectionLeave?: (node: ClassIntersection) => void; - onClassStringDisjunctionEnter?: (node: ClassStringDisjunction) => void; - onClassStringDisjunctionLeave?: (node: ClassStringDisjunction) => void; - onClassSubtractionEnter?: (node: ClassSubtraction) => void; - onClassSubtractionLeave?: (node: ClassSubtraction) => void; - onExpressionCharacterClassEnter?: ( - node: ExpressionCharacterClass - ) => void; - onExpressionCharacterClassLeave?: ( - node: ExpressionCharacterClass - ) => void; - onFlagsEnter?: (node: Flags) => void; - onFlagsLeave?: (node: Flags) => void; - onGroupEnter?: (node: Group) => void; - onGroupLeave?: (node: Group) => void; - onModifierFlagsEnter?: (node: ModifierFlags) => void; - onModifierFlagsLeave?: (node: ModifierFlags) => void; - onModifiersEnter?: (node: Modifiers) => void; - onModifiersLeave?: (node: Modifiers) => 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; - onStringAlternativeEnter?: (node: StringAlternative) => void; - onStringAlternativeLeave?: (node: StringAlternative) => void; - } - } -} - -declare module "@eslint-community/regexpp/regexp-syntax-error" { - import type { RegExpValidatorSourceContext } from "@eslint-community/regexpp/validator"; - export class RegExpSyntaxError extends SyntaxError { - index: number; - constructor(message: string, index: number); - } - export function newRegExpSyntaxError( - srcCtx: RegExpValidatorSourceContext, - flags: { - unicode: boolean; - unicodeSets: boolean; - }, - index: number, - message: string - ): RegExpSyntaxError; -} - -declare module "@eslint-community/regexpp/ecma-versions" { - export type EcmaVersion = - | 5 - | 2015 - | 2016 - | 2017 - | 2018 - | 2019 - | 2020 - | 2021 - | 2022 - | 2023 - | 2024 - | 2025; - export const latestEcmaVersion = 2025; -} diff --git a/node_modules/@eslint-community/regexpp/index.js b/node_modules/@eslint-community/regexpp/index.js deleted file mode 100644 index ac5d686..0000000 --- a/node_modules/@eslint-community/regexpp/index.js +++ /dev/null @@ -1,3037 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var ast = /*#__PURE__*/Object.freeze({ - __proto__: null -}); - -const latestEcmaVersion = 2025; - -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 !== null && largeIdStartRanges !== void 0 ? largeIdStartRanges : (largeIdStartRanges = initLargeIdStartRanges())); -} -function isLargeIdContinue(cp) { - return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? 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 6 n 2 5 i 15 1n 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 3 0 3 1 v 0 5 7 2 2 2 m 2 9 2 4 4 0 w 1 2 1 g 1 i 8 2 2 2 14 3 0 h 0 6 2 9 2 p 5 6 h 4 n 2 8 2 0 3 6 1n 1b 2 1 d 6 1n 1 2 0 2 4 2 n 2 0 2 9 2 1 a 0 3 4 2 0 m 3 x 0 1s 7 2 z s 4 38 16 l 0 h 5 5 3 4 0 4 1 8 2 5 c d 0 i 11 2 0 6 0 3 16 2 98 2 3 3 6 2 0 2 3 3 14 2 3 3 w 2 3 3 6 2 0 2 3 3 e 2 1k 2 3 3 1u 12 f h 2d 3 5 4 h7 3 g 2 p 6 22 4 a 8 h e i f h f c 2 2 g 1f 10 0 5 0 1w 2g 8 14 2 0 6 1x b u 1e t 3 4 c 17 5 p 1j m a 1g 2b 0 2m 1a i 7 1j t e 1 b 17 r z 16 2 b z 3 a 6 16 3 2 16 3 2 5 2 1 4 0 6 5b 1t 7p 3 5 3 11 3 5 3 7 2 0 2 0 2 0 2 u 3 1g 2 6 2 0 4 2 2 6 4 3 3 5 5 c 6 2 2 6 39 0 e 0 h c 2u 0 5 0 3 9 2 0 3 5 7 0 2 0 2 0 2 f 3 3 6 4 5 0 i 14 22g 6c 7 3 4 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 h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 1u 3 1 2 0 2 7 m f 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 d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 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 13 r a m 6z 15 7 1 h 2 1o s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 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 k 1 1s 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 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 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 12 6 56 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 j 20 5k w w 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 g 0 2 c 2 x 3h 0 28 pl 2v 32 i 5f 219 2o g tr i 5 q 32y 6 g6 5a2 t 1cz fs 8 u i 26 i t j 1b h 3 w k 6 i c1 18 5w 1r 3l 22 6 0 1v c 1t 1 2 0 t 4qf 9 yd 16 9 6w8 3 2 6 2 1 2 82 g 0 u 2 3 0 f 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 1f9 u 7 5 7a 1p 43 18 b 6 h 0 8y t j 17 dh r 6d t 3 0 ds 6 2 3 2 1 2 e 2 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 wyn x 37d 7 65 3 4g1 f 5rk g h9 1wj f1 15v 3t6 6 38f"); -} -function initLargeIdContinueRanges() { - return restoreRanges("53 0 g9 33 o 0 70 4 7e 18 2 0 2 1 2 1 2 0 21 a 1d u 7 0 2u 6 3 5 3 1 2 3 3 9 o 0 v q 2k a g 9 y 8 a 0 p 3 2 8 2 2 2 4 18 2 1o 8 17 n 2 w 1j 2 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 0 3 0 2 3 2 4 2 0 f 1 2b h a 9 5 0 2a j d 9 5y 6 3 8 s 1 2b g g 9 2a c 9 9 7 j 1m 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 9j 9 1i 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 a 1 2 0 1d 6 4 4 e a 44m 0 7 e 8uh r 1t3 9 2f 9 13 4 1o 6 q 9 ev 9 d2 0 2 1i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 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 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 k6 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, raw2022, raw2023, raw2024, raw2025) { - this._raw2018 = raw2018; - this._raw2019 = raw2019; - this._raw2020 = raw2020; - this._raw2021 = raw2021; - this._raw2022 = raw2022; - this._raw2023 = raw2023; - this._raw2024 = raw2024; - this._raw2025 = raw2025; - } - get es2018() { - var _a; - return ((_a = this._set2018) !== null && _a !== void 0 ? _a : (this._set2018 = new Set(this._raw2018.split(" ")))); - } - get es2019() { - var _a; - return ((_a = this._set2019) !== null && _a !== void 0 ? _a : (this._set2019 = new Set(this._raw2019.split(" ")))); - } - get es2020() { - var _a; - return ((_a = this._set2020) !== null && _a !== void 0 ? _a : (this._set2020 = new Set(this._raw2020.split(" ")))); - } - get es2021() { - var _a; - return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" ")))); - } - get es2022() { - var _a; - return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" ")))); - } - get es2023() { - var _a; - return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" ")))); - } - get es2024() { - var _a; - return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" ")))); - } - get es2025() { - var _a; - return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.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", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz", "", ""); -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", "", "", "", ""); -const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", ""); -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)) || - (version >= 2022 && scValueSets.es2022.has(value)) || - (version >= 2023 && scValueSets.es2023.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))); -} -function isValidLoneUnicodePropertyOfString(version, value) { - return version >= 2024 && binPropertyOfStringsSets.es2024.has(value); -} - -const BACKSPACE = 0x08; -const CHARACTER_TABULATION = 0x09; -const LINE_FEED = 0x0a; -const LINE_TABULATION = 0x0b; -const FORM_FEED = 0x0c; -const CARRIAGE_RETURN = 0x0d; -const EXCLAMATION_MARK = 0x21; -const NUMBER_SIGN = 0x23; -const DOLLAR_SIGN = 0x24; -const PERCENT_SIGN = 0x25; -const AMPERSAND = 0x26; -const LEFT_PARENTHESIS = 0x28; -const RIGHT_PARENTHESIS = 0x29; -const ASTERISK = 0x2a; -const PLUS_SIGN = 0x2b; -const COMMA = 0x2c; -const HYPHEN_MINUS = 0x2d; -const FULL_STOP = 0x2e; -const SOLIDUS = 0x2f; -const DIGIT_ZERO = 0x30; -const DIGIT_ONE = 0x31; -const DIGIT_SEVEN = 0x37; -const DIGIT_NINE = 0x39; -const COLON = 0x3a; -const SEMICOLON = 0x3b; -const LESS_THAN_SIGN = 0x3c; -const EQUALS_SIGN = 0x3d; -const GREATER_THAN_SIGN = 0x3e; -const QUESTION_MARK = 0x3f; -const COMMERCIAL_AT = 0x40; -const LATIN_CAPITAL_LETTER_A = 0x41; -const LATIN_CAPITAL_LETTER_B = 0x42; -const LATIN_CAPITAL_LETTER_D = 0x44; -const LATIN_CAPITAL_LETTER_F = 0x46; -const LATIN_CAPITAL_LETTER_P = 0x50; -const LATIN_CAPITAL_LETTER_S = 0x53; -const LATIN_CAPITAL_LETTER_W = 0x57; -const LATIN_CAPITAL_LETTER_Z = 0x5a; -const LOW_LINE = 0x5f; -const LATIN_SMALL_LETTER_A = 0x61; -const LATIN_SMALL_LETTER_B = 0x62; -const LATIN_SMALL_LETTER_C = 0x63; -const LATIN_SMALL_LETTER_D = 0x64; -const LATIN_SMALL_LETTER_F = 0x66; -const LATIN_SMALL_LETTER_G = 0x67; -const LATIN_SMALL_LETTER_I = 0x69; -const LATIN_SMALL_LETTER_K = 0x6b; -const LATIN_SMALL_LETTER_M = 0x6d; -const LATIN_SMALL_LETTER_N = 0x6e; -const LATIN_SMALL_LETTER_P = 0x70; -const LATIN_SMALL_LETTER_Q = 0x71; -const LATIN_SMALL_LETTER_R = 0x72; -const LATIN_SMALL_LETTER_S = 0x73; -const LATIN_SMALL_LETTER_T = 0x74; -const LATIN_SMALL_LETTER_U = 0x75; -const LATIN_SMALL_LETTER_V = 0x76; -const LATIN_SMALL_LETTER_W = 0x77; -const LATIN_SMALL_LETTER_X = 0x78; -const LATIN_SMALL_LETTER_Y = 0x79; -const LATIN_SMALL_LETTER_Z = 0x7a; -const LEFT_SQUARE_BRACKET = 0x5b; -const REVERSE_SOLIDUS = 0x5c; -const RIGHT_SQUARE_BRACKET = 0x5d; -const CIRCUMFLEX_ACCENT = 0x5e; -const GRAVE_ACCENT = 0x60; -const LEFT_CURLY_BRACKET = 0x7b; -const VERTICAL_LINE = 0x7c; -const RIGHT_CURLY_BRACKET = 0x7d; -const TILDE = 0x7e; -const ZERO_WIDTH_NON_JOINER = 0x200c; -const ZERO_WIDTH_JOINER = 0x200d; -const LINE_SEPARATOR = 0x2028; -const PARAGRAPH_SEPARATOR = 0x2029; -const MIN_CODE_POINT = 0x00; -const MAX_CODE_POINT = 0x10ffff; -function isLatinLetter(code) { - return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) || - (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z)); -} -function isDecimalDigit(code) { - return code >= DIGIT_ZERO && code <= DIGIT_NINE; -} -function isOctalDigit(code) { - return code >= DIGIT_ZERO && code <= DIGIT_SEVEN; -} -function isHexDigit(code) { - return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) || - (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) || - (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F)); -} -function isLineTerminator(code) { - return (code === LINE_FEED || - code === CARRIAGE_RETURN || - code === LINE_SEPARATOR || - code === PARAGRAPH_SEPARATOR); -} -function isValidUnicode(code) { - return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT; -} -function digitToInt(code) { - if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) { - return code - LATIN_SMALL_LETTER_A + 10; - } - if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) { - return code - LATIN_CAPITAL_LETTER_A + 10; - } - return code - DIGIT_ZERO; -} -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; -} - -class GroupSpecifiersAsES2018 { - constructor() { - this.groupName = new Set(); - } - clear() { - this.groupName.clear(); - } - isEmpty() { - return !this.groupName.size; - } - hasInPattern(name) { - return this.groupName.has(name); - } - hasInScope(name) { - return this.hasInPattern(name); - } - addToScope(name) { - this.groupName.add(name); - } - enterDisjunction() { - } - enterAlternative() { - } - leaveDisjunction() { - } -} -class BranchID { - constructor(parent, base) { - this.parent = parent; - this.base = base !== null && base !== void 0 ? base : this; - } - separatedFrom(other) { - var _a, _b; - if (this.base === other.base && this !== other) { - return true; - } - if (other.parent && this.separatedFrom(other.parent)) { - return true; - } - return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false; - } - child() { - return new BranchID(this, null); - } - sibling() { - return new BranchID(this.parent, this.base); - } -} -class GroupSpecifiersAsES2025 { - constructor() { - this.branchID = new BranchID(null, null); - this.groupNames = new Map(); - } - clear() { - this.branchID = new BranchID(null, null); - this.groupNames.clear(); - } - isEmpty() { - return !this.groupNames.size; - } - enterDisjunction() { - this.branchID = this.branchID.child(); - } - enterAlternative(index) { - if (index === 0) { - return; - } - this.branchID = this.branchID.sibling(); - } - leaveDisjunction() { - this.branchID = this.branchID.parent; - } - hasInPattern(name) { - return this.groupNames.has(name); - } - hasInScope(name) { - const branches = this.groupNames.get(name); - if (!branches) { - return false; - } - for (const branch of branches) { - if (!branch.separatedFrom(this.branchID)) { - return true; - } - } - return false; - } - addToScope(name) { - const branches = this.groupNames.get(name); - if (branches) { - branches.push(this.branchID); - return; - } - this.groupNames.set(name, [this.branchID]); - } -} - -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(message, index) { - super(message); - this.index = index; - } -} -function newRegExpSyntaxError(srcCtx, flags, index, message) { - let source = ""; - if (srcCtx.kind === "literal") { - const literal = srcCtx.source.slice(srcCtx.start, srcCtx.end); - if (literal) { - source = `: ${literal}`; - } - } - else if (srcCtx.kind === "pattern") { - const pattern = srcCtx.source.slice(srcCtx.start, srcCtx.end); - const flagsText = `${flags.unicode ? "u" : ""}${flags.unicodeSets ? "v" : ""}`; - source = `: /${pattern}/${flagsText}`; - } - return new RegExpSyntaxError(`Invalid regular expression${source}: ${message}`, index); -} - -const SYNTAX_CHARACTER = new Set([ - CIRCUMFLEX_ACCENT, - DOLLAR_SIGN, - REVERSE_SOLIDUS, - FULL_STOP, - ASTERISK, - PLUS_SIGN, - QUESTION_MARK, - LEFT_PARENTHESIS, - RIGHT_PARENTHESIS, - LEFT_SQUARE_BRACKET, - RIGHT_SQUARE_BRACKET, - LEFT_CURLY_BRACKET, - RIGHT_CURLY_BRACKET, - VERTICAL_LINE, -]); -const CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER = new Set([ - AMPERSAND, - EXCLAMATION_MARK, - NUMBER_SIGN, - DOLLAR_SIGN, - PERCENT_SIGN, - ASTERISK, - PLUS_SIGN, - COMMA, - FULL_STOP, - COLON, - SEMICOLON, - LESS_THAN_SIGN, - EQUALS_SIGN, - GREATER_THAN_SIGN, - QUESTION_MARK, - COMMERCIAL_AT, - CIRCUMFLEX_ACCENT, - GRAVE_ACCENT, - TILDE, -]); -const CLASS_SET_SYNTAX_CHARACTER = new Set([ - LEFT_PARENTHESIS, - RIGHT_PARENTHESIS, - LEFT_SQUARE_BRACKET, - RIGHT_SQUARE_BRACKET, - LEFT_CURLY_BRACKET, - RIGHT_CURLY_BRACKET, - SOLIDUS, - HYPHEN_MINUS, - REVERSE_SOLIDUS, - VERTICAL_LINE, -]); -const CLASS_SET_RESERVED_PUNCTUATOR = new Set([ - AMPERSAND, - HYPHEN_MINUS, - EXCLAMATION_MARK, - NUMBER_SIGN, - PERCENT_SIGN, - COMMA, - COLON, - SEMICOLON, - LESS_THAN_SIGN, - EQUALS_SIGN, - GREATER_THAN_SIGN, - COMMERCIAL_AT, - GRAVE_ACCENT, - TILDE, -]); -const FLAG_PROP_TO_CODEPOINT = { - global: LATIN_SMALL_LETTER_G, - ignoreCase: LATIN_SMALL_LETTER_I, - multiline: LATIN_SMALL_LETTER_M, - unicode: LATIN_SMALL_LETTER_U, - sticky: LATIN_SMALL_LETTER_Y, - dotAll: LATIN_SMALL_LETTER_S, - hasIndices: LATIN_SMALL_LETTER_D, - unicodeSets: LATIN_SMALL_LETTER_V, -}; -const FLAG_CODEPOINT_TO_PROP = Object.fromEntries(Object.entries(FLAG_PROP_TO_CODEPOINT).map(([k, v]) => [v, k])); -function isSyntaxCharacter(cp) { - return SYNTAX_CHARACTER.has(cp); -} -function isClassSetReservedDoublePunctuatorCharacter(cp) { - return CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER.has(cp); -} -function isClassSetSyntaxCharacter(cp) { - return CLASS_SET_SYNTAX_CHARACTER.has(cp); -} -function isClassSetReservedPunctuator(cp) { - return CLASS_SET_RESERVED_PUNCTUATOR.has(cp); -} -function isIdentifierStartChar(cp) { - return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE; -} -function isIdentifierPartChar(cp) { - return (isIdContinue(cp) || - cp === DOLLAR_SIGN || - cp === ZERO_WIDTH_NON_JOINER || - cp === ZERO_WIDTH_JOINER); -} -function isUnicodePropertyNameCharacter(cp) { - return isLatinLetter(cp) || cp === LOW_LINE; -} -function isUnicodePropertyValueCharacter(cp) { - return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp); -} -function isRegularExpressionModifier(ch) { - return (ch === LATIN_SMALL_LETTER_I || - ch === LATIN_SMALL_LETTER_M || - ch === LATIN_SMALL_LETTER_S); -} -class RegExpValidator { - constructor(options) { - this._reader = new Reader(); - this._unicodeMode = false; - this._unicodeSetsMode = false; - this._nFlag = false; - this._lastIntValue = 0; - this._lastRange = { - min: 0, - max: Number.POSITIVE_INFINITY, - }; - this._lastStrValue = ""; - this._lastAssertionIsQuantifiable = false; - this._numCapturingParens = 0; - this._backreferenceNames = new Set(); - this._srcCtx = null; - this._options = options !== null && options !== void 0 ? options : {}; - this._groupSpecifiers = - this.ecmaVersion >= 2025 - ? new GroupSpecifiersAsES2025() - : new GroupSpecifiersAsES2018(); - } - validateLiteral(source, start = 0, end = source.length) { - this._srcCtx = { source, start, end, kind: "literal" }; - this._unicodeSetsMode = this._unicodeMode = 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 unicode = source.includes("u", flagStart); - const unicodeSets = source.includes("v", flagStart); - this.validateFlagsInternal(source, flagStart, end); - this.validatePatternInternal(source, start + 1, flagStart - 1, { - unicode, - unicodeSets, - }); - } - 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) { - this._srcCtx = { source, start, end, kind: "flags" }; - this.validateFlagsInternal(source, start, end); - } - validatePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) { - this._srcCtx = { source, start, end, kind: "pattern" }; - this.validatePatternInternal(source, start, end, uFlagOrFlags); - } - validatePatternInternal(source, start = 0, end = source.length, uFlagOrFlags = undefined) { - const mode = this._parseFlagsOptionToMode(uFlagOrFlags, end); - this._unicodeMode = mode.unicodeMode; - this._nFlag = mode.nFlag; - this._unicodeSetsMode = mode.unicodeSetsMode; - this.reset(source, start, end); - this.consumePattern(); - if (!this._nFlag && - this.ecmaVersion >= 2018 && - !this._groupSpecifiers.isEmpty()) { - this._nFlag = true; - this.rewind(start); - this.consumePattern(); - } - } - validateFlagsInternal(source, start, end) { - const flags = this.parseFlags(source, start, end); - this.onRegExpFlags(start, end, flags); - } - _parseFlagsOptionToMode(uFlagOrFlags, sourceEnd) { - let unicode = false; - let unicodeSets = false; - if (uFlagOrFlags && this.ecmaVersion >= 2015) { - if (typeof uFlagOrFlags === "object") { - unicode = Boolean(uFlagOrFlags.unicode); - if (this.ecmaVersion >= 2024) { - unicodeSets = Boolean(uFlagOrFlags.unicodeSets); - } - } - else { - unicode = uFlagOrFlags; - } - } - if (unicode && unicodeSets) { - this.raise("Invalid regular expression flags", { - index: sourceEnd + 1, - unicode, - unicodeSets, - }); - } - const unicodeMode = unicode || unicodeSets; - const nFlag = (unicode && this.ecmaVersion >= 2018) || - unicodeSets || - Boolean(this._options.strict && this.ecmaVersion >= 2023); - const unicodeSetsMode = unicodeSets; - return { unicodeMode, nFlag, unicodeSetsMode }; - } - get strict() { - return Boolean(this._options.strict) || this._unicodeMode; - } - get ecmaVersion() { - var _a; - return (_a = this._options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; - } - onLiteralEnter(start) { - if (this._options.onLiteralEnter) { - this._options.onLiteralEnter(start); - } - } - onLiteralLeave(start, end) { - if (this._options.onLiteralLeave) { - this._options.onLiteralLeave(start, end); - } - } - onRegExpFlags(start, end, flags) { - if (this._options.onRegExpFlags) { - this._options.onRegExpFlags(start, end, flags); - } - if (this._options.onFlags) { - this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.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); - } - } - onModifiersEnter(start) { - if (this._options.onModifiersEnter) { - this._options.onModifiersEnter(start); - } - } - onModifiersLeave(start, end) { - if (this._options.onModifiersLeave) { - this._options.onModifiersLeave(start, end); - } - } - onAddModifiers(start, end, flags) { - if (this._options.onAddModifiers) { - this._options.onAddModifiers(start, end, flags); - } - } - onRemoveModifiers(start, end, flags) { - if (this._options.onRemoveModifiers) { - this._options.onRemoveModifiers(start, end, flags); - } - } - 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, strings) { - if (this._options.onUnicodePropertyCharacterSet) { - this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings); - } - } - 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, unicodeSets) { - if (this._options.onCharacterClassEnter) { - this._options.onCharacterClassEnter(start, negate, unicodeSets); - } - } - 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); - } - } - onClassIntersection(start, end) { - if (this._options.onClassIntersection) { - this._options.onClassIntersection(start, end); - } - } - onClassSubtraction(start, end) { - if (this._options.onClassSubtraction) { - this._options.onClassSubtraction(start, end); - } - } - onClassStringDisjunctionEnter(start) { - if (this._options.onClassStringDisjunctionEnter) { - this._options.onClassStringDisjunctionEnter(start); - } - } - onClassStringDisjunctionLeave(start, end) { - if (this._options.onClassStringDisjunctionLeave) { - this._options.onClassStringDisjunctionLeave(start, end); - } - } - onStringAlternativeEnter(start, index) { - if (this._options.onStringAlternativeEnter) { - this._options.onStringAlternativeEnter(start, index); - } - } - onStringAlternativeLeave(start, end, index) { - if (this._options.onStringAlternativeLeave) { - this._options.onStringAlternativeLeave(start, end, index); - } - } - 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._unicodeMode); - } - 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, context) { - var _a, _b, _c; - throw newRegExpSyntaxError(this._srcCtx, { - unicode: (_a = context === null || context === void 0 ? void 0 : context.unicode) !== null && _a !== void 0 ? _a : (this._unicodeMode && !this._unicodeSetsMode), - unicodeSets: (_b = context === null || context === void 0 ? void 0 : context.unicodeSets) !== null && _b !== void 0 ? _b : this._unicodeSetsMode, - }, (_c = context === null || context === void 0 ? void 0 : context.index) !== null && _c !== void 0 ? _c : 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 === REVERSE_SOLIDUS) { - escaped = true; - } - else if (cp === LEFT_SQUARE_BRACKET) { - inClass = true; - } - else if (cp === RIGHT_SQUARE_BRACKET) { - 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._groupSpecifiers.clear(); - this._backreferenceNames.clear(); - this.onPatternEnter(start); - this.consumeDisjunction(); - const cp = this.currentCodePoint; - if (this.currentCodePoint !== -1) { - if (cp === RIGHT_PARENTHESIS) { - this.raise("Unmatched ')'"); - } - if (cp === REVERSE_SOLIDUS) { - this.raise("\\ at end of pattern"); - } - if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) { - this.raise("Lone quantifier brackets"); - } - const c = String.fromCodePoint(cp); - this.raise(`Unexpected character '${c}'`); - } - for (const name of this._backreferenceNames) { - if (!this._groupSpecifiers.hasInPattern(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 === REVERSE_SOLIDUS) { - escaped = true; - } - else if (cp === LEFT_SQUARE_BRACKET) { - inClass = true; - } - else if (cp === RIGHT_SQUARE_BRACKET) { - inClass = false; - } - else if (cp === LEFT_PARENTHESIS && - !inClass && - (this.nextCodePoint !== QUESTION_MARK || - (this.nextCodePoint2 === LESS_THAN_SIGN && - this.nextCodePoint3 !== EQUALS_SIGN && - this.nextCodePoint3 !== EXCLAMATION_MARK))) { - count += 1; - } - this.advance(); - } - this.rewind(start); - return count; - } - consumeDisjunction() { - const start = this.index; - let i = 0; - this._groupSpecifiers.enterDisjunction(); - this.onDisjunctionEnter(start); - do { - this.consumeAlternative(i++); - } while (this.eat(VERTICAL_LINE)); - if (this.consumeQuantifier(true)) { - this.raise("Nothing to repeat"); - } - if (this.eat(LEFT_CURLY_BRACKET)) { - this.raise("Lone quantifier brackets"); - } - this.onDisjunctionLeave(start, this.index); - this._groupSpecifiers.leaveDisjunction(); - } - consumeAlternative(i) { - const start = this.index; - this._groupSpecifiers.enterAlternative(i); - this.onAlternativeEnter(start, i); - while (this.currentCodePoint !== -1 && this.consumeTerm()) { - } - this.onAlternativeLeave(start, this.index, i); - } - consumeTerm() { - if (this._unicodeMode || 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(CIRCUMFLEX_ACCENT)) { - this.onEdgeAssertion(start, this.index, "start"); - return true; - } - if (this.eat(DOLLAR_SIGN)) { - this.onEdgeAssertion(start, this.index, "end"); - return true; - } - if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) { - this.onWordBoundaryAssertion(start, this.index, "word", true); - return true; - } - if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) { - this.onWordBoundaryAssertion(start, this.index, "word", false); - return true; - } - if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { - const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN); - let negate = false; - if (this.eat(EQUALS_SIGN) || - (negate = this.eat(EXCLAMATION_MARK))) { - const kind = lookbehind ? "lookbehind" : "lookahead"; - this.onLookaroundAssertionEnter(start, kind, negate); - this.consumeDisjunction(); - if (!this.eat(RIGHT_PARENTHESIS)) { - 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(PLUS_SIGN)) { - min = 1; - max = Number.POSITIVE_INFINITY; - } - else if (this.eat(QUESTION_MARK)) { - min = 0; - max = 1; - } - else if (this.eatBracedQuantifier(noConsume)) { - ({ min, max } = this._lastRange); - } - else { - return false; - } - greedy = !this.eat(QUESTION_MARK); - if (!noConsume) { - this.onQuantifier(start, this.index, min, max, greedy); - } - return true; - } - eatBracedQuantifier(noError) { - const start = this.index; - if (this.eat(LEFT_CURLY_BRACKET)) { - if (this.eatDecimalDigits()) { - const min = this._lastIntValue; - let max = min; - if (this.eat(COMMA)) { - max = this.eatDecimalDigits() - ? this._lastIntValue - : Number.POSITIVE_INFINITY; - } - if (this.eat(RIGHT_CURLY_BRACKET)) { - if (!noError && max < min) { - this.raise("numbers out of order in {} quantifier"); - } - this._lastRange = { min, max }; - return true; - } - } - if (!noError && (this._unicodeMode || this.strict)) { - this.raise("Incomplete quantifier"); - } - this.rewind(start); - } - return false; - } - consumeAtom() { - return (this.consumePatternCharacter() || - this.consumeDot() || - this.consumeReverseSolidusAtomEscape() || - Boolean(this.consumeCharacterClass()) || - this.consumeCapturingGroup() || - this.consumeUncapturingGroup()); - } - consumeDot() { - if (this.eat(FULL_STOP)) { - this.onAnyCharacterSet(this.index - 1, this.index, "any"); - return true; - } - return false; - } - consumeReverseSolidusAtomEscape() { - const start = this.index; - if (this.eat(REVERSE_SOLIDUS)) { - if (this.consumeAtomEscape()) { - return true; - } - this.rewind(start); - } - return false; - } - consumeUncapturingGroup() { - const start = this.index; - if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { - this.onGroupEnter(start); - if (this.ecmaVersion >= 2025) { - this.consumeModifiers(); - } - if (!this.eat(COLON)) { - this.rewind(start + 1); - this.raise("Invalid group"); - } - this.consumeDisjunction(); - if (!this.eat(RIGHT_PARENTHESIS)) { - this.raise("Unterminated group"); - } - this.onGroupLeave(start, this.index); - return true; - } - return false; - } - consumeModifiers() { - const start = this.index; - const hasAddModifiers = this.eatModifiers(); - const addModifiersEnd = this.index; - const hasHyphen = this.eat(HYPHEN_MINUS); - if (!hasAddModifiers && !hasHyphen) { - return false; - } - this.onModifiersEnter(start); - const addModifiers = this.parseModifiers(start, addModifiersEnd); - this.onAddModifiers(start, addModifiersEnd, addModifiers); - if (hasHyphen) { - const modifiersStart = this.index; - if (!this.eatModifiers() && - !hasAddModifiers && - this.currentCodePoint === COLON) { - this.raise("Invalid empty flags"); - } - const modifiers = this.parseModifiers(modifiersStart, this.index); - for (const [flagName] of Object.entries(modifiers).filter(([, enable]) => enable)) { - if (addModifiers[flagName]) { - this.raise(`Duplicated flag '${String.fromCodePoint(FLAG_PROP_TO_CODEPOINT[flagName])}'`); - } - } - this.onRemoveModifiers(modifiersStart, this.index, modifiers); - } - this.onModifiersLeave(start, this.index); - return true; - } - consumeCapturingGroup() { - const start = this.index; - if (this.eat(LEFT_PARENTHESIS)) { - let name = null; - if (this.ecmaVersion >= 2018) { - if (this.consumeGroupSpecifier()) { - name = this._lastStrValue; - } - else if (this.currentCodePoint === QUESTION_MARK) { - this.rewind(start); - return false; - } - } - else if (this.currentCodePoint === QUESTION_MARK) { - this.rewind(start); - return false; - } - this.onCapturingGroupEnter(start, name); - this.consumeDisjunction(); - if (!this.eat(RIGHT_PARENTHESIS)) { - this.raise("Unterminated group"); - } - this.onCapturingGroupLeave(start, this.index, name); - return true; - } - return false; - } - consumeExtendedAtom() { - return (this.consumeDot() || - this.consumeReverseSolidusAtomEscape() || - this.consumeReverseSolidusFollowedByC() || - Boolean(this.consumeCharacterClass()) || - this.consumeCapturingGroup() || - this.consumeUncapturingGroup() || - this.consumeInvalidBracedQuantifier() || - this.consumeExtendedPatternCharacter()); - } - consumeReverseSolidusFollowedByC() { - const start = this.index; - if (this.currentCodePoint === REVERSE_SOLIDUS && - this.nextCodePoint === LATIN_SMALL_LETTER_C) { - this._lastIntValue = this.currentCodePoint; - this.advance(); - this.onCharacter(start, this.index, REVERSE_SOLIDUS); - 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 !== CIRCUMFLEX_ACCENT && - cp !== DOLLAR_SIGN && - cp !== REVERSE_SOLIDUS && - cp !== FULL_STOP && - cp !== ASTERISK && - cp !== PLUS_SIGN && - cp !== QUESTION_MARK && - cp !== LEFT_PARENTHESIS && - cp !== RIGHT_PARENTHESIS && - cp !== LEFT_SQUARE_BRACKET && - cp !== VERTICAL_LINE) { - this.advance(); - this.onCharacter(start, this.index, cp); - return true; - } - return false; - } - consumeGroupSpecifier() { - const start = this.index; - if (this.eat(QUESTION_MARK)) { - if (this.eatGroupName()) { - if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) { - this._groupSpecifiers.addToScope(this._lastStrValue); - return true; - } - this.raise("Duplicate capture group name"); - } - this.rewind(start); - } - return false; - } - consumeAtomEscape() { - if (this.consumeBackreference() || - this.consumeCharacterClassEscape() || - this.consumeCharacterEscape() || - (this._nFlag && this.consumeKGroupName())) { - return true; - } - if (this.strict || this._unicodeMode) { - 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._unicodeMode) { - this.raise("Invalid escape"); - } - this.rewind(start); - } - return false; - } - consumeCharacterClassEscape() { - var _a; - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_D)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "digit", false); - return {}; - } - if (this.eat(LATIN_CAPITAL_LETTER_D)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "digit", true); - return {}; - } - if (this.eat(LATIN_SMALL_LETTER_S)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "space", false); - return {}; - } - if (this.eat(LATIN_CAPITAL_LETTER_S)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "space", true); - return {}; - } - if (this.eat(LATIN_SMALL_LETTER_W)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "word", false); - return {}; - } - if (this.eat(LATIN_CAPITAL_LETTER_W)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "word", true); - return {}; - } - let negate = false; - if (this._unicodeMode && - this.ecmaVersion >= 2018 && - (this.eat(LATIN_SMALL_LETTER_P) || - (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) { - this._lastIntValue = -1; - let result = null; - if (this.eat(LEFT_CURLY_BRACKET) && - (result = this.eatUnicodePropertyValueExpression()) && - this.eat(RIGHT_CURLY_BRACKET)) { - if (negate && result.strings) { - this.raise("Invalid property name"); - } - this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", result.key, result.value, negate, (_a = result.strings) !== null && _a !== void 0 ? _a : false); - return { mayContainStrings: result.strings }; - } - this.raise("Invalid property name"); - } - return null; - } - consumeCharacterEscape() { - const start = this.index; - if (this.eatControlEscape() || - this.eatCControlLetter() || - this.eatZero() || - this.eatHexEscapeSequence() || - this.eatRegExpUnicodeEscapeSequence() || - (!this.strict && - !this._unicodeMode && - this.eatLegacyOctalEscapeSequence()) || - this.eatIdentityEscape()) { - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - return false; - } - consumeKGroupName() { - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_K)) { - 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(LEFT_SQUARE_BRACKET)) { - const negate = this.eat(CIRCUMFLEX_ACCENT); - this.onCharacterClassEnter(start, negate, this._unicodeSetsMode); - const result = this.consumeClassContents(); - if (!this.eat(RIGHT_SQUARE_BRACKET)) { - if (this.currentCodePoint === -1) { - this.raise("Unterminated character class"); - } - this.raise("Invalid character in character class"); - } - if (negate && result.mayContainStrings) { - this.raise("Negated character class may contain strings"); - } - this.onCharacterClassLeave(start, this.index, negate); - return result; - } - return null; - } - consumeClassContents() { - if (this._unicodeSetsMode) { - if (this.currentCodePoint === RIGHT_SQUARE_BRACKET) { - return {}; - } - const result = this.consumeClassSetExpression(); - return result; - } - const strict = this.strict || this._unicodeMode; - for (;;) { - const rangeStart = this.index; - if (!this.consumeClassAtom()) { - break; - } - const min = this._lastIntValue; - if (!this.eat(HYPHEN_MINUS)) { - continue; - } - this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS); - 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); - } - return {}; - } - consumeClassAtom() { - const start = this.index; - const cp = this.currentCodePoint; - if (cp !== -1 && - cp !== REVERSE_SOLIDUS && - cp !== RIGHT_SQUARE_BRACKET) { - this.advance(); - this._lastIntValue = cp; - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - if (this.eat(REVERSE_SOLIDUS)) { - if (this.consumeClassEscape()) { - return true; - } - if (!this.strict && - this.currentCodePoint === LATIN_SMALL_LETTER_C) { - this._lastIntValue = REVERSE_SOLIDUS; - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - if (this.strict || this._unicodeMode) { - this.raise("Invalid escape"); - } - this.rewind(start); - } - return false; - } - consumeClassEscape() { - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_B)) { - this._lastIntValue = BACKSPACE; - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - if (this._unicodeMode && this.eat(HYPHEN_MINUS)) { - this._lastIntValue = HYPHEN_MINUS; - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - let cp = 0; - if (!this.strict && - !this._unicodeMode && - this.currentCodePoint === LATIN_SMALL_LETTER_C && - (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) { - this.advance(); - this.advance(); - this._lastIntValue = cp % 0x20; - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - return (Boolean(this.consumeCharacterClassEscape()) || - this.consumeCharacterEscape()); - } - consumeClassSetExpression() { - const start = this.index; - let mayContainStrings = false; - let result = null; - if (this.consumeClassSetCharacter()) { - if (this.consumeClassSetRangeFromOperator(start)) { - this.consumeClassUnionRight({}); - return {}; - } - mayContainStrings = false; - } - else if ((result = this.consumeClassSetOperand())) { - mayContainStrings = result.mayContainStrings; - } - else { - const cp = this.currentCodePoint; - if (cp === REVERSE_SOLIDUS) { - this.advance(); - this.raise("Invalid escape"); - } - if (cp === this.nextCodePoint && - isClassSetReservedDoublePunctuatorCharacter(cp)) { - this.raise("Invalid set operation in character class"); - } - this.raise("Invalid character in character class"); - } - if (this.eat2(AMPERSAND, AMPERSAND)) { - while (this.currentCodePoint !== AMPERSAND && - (result = this.consumeClassSetOperand())) { - this.onClassIntersection(start, this.index); - if (!result.mayContainStrings) { - mayContainStrings = false; - } - if (this.eat2(AMPERSAND, AMPERSAND)) { - continue; - } - return { mayContainStrings }; - } - this.raise("Invalid character in character class"); - } - if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { - while (this.consumeClassSetOperand()) { - this.onClassSubtraction(start, this.index); - if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { - continue; - } - return { mayContainStrings }; - } - this.raise("Invalid character in character class"); - } - return this.consumeClassUnionRight({ mayContainStrings }); - } - consumeClassUnionRight(leftResult) { - let mayContainStrings = leftResult.mayContainStrings; - for (;;) { - const start = this.index; - if (this.consumeClassSetCharacter()) { - this.consumeClassSetRangeFromOperator(start); - continue; - } - const result = this.consumeClassSetOperand(); - if (result) { - if (result.mayContainStrings) { - mayContainStrings = true; - } - continue; - } - break; - } - return { mayContainStrings }; - } - consumeClassSetRangeFromOperator(start) { - const currentStart = this.index; - const min = this._lastIntValue; - if (this.eat(HYPHEN_MINUS)) { - if (this.consumeClassSetCharacter()) { - const max = this._lastIntValue; - if (min === -1 || max === -1) { - this.raise("Invalid character class"); - } - if (min > max) { - this.raise("Range out of order in character class"); - } - this.onCharacterClassRange(start, this.index, min, max); - return true; - } - this.rewind(currentStart); - } - return false; - } - consumeClassSetOperand() { - let result = null; - if ((result = this.consumeNestedClass())) { - return result; - } - if ((result = this.consumeClassStringDisjunction())) { - return result; - } - if (this.consumeClassSetCharacter()) { - return {}; - } - return null; - } - consumeNestedClass() { - const start = this.index; - if (this.eat(LEFT_SQUARE_BRACKET)) { - const negate = this.eat(CIRCUMFLEX_ACCENT); - this.onCharacterClassEnter(start, negate, true); - const result = this.consumeClassContents(); - if (!this.eat(RIGHT_SQUARE_BRACKET)) { - this.raise("Unterminated character class"); - } - if (negate && result.mayContainStrings) { - this.raise("Negated character class may contain strings"); - } - this.onCharacterClassLeave(start, this.index, negate); - return result; - } - if (this.eat(REVERSE_SOLIDUS)) { - const result = this.consumeCharacterClassEscape(); - if (result) { - return result; - } - this.rewind(start); - } - return null; - } - consumeClassStringDisjunction() { - const start = this.index; - if (this.eat3(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_Q, LEFT_CURLY_BRACKET)) { - this.onClassStringDisjunctionEnter(start); - let i = 0; - let mayContainStrings = false; - do { - if (this.consumeClassString(i++).mayContainStrings) { - mayContainStrings = true; - } - } while (this.eat(VERTICAL_LINE)); - if (this.eat(RIGHT_CURLY_BRACKET)) { - this.onClassStringDisjunctionLeave(start, this.index); - return { mayContainStrings }; - } - this.raise("Unterminated class string disjunction"); - } - return null; - } - consumeClassString(i) { - const start = this.index; - let count = 0; - this.onStringAlternativeEnter(start, i); - while (this.currentCodePoint !== -1 && - this.consumeClassSetCharacter()) { - count++; - } - this.onStringAlternativeLeave(start, this.index, i); - return { mayContainStrings: count !== 1 }; - } - consumeClassSetCharacter() { - const start = this.index; - const cp = this.currentCodePoint; - if (cp !== this.nextCodePoint || - !isClassSetReservedDoublePunctuatorCharacter(cp)) { - if (cp !== -1 && !isClassSetSyntaxCharacter(cp)) { - this._lastIntValue = cp; - this.advance(); - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - } - if (this.eat(REVERSE_SOLIDUS)) { - if (this.consumeCharacterEscape()) { - return true; - } - if (isClassSetReservedPunctuator(this.currentCodePoint)) { - this._lastIntValue = this.currentCodePoint; - this.advance(); - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - if (this.eat(LATIN_SMALL_LETTER_B)) { - this._lastIntValue = BACKSPACE; - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - this.rewind(start); - } - return false; - } - eatGroupName() { - if (this.eat(LESS_THAN_SIGN)) { - if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) { - 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._unicodeMode && this.ecmaVersion >= 2020; - let cp = this.currentCodePoint; - this.advance(); - if (cp === REVERSE_SOLIDUS && - this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { - cp = this._lastIntValue; - } - else if (forceUFlag && - isLeadSurrogate(cp) && - isTrailSurrogate(this.currentCodePoint)) { - cp = combineSurrogatePair(cp, this.currentCodePoint); - this.advance(); - } - if (isIdentifierStartChar(cp)) { - this._lastIntValue = cp; - return true; - } - if (this.index !== start) { - this.rewind(start); - } - return false; - } - eatRegExpIdentifierPart() { - const start = this.index; - const forceUFlag = !this._unicodeMode && this.ecmaVersion >= 2020; - let cp = this.currentCodePoint; - this.advance(); - if (cp === REVERSE_SOLIDUS && - this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { - cp = this._lastIntValue; - } - else if (forceUFlag && - isLeadSurrogate(cp) && - isTrailSurrogate(this.currentCodePoint)) { - cp = combineSurrogatePair(cp, this.currentCodePoint); - this.advance(); - } - if (isIdentifierPartChar(cp)) { - this._lastIntValue = cp; - return true; - } - if (this.index !== start) { - this.rewind(start); - } - return false; - } - eatCControlLetter() { - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_C)) { - if (this.eatControlLetter()) { - return true; - } - this.rewind(start); - } - return false; - } - eatZero() { - if (this.currentCodePoint === DIGIT_ZERO && - !isDecimalDigit(this.nextCodePoint)) { - this._lastIntValue = 0; - this.advance(); - return true; - } - return false; - } - eatControlEscape() { - if (this.eat(LATIN_SMALL_LETTER_F)) { - this._lastIntValue = FORM_FEED; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_N)) { - this._lastIntValue = LINE_FEED; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_R)) { - this._lastIntValue = CARRIAGE_RETURN; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_T)) { - this._lastIntValue = CHARACTER_TABULATION; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_V)) { - this._lastIntValue = LINE_TABULATION; - 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._unicodeMode; - if (this.eat(LATIN_SMALL_LETTER_U)) { - 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(REVERSE_SOLIDUS) && - this.eat(LATIN_SMALL_LETTER_U) && - 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(LEFT_CURLY_BRACKET) && - this.eatHexDigits() && - this.eat(RIGHT_CURLY_BRACKET) && - 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._unicodeMode) { - return isSyntaxCharacter(cp) || cp === SOLIDUS; - } - if (this.strict) { - return !isIdContinue(cp); - } - if (this._nFlag) { - return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K); - } - return cp !== LATIN_SMALL_LETTER_C; - } - eatDecimalEscape() { - this._lastIntValue = 0; - let cp = this.currentCodePoint; - if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) { - do { - this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO); - this.advance(); - } while ((cp = this.currentCodePoint) >= DIGIT_ZERO && - cp <= DIGIT_NINE); - return true; - } - return false; - } - eatUnicodePropertyValueExpression() { - const start = this.index; - if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) { - const key = this._lastStrValue; - if (this.eatUnicodePropertyValue()) { - const value = this._lastStrValue; - if (isValidUnicodeProperty(this.ecmaVersion, key, value)) { - return { - key, - value: value || null, - }; - } - this.raise("Invalid property name"); - } - } - this.rewind(start); - if (this.eatLoneUnicodePropertyNameOrValue()) { - const nameOrValue = this._lastStrValue; - if (isValidUnicodeProperty(this.ecmaVersion, "General_Category", nameOrValue)) { - return { - key: "General_Category", - value: nameOrValue || null, - }; - } - if (isValidLoneUnicodeProperty(this.ecmaVersion, nameOrValue)) { - return { - key: nameOrValue, - value: null, - }; - } - if (this._unicodeSetsMode && - isValidLoneUnicodePropertyOfString(this.ecmaVersion, nameOrValue)) { - return { - key: nameOrValue, - value: null, - strings: true, - }; - } - this.raise("Invalid property name"); - } - return null; - } - 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(LATIN_SMALL_LETTER_X)) { - if (this.eatFixedHexDigits(2)) { - return true; - } - if (this._unicodeMode || 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 - DIGIT_ZERO; - 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; - } - eatModifiers() { - let ate = false; - while (isRegularExpressionModifier(this.currentCodePoint)) { - this.advance(); - ate = true; - } - return ate; - } - parseModifiers(start, end) { - const { ignoreCase, multiline, dotAll } = this.parseFlags(this._reader.source, start, end); - return { ignoreCase, multiline, dotAll }; - } - parseFlags(source, start, end) { - const flags = { - global: false, - ignoreCase: false, - multiline: false, - unicode: false, - sticky: false, - dotAll: false, - hasIndices: false, - unicodeSets: false, - }; - const validFlags = new Set(); - validFlags.add(LATIN_SMALL_LETTER_G); - validFlags.add(LATIN_SMALL_LETTER_I); - validFlags.add(LATIN_SMALL_LETTER_M); - if (this.ecmaVersion >= 2015) { - validFlags.add(LATIN_SMALL_LETTER_U); - validFlags.add(LATIN_SMALL_LETTER_Y); - if (this.ecmaVersion >= 2018) { - validFlags.add(LATIN_SMALL_LETTER_S); - if (this.ecmaVersion >= 2022) { - validFlags.add(LATIN_SMALL_LETTER_D); - if (this.ecmaVersion >= 2024) { - validFlags.add(LATIN_SMALL_LETTER_V); - } - } - } - } - for (let i = start; i < end; ++i) { - const flag = source.charCodeAt(i); - if (validFlags.has(flag)) { - const prop = FLAG_CODEPOINT_TO_PROP[flag]; - if (flags[prop]) { - this.raise(`Duplicated flag '${source[i]}'`, { - index: start, - }); - } - flags[prop] = true; - } - else { - this.raise(`Invalid flag '${source[i]}'`, { index: start }); - } - } - return flags; - } -} - -const DUMMY_PATTERN = {}; -const DUMMY_FLAGS = {}; -const DUMMY_CAPTURING_GROUP = {}; -function isClassSetOperand(node) { - return (node.type === "Character" || - node.type === "CharacterSet" || - node.type === "CharacterClass" || - node.type === "ExpressionCharacterClass" || - node.type === "ClassStringDisjunction"); -} -class RegExpParserState { - constructor(options) { - var _a; - this._node = DUMMY_PATTERN; - this._expressionBufferMap = new Map(); - this._flags = DUMMY_FLAGS; - this._backreferences = []; - this._capturingGroups = []; - this.source = ""; - this.strict = Boolean(options === null || options === void 0 ? void 0 : options.strict); - this.ecmaVersion = (_a = options === null || options === void 0 ? void 0 : options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; - } - 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; - } - onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, unicodeSets, }) { - this._flags = { - type: "Flags", - parent: null, - start, - end, - raw: this.source.slice(start, end), - global, - ignoreCase, - multiline, - unicode, - sticky, - dotAll, - hasIndices, - unicodeSets, - }; - } - 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 groups = typeof ref === "number" - ? [this._capturingGroups[ref - 1]] - : this._capturingGroups.filter((g) => g.name === ref); - if (groups.length === 1) { - const group = groups[0]; - reference.ambiguous = false; - reference.resolved = group; - } - else { - reference.ambiguous = true; - reference.resolved = groups; - } - for (const group of groups) { - 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"); - } - const group = { - type: "Group", - parent, - start, - end: start, - raw: "", - modifiers: null, - alternatives: [], - }; - this._node = group; - 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; - } - onModifiersEnter(start) { - const parent = this._node; - if (parent.type !== "Group") { - throw new Error("UnknownError"); - } - this._node = { - type: "Modifiers", - parent, - start, - end: start, - raw: "", - add: null, - remove: null, - }; - parent.modifiers = this._node; - } - onModifiersLeave(start, end) { - const node = this._node; - if (node.type !== "Modifiers" || node.parent.type !== "Group") { - throw new Error("UnknownError"); - } - node.end = end; - node.raw = this.source.slice(start, end); - this._node = node.parent; - } - onAddModifiers(start, end, { ignoreCase, multiline, dotAll, }) { - const parent = this._node; - if (parent.type !== "Modifiers") { - throw new Error("UnknownError"); - } - parent.add = { - type: "ModifierFlags", - parent, - start, - end, - raw: this.source.slice(start, end), - ignoreCase, - multiline, - dotAll, - }; - } - onRemoveModifiers(start, end, { ignoreCase, multiline, dotAll, }) { - const parent = this._node; - if (parent.type !== "Modifiers") { - throw new Error("UnknownError"); - } - parent.remove = { - type: "ModifierFlags", - parent, - start, - end, - raw: this.source.slice(start, end), - ignoreCase, - multiline, - dotAll, - }; - } - 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, strings) { - const parent = this._node; - if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { - throw new Error("UnknownError"); - } - const base = { - type: "CharacterSet", - parent: null, - start, - end, - raw: this.source.slice(start, end), - kind, - strings: null, - key, - }; - if (strings) { - if ((parent.type === "CharacterClass" && !parent.unicodeSets) || - negate || - value !== null) { - throw new Error("UnknownError"); - } - parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); - } - else { - parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); - } - } - onCharacter(start, end, value) { - const parent = this._node; - if (parent.type !== "Alternative" && - parent.type !== "CharacterClass" && - parent.type !== "StringAlternative") { - 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, - ambiguous: false, - resolved: DUMMY_CAPTURING_GROUP, - }; - parent.elements.push(node); - this._backreferences.push(node); - } - onCharacterClassEnter(start, negate, unicodeSets) { - const parent = this._node; - const base = { - type: "CharacterClass", - parent, - start, - end: start, - raw: "", - unicodeSets, - negate, - elements: [], - }; - if (parent.type === "Alternative") { - const node = Object.assign(Object.assign({}, base), { parent }); - this._node = node; - parent.elements.push(node); - } - else if (parent.type === "CharacterClass" && - parent.unicodeSets && - unicodeSets) { - const node = Object.assign(Object.assign({}, base), { parent, - unicodeSets }); - this._node = node; - parent.elements.push(node); - } - else { - throw new Error("UnknownError"); - } - } - onCharacterClassLeave(start, end) { - const node = this._node; - if (node.type !== "CharacterClass" || - (node.parent.type !== "Alternative" && - node.parent.type !== "CharacterClass")) { - throw new Error("UnknownError"); - } - const parent = node.parent; - node.end = end; - node.raw = this.source.slice(start, end); - this._node = parent; - const expression = this._expressionBufferMap.get(node); - if (!expression) { - return; - } - if (node.elements.length > 0) { - throw new Error("UnknownError"); - } - this._expressionBufferMap.delete(node); - const newNode = { - type: "ExpressionCharacterClass", - parent, - start: node.start, - end: node.end, - raw: node.raw, - negate: node.negate, - expression, - }; - expression.parent = newNode; - if (node !== parent.elements.pop()) { - throw new Error("UnknownError"); - } - parent.elements.push(newNode); - } - onCharacterClassRange(start, end) { - const parent = this._node; - if (parent.type !== "CharacterClass") { - throw new Error("UnknownError"); - } - const elements = parent.elements; - const max = elements.pop(); - if (!max || max.type !== "Character") { - throw new Error("UnknownError"); - } - if (!parent.unicodeSets) { - const hyphen = elements.pop(); - if (!hyphen || - hyphen.type !== "Character" || - hyphen.value !== HYPHEN_MINUS) { - throw new Error("UnknownError"); - } - } - const min = elements.pop(); - if (!min || min.type !== "Character") { - 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); - } - onClassIntersection(start, end) { - var _a; - const parent = this._node; - if (parent.type !== "CharacterClass" || !parent.unicodeSets) { - throw new Error("UnknownError"); - } - const right = parent.elements.pop(); - const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); - if (!left || - !right || - left.type === "ClassSubtraction" || - (left.type !== "ClassIntersection" && !isClassSetOperand(left)) || - !isClassSetOperand(right)) { - throw new Error("UnknownError"); - } - const node = { - type: "ClassIntersection", - parent: parent, - start, - end, - raw: this.source.slice(start, end), - left, - right, - }; - left.parent = node; - right.parent = node; - this._expressionBufferMap.set(parent, node); - } - onClassSubtraction(start, end) { - var _a; - const parent = this._node; - if (parent.type !== "CharacterClass" || !parent.unicodeSets) { - throw new Error("UnknownError"); - } - const right = parent.elements.pop(); - const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); - if (!left || - !right || - left.type === "ClassIntersection" || - (left.type !== "ClassSubtraction" && !isClassSetOperand(left)) || - !isClassSetOperand(right)) { - throw new Error("UnknownError"); - } - const node = { - type: "ClassSubtraction", - parent: parent, - start, - end, - raw: this.source.slice(start, end), - left, - right, - }; - left.parent = node; - right.parent = node; - this._expressionBufferMap.set(parent, node); - } - onClassStringDisjunctionEnter(start) { - const parent = this._node; - if (parent.type !== "CharacterClass" || !parent.unicodeSets) { - throw new Error("UnknownError"); - } - this._node = { - type: "ClassStringDisjunction", - parent, - start, - end: start, - raw: "", - alternatives: [], - }; - parent.elements.push(this._node); - } - onClassStringDisjunctionLeave(start, end) { - const node = this._node; - if (node.type !== "ClassStringDisjunction" || - node.parent.type !== "CharacterClass") { - throw new Error("UnknownError"); - } - node.end = end; - node.raw = this.source.slice(start, end); - this._node = node.parent; - } - onStringAlternativeEnter(start) { - const parent = this._node; - if (parent.type !== "ClassStringDisjunction") { - throw new Error("UnknownError"); - } - this._node = { - type: "StringAlternative", - parent, - start, - end: start, - raw: "", - elements: [], - }; - parent.alternatives.push(this._node); - } - onStringAlternativeLeave(start, end) { - const node = this._node; - if (node.type !== "StringAlternative") { - throw new Error("UnknownError"); - } - node.end = end; - node.raw = this.source.slice(start, end); - this._node = node.parent; - } -} -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, uFlagOrFlags = undefined) { - this._state.source = source; - this._validator.validatePattern(source, start, end, uFlagOrFlags); - 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 "ClassIntersection": - this.visitClassIntersection(node); - break; - case "ClassStringDisjunction": - this.visitClassStringDisjunction(node); - break; - case "ClassSubtraction": - this.visitClassSubtraction(node); - break; - case "ExpressionCharacterClass": - this.visitExpressionCharacterClass(node); - break; - case "Flags": - this.visitFlags(node); - break; - case "Group": - this.visitGroup(node); - break; - case "Modifiers": - this.visitModifiers(node); - break; - case "ModifierFlags": - this.visitModifierFlags(node); - break; - case "Pattern": - this.visitPattern(node); - break; - case "Quantifier": - this.visitQuantifier(node); - break; - case "RegExpLiteral": - this.visitRegExpLiteral(node); - break; - case "StringAlternative": - this.visitStringAlternative(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); - } - } - visitClassIntersection(node) { - if (this._handlers.onClassIntersectionEnter) { - this._handlers.onClassIntersectionEnter(node); - } - this.visit(node.left); - this.visit(node.right); - if (this._handlers.onClassIntersectionLeave) { - this._handlers.onClassIntersectionLeave(node); - } - } - visitClassStringDisjunction(node) { - if (this._handlers.onClassStringDisjunctionEnter) { - this._handlers.onClassStringDisjunctionEnter(node); - } - node.alternatives.forEach(this.visit, this); - if (this._handlers.onClassStringDisjunctionLeave) { - this._handlers.onClassStringDisjunctionLeave(node); - } - } - visitClassSubtraction(node) { - if (this._handlers.onClassSubtractionEnter) { - this._handlers.onClassSubtractionEnter(node); - } - this.visit(node.left); - this.visit(node.right); - if (this._handlers.onClassSubtractionLeave) { - this._handlers.onClassSubtractionLeave(node); - } - } - visitExpressionCharacterClass(node) { - if (this._handlers.onExpressionCharacterClassEnter) { - this._handlers.onExpressionCharacterClassEnter(node); - } - this.visit(node.expression); - if (this._handlers.onExpressionCharacterClassLeave) { - this._handlers.onExpressionCharacterClassLeave(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); - } - if (node.modifiers) { - this.visit(node.modifiers); - } - node.alternatives.forEach(this.visit, this); - if (this._handlers.onGroupLeave) { - this._handlers.onGroupLeave(node); - } - } - visitModifiers(node) { - if (this._handlers.onModifiersEnter) { - this._handlers.onModifiersEnter(node); - } - if (node.add) { - this.visit(node.add); - } - if (node.remove) { - this.visit(node.remove); - } - if (this._handlers.onModifiersLeave) { - this._handlers.onModifiersLeave(node); - } - } - visitModifierFlags(node) { - if (this._handlers.onModifierFlagsEnter) { - this._handlers.onModifierFlagsEnter(node); - } - if (this._handlers.onModifierFlagsLeave) { - this._handlers.onModifierFlagsLeave(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); - } - } - visitStringAlternative(node) { - if (this._handlers.onStringAlternativeEnter) { - this._handlers.onStringAlternativeEnter(node); - } - node.elements.forEach(this.visit, this); - if (this._handlers.onStringAlternativeLeave) { - this._handlers.onStringAlternativeLeave(node); - } - } -} - -function parseRegExpLiteral(source, options) { - return new RegExpParser(options).parseLiteral(String(source)); -} -function validateRegExpLiteral(source, options) { - new RegExpValidator(options).validateLiteral(source); -} -function visitRegExpAST(node, handlers) { - new RegExpVisitor(handlers).visit(node); -} - -exports.AST = ast; -exports.RegExpParser = RegExpParser; -exports.RegExpSyntaxError = RegExpSyntaxError; -exports.RegExpValidator = RegExpValidator; -exports.parseRegExpLiteral = parseRegExpLiteral; -exports.validateRegExpLiteral = validateRegExpLiteral; -exports.visitRegExpAST = visitRegExpAST; -//# sourceMappingURL=index.js.map diff --git a/node_modules/@eslint-community/regexpp/index.js.map b/node_modules/@eslint-community/regexpp/index.js.map deleted file mode 100644 index a13b289..0000000 --- a/node_modules/@eslint-community/regexpp/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js.map","sources":[".temp/src/ecma-versions.ts",".temp/unicode/src/unicode/ids.ts",".temp/unicode/src/unicode/properties.ts",".temp/unicode/src/unicode/index.ts",".temp/src/group-specifiers.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":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;;;AAaO,MAAM,iBAAiB,GAAG,IAAI;;ACTrC,IAAI,kBAAkB,GAAyB,SAAS,CAAA;AACxD,IAAI,qBAAqB,GAAyB,SAAS,CAAA;AAErD,SAAU,SAAS,CAAC,EAAU,EAAA;IAChC,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CA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;AAOe,SAAA,qBAAqB,CACjC,MAAc,EACd,OAAiC,EAAA;IAEjC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;AACxD,CAAC;AAEe,SAAA,cAAc,CAC1B,IAAc,EACd,QAAgC,EAAA;IAEhC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC3C;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/regexpp/index.mjs b/node_modules/@eslint-community/regexpp/index.mjs deleted file mode 100644 index 7652c62..0000000 --- a/node_modules/@eslint-community/regexpp/index.mjs +++ /dev/null @@ -1,3027 +0,0 @@ -var ast = /*#__PURE__*/Object.freeze({ - __proto__: null -}); - -const latestEcmaVersion = 2025; - -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 !== null && largeIdStartRanges !== void 0 ? largeIdStartRanges : (largeIdStartRanges = initLargeIdStartRanges())); -} -function isLargeIdContinue(cp) { - return isInRange(cp, largeIdContinueRanges !== null && largeIdContinueRanges !== void 0 ? 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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 8 8 4 3 4 5 2d 5 4 2 2h 2 3 6 16 2 2l i v 1d f e9 533 1t h3g 1w 19 3 7g 4 f b 1 l 1a h u 3 27 14 8 3 2u 3 1u 3 1 2 0 2 7 m f 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 d a 2 e 2 6 2 1 2 a 2 e 2 6 2 1 4 1f d 8m a l b 7 p 5 2 15 2 8 1y 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 13 r a m 6z 15 7 1 h 2 1o s b 0 9 l 17 h 1b k s m d 1g 1m 1 3 0 e 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 k 1 1s 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 v 9 2 0 3 0 2 11 2 0 q 0 2 0 19 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 12 6 56 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 j 20 5k w w 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 g 0 2 c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i 8 3 2a 0 c 1 f58 1 382 9 ef 19 3 m f3 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 2t 0 4h 6 a 9 9x 0 1q d dv d 6t 1 2 9 k6 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, raw2022, raw2023, raw2024, raw2025) { - this._raw2018 = raw2018; - this._raw2019 = raw2019; - this._raw2020 = raw2020; - this._raw2021 = raw2021; - this._raw2022 = raw2022; - this._raw2023 = raw2023; - this._raw2024 = raw2024; - this._raw2025 = raw2025; - } - get es2018() { - var _a; - return ((_a = this._set2018) !== null && _a !== void 0 ? _a : (this._set2018 = new Set(this._raw2018.split(" ")))); - } - get es2019() { - var _a; - return ((_a = this._set2019) !== null && _a !== void 0 ? _a : (this._set2019 = new Set(this._raw2019.split(" ")))); - } - get es2020() { - var _a; - return ((_a = this._set2020) !== null && _a !== void 0 ? _a : (this._set2020 = new Set(this._raw2020.split(" ")))); - } - get es2021() { - var _a; - return ((_a = this._set2021) !== null && _a !== void 0 ? _a : (this._set2021 = new Set(this._raw2021.split(" ")))); - } - get es2022() { - var _a; - return ((_a = this._set2022) !== null && _a !== void 0 ? _a : (this._set2022 = new Set(this._raw2022.split(" ")))); - } - get es2023() { - var _a; - return ((_a = this._set2023) !== null && _a !== void 0 ? _a : (this._set2023 = new Set(this._raw2023.split(" ")))); - } - get es2024() { - var _a; - return ((_a = this._set2024) !== null && _a !== void 0 ? _a : (this._set2024 = new Set(this._raw2024.split(" ")))); - } - get es2025() { - var _a; - return ((_a = this._set2025) !== null && _a !== void 0 ? _a : (this._set2025 = new Set(this._raw2025.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", "Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi", "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz", "", ""); -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", "", "", "", ""); -const binPropertyOfStringsSets = new DataSet("", "", "", "", "", "", "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji RGI_Emoji_Flag_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence", ""); -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)) || - (version >= 2022 && scValueSets.es2022.has(value)) || - (version >= 2023 && scValueSets.es2023.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))); -} -function isValidLoneUnicodePropertyOfString(version, value) { - return version >= 2024 && binPropertyOfStringsSets.es2024.has(value); -} - -const BACKSPACE = 0x08; -const CHARACTER_TABULATION = 0x09; -const LINE_FEED = 0x0a; -const LINE_TABULATION = 0x0b; -const FORM_FEED = 0x0c; -const CARRIAGE_RETURN = 0x0d; -const EXCLAMATION_MARK = 0x21; -const NUMBER_SIGN = 0x23; -const DOLLAR_SIGN = 0x24; -const PERCENT_SIGN = 0x25; -const AMPERSAND = 0x26; -const LEFT_PARENTHESIS = 0x28; -const RIGHT_PARENTHESIS = 0x29; -const ASTERISK = 0x2a; -const PLUS_SIGN = 0x2b; -const COMMA = 0x2c; -const HYPHEN_MINUS = 0x2d; -const FULL_STOP = 0x2e; -const SOLIDUS = 0x2f; -const DIGIT_ZERO = 0x30; -const DIGIT_ONE = 0x31; -const DIGIT_SEVEN = 0x37; -const DIGIT_NINE = 0x39; -const COLON = 0x3a; -const SEMICOLON = 0x3b; -const LESS_THAN_SIGN = 0x3c; -const EQUALS_SIGN = 0x3d; -const GREATER_THAN_SIGN = 0x3e; -const QUESTION_MARK = 0x3f; -const COMMERCIAL_AT = 0x40; -const LATIN_CAPITAL_LETTER_A = 0x41; -const LATIN_CAPITAL_LETTER_B = 0x42; -const LATIN_CAPITAL_LETTER_D = 0x44; -const LATIN_CAPITAL_LETTER_F = 0x46; -const LATIN_CAPITAL_LETTER_P = 0x50; -const LATIN_CAPITAL_LETTER_S = 0x53; -const LATIN_CAPITAL_LETTER_W = 0x57; -const LATIN_CAPITAL_LETTER_Z = 0x5a; -const LOW_LINE = 0x5f; -const LATIN_SMALL_LETTER_A = 0x61; -const LATIN_SMALL_LETTER_B = 0x62; -const LATIN_SMALL_LETTER_C = 0x63; -const LATIN_SMALL_LETTER_D = 0x64; -const LATIN_SMALL_LETTER_F = 0x66; -const LATIN_SMALL_LETTER_G = 0x67; -const LATIN_SMALL_LETTER_I = 0x69; -const LATIN_SMALL_LETTER_K = 0x6b; -const LATIN_SMALL_LETTER_M = 0x6d; -const LATIN_SMALL_LETTER_N = 0x6e; -const LATIN_SMALL_LETTER_P = 0x70; -const LATIN_SMALL_LETTER_Q = 0x71; -const LATIN_SMALL_LETTER_R = 0x72; -const LATIN_SMALL_LETTER_S = 0x73; -const LATIN_SMALL_LETTER_T = 0x74; -const LATIN_SMALL_LETTER_U = 0x75; -const LATIN_SMALL_LETTER_V = 0x76; -const LATIN_SMALL_LETTER_W = 0x77; -const LATIN_SMALL_LETTER_X = 0x78; -const LATIN_SMALL_LETTER_Y = 0x79; -const LATIN_SMALL_LETTER_Z = 0x7a; -const LEFT_SQUARE_BRACKET = 0x5b; -const REVERSE_SOLIDUS = 0x5c; -const RIGHT_SQUARE_BRACKET = 0x5d; -const CIRCUMFLEX_ACCENT = 0x5e; -const GRAVE_ACCENT = 0x60; -const LEFT_CURLY_BRACKET = 0x7b; -const VERTICAL_LINE = 0x7c; -const RIGHT_CURLY_BRACKET = 0x7d; -const TILDE = 0x7e; -const ZERO_WIDTH_NON_JOINER = 0x200c; -const ZERO_WIDTH_JOINER = 0x200d; -const LINE_SEPARATOR = 0x2028; -const PARAGRAPH_SEPARATOR = 0x2029; -const MIN_CODE_POINT = 0x00; -const MAX_CODE_POINT = 0x10ffff; -function isLatinLetter(code) { - return ((code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_Z) || - (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_Z)); -} -function isDecimalDigit(code) { - return code >= DIGIT_ZERO && code <= DIGIT_NINE; -} -function isOctalDigit(code) { - return code >= DIGIT_ZERO && code <= DIGIT_SEVEN; -} -function isHexDigit(code) { - return ((code >= DIGIT_ZERO && code <= DIGIT_NINE) || - (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) || - (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F)); -} -function isLineTerminator(code) { - return (code === LINE_FEED || - code === CARRIAGE_RETURN || - code === LINE_SEPARATOR || - code === PARAGRAPH_SEPARATOR); -} -function isValidUnicode(code) { - return code >= MIN_CODE_POINT && code <= MAX_CODE_POINT; -} -function digitToInt(code) { - if (code >= LATIN_SMALL_LETTER_A && code <= LATIN_SMALL_LETTER_F) { - return code - LATIN_SMALL_LETTER_A + 10; - } - if (code >= LATIN_CAPITAL_LETTER_A && code <= LATIN_CAPITAL_LETTER_F) { - return code - LATIN_CAPITAL_LETTER_A + 10; - } - return code - DIGIT_ZERO; -} -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; -} - -class GroupSpecifiersAsES2018 { - constructor() { - this.groupName = new Set(); - } - clear() { - this.groupName.clear(); - } - isEmpty() { - return !this.groupName.size; - } - hasInPattern(name) { - return this.groupName.has(name); - } - hasInScope(name) { - return this.hasInPattern(name); - } - addToScope(name) { - this.groupName.add(name); - } - enterDisjunction() { - } - enterAlternative() { - } - leaveDisjunction() { - } -} -class BranchID { - constructor(parent, base) { - this.parent = parent; - this.base = base !== null && base !== void 0 ? base : this; - } - separatedFrom(other) { - var _a, _b; - if (this.base === other.base && this !== other) { - return true; - } - if (other.parent && this.separatedFrom(other.parent)) { - return true; - } - return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false; - } - child() { - return new BranchID(this, null); - } - sibling() { - return new BranchID(this.parent, this.base); - } -} -class GroupSpecifiersAsES2025 { - constructor() { - this.branchID = new BranchID(null, null); - this.groupNames = new Map(); - } - clear() { - this.branchID = new BranchID(null, null); - this.groupNames.clear(); - } - isEmpty() { - return !this.groupNames.size; - } - enterDisjunction() { - this.branchID = this.branchID.child(); - } - enterAlternative(index) { - if (index === 0) { - return; - } - this.branchID = this.branchID.sibling(); - } - leaveDisjunction() { - this.branchID = this.branchID.parent; - } - hasInPattern(name) { - return this.groupNames.has(name); - } - hasInScope(name) { - const branches = this.groupNames.get(name); - if (!branches) { - return false; - } - for (const branch of branches) { - if (!branch.separatedFrom(this.branchID)) { - return true; - } - } - return false; - } - addToScope(name) { - const branches = this.groupNames.get(name); - if (branches) { - branches.push(this.branchID); - return; - } - this.groupNames.set(name, [this.branchID]); - } -} - -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(message, index) { - super(message); - this.index = index; - } -} -function newRegExpSyntaxError(srcCtx, flags, index, message) { - let source = ""; - if (srcCtx.kind === "literal") { - const literal = srcCtx.source.slice(srcCtx.start, srcCtx.end); - if (literal) { - source = `: ${literal}`; - } - } - else if (srcCtx.kind === "pattern") { - const pattern = srcCtx.source.slice(srcCtx.start, srcCtx.end); - const flagsText = `${flags.unicode ? "u" : ""}${flags.unicodeSets ? "v" : ""}`; - source = `: /${pattern}/${flagsText}`; - } - return new RegExpSyntaxError(`Invalid regular expression${source}: ${message}`, index); -} - -const SYNTAX_CHARACTER = new Set([ - CIRCUMFLEX_ACCENT, - DOLLAR_SIGN, - REVERSE_SOLIDUS, - FULL_STOP, - ASTERISK, - PLUS_SIGN, - QUESTION_MARK, - LEFT_PARENTHESIS, - RIGHT_PARENTHESIS, - LEFT_SQUARE_BRACKET, - RIGHT_SQUARE_BRACKET, - LEFT_CURLY_BRACKET, - RIGHT_CURLY_BRACKET, - VERTICAL_LINE, -]); -const CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER = new Set([ - AMPERSAND, - EXCLAMATION_MARK, - NUMBER_SIGN, - DOLLAR_SIGN, - PERCENT_SIGN, - ASTERISK, - PLUS_SIGN, - COMMA, - FULL_STOP, - COLON, - SEMICOLON, - LESS_THAN_SIGN, - EQUALS_SIGN, - GREATER_THAN_SIGN, - QUESTION_MARK, - COMMERCIAL_AT, - CIRCUMFLEX_ACCENT, - GRAVE_ACCENT, - TILDE, -]); -const CLASS_SET_SYNTAX_CHARACTER = new Set([ - LEFT_PARENTHESIS, - RIGHT_PARENTHESIS, - LEFT_SQUARE_BRACKET, - RIGHT_SQUARE_BRACKET, - LEFT_CURLY_BRACKET, - RIGHT_CURLY_BRACKET, - SOLIDUS, - HYPHEN_MINUS, - REVERSE_SOLIDUS, - VERTICAL_LINE, -]); -const CLASS_SET_RESERVED_PUNCTUATOR = new Set([ - AMPERSAND, - HYPHEN_MINUS, - EXCLAMATION_MARK, - NUMBER_SIGN, - PERCENT_SIGN, - COMMA, - COLON, - SEMICOLON, - LESS_THAN_SIGN, - EQUALS_SIGN, - GREATER_THAN_SIGN, - COMMERCIAL_AT, - GRAVE_ACCENT, - TILDE, -]); -const FLAG_PROP_TO_CODEPOINT = { - global: LATIN_SMALL_LETTER_G, - ignoreCase: LATIN_SMALL_LETTER_I, - multiline: LATIN_SMALL_LETTER_M, - unicode: LATIN_SMALL_LETTER_U, - sticky: LATIN_SMALL_LETTER_Y, - dotAll: LATIN_SMALL_LETTER_S, - hasIndices: LATIN_SMALL_LETTER_D, - unicodeSets: LATIN_SMALL_LETTER_V, -}; -const FLAG_CODEPOINT_TO_PROP = Object.fromEntries(Object.entries(FLAG_PROP_TO_CODEPOINT).map(([k, v]) => [v, k])); -function isSyntaxCharacter(cp) { - return SYNTAX_CHARACTER.has(cp); -} -function isClassSetReservedDoublePunctuatorCharacter(cp) { - return CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR_CHARACTER.has(cp); -} -function isClassSetSyntaxCharacter(cp) { - return CLASS_SET_SYNTAX_CHARACTER.has(cp); -} -function isClassSetReservedPunctuator(cp) { - return CLASS_SET_RESERVED_PUNCTUATOR.has(cp); -} -function isIdentifierStartChar(cp) { - return isIdStart(cp) || cp === DOLLAR_SIGN || cp === LOW_LINE; -} -function isIdentifierPartChar(cp) { - return (isIdContinue(cp) || - cp === DOLLAR_SIGN || - cp === ZERO_WIDTH_NON_JOINER || - cp === ZERO_WIDTH_JOINER); -} -function isUnicodePropertyNameCharacter(cp) { - return isLatinLetter(cp) || cp === LOW_LINE; -} -function isUnicodePropertyValueCharacter(cp) { - return isUnicodePropertyNameCharacter(cp) || isDecimalDigit(cp); -} -function isRegularExpressionModifier(ch) { - return (ch === LATIN_SMALL_LETTER_I || - ch === LATIN_SMALL_LETTER_M || - ch === LATIN_SMALL_LETTER_S); -} -class RegExpValidator { - constructor(options) { - this._reader = new Reader(); - this._unicodeMode = false; - this._unicodeSetsMode = false; - this._nFlag = false; - this._lastIntValue = 0; - this._lastRange = { - min: 0, - max: Number.POSITIVE_INFINITY, - }; - this._lastStrValue = ""; - this._lastAssertionIsQuantifiable = false; - this._numCapturingParens = 0; - this._backreferenceNames = new Set(); - this._srcCtx = null; - this._options = options !== null && options !== void 0 ? options : {}; - this._groupSpecifiers = - this.ecmaVersion >= 2025 - ? new GroupSpecifiersAsES2025() - : new GroupSpecifiersAsES2018(); - } - validateLiteral(source, start = 0, end = source.length) { - this._srcCtx = { source, start, end, kind: "literal" }; - this._unicodeSetsMode = this._unicodeMode = 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 unicode = source.includes("u", flagStart); - const unicodeSets = source.includes("v", flagStart); - this.validateFlagsInternal(source, flagStart, end); - this.validatePatternInternal(source, start + 1, flagStart - 1, { - unicode, - unicodeSets, - }); - } - 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) { - this._srcCtx = { source, start, end, kind: "flags" }; - this.validateFlagsInternal(source, start, end); - } - validatePattern(source, start = 0, end = source.length, uFlagOrFlags = undefined) { - this._srcCtx = { source, start, end, kind: "pattern" }; - this.validatePatternInternal(source, start, end, uFlagOrFlags); - } - validatePatternInternal(source, start = 0, end = source.length, uFlagOrFlags = undefined) { - const mode = this._parseFlagsOptionToMode(uFlagOrFlags, end); - this._unicodeMode = mode.unicodeMode; - this._nFlag = mode.nFlag; - this._unicodeSetsMode = mode.unicodeSetsMode; - this.reset(source, start, end); - this.consumePattern(); - if (!this._nFlag && - this.ecmaVersion >= 2018 && - !this._groupSpecifiers.isEmpty()) { - this._nFlag = true; - this.rewind(start); - this.consumePattern(); - } - } - validateFlagsInternal(source, start, end) { - const flags = this.parseFlags(source, start, end); - this.onRegExpFlags(start, end, flags); - } - _parseFlagsOptionToMode(uFlagOrFlags, sourceEnd) { - let unicode = false; - let unicodeSets = false; - if (uFlagOrFlags && this.ecmaVersion >= 2015) { - if (typeof uFlagOrFlags === "object") { - unicode = Boolean(uFlagOrFlags.unicode); - if (this.ecmaVersion >= 2024) { - unicodeSets = Boolean(uFlagOrFlags.unicodeSets); - } - } - else { - unicode = uFlagOrFlags; - } - } - if (unicode && unicodeSets) { - this.raise("Invalid regular expression flags", { - index: sourceEnd + 1, - unicode, - unicodeSets, - }); - } - const unicodeMode = unicode || unicodeSets; - const nFlag = (unicode && this.ecmaVersion >= 2018) || - unicodeSets || - Boolean(this._options.strict && this.ecmaVersion >= 2023); - const unicodeSetsMode = unicodeSets; - return { unicodeMode, nFlag, unicodeSetsMode }; - } - get strict() { - return Boolean(this._options.strict) || this._unicodeMode; - } - get ecmaVersion() { - var _a; - return (_a = this._options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; - } - onLiteralEnter(start) { - if (this._options.onLiteralEnter) { - this._options.onLiteralEnter(start); - } - } - onLiteralLeave(start, end) { - if (this._options.onLiteralLeave) { - this._options.onLiteralLeave(start, end); - } - } - onRegExpFlags(start, end, flags) { - if (this._options.onRegExpFlags) { - this._options.onRegExpFlags(start, end, flags); - } - if (this._options.onFlags) { - this._options.onFlags(start, end, flags.global, flags.ignoreCase, flags.multiline, flags.unicode, flags.sticky, flags.dotAll, flags.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); - } - } - onModifiersEnter(start) { - if (this._options.onModifiersEnter) { - this._options.onModifiersEnter(start); - } - } - onModifiersLeave(start, end) { - if (this._options.onModifiersLeave) { - this._options.onModifiersLeave(start, end); - } - } - onAddModifiers(start, end, flags) { - if (this._options.onAddModifiers) { - this._options.onAddModifiers(start, end, flags); - } - } - onRemoveModifiers(start, end, flags) { - if (this._options.onRemoveModifiers) { - this._options.onRemoveModifiers(start, end, flags); - } - } - 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, strings) { - if (this._options.onUnicodePropertyCharacterSet) { - this._options.onUnicodePropertyCharacterSet(start, end, kind, key, value, negate, strings); - } - } - 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, unicodeSets) { - if (this._options.onCharacterClassEnter) { - this._options.onCharacterClassEnter(start, negate, unicodeSets); - } - } - 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); - } - } - onClassIntersection(start, end) { - if (this._options.onClassIntersection) { - this._options.onClassIntersection(start, end); - } - } - onClassSubtraction(start, end) { - if (this._options.onClassSubtraction) { - this._options.onClassSubtraction(start, end); - } - } - onClassStringDisjunctionEnter(start) { - if (this._options.onClassStringDisjunctionEnter) { - this._options.onClassStringDisjunctionEnter(start); - } - } - onClassStringDisjunctionLeave(start, end) { - if (this._options.onClassStringDisjunctionLeave) { - this._options.onClassStringDisjunctionLeave(start, end); - } - } - onStringAlternativeEnter(start, index) { - if (this._options.onStringAlternativeEnter) { - this._options.onStringAlternativeEnter(start, index); - } - } - onStringAlternativeLeave(start, end, index) { - if (this._options.onStringAlternativeLeave) { - this._options.onStringAlternativeLeave(start, end, index); - } - } - 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._unicodeMode); - } - 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, context) { - var _a, _b, _c; - throw newRegExpSyntaxError(this._srcCtx, { - unicode: (_a = context === null || context === void 0 ? void 0 : context.unicode) !== null && _a !== void 0 ? _a : (this._unicodeMode && !this._unicodeSetsMode), - unicodeSets: (_b = context === null || context === void 0 ? void 0 : context.unicodeSets) !== null && _b !== void 0 ? _b : this._unicodeSetsMode, - }, (_c = context === null || context === void 0 ? void 0 : context.index) !== null && _c !== void 0 ? _c : 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 === REVERSE_SOLIDUS) { - escaped = true; - } - else if (cp === LEFT_SQUARE_BRACKET) { - inClass = true; - } - else if (cp === RIGHT_SQUARE_BRACKET) { - 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._groupSpecifiers.clear(); - this._backreferenceNames.clear(); - this.onPatternEnter(start); - this.consumeDisjunction(); - const cp = this.currentCodePoint; - if (this.currentCodePoint !== -1) { - if (cp === RIGHT_PARENTHESIS) { - this.raise("Unmatched ')'"); - } - if (cp === REVERSE_SOLIDUS) { - this.raise("\\ at end of pattern"); - } - if (cp === RIGHT_SQUARE_BRACKET || cp === RIGHT_CURLY_BRACKET) { - this.raise("Lone quantifier brackets"); - } - const c = String.fromCodePoint(cp); - this.raise(`Unexpected character '${c}'`); - } - for (const name of this._backreferenceNames) { - if (!this._groupSpecifiers.hasInPattern(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 === REVERSE_SOLIDUS) { - escaped = true; - } - else if (cp === LEFT_SQUARE_BRACKET) { - inClass = true; - } - else if (cp === RIGHT_SQUARE_BRACKET) { - inClass = false; - } - else if (cp === LEFT_PARENTHESIS && - !inClass && - (this.nextCodePoint !== QUESTION_MARK || - (this.nextCodePoint2 === LESS_THAN_SIGN && - this.nextCodePoint3 !== EQUALS_SIGN && - this.nextCodePoint3 !== EXCLAMATION_MARK))) { - count += 1; - } - this.advance(); - } - this.rewind(start); - return count; - } - consumeDisjunction() { - const start = this.index; - let i = 0; - this._groupSpecifiers.enterDisjunction(); - this.onDisjunctionEnter(start); - do { - this.consumeAlternative(i++); - } while (this.eat(VERTICAL_LINE)); - if (this.consumeQuantifier(true)) { - this.raise("Nothing to repeat"); - } - if (this.eat(LEFT_CURLY_BRACKET)) { - this.raise("Lone quantifier brackets"); - } - this.onDisjunctionLeave(start, this.index); - this._groupSpecifiers.leaveDisjunction(); - } - consumeAlternative(i) { - const start = this.index; - this._groupSpecifiers.enterAlternative(i); - this.onAlternativeEnter(start, i); - while (this.currentCodePoint !== -1 && this.consumeTerm()) { - } - this.onAlternativeLeave(start, this.index, i); - } - consumeTerm() { - if (this._unicodeMode || 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(CIRCUMFLEX_ACCENT)) { - this.onEdgeAssertion(start, this.index, "start"); - return true; - } - if (this.eat(DOLLAR_SIGN)) { - this.onEdgeAssertion(start, this.index, "end"); - return true; - } - if (this.eat2(REVERSE_SOLIDUS, LATIN_CAPITAL_LETTER_B)) { - this.onWordBoundaryAssertion(start, this.index, "word", true); - return true; - } - if (this.eat2(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_B)) { - this.onWordBoundaryAssertion(start, this.index, "word", false); - return true; - } - if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { - const lookbehind = this.ecmaVersion >= 2018 && this.eat(LESS_THAN_SIGN); - let negate = false; - if (this.eat(EQUALS_SIGN) || - (negate = this.eat(EXCLAMATION_MARK))) { - const kind = lookbehind ? "lookbehind" : "lookahead"; - this.onLookaroundAssertionEnter(start, kind, negate); - this.consumeDisjunction(); - if (!this.eat(RIGHT_PARENTHESIS)) { - 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(PLUS_SIGN)) { - min = 1; - max = Number.POSITIVE_INFINITY; - } - else if (this.eat(QUESTION_MARK)) { - min = 0; - max = 1; - } - else if (this.eatBracedQuantifier(noConsume)) { - ({ min, max } = this._lastRange); - } - else { - return false; - } - greedy = !this.eat(QUESTION_MARK); - if (!noConsume) { - this.onQuantifier(start, this.index, min, max, greedy); - } - return true; - } - eatBracedQuantifier(noError) { - const start = this.index; - if (this.eat(LEFT_CURLY_BRACKET)) { - if (this.eatDecimalDigits()) { - const min = this._lastIntValue; - let max = min; - if (this.eat(COMMA)) { - max = this.eatDecimalDigits() - ? this._lastIntValue - : Number.POSITIVE_INFINITY; - } - if (this.eat(RIGHT_CURLY_BRACKET)) { - if (!noError && max < min) { - this.raise("numbers out of order in {} quantifier"); - } - this._lastRange = { min, max }; - return true; - } - } - if (!noError && (this._unicodeMode || this.strict)) { - this.raise("Incomplete quantifier"); - } - this.rewind(start); - } - return false; - } - consumeAtom() { - return (this.consumePatternCharacter() || - this.consumeDot() || - this.consumeReverseSolidusAtomEscape() || - Boolean(this.consumeCharacterClass()) || - this.consumeCapturingGroup() || - this.consumeUncapturingGroup()); - } - consumeDot() { - if (this.eat(FULL_STOP)) { - this.onAnyCharacterSet(this.index - 1, this.index, "any"); - return true; - } - return false; - } - consumeReverseSolidusAtomEscape() { - const start = this.index; - if (this.eat(REVERSE_SOLIDUS)) { - if (this.consumeAtomEscape()) { - return true; - } - this.rewind(start); - } - return false; - } - consumeUncapturingGroup() { - const start = this.index; - if (this.eat2(LEFT_PARENTHESIS, QUESTION_MARK)) { - this.onGroupEnter(start); - if (this.ecmaVersion >= 2025) { - this.consumeModifiers(); - } - if (!this.eat(COLON)) { - this.rewind(start + 1); - this.raise("Invalid group"); - } - this.consumeDisjunction(); - if (!this.eat(RIGHT_PARENTHESIS)) { - this.raise("Unterminated group"); - } - this.onGroupLeave(start, this.index); - return true; - } - return false; - } - consumeModifiers() { - const start = this.index; - const hasAddModifiers = this.eatModifiers(); - const addModifiersEnd = this.index; - const hasHyphen = this.eat(HYPHEN_MINUS); - if (!hasAddModifiers && !hasHyphen) { - return false; - } - this.onModifiersEnter(start); - const addModifiers = this.parseModifiers(start, addModifiersEnd); - this.onAddModifiers(start, addModifiersEnd, addModifiers); - if (hasHyphen) { - const modifiersStart = this.index; - if (!this.eatModifiers() && - !hasAddModifiers && - this.currentCodePoint === COLON) { - this.raise("Invalid empty flags"); - } - const modifiers = this.parseModifiers(modifiersStart, this.index); - for (const [flagName] of Object.entries(modifiers).filter(([, enable]) => enable)) { - if (addModifiers[flagName]) { - this.raise(`Duplicated flag '${String.fromCodePoint(FLAG_PROP_TO_CODEPOINT[flagName])}'`); - } - } - this.onRemoveModifiers(modifiersStart, this.index, modifiers); - } - this.onModifiersLeave(start, this.index); - return true; - } - consumeCapturingGroup() { - const start = this.index; - if (this.eat(LEFT_PARENTHESIS)) { - let name = null; - if (this.ecmaVersion >= 2018) { - if (this.consumeGroupSpecifier()) { - name = this._lastStrValue; - } - else if (this.currentCodePoint === QUESTION_MARK) { - this.rewind(start); - return false; - } - } - else if (this.currentCodePoint === QUESTION_MARK) { - this.rewind(start); - return false; - } - this.onCapturingGroupEnter(start, name); - this.consumeDisjunction(); - if (!this.eat(RIGHT_PARENTHESIS)) { - this.raise("Unterminated group"); - } - this.onCapturingGroupLeave(start, this.index, name); - return true; - } - return false; - } - consumeExtendedAtom() { - return (this.consumeDot() || - this.consumeReverseSolidusAtomEscape() || - this.consumeReverseSolidusFollowedByC() || - Boolean(this.consumeCharacterClass()) || - this.consumeCapturingGroup() || - this.consumeUncapturingGroup() || - this.consumeInvalidBracedQuantifier() || - this.consumeExtendedPatternCharacter()); - } - consumeReverseSolidusFollowedByC() { - const start = this.index; - if (this.currentCodePoint === REVERSE_SOLIDUS && - this.nextCodePoint === LATIN_SMALL_LETTER_C) { - this._lastIntValue = this.currentCodePoint; - this.advance(); - this.onCharacter(start, this.index, REVERSE_SOLIDUS); - 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 !== CIRCUMFLEX_ACCENT && - cp !== DOLLAR_SIGN && - cp !== REVERSE_SOLIDUS && - cp !== FULL_STOP && - cp !== ASTERISK && - cp !== PLUS_SIGN && - cp !== QUESTION_MARK && - cp !== LEFT_PARENTHESIS && - cp !== RIGHT_PARENTHESIS && - cp !== LEFT_SQUARE_BRACKET && - cp !== VERTICAL_LINE) { - this.advance(); - this.onCharacter(start, this.index, cp); - return true; - } - return false; - } - consumeGroupSpecifier() { - const start = this.index; - if (this.eat(QUESTION_MARK)) { - if (this.eatGroupName()) { - if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) { - this._groupSpecifiers.addToScope(this._lastStrValue); - return true; - } - this.raise("Duplicate capture group name"); - } - this.rewind(start); - } - return false; - } - consumeAtomEscape() { - if (this.consumeBackreference() || - this.consumeCharacterClassEscape() || - this.consumeCharacterEscape() || - (this._nFlag && this.consumeKGroupName())) { - return true; - } - if (this.strict || this._unicodeMode) { - 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._unicodeMode) { - this.raise("Invalid escape"); - } - this.rewind(start); - } - return false; - } - consumeCharacterClassEscape() { - var _a; - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_D)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "digit", false); - return {}; - } - if (this.eat(LATIN_CAPITAL_LETTER_D)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "digit", true); - return {}; - } - if (this.eat(LATIN_SMALL_LETTER_S)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "space", false); - return {}; - } - if (this.eat(LATIN_CAPITAL_LETTER_S)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "space", true); - return {}; - } - if (this.eat(LATIN_SMALL_LETTER_W)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "word", false); - return {}; - } - if (this.eat(LATIN_CAPITAL_LETTER_W)) { - this._lastIntValue = -1; - this.onEscapeCharacterSet(start - 1, this.index, "word", true); - return {}; - } - let negate = false; - if (this._unicodeMode && - this.ecmaVersion >= 2018 && - (this.eat(LATIN_SMALL_LETTER_P) || - (negate = this.eat(LATIN_CAPITAL_LETTER_P)))) { - this._lastIntValue = -1; - let result = null; - if (this.eat(LEFT_CURLY_BRACKET) && - (result = this.eatUnicodePropertyValueExpression()) && - this.eat(RIGHT_CURLY_BRACKET)) { - if (negate && result.strings) { - this.raise("Invalid property name"); - } - this.onUnicodePropertyCharacterSet(start - 1, this.index, "property", result.key, result.value, negate, (_a = result.strings) !== null && _a !== void 0 ? _a : false); - return { mayContainStrings: result.strings }; - } - this.raise("Invalid property name"); - } - return null; - } - consumeCharacterEscape() { - const start = this.index; - if (this.eatControlEscape() || - this.eatCControlLetter() || - this.eatZero() || - this.eatHexEscapeSequence() || - this.eatRegExpUnicodeEscapeSequence() || - (!this.strict && - !this._unicodeMode && - this.eatLegacyOctalEscapeSequence()) || - this.eatIdentityEscape()) { - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - return false; - } - consumeKGroupName() { - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_K)) { - 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(LEFT_SQUARE_BRACKET)) { - const negate = this.eat(CIRCUMFLEX_ACCENT); - this.onCharacterClassEnter(start, negate, this._unicodeSetsMode); - const result = this.consumeClassContents(); - if (!this.eat(RIGHT_SQUARE_BRACKET)) { - if (this.currentCodePoint === -1) { - this.raise("Unterminated character class"); - } - this.raise("Invalid character in character class"); - } - if (negate && result.mayContainStrings) { - this.raise("Negated character class may contain strings"); - } - this.onCharacterClassLeave(start, this.index, negate); - return result; - } - return null; - } - consumeClassContents() { - if (this._unicodeSetsMode) { - if (this.currentCodePoint === RIGHT_SQUARE_BRACKET) { - return {}; - } - const result = this.consumeClassSetExpression(); - return result; - } - const strict = this.strict || this._unicodeMode; - for (;;) { - const rangeStart = this.index; - if (!this.consumeClassAtom()) { - break; - } - const min = this._lastIntValue; - if (!this.eat(HYPHEN_MINUS)) { - continue; - } - this.onCharacter(this.index - 1, this.index, HYPHEN_MINUS); - 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); - } - return {}; - } - consumeClassAtom() { - const start = this.index; - const cp = this.currentCodePoint; - if (cp !== -1 && - cp !== REVERSE_SOLIDUS && - cp !== RIGHT_SQUARE_BRACKET) { - this.advance(); - this._lastIntValue = cp; - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - if (this.eat(REVERSE_SOLIDUS)) { - if (this.consumeClassEscape()) { - return true; - } - if (!this.strict && - this.currentCodePoint === LATIN_SMALL_LETTER_C) { - this._lastIntValue = REVERSE_SOLIDUS; - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - if (this.strict || this._unicodeMode) { - this.raise("Invalid escape"); - } - this.rewind(start); - } - return false; - } - consumeClassEscape() { - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_B)) { - this._lastIntValue = BACKSPACE; - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - if (this._unicodeMode && this.eat(HYPHEN_MINUS)) { - this._lastIntValue = HYPHEN_MINUS; - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - let cp = 0; - if (!this.strict && - !this._unicodeMode && - this.currentCodePoint === LATIN_SMALL_LETTER_C && - (isDecimalDigit((cp = this.nextCodePoint)) || cp === LOW_LINE)) { - this.advance(); - this.advance(); - this._lastIntValue = cp % 0x20; - this.onCharacter(start - 1, this.index, this._lastIntValue); - return true; - } - return (Boolean(this.consumeCharacterClassEscape()) || - this.consumeCharacterEscape()); - } - consumeClassSetExpression() { - const start = this.index; - let mayContainStrings = false; - let result = null; - if (this.consumeClassSetCharacter()) { - if (this.consumeClassSetRangeFromOperator(start)) { - this.consumeClassUnionRight({}); - return {}; - } - mayContainStrings = false; - } - else if ((result = this.consumeClassSetOperand())) { - mayContainStrings = result.mayContainStrings; - } - else { - const cp = this.currentCodePoint; - if (cp === REVERSE_SOLIDUS) { - this.advance(); - this.raise("Invalid escape"); - } - if (cp === this.nextCodePoint && - isClassSetReservedDoublePunctuatorCharacter(cp)) { - this.raise("Invalid set operation in character class"); - } - this.raise("Invalid character in character class"); - } - if (this.eat2(AMPERSAND, AMPERSAND)) { - while (this.currentCodePoint !== AMPERSAND && - (result = this.consumeClassSetOperand())) { - this.onClassIntersection(start, this.index); - if (!result.mayContainStrings) { - mayContainStrings = false; - } - if (this.eat2(AMPERSAND, AMPERSAND)) { - continue; - } - return { mayContainStrings }; - } - this.raise("Invalid character in character class"); - } - if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { - while (this.consumeClassSetOperand()) { - this.onClassSubtraction(start, this.index); - if (this.eat2(HYPHEN_MINUS, HYPHEN_MINUS)) { - continue; - } - return { mayContainStrings }; - } - this.raise("Invalid character in character class"); - } - return this.consumeClassUnionRight({ mayContainStrings }); - } - consumeClassUnionRight(leftResult) { - let mayContainStrings = leftResult.mayContainStrings; - for (;;) { - const start = this.index; - if (this.consumeClassSetCharacter()) { - this.consumeClassSetRangeFromOperator(start); - continue; - } - const result = this.consumeClassSetOperand(); - if (result) { - if (result.mayContainStrings) { - mayContainStrings = true; - } - continue; - } - break; - } - return { mayContainStrings }; - } - consumeClassSetRangeFromOperator(start) { - const currentStart = this.index; - const min = this._lastIntValue; - if (this.eat(HYPHEN_MINUS)) { - if (this.consumeClassSetCharacter()) { - const max = this._lastIntValue; - if (min === -1 || max === -1) { - this.raise("Invalid character class"); - } - if (min > max) { - this.raise("Range out of order in character class"); - } - this.onCharacterClassRange(start, this.index, min, max); - return true; - } - this.rewind(currentStart); - } - return false; - } - consumeClassSetOperand() { - let result = null; - if ((result = this.consumeNestedClass())) { - return result; - } - if ((result = this.consumeClassStringDisjunction())) { - return result; - } - if (this.consumeClassSetCharacter()) { - return {}; - } - return null; - } - consumeNestedClass() { - const start = this.index; - if (this.eat(LEFT_SQUARE_BRACKET)) { - const negate = this.eat(CIRCUMFLEX_ACCENT); - this.onCharacterClassEnter(start, negate, true); - const result = this.consumeClassContents(); - if (!this.eat(RIGHT_SQUARE_BRACKET)) { - this.raise("Unterminated character class"); - } - if (negate && result.mayContainStrings) { - this.raise("Negated character class may contain strings"); - } - this.onCharacterClassLeave(start, this.index, negate); - return result; - } - if (this.eat(REVERSE_SOLIDUS)) { - const result = this.consumeCharacterClassEscape(); - if (result) { - return result; - } - this.rewind(start); - } - return null; - } - consumeClassStringDisjunction() { - const start = this.index; - if (this.eat3(REVERSE_SOLIDUS, LATIN_SMALL_LETTER_Q, LEFT_CURLY_BRACKET)) { - this.onClassStringDisjunctionEnter(start); - let i = 0; - let mayContainStrings = false; - do { - if (this.consumeClassString(i++).mayContainStrings) { - mayContainStrings = true; - } - } while (this.eat(VERTICAL_LINE)); - if (this.eat(RIGHT_CURLY_BRACKET)) { - this.onClassStringDisjunctionLeave(start, this.index); - return { mayContainStrings }; - } - this.raise("Unterminated class string disjunction"); - } - return null; - } - consumeClassString(i) { - const start = this.index; - let count = 0; - this.onStringAlternativeEnter(start, i); - while (this.currentCodePoint !== -1 && - this.consumeClassSetCharacter()) { - count++; - } - this.onStringAlternativeLeave(start, this.index, i); - return { mayContainStrings: count !== 1 }; - } - consumeClassSetCharacter() { - const start = this.index; - const cp = this.currentCodePoint; - if (cp !== this.nextCodePoint || - !isClassSetReservedDoublePunctuatorCharacter(cp)) { - if (cp !== -1 && !isClassSetSyntaxCharacter(cp)) { - this._lastIntValue = cp; - this.advance(); - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - } - if (this.eat(REVERSE_SOLIDUS)) { - if (this.consumeCharacterEscape()) { - return true; - } - if (isClassSetReservedPunctuator(this.currentCodePoint)) { - this._lastIntValue = this.currentCodePoint; - this.advance(); - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - if (this.eat(LATIN_SMALL_LETTER_B)) { - this._lastIntValue = BACKSPACE; - this.onCharacter(start, this.index, this._lastIntValue); - return true; - } - this.rewind(start); - } - return false; - } - eatGroupName() { - if (this.eat(LESS_THAN_SIGN)) { - if (this.eatRegExpIdentifierName() && this.eat(GREATER_THAN_SIGN)) { - 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._unicodeMode && this.ecmaVersion >= 2020; - let cp = this.currentCodePoint; - this.advance(); - if (cp === REVERSE_SOLIDUS && - this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { - cp = this._lastIntValue; - } - else if (forceUFlag && - isLeadSurrogate(cp) && - isTrailSurrogate(this.currentCodePoint)) { - cp = combineSurrogatePair(cp, this.currentCodePoint); - this.advance(); - } - if (isIdentifierStartChar(cp)) { - this._lastIntValue = cp; - return true; - } - if (this.index !== start) { - this.rewind(start); - } - return false; - } - eatRegExpIdentifierPart() { - const start = this.index; - const forceUFlag = !this._unicodeMode && this.ecmaVersion >= 2020; - let cp = this.currentCodePoint; - this.advance(); - if (cp === REVERSE_SOLIDUS && - this.eatRegExpUnicodeEscapeSequence(forceUFlag)) { - cp = this._lastIntValue; - } - else if (forceUFlag && - isLeadSurrogate(cp) && - isTrailSurrogate(this.currentCodePoint)) { - cp = combineSurrogatePair(cp, this.currentCodePoint); - this.advance(); - } - if (isIdentifierPartChar(cp)) { - this._lastIntValue = cp; - return true; - } - if (this.index !== start) { - this.rewind(start); - } - return false; - } - eatCControlLetter() { - const start = this.index; - if (this.eat(LATIN_SMALL_LETTER_C)) { - if (this.eatControlLetter()) { - return true; - } - this.rewind(start); - } - return false; - } - eatZero() { - if (this.currentCodePoint === DIGIT_ZERO && - !isDecimalDigit(this.nextCodePoint)) { - this._lastIntValue = 0; - this.advance(); - return true; - } - return false; - } - eatControlEscape() { - if (this.eat(LATIN_SMALL_LETTER_F)) { - this._lastIntValue = FORM_FEED; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_N)) { - this._lastIntValue = LINE_FEED; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_R)) { - this._lastIntValue = CARRIAGE_RETURN; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_T)) { - this._lastIntValue = CHARACTER_TABULATION; - return true; - } - if (this.eat(LATIN_SMALL_LETTER_V)) { - this._lastIntValue = LINE_TABULATION; - 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._unicodeMode; - if (this.eat(LATIN_SMALL_LETTER_U)) { - 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(REVERSE_SOLIDUS) && - this.eat(LATIN_SMALL_LETTER_U) && - 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(LEFT_CURLY_BRACKET) && - this.eatHexDigits() && - this.eat(RIGHT_CURLY_BRACKET) && - 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._unicodeMode) { - return isSyntaxCharacter(cp) || cp === SOLIDUS; - } - if (this.strict) { - return !isIdContinue(cp); - } - if (this._nFlag) { - return !(cp === LATIN_SMALL_LETTER_C || cp === LATIN_SMALL_LETTER_K); - } - return cp !== LATIN_SMALL_LETTER_C; - } - eatDecimalEscape() { - this._lastIntValue = 0; - let cp = this.currentCodePoint; - if (cp >= DIGIT_ONE && cp <= DIGIT_NINE) { - do { - this._lastIntValue = 10 * this._lastIntValue + (cp - DIGIT_ZERO); - this.advance(); - } while ((cp = this.currentCodePoint) >= DIGIT_ZERO && - cp <= DIGIT_NINE); - return true; - } - return false; - } - eatUnicodePropertyValueExpression() { - const start = this.index; - if (this.eatUnicodePropertyName() && this.eat(EQUALS_SIGN)) { - const key = this._lastStrValue; - if (this.eatUnicodePropertyValue()) { - const value = this._lastStrValue; - if (isValidUnicodeProperty(this.ecmaVersion, key, value)) { - return { - key, - value: value || null, - }; - } - this.raise("Invalid property name"); - } - } - this.rewind(start); - if (this.eatLoneUnicodePropertyNameOrValue()) { - const nameOrValue = this._lastStrValue; - if (isValidUnicodeProperty(this.ecmaVersion, "General_Category", nameOrValue)) { - return { - key: "General_Category", - value: nameOrValue || null, - }; - } - if (isValidLoneUnicodeProperty(this.ecmaVersion, nameOrValue)) { - return { - key: nameOrValue, - value: null, - }; - } - if (this._unicodeSetsMode && - isValidLoneUnicodePropertyOfString(this.ecmaVersion, nameOrValue)) { - return { - key: nameOrValue, - value: null, - strings: true, - }; - } - this.raise("Invalid property name"); - } - return null; - } - 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(LATIN_SMALL_LETTER_X)) { - if (this.eatFixedHexDigits(2)) { - return true; - } - if (this._unicodeMode || 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 - DIGIT_ZERO; - 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; - } - eatModifiers() { - let ate = false; - while (isRegularExpressionModifier(this.currentCodePoint)) { - this.advance(); - ate = true; - } - return ate; - } - parseModifiers(start, end) { - const { ignoreCase, multiline, dotAll } = this.parseFlags(this._reader.source, start, end); - return { ignoreCase, multiline, dotAll }; - } - parseFlags(source, start, end) { - const flags = { - global: false, - ignoreCase: false, - multiline: false, - unicode: false, - sticky: false, - dotAll: false, - hasIndices: false, - unicodeSets: false, - }; - const validFlags = new Set(); - validFlags.add(LATIN_SMALL_LETTER_G); - validFlags.add(LATIN_SMALL_LETTER_I); - validFlags.add(LATIN_SMALL_LETTER_M); - if (this.ecmaVersion >= 2015) { - validFlags.add(LATIN_SMALL_LETTER_U); - validFlags.add(LATIN_SMALL_LETTER_Y); - if (this.ecmaVersion >= 2018) { - validFlags.add(LATIN_SMALL_LETTER_S); - if (this.ecmaVersion >= 2022) { - validFlags.add(LATIN_SMALL_LETTER_D); - if (this.ecmaVersion >= 2024) { - validFlags.add(LATIN_SMALL_LETTER_V); - } - } - } - } - for (let i = start; i < end; ++i) { - const flag = source.charCodeAt(i); - if (validFlags.has(flag)) { - const prop = FLAG_CODEPOINT_TO_PROP[flag]; - if (flags[prop]) { - this.raise(`Duplicated flag '${source[i]}'`, { - index: start, - }); - } - flags[prop] = true; - } - else { - this.raise(`Invalid flag '${source[i]}'`, { index: start }); - } - } - return flags; - } -} - -const DUMMY_PATTERN = {}; -const DUMMY_FLAGS = {}; -const DUMMY_CAPTURING_GROUP = {}; -function isClassSetOperand(node) { - return (node.type === "Character" || - node.type === "CharacterSet" || - node.type === "CharacterClass" || - node.type === "ExpressionCharacterClass" || - node.type === "ClassStringDisjunction"); -} -class RegExpParserState { - constructor(options) { - var _a; - this._node = DUMMY_PATTERN; - this._expressionBufferMap = new Map(); - this._flags = DUMMY_FLAGS; - this._backreferences = []; - this._capturingGroups = []; - this.source = ""; - this.strict = Boolean(options === null || options === void 0 ? void 0 : options.strict); - this.ecmaVersion = (_a = options === null || options === void 0 ? void 0 : options.ecmaVersion) !== null && _a !== void 0 ? _a : latestEcmaVersion; - } - 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; - } - onRegExpFlags(start, end, { global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices, unicodeSets, }) { - this._flags = { - type: "Flags", - parent: null, - start, - end, - raw: this.source.slice(start, end), - global, - ignoreCase, - multiline, - unicode, - sticky, - dotAll, - hasIndices, - unicodeSets, - }; - } - 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 groups = typeof ref === "number" - ? [this._capturingGroups[ref - 1]] - : this._capturingGroups.filter((g) => g.name === ref); - if (groups.length === 1) { - const group = groups[0]; - reference.ambiguous = false; - reference.resolved = group; - } - else { - reference.ambiguous = true; - reference.resolved = groups; - } - for (const group of groups) { - 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"); - } - const group = { - type: "Group", - parent, - start, - end: start, - raw: "", - modifiers: null, - alternatives: [], - }; - this._node = group; - 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; - } - onModifiersEnter(start) { - const parent = this._node; - if (parent.type !== "Group") { - throw new Error("UnknownError"); - } - this._node = { - type: "Modifiers", - parent, - start, - end: start, - raw: "", - add: null, - remove: null, - }; - parent.modifiers = this._node; - } - onModifiersLeave(start, end) { - const node = this._node; - if (node.type !== "Modifiers" || node.parent.type !== "Group") { - throw new Error("UnknownError"); - } - node.end = end; - node.raw = this.source.slice(start, end); - this._node = node.parent; - } - onAddModifiers(start, end, { ignoreCase, multiline, dotAll, }) { - const parent = this._node; - if (parent.type !== "Modifiers") { - throw new Error("UnknownError"); - } - parent.add = { - type: "ModifierFlags", - parent, - start, - end, - raw: this.source.slice(start, end), - ignoreCase, - multiline, - dotAll, - }; - } - onRemoveModifiers(start, end, { ignoreCase, multiline, dotAll, }) { - const parent = this._node; - if (parent.type !== "Modifiers") { - throw new Error("UnknownError"); - } - parent.remove = { - type: "ModifierFlags", - parent, - start, - end, - raw: this.source.slice(start, end), - ignoreCase, - multiline, - dotAll, - }; - } - 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, strings) { - const parent = this._node; - if (parent.type !== "Alternative" && parent.type !== "CharacterClass") { - throw new Error("UnknownError"); - } - const base = { - type: "CharacterSet", - parent: null, - start, - end, - raw: this.source.slice(start, end), - kind, - strings: null, - key, - }; - if (strings) { - if ((parent.type === "CharacterClass" && !parent.unicodeSets) || - negate || - value !== null) { - throw new Error("UnknownError"); - } - parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); - } - else { - parent.elements.push(Object.assign(Object.assign({}, base), { parent, strings, value, negate })); - } - } - onCharacter(start, end, value) { - const parent = this._node; - if (parent.type !== "Alternative" && - parent.type !== "CharacterClass" && - parent.type !== "StringAlternative") { - 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, - ambiguous: false, - resolved: DUMMY_CAPTURING_GROUP, - }; - parent.elements.push(node); - this._backreferences.push(node); - } - onCharacterClassEnter(start, negate, unicodeSets) { - const parent = this._node; - const base = { - type: "CharacterClass", - parent, - start, - end: start, - raw: "", - unicodeSets, - negate, - elements: [], - }; - if (parent.type === "Alternative") { - const node = Object.assign(Object.assign({}, base), { parent }); - this._node = node; - parent.elements.push(node); - } - else if (parent.type === "CharacterClass" && - parent.unicodeSets && - unicodeSets) { - const node = Object.assign(Object.assign({}, base), { parent, - unicodeSets }); - this._node = node; - parent.elements.push(node); - } - else { - throw new Error("UnknownError"); - } - } - onCharacterClassLeave(start, end) { - const node = this._node; - if (node.type !== "CharacterClass" || - (node.parent.type !== "Alternative" && - node.parent.type !== "CharacterClass")) { - throw new Error("UnknownError"); - } - const parent = node.parent; - node.end = end; - node.raw = this.source.slice(start, end); - this._node = parent; - const expression = this._expressionBufferMap.get(node); - if (!expression) { - return; - } - if (node.elements.length > 0) { - throw new Error("UnknownError"); - } - this._expressionBufferMap.delete(node); - const newNode = { - type: "ExpressionCharacterClass", - parent, - start: node.start, - end: node.end, - raw: node.raw, - negate: node.negate, - expression, - }; - expression.parent = newNode; - if (node !== parent.elements.pop()) { - throw new Error("UnknownError"); - } - parent.elements.push(newNode); - } - onCharacterClassRange(start, end) { - const parent = this._node; - if (parent.type !== "CharacterClass") { - throw new Error("UnknownError"); - } - const elements = parent.elements; - const max = elements.pop(); - if (!max || max.type !== "Character") { - throw new Error("UnknownError"); - } - if (!parent.unicodeSets) { - const hyphen = elements.pop(); - if (!hyphen || - hyphen.type !== "Character" || - hyphen.value !== HYPHEN_MINUS) { - throw new Error("UnknownError"); - } - } - const min = elements.pop(); - if (!min || min.type !== "Character") { - 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); - } - onClassIntersection(start, end) { - var _a; - const parent = this._node; - if (parent.type !== "CharacterClass" || !parent.unicodeSets) { - throw new Error("UnknownError"); - } - const right = parent.elements.pop(); - const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); - if (!left || - !right || - left.type === "ClassSubtraction" || - (left.type !== "ClassIntersection" && !isClassSetOperand(left)) || - !isClassSetOperand(right)) { - throw new Error("UnknownError"); - } - const node = { - type: "ClassIntersection", - parent: parent, - start, - end, - raw: this.source.slice(start, end), - left, - right, - }; - left.parent = node; - right.parent = node; - this._expressionBufferMap.set(parent, node); - } - onClassSubtraction(start, end) { - var _a; - const parent = this._node; - if (parent.type !== "CharacterClass" || !parent.unicodeSets) { - throw new Error("UnknownError"); - } - const right = parent.elements.pop(); - const left = (_a = this._expressionBufferMap.get(parent)) !== null && _a !== void 0 ? _a : parent.elements.pop(); - if (!left || - !right || - left.type === "ClassIntersection" || - (left.type !== "ClassSubtraction" && !isClassSetOperand(left)) || - !isClassSetOperand(right)) { - throw new Error("UnknownError"); - } - const node = { - type: "ClassSubtraction", - parent: parent, - start, - end, - raw: this.source.slice(start, end), - left, - right, - }; - left.parent = node; - right.parent = node; - this._expressionBufferMap.set(parent, node); - } - onClassStringDisjunctionEnter(start) { - const parent = this._node; - if (parent.type !== "CharacterClass" || !parent.unicodeSets) { - throw new Error("UnknownError"); - } - this._node = { - type: "ClassStringDisjunction", - parent, - start, - end: start, - raw: "", - alternatives: [], - }; - parent.elements.push(this._node); - } - onClassStringDisjunctionLeave(start, end) { - const node = this._node; - if (node.type !== "ClassStringDisjunction" || - node.parent.type !== "CharacterClass") { - throw new Error("UnknownError"); - } - node.end = end; - node.raw = this.source.slice(start, end); - this._node = node.parent; - } - onStringAlternativeEnter(start) { - const parent = this._node; - if (parent.type !== "ClassStringDisjunction") { - throw new Error("UnknownError"); - } - this._node = { - type: "StringAlternative", - parent, - start, - end: start, - raw: "", - elements: [], - }; - parent.alternatives.push(this._node); - } - onStringAlternativeLeave(start, end) { - const node = this._node; - if (node.type !== "StringAlternative") { - throw new Error("UnknownError"); - } - node.end = end; - node.raw = this.source.slice(start, end); - this._node = node.parent; - } -} -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, uFlagOrFlags = undefined) { - this._state.source = source; - this._validator.validatePattern(source, start, end, uFlagOrFlags); - 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 "ClassIntersection": - this.visitClassIntersection(node); - break; - case "ClassStringDisjunction": - this.visitClassStringDisjunction(node); - break; - case "ClassSubtraction": - this.visitClassSubtraction(node); - break; - case "ExpressionCharacterClass": - this.visitExpressionCharacterClass(node); - break; - case "Flags": - this.visitFlags(node); - break; - case "Group": - this.visitGroup(node); - break; - case "Modifiers": - this.visitModifiers(node); - break; - case "ModifierFlags": - this.visitModifierFlags(node); - break; - case "Pattern": - this.visitPattern(node); - break; - case "Quantifier": - this.visitQuantifier(node); - break; - case "RegExpLiteral": - this.visitRegExpLiteral(node); - break; - case "StringAlternative": - this.visitStringAlternative(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); - } - } - visitClassIntersection(node) { - if (this._handlers.onClassIntersectionEnter) { - this._handlers.onClassIntersectionEnter(node); - } - this.visit(node.left); - this.visit(node.right); - if (this._handlers.onClassIntersectionLeave) { - this._handlers.onClassIntersectionLeave(node); - } - } - visitClassStringDisjunction(node) { - if (this._handlers.onClassStringDisjunctionEnter) { - this._handlers.onClassStringDisjunctionEnter(node); - } - node.alternatives.forEach(this.visit, this); - if (this._handlers.onClassStringDisjunctionLeave) { - this._handlers.onClassStringDisjunctionLeave(node); - } - } - visitClassSubtraction(node) { - if (this._handlers.onClassSubtractionEnter) { - this._handlers.onClassSubtractionEnter(node); - } - this.visit(node.left); - this.visit(node.right); - if (this._handlers.onClassSubtractionLeave) { - this._handlers.onClassSubtractionLeave(node); - } - } - visitExpressionCharacterClass(node) { - if (this._handlers.onExpressionCharacterClassEnter) { - this._handlers.onExpressionCharacterClassEnter(node); - } - this.visit(node.expression); - if (this._handlers.onExpressionCharacterClassLeave) { - this._handlers.onExpressionCharacterClassLeave(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); - } - if (node.modifiers) { - this.visit(node.modifiers); - } - node.alternatives.forEach(this.visit, this); - if (this._handlers.onGroupLeave) { - this._handlers.onGroupLeave(node); - } - } - visitModifiers(node) { - if (this._handlers.onModifiersEnter) { - this._handlers.onModifiersEnter(node); - } - if (node.add) { - this.visit(node.add); - } - if (node.remove) { - this.visit(node.remove); - } - if (this._handlers.onModifiersLeave) { - this._handlers.onModifiersLeave(node); - } - } - visitModifierFlags(node) { - if (this._handlers.onModifierFlagsEnter) { - this._handlers.onModifierFlagsEnter(node); - } - if (this._handlers.onModifierFlagsLeave) { - this._handlers.onModifierFlagsLeave(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); - } - } - visitStringAlternative(node) { - if (this._handlers.onStringAlternativeEnter) { - this._handlers.onStringAlternativeEnter(node); - } - node.elements.forEach(this.visit, this); - if (this._handlers.onStringAlternativeLeave) { - this._handlers.onStringAlternativeLeave(node); - } - } -} - -function parseRegExpLiteral(source, options) { - return new RegExpParser(options).parseLiteral(String(source)); -} -function validateRegExpLiteral(source, options) { - new RegExpValidator(options).validateLiteral(source); -} -function visitRegExpAST(node, handlers) { - new RegExpVisitor(handlers).visit(node); -} - -export { ast as AST, RegExpParser, RegExpSyntaxError, RegExpValidator, parseRegExpLiteral, validateRegExpLiteral, visitRegExpAST }; -//# sourceMappingURL=index.mjs.map diff --git a/node_modules/@eslint-community/regexpp/index.mjs.map b/node_modules/@eslint-community/regexpp/index.mjs.map deleted file mode 100644 index 0d1c5f7..0000000 --- a/node_modules/@eslint-community/regexpp/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs.map","sources":[".temp/src/ecma-versions.ts",".temp/unicode/src/unicode/ids.ts",".temp/unicode/src/unicode/properties.ts",".temp/unicode/src/unicode/index.ts",".temp/src/group-specifiers.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":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;AAaO,MAAM,iBAAiB,GAAG,IAAI;;ACTrC,IAAI,kBAAkB,GAAyB,SAAS,CAAA;AACxD,IAAI,qBAAqB,GAAyB,SAAS,CAAA;AAErD,SAAU,SAAS,CAAC,EAAU,EAAA;IAChC,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;AAC1B,IAAA,OAAO,cAAc,CAAC,EAAE,CAAC,CAAA;AAC7B,CAAC;AAEK,SAAU,YAAY,CAAC,EAAU,EAAA;IACnC,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,KAAK,CAAA;IAC3B,IAAI,EAAE,GAAG,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;IAC1B,IAAI,EAAE,KAAK,IAAI;AAAE,QAAA,OAAO,IAAI,CAAA;IAC5B,IAAI,EAAE,GAAG,IAAI;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AC/B,QAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC3B,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE;AACrC,YAAA,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;AAC5C,SAAA;KACJ;AAEO,IAAA,sBAAsB,CAAC,IAAuB,EAAA;AAClD,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,wBAAwB,EAAE;AACzC,YAAA,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;AAChD,SAAA;QACD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACvC,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,wBAAwB,EAAE;AACzC,YAAA,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAA;AAChD,SAAA;KACJ;AACJ;;ACpTe,SAAA,kBAAkB,CAC9B,MAAuB,EACvB,OAA8B,EAAA;AAE9B,IAAA,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;AACjE,CAAC;AAOe,SAAA,qBAAqB,CACjC,MAAc,EACd,OAAiC,EAAA;IAEjC,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;AACxD,CAAC;AAEe,SAAA,cAAc,CAC1B,IAAc,EACd,QAAgC,EAAA;IAEhC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC3C;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint-community/regexpp/package.json b/node_modules/@eslint-community/regexpp/package.json deleted file mode 100644 index 39cbfde..0000000 --- a/node_modules/@eslint-community/regexpp/package.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "@eslint-community/regexpp", - "version": "4.12.1", - "description": "Regular expression parser for ECMAScript.", - "keywords": [ - "regexp", - "regular", - "expression", - "parser", - "validator", - "ast", - "abstract", - "syntax", - "tree", - "ecmascript", - "es2015", - "es2016", - "es2017", - "es2018", - "es2019", - "es2020", - "es2021", - "annexB" - ], - "homepage": "https://github.com/eslint-community/regexpp#readme", - "bugs": { - "url": "https://github.com/eslint-community/regexpp/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/eslint-community/regexpp" - }, - "license": "MIT", - "author": "Toru Nagashima", - "exports": { - ".": { - "types": "./index.d.ts", - "import": "./index.mjs", - "default": "./index.js" - }, - "./package.json": "./package.json" - }, - "main": "index", - "files": [ - "index.*" - ], - "scripts": { - "prebuild": "npm run -s clean", - "build": "run-s build:*", - "build:tsc": "tsc --module es2015", - "build:rollup": "rollup -c", - "build:dts": "npm run -s build:tsc -- --removeComments false && dts-bundle --name @eslint-community/regexpp --main .temp/index.d.ts --out ../index.d.ts && prettier --write index.d.ts", - "clean": "rimraf .temp index.*", - "lint": "eslint . --ext .ts", - "test": "nyc _mocha \"test/*.ts\" --reporter dot --timeout 10000", - "debug": "mocha --require ts-node/register/transpile-only \"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", - "update:test262:extract": "ts-node -T scripts/extract-test262.ts", - "preversion": "npm test && 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" - }, - "dependencies": {}, - "devDependencies": { - "@eslint-community/eslint-plugin-mysticatea": "^15.5.1", - "@rollup/plugin-node-resolve": "^14.1.0", - "@types/eslint": "^8.44.3", - "@types/jsdom": "^16.2.15", - "@types/mocha": "^9.1.1", - "@types/node": "^12.20.55", - "dts-bundle": "^0.7.3", - "eslint": "^8.50.0", - "js-tokens": "^8.0.2", - "jsdom": "^19.0.0", - "mocha": "^9.2.2", - "npm-run-all2": "^6.2.2", - "nyc": "^14.1.1", - "rimraf": "^3.0.2", - "rollup": "^2.79.1", - "rollup-plugin-sourcemaps": "^0.6.3", - "ts-node": "^10.9.1", - "typescript": "~5.0.2" - }, - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } -} diff --git a/node_modules/@eslint/config-array/LICENSE b/node_modules/@eslint/config-array/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@eslint/config-array/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/config-array/README.md b/node_modules/@eslint/config-array/README.md deleted file mode 100644 index 9d343aa..0000000 --- a/node_modules/@eslint/config-array/README.md +++ /dev/null @@ -1,358 +0,0 @@ -# Config Array - -## 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. - -**Note:** This is a generic package that can be used outside of ESLint. It contains no ESLint-specific functionality. - -## Installation - -For Node.js and compatible runtimes: - -```shell -npm install @eslint/config-array -# or -yarn add @eslint/config-array -# or -pnpm install @eslint/config-array -# or -bun install @eslint/config-array -``` - -For Deno: - -```shell -deno add @eslint/config-array -``` - -## Background - -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). - -## Usage - -First, import the `ConfigArray` constructor: - -```js -import { ConfigArray } from "@eslint/config-array"; - -// or using CommonJS - -const { ConfigArray } = require("@eslint/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 directory 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 an object that follows the format of an [`ObjectSchema`](https://npmjs.com/package/@eslint/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 path of the file as it was passed in. The function 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 get 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 any other keys, then those ignores will always be applied; otherwise those ignores act as exclusions. 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 - { - files: ["**/*"], - 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 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: - -- If a filename is not an absolute path, it will be resolved relative to the base path directory. -- 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. -- A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). Any config with a `files` key entry that is `*` or ends with `/**` or `/*` will only be applied if another entry in the same `files` key matches or another config matches. - -## Determining Ignored Paths - -You can determine if a file is ignored by using the `isFileIgnored()` method and passing in the path of any file, as in this example: - -```js -const ignored = configs.isFileIgnored("/foo/bar/baz.txt"); -``` - -A file is considered ignored if any of the following is true: - -- **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/a.js` is considered ignored. -- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/baz/a.js` is considered ignored. -- **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. -- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. -- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored. - -For directories, use the `isDirectoryIgnored()` method and pass in the path of any directory, as in this example: - -```js -const ignored = configs.isDirectoryIgnored("/foo/bar/"); -``` - -A directory is considered ignored if any of the following is true: - -- **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/baz` is considered ignored. -- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/bar/baz/a.js` is considered ignored. -- **It matches and ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. -- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. -- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored. - -**Important:** A pattern such as `foo/**` means that `foo` and `foo/` are _not_ ignored whereas `foo/bar` is ignored. If you want to ignore `foo` and all of its subdirectories, use the pattern `foo` or `foo/` in `ignores`. - -## Caching Mechanisms - -Each `ConfigArray` aggressively caches configuration objects to avoid unnecessary work. This caching occurs in two ways: - -1. **File-based Caching.** For each filename that is passed into a method, the resulting config is cached against that filename so you're always guaranteed to get the same object returned from `getConfig()` whenever you pass the same filename in. -2. **Index-based Caching.** Whenever a config is calculated, the config elements that were used to create the config are also cached. So if a given filename matches elements 1, 5, and 7, the resulting config is cached with a key of `1,5,7`. That way, if another file is passed that matches the same config elements, the result is already known and doesn't have to be recalculated. That means two files that match all the same elements will return the same config from `getConfig()`. - -## 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 - - - - -## Sponsors - -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) -to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

-

Automattic Airbnb

Gold Sponsors

-

trunk.io

Silver Sponsors

-

JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

-

Technology Sponsors

-Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. -

Netlify Algolia 1Password

- diff --git a/node_modules/@eslint/config-array/dist/cjs/index.cjs b/node_modules/@eslint/config-array/dist/cjs/index.cjs deleted file mode 100644 index cc033c3..0000000 --- a/node_modules/@eslint/config-array/dist/cjs/index.cjs +++ /dev/null @@ -1,1304 +0,0 @@ -'use strict'; - -var posixPath = require('./std__path/posix.cjs'); -var windowsPath = require('./std__path/windows.cjs'); -var minimatch = require('minimatch'); -var createDebug = require('debug'); -var objectSchema = require('@eslint/object-schema'); - -function _interopNamespaceDefault(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 posixPath__namespace = /*#__PURE__*/_interopNamespaceDefault(posixPath); -var windowsPath__namespace = /*#__PURE__*/_interopNamespaceDefault(windowsPath); - -/** - * @fileoverview ConfigSchema - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - -/** @typedef {import("@eslint/object-schema").PropertyDefinition} PropertyDefinition */ -/** @typedef {import("@eslint/object-schema").ObjectDefinition} ObjectDefinition */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * A strategy that does nothing. - * @type {PropertyDefinition} - */ -const NOOP_STRATEGY = { - required: false, - merge() { - return undefined; - }, - validate() {}, -}; - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The base schema that every ConfigArray uses. - * @type {ObjectDefinition} - */ -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: NOOP_STRATEGY, - ignores: NOOP_STRATEGY, -}); - -/** - * @fileoverview ConfigSchema - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Asserts 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."); - } -} - -/** - * Asserts 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) { - assertIsArray(value); - - if ( - value.some( - item => typeof item !== "string" && typeof item !== "function", - ) - ) { - throw new TypeError( - "Expected array to only contain strings and functions.", - ); - } -} - -/** - * Asserts that a given value is a non-empty array. - * @param {*} value The value to check. - * @returns {void} - * @throws {TypeError} When the value is not an array or an empty array. - */ -function assertIsNonEmptyArray(value) { - if (!Array.isArray(value) || value.length === 0) { - throw new TypeError("Expected value to be a non-empty array."); - } -} - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The schema for `files` and `ignores` that every ConfigArray uses. - * @type {ObjectDefinition} - */ -const filesAndIgnoresSchema = Object.freeze({ - files: { - required: false, - merge() { - return undefined; - }, - validate(value) { - // first check if it's an array - assertIsNonEmptyArray(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 - */ - - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - -/** @typedef {import("./types.ts").ConfigObject} ConfigObject */ -/** @typedef {import("minimatch").IMinimatchStatic} IMinimatchStatic */ -/** @typedef {import("minimatch").IMinimatch} IMinimatch */ -/** @typedef {import("@jsr/std__path")} PathImpl */ - -/* - * This is a bit of a hack to make TypeScript happy with the Rollup-created - * CommonJS file. Rollup doesn't do object destructuring for imported files - * and instead imports the default via `require()`. This messes up type checking - * for `ObjectSchema`. To work around that, we just import the type manually - * and give it a different name to use in the JSDoc comments. - */ -/** @typedef {import("@eslint/object-schema").ObjectSchema} ObjectSchemaInstance */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const Minimatch = minimatch.Minimatch; -const debug = createDebug("@eslint/config-array"); - -/** - * A cache for minimatch instances. - * @type {Map} - */ -const minimatchCache = new Map(); - -/** - * A cache for negated minimatch instances. - * @type {Map} - */ -const negatedMinimatchCache = new Map(); - -/** - * Options to use with minimatch. - * @type {Object} - */ -const MINIMATCH_OPTIONS = { - // matchBase: true, - dot: true, - allowWindowsEscape: true, -}; - -/** - * The types of config objects that are supported. - * @type {Set} - */ -const CONFIG_TYPES = new Set(["array", "function"]); - -/** - * Fields that are considered metadata and not part of the config object. - * @type {Set} - */ -const META_FIELDS = new Set(["name"]); - -/** - * A schema containing just files and ignores for early validation. - * @type {ObjectSchemaInstance} - */ -const FILES_AND_IGNORES_SCHEMA = new objectSchema.ObjectSchema(filesAndIgnoresSchema); - -// Precomputed constant objects returned by `ConfigArray.getConfigWithStatus`. - -const CONFIG_WITH_STATUS_EXTERNAL = Object.freeze({ status: "external" }); -const CONFIG_WITH_STATUS_IGNORED = Object.freeze({ status: "ignored" }); -const CONFIG_WITH_STATUS_UNCONFIGURED = Object.freeze({ - status: "unconfigured", -}); - -// Match two leading dots followed by a slash or the end of input. -const EXTERNAL_PATH_REGEX = /^\.\.(?:\/|$)/u; - -/** - * Wrapper error for config validation errors that adds a name to the front of the - * error message. - */ -class ConfigError extends Error { - /** - * Creates a new instance. - * @param {string} name The config object name causing the error. - * @param {number} index The index of the config object in the array. - * @param {Object} options The options for the error. - * @param {Error} [options.cause] The error that caused this error. - * @param {string} [options.message] The message to use for the error. - */ - constructor(name, index, { cause, message }) { - const finalMessage = message || cause.message; - - super(`Config ${name}: ${finalMessage}`, { cause }); - - // copy over custom properties that aren't represented - if (cause) { - for (const key of Object.keys(cause)) { - if (!(key in this)) { - this[key] = cause[key]; - } - } - } - - /** - * The name of the error. - * @type {string} - * @readonly - */ - this.name = "ConfigError"; - - /** - * The index of the config object in the array. - * @type {number} - * @readonly - */ - this.index = index; - } -} - -/** - * Gets the name of a config object. - * @param {ConfigObject} config The config object to get the name of. - * @returns {string} The name of the config object. - */ -function getConfigName(config) { - if (config && typeof config.name === "string" && config.name) { - return `"${config.name}"`; - } - - return "(unnamed)"; -} - -/** - * Rethrows a config error with additional information about the config object. - * @param {object} config The config object to get the name of. - * @param {number} index The index of the config object in the array. - * @param {Error} error The error to rethrow. - * @throws {ConfigError} When the error is rethrown for a config. - */ -function rethrowConfigError(config, index, error) { - const configName = getConfigName(config); - throw new ConfigError(configName, index, { cause: error }); -} - -/** - * 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"; -} - -/** - * Creates a function that asserts that the config is valid - * during normalization. This checks that the config is not nullish - * and that files and ignores keys of a config object are valid as per base schema. - * @param {Object} config The config object to check. - * @param {number} index The index of the config object in the array. - * @returns {void} - * @throws {ConfigError} If the files and ignores keys of a config object are not valid. - */ -function assertValidBaseConfig(config, index) { - if (config === null) { - throw new ConfigError(getConfigName(config), index, { - message: "Unexpected null config.", - }); - } - - if (config === undefined) { - throw new ConfigError(getConfigName(config), index, { - message: "Unexpected undefined config.", - }); - } - - if (typeof config !== "object") { - throw new ConfigError(getConfigName(config), index, { - message: "Unexpected non-object config.", - }); - } - - const validateConfig = {}; - - if ("files" in config) { - validateConfig.files = config.files; - } - - if ("ignores" in config) { - validateConfig.ignores = config.ignores; - } - - try { - FILES_AND_IGNORES_SCHEMA.validate(validateConfig); - } catch (validationError) { - rethrowConfigError(config, index, validationError); - } -} - -/** - * Wrapper around minimatch that caches minimatch patterns for - * faster matching speed over multiple file path evaluations. - * @param {string} filepath The file path to match. - * @param {string} pattern The glob pattern to match against. - * @param {object} options The minimatch options to use. - * @returns - */ -function doMatch(filepath, pattern, options = {}) { - let cache = minimatchCache; - - if (options.flipNegate) { - cache = negatedMinimatchCache; - } - - let matcher = cache.get(pattern); - - if (!matcher) { - matcher = new Minimatch( - pattern, - Object.assign({}, MINIMATCH_OPTIONS, options), - ); - cache.set(pattern, matcher); - } - - return matcher.match(filepath); -} - -/** - * 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 unprocessed file path to check. - * @param {string} relativeFilePath The path of the file to check relative to the base path, - * using forward slash (`"/"`) as a separator. - * @returns {boolean} True if the path should be ignored and false if not. - */ -function shouldIgnorePath(ignores, filePath, relativeFilePath) { - return ignores.reduce((ignored, matcher) => { - if (!ignored) { - if (typeof matcher === "function") { - return matcher(filePath); - } - - // don't check negated patterns because we're not ignored yet - if (!matcher.startsWith("!")) { - return doMatch(relativeFilePath, matcher); - } - - // otherwise we're still not ignored - return false; - } - - // only need to check negated patterns because we're ignored - if (typeof matcher === "string" && matcher.startsWith("!")) { - return !doMatch(relativeFilePath, matcher, { - flipNegate: true, - }); - } - - return ignored; - }, false); -} - -/** - * Determines if a given file path is matched by a config based on - * `ignores` only. - * @param {string} filePath The unprocessed file path to check. - * @param {string} relativeFilePath The path of the file to check relative to the base path, - * using forward slash (`"/"`) as a separator. - * @param {Object} config The config object to check. - * @returns {boolean} True if the file path is matched by the config, - * false if not. - */ -function pathMatchesIgnores(filePath, relativeFilePath, config) { - return ( - Object.keys(config).filter(key => !META_FIELDS.has(key)).length > 1 && - !shouldIgnorePath(config.ignores, filePath, relativeFilePath) - ); -} - -/** - * 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 unprocessed file path to check. - * @param {string} relativeFilePath The path of the file to check relative to the base path, - * using forward slash (`"/"`) as a separator. - * @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, relativeFilePath, config) { - // match both strings and functions - function match(pattern) { - if (isString(pattern)) { - return doMatch(relativeFilePath, pattern); - } - - 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 = !shouldIgnorePath( - 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".`, - ); - } - } -} - -/** - * Returns path-handling implementations for Unix or Windows, depending on a given absolute path. - * @param {string} fileOrDirPath The absolute path to check. - * @returns {PathImpl} Path-handling implementations for the specified path. - * @throws An error is thrown if the specified argument is not an absolute path. - */ -function getPathImpl(fileOrDirPath) { - // Posix absolute paths always start with a slash. - if (fileOrDirPath.startsWith("/")) { - return posixPath__namespace; - } - - // Windows absolute paths start with a letter followed by a colon and at least one backslash, - // or with two backslashes in the case of UNC paths. - // Forward slashed are automatically normalized to backslashes. - if (/^(?:[A-Za-z]:[/\\]|[/\\]{2})/u.test(fileOrDirPath)) { - return windowsPath__namespace; - } - - throw new Error( - `Expected an absolute path but received "${fileOrDirPath}"`, - ); -} - -/** - * Converts a given path to a relative path with all separator characters replaced by forward slashes (`"/"`). - * @param {string} fileOrDirPath The unprocessed path to convert. - * @param {string} namespacedBasePath The namespaced base path of the directory to which the calculated path shall be relative. - * @param {PathImpl} path Path-handling implementations. - * @returns {string} A relative path with all separator characters replaced by forward slashes. - */ -function toRelativePath(fileOrDirPath, namespacedBasePath, path) { - const fullPath = path.resolve(namespacedBasePath, fileOrDirPath); - const namespacedFullPath = path.toNamespacedPath(fullPath); - const relativePath = path.relative(namespacedBasePath, namespacedFullPath); - return relativePath.replaceAll(path.SEPARATOR, "/"); -} - -//------------------------------------------------------------------------------ -// 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 { - /** - * The namespaced path of the config file directory. - * @type {string} - */ - #namespacedBasePath; - - /** - * Path-handling implementations. - * @type {PathImpl} - */ - #path; - - /** - * 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 {Object} options The options for the ConfigArray. - * @param {string} [options.basePath="/"] The absolute path of the config file directory. - * Defaults to `"/"`. - * @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.extraConfigTypes] 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 {ObjectSchemaInstance} - * @private - */ - this[ConfigArraySymbol.schema] = new objectSchema.ObjectSchema( - Object.assign({}, customSchema, baseSchema), - ); - - if (!isString(basePath) || !basePath) { - throw new TypeError("basePath must be a non-empty string"); - } - - /** - * 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. - * @type {Array} - */ - this.extraConfigTypes = [...extraConfigTypes]; - Object.freeze(this.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, { - explicitMatches: new Map(), - directoryMatches: new Map(), - files: undefined, - ignores: undefined, - }); - - // load the configs into this array - if (Array.isArray(configs)) { - this.push(...configs); - } else { - this.push(configs); - } - - // select path-handling implementations depending on the base path - this.#path = getPathImpl(basePath); - - // On Windows, `path.relative()` returns an absolute path when given two paths on different drives. - // The namespaced base path is useful to make sure that calculated relative paths are always relative. - // On Unix, it is identical to the base path. - this.#namespacedBasePath = this.#path.toNamespacedPath(basePath); - } - - /** - * 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. - * @type {ArrayConstructor} 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) { - /* - * We only count ignores if there are no other keys in the object. - * In this case, it acts list a globally ignored pattern. If there - * are additional keys, then ignores act like exclusions. - */ - if ( - config.ignores && - Object.keys(config).filter(key => !META_FIELDS.has(key)) - .length === 1 - ) { - 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 {Object} [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.forEach(assertValidBaseConfig); - 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 {Object} [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].bind(this), - ), - ); - this.forEach(assertValidBaseConfig); - this[ConfigArraySymbol.isNormalized] = true; - - // prevent further changes - Object.freeze(this); - } - - return this; - } - - /* eslint-disable class-methods-use-this -- Desired as instance methods */ - - /** - * 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; - } - - /* eslint-enable class-methods-use-this -- Desired as instance methods */ - - /** - * Returns the config object for a given file path and a status that can be used to determine why a file has no config. - * @param {string} filePath The path of a file to get a config for. - * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }} - * An object with an optional property `config` and property `status`. - * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig}, - * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}. - */ - getConfigWithStatus(filePath) { - assertNormalized(this); - - const cache = this[ConfigArraySymbol.configCache]; - - // first check the cache for a filename match to avoid duplicate work - if (cache.has(filePath)) { - return cache.get(filePath); - } - - // check to see if the file is outside the base path - - const relativeFilePath = toRelativePath( - filePath, - this.#namespacedBasePath, - this.#path, - ); - - if (EXTERNAL_PATH_REGEX.test(relativeFilePath)) { - debug(`No config for file ${filePath} outside of base path`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_EXTERNAL); - return CONFIG_WITH_STATUS_EXTERNAL; - } - - // next check to see if the file should be ignored - - // check if this should be ignored due to its directory - if (this.isDirectoryIgnored(this.#path.dirname(filePath))) { - debug(`Ignoring ${filePath} based on directory pattern`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_IGNORED); - return CONFIG_WITH_STATUS_IGNORED; - } - - if (shouldIgnorePath(this.ignores, filePath, relativeFilePath)) { - debug(`Ignoring ${filePath} based on file pattern`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_IGNORED); - return CONFIG_WITH_STATUS_IGNORED; - } - - // filePath isn't automatically ignored, so try to construct config - - const matchingConfigIndices = []; - let matchFound = false; - const universalPattern = /^\*$|\/\*{1,2}$/u; - - this.forEach((config, index) => { - if (!config.files) { - if (!config.ignores) { - debug(`Universal config found for ${filePath}`); - matchingConfigIndices.push(index); - return; - } - - if (pathMatchesIgnores(filePath, relativeFilePath, config)) { - debug( - `Matching config found for ${filePath} (based on ignores: ${config.ignores})`, - ); - matchingConfigIndices.push(index); - return; - } - - debug( - `Skipped config found for ${filePath} (based on ignores: ${config.ignores})`, - ); - return; - } - - /* - * If a config has a files pattern * or patterns ending in /** or /*, - * and the filePath only matches those patterns, then the config is only - * applied if there is another config where the filePath matches - * a file with a specific extensions such as *.js. - */ - - const universalFiles = config.files.filter(pattern => - universalPattern.test(pattern), - ); - - // universal patterns were found so we need to check the config twice - if (universalFiles.length) { - debug("Universal files patterns found. Checking carefully."); - - const nonUniversalFiles = config.files.filter( - pattern => !universalPattern.test(pattern), - ); - - // check that the config matches without the non-universal files first - if ( - nonUniversalFiles.length && - pathMatches(filePath, relativeFilePath, { - files: nonUniversalFiles, - ignores: config.ignores, - }) - ) { - debug(`Matching config found for ${filePath}`); - matchingConfigIndices.push(index); - matchFound = true; - return; - } - - // if there wasn't a match then check if it matches with universal files - if ( - universalFiles.length && - pathMatches(filePath, relativeFilePath, { - files: universalFiles, - ignores: config.ignores, - }) - ) { - debug(`Matching config found for ${filePath}`); - matchingConfigIndices.push(index); - return; - } - - // if we make here, then there was no match - return; - } - - // the normal case - if (pathMatches(filePath, relativeFilePath, config)) { - debug(`Matching config found for ${filePath}`); - matchingConfigIndices.push(index); - matchFound = true; - } - }); - - // if matching both files and ignores, there will be no config to create - if (!matchFound) { - debug(`No matching configs found for ${filePath}`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_UNCONFIGURED); - return CONFIG_WITH_STATUS_UNCONFIGURED; - } - - // check to see if there is a config cached by indices - const indicesKey = matchingConfigIndices.toString(); - let configWithStatus = cache.get(indicesKey); - - if (configWithStatus) { - // also store for filename for faster lookup next time - cache.set(filePath, configWithStatus); - - return configWithStatus; - } - - // otherwise construct the config - - // eslint-disable-next-line array-callback-return, consistent-return -- rethrowConfigError always throws an error - let finalConfig = matchingConfigIndices.reduce((result, index) => { - try { - return this[ConfigArraySymbol.schema].merge( - result, - this[index], - ); - } catch (validationError) { - rethrowConfigError(this[index], index, validationError); - } - }, {}); - - finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig); - - configWithStatus = Object.freeze({ - config: finalConfig, - status: "matched", - }); - cache.set(filePath, configWithStatus); - cache.set(indicesKey, configWithStatus); - - return configWithStatus; - } - - /** - * Returns the config object for a given file path. - * @param {string} filePath The path of a file to get a config for. - * @returns {Object|undefined} The config object for this file or `undefined`. - */ - getConfig(filePath) { - return this.getConfigWithStatus(filePath).config; - } - - /** - * Determines whether a file has a config or why it doesn't. - * @param {string} filePath The path of the file to check. - * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values: - * * `"ignored"`: the file is ignored - * * `"external"`: the file is outside the base path - * * `"unconfigured"`: the file is not matched by any config - * * `"matched"`: the file has a matching config - */ - getConfigStatus(filePath) { - return this.getConfigWithStatus(filePath).status; - } - - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - * @deprecated Use `isFileIgnored` instead. - */ - isIgnored(filePath) { - return this.isFileIgnored(filePath); - } - - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - */ - isFileIgnored(filePath) { - return this.getConfigStatus(filePath) === "ignored"; - } - - /** - * Determines if the given directory is ignored based on the configs. - * This checks only default `ignores` that don't have `files` in the - * same config. A pattern such as `/foo` be considered to ignore the directory - * while a pattern such as `/foo/**` is not considered to ignore the - * directory because it is matching files. - * @param {string} directoryPath The path of a directory to check. - * @returns {boolean} True if the directory is ignored, false if not. Will - * return true for any directory that is not inside of `basePath`. - * @throws {Error} When the `ConfigArray` is not normalized. - */ - isDirectoryIgnored(directoryPath) { - assertNormalized(this); - - const relativeDirectoryPath = toRelativePath( - directoryPath, - this.#namespacedBasePath, - this.#path, - ); - - // basePath directory can never be ignored - if (relativeDirectoryPath === "") { - return false; - } - - if (EXTERNAL_PATH_REGEX.test(relativeDirectoryPath)) { - return true; - } - - // first check the cache - const cache = dataCache.get(this).directoryMatches; - - if (cache.has(relativeDirectoryPath)) { - return cache.get(relativeDirectoryPath); - } - - const directoryParts = relativeDirectoryPath.split("/"); - let relativeDirectoryToCheck = ""; - let result; - - /* - * In order to get the correct gitignore-style ignores, where an - * ignored parent directory cannot have any descendants unignored, - * we need to check every directory starting at the parent all - * the way down to the actual requested directory. - * - * We aggressively cache all of this info to make sure we don't - * have to recalculate everything for every call. - */ - do { - relativeDirectoryToCheck += `${directoryParts.shift()}/`; - - result = shouldIgnorePath( - this.ignores, - this.#path.join(this.basePath, relativeDirectoryToCheck), - relativeDirectoryToCheck, - ); - - cache.set(relativeDirectoryToCheck, result); - } while (!result && directoryParts.length); - - // also cache the result for the requested path - cache.set(relativeDirectoryPath, result); - - return result; - } -} - -Object.defineProperty(exports, "ObjectSchema", { - enumerable: true, - get: function () { return objectSchema.ObjectSchema; } -}); -exports.ConfigArray = ConfigArray; -exports.ConfigArraySymbol = ConfigArraySymbol; diff --git a/node_modules/@eslint/config-array/dist/cjs/index.d.cts b/node_modules/@eslint/config-array/dist/cjs/index.d.cts deleted file mode 100644 index 6fb977e..0000000 --- a/node_modules/@eslint/config-array/dist/cjs/index.d.cts +++ /dev/null @@ -1,141 +0,0 @@ -export { ObjectSchema } from "@eslint/object-schema"; -export type PropertyDefinition = import("@eslint/object-schema").PropertyDefinition; -export type ObjectDefinition = import("@eslint/object-schema").ObjectDefinition; -export type ConfigObject = import("./types.ts").ConfigObject; -export type IMinimatchStatic = import("minimatch").IMinimatchStatic; -export type IMinimatch = import("minimatch").IMinimatch; -export type PathImpl = typeof import("@jsr/std__path"); -export type ObjectSchemaInstance = import("@eslint/object-schema").ObjectSchema; -/** - * Represents an array of config objects and provides method for working with - * those config objects. - */ -export 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 {Object} options The options for the ConfigArray. - * @param {string} [options.basePath="/"] The absolute path of the config file directory. - * Defaults to `"/"`. - * @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.extraConfigTypes] List of config types supported. - */ - constructor(configs: Iterable | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: { - basePath?: string; - normalized?: boolean; - schema?: any; - extraConfigTypes?: Array; - }); - /** - * The path of the config file that this array was loaded from. - * This is used to calculate filename matches. - * @property basePath - * @type {string} - */ - basePath: string; - /** - * The supported config types. - * @type {Array} - */ - extraConfigTypes: 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(): (string | Function)[]; - /** - * 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(): string[]; - /** - * Indicates if the config array has been normalized. - * @returns {boolean} True if the config array is normalized, false if not. - */ - isNormalized(): boolean; - /** - * Normalizes a config array by flattening embedded arrays and executing - * config functions. - * @param {Object} [context] The context object for config functions. - * @returns {Promise} The current ConfigArray instance. - */ - normalize(context?: any): Promise; - /** - * Normalizes a config array by flattening embedded arrays and executing - * config functions. - * @param {Object} [context] The context object for config functions. - * @returns {ConfigArray} The current ConfigArray instance. - */ - normalizeSync(context?: any): ConfigArray; - /** - * Returns the config object for a given file path and a status that can be used to determine why a file has no config. - * @param {string} filePath The path of a file to get a config for. - * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }} - * An object with an optional property `config` and property `status`. - * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig}, - * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}. - */ - getConfigWithStatus(filePath: string): { - config?: any; - status: "ignored" | "external" | "unconfigured" | "matched"; - }; - /** - * Returns the config object for a given file path. - * @param {string} filePath The path of a file to get a config for. - * @returns {Object|undefined} The config object for this file or `undefined`. - */ - getConfig(filePath: string): any | undefined; - /** - * Determines whether a file has a config or why it doesn't. - * @param {string} filePath The path of the file to check. - * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values: - * * `"ignored"`: the file is ignored - * * `"external"`: the file is outside the base path - * * `"unconfigured"`: the file is not matched by any config - * * `"matched"`: the file has a matching config - */ - getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched"; - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - * @deprecated Use `isFileIgnored` instead. - */ - isIgnored(filePath: string): boolean; - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - */ - isFileIgnored(filePath: string): boolean; - /** - * Determines if the given directory is ignored based on the configs. - * This checks only default `ignores` that don't have `files` in the - * same config. A pattern such as `/foo` be considered to ignore the directory - * while a pattern such as `/foo/**` is not considered to ignore the - * directory because it is matching files. - * @param {string} directoryPath The path of a directory to check. - * @returns {boolean} True if the directory is ignored, false if not. Will - * return true for any directory that is not inside of `basePath`. - * @throws {Error} When the `ConfigArray` is not normalized. - */ - isDirectoryIgnored(directoryPath: string): boolean; - #private; -} -export namespace ConfigArraySymbol { - let isNormalized: symbol; - let configCache: symbol; - let schema: symbol; - let finalizeConfig: symbol; - let preprocessConfig: symbol; -} diff --git a/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs b/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs deleted file mode 100644 index 036cff9..0000000 --- a/node_modules/@eslint/config-array/dist/cjs/std__path/posix.cjs +++ /dev/null @@ -1,1323 +0,0 @@ -'use strict'; - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -function assertPath(path) { - if (typeof path !== "string") { - throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function stripSuffix(name, suffix) { - if (suffix.length >= name.length) { - return name; - } - const lenDiff = name.length - suffix.length; - for(let i = suffix.length - 1; i >= 0; --i){ - if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) { - return name; - } - } - return name.slice(0, -suffix.length); -} -function lastPathSegment(path, isSep, start = 0) { - let matchedNonSeparator = false; - let end = path.length; - for(let i = path.length - 1; i >= start; --i){ - if (isSep(path.charCodeAt(i))) { - if (matchedNonSeparator) { - start = i + 1; - break; - } - } else if (!matchedNonSeparator) { - matchedNonSeparator = true; - end = i + 1; - } - } - return path.slice(start, end); -} -function assertArgs$1(path, suffix) { - assertPath(path); - if (path.length === 0) return path; - if (typeof suffix !== "string") { - throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function stripTrailingSeparators(segment, isSep) { - if (segment.length <= 1) { - return segment; - } - let end = segment.length; - for(let i = segment.length - 1; i > 0; i--){ - if (isSep(segment.charCodeAt(i))) { - end = i; - } else { - break; - } - } - return segment.slice(0, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Alphabet chars. -// Non-alphabetic chars. -const CHAR_DOT = 46; /* . */ -const CHAR_FORWARD_SLASH = 47; /* / */ - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function isPosixPathSeparator(code) { - return code === CHAR_FORWARD_SLASH; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the last portion of a `path`. - * Trailing directory separators are ignored, and optional suffix is removed. - * - * @example Usage - * ```ts - * import { basename } from "@std/path/posix/basename"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(basename("/home/user/Documents/"), "Documents"); - * assertEquals(basename("/home/user/Documents/image.png"), "image.png"); - * assertEquals(basename("/home/user/Documents/image.png", ".png"), "image"); - * ``` - * - * @example Working with URLs - * - * Note: This function doesn't automatically strip hash and query parts from - * URLs. If your URL contains a hash or query, remove them before passing the - * URL to the function. This can be done by passing the URL to `new URL(url)`, - * and setting the `hash` and `search` properties to empty strings. - * - * ```ts - * import { basename } from "@std/path/posix/basename"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(basename("https://deno.land/std/path/mod.ts"), "mod.ts"); - * assertEquals(basename("https://deno.land/std/path/mod.ts", ".ts"), "mod"); - * assertEquals(basename("https://deno.land/std/path/mod.ts?a=b"), "mod.ts?a=b"); - * assertEquals(basename("https://deno.land/std/path/mod.ts#header"), "mod.ts#header"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `basename` from `@std/path/posix/unstable-basename`. - * - * @param path The path to extract the name from. - * @param suffix The suffix to remove from extracted name. - * @returns The extracted name. - */ function basename(path, suffix = "") { - assertArgs$1(path, suffix); - const lastSegment = lastPathSegment(path, isPosixPathSeparator); - const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator); - return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * The character used to separate entries in the PATH environment variable. - */ const DELIMITER = ":"; -/** - * The character used to separate components of a file path. - */ const SEPARATOR = "/"; -/** - * A regular expression that matches one or more path separators. - */ const SEPARATOR_PATTERN = /\/+/; - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$3(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the directory path of a `path`. - * - * @example Usage - * ```ts - * import { dirname } from "@std/path/posix/dirname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(dirname("/home/user/Documents/"), "/home/user"); - * assertEquals(dirname("/home/user/Documents/image.png"), "/home/user/Documents"); - * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); - * ``` - * - * @example Working with URLs - * - * ```ts - * import { dirname } from "@std/path/posix/dirname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); - * assertEquals(dirname("https://deno.land/std/path/mod.ts?a=b"), "https://deno.land/std/path"); - * assertEquals(dirname("https://deno.land/std/path/mod.ts#header"), "https://deno.land/std/path"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `dirname` from `@std/path/posix/unstable-dirname`. - * - * @param path The path to get the directory from. - * @returns The directory path. - */ function dirname(path) { - assertArg$3(path); - let end = -1; - let matchedNonSeparator = false; - for(let i = path.length - 1; i >= 1; --i){ - if (isPosixPathSeparator(path.charCodeAt(i))) { - if (matchedNonSeparator) { - end = i; - break; - } - } else { - matchedNonSeparator = true; - } - } - // No matches. Fallback based on provided path: - // - // - leading slashes paths - // "/foo" => "/" - // "///foo" => "/" - // - no slash path - // "foo" => "." - if (end === -1) { - return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : "."; - } - return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the extension of the `path` with leading period. - * - * @example Usage - * ```ts - * import { extname } from "@std/path/posix/extname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(extname("/home/user/Documents/file.ts"), ".ts"); - * assertEquals(extname("/home/user/Documents/"), ""); - * assertEquals(extname("/home/user/Documents/image.png"), ".png"); - * ``` - * - * @example Working with URLs - * - * Note: This function doesn't automatically strip hash and query parts from - * URLs. If your URL contains a hash or query, remove them before passing the - * URL to the function. This can be done by passing the URL to `new URL(url)`, - * and setting the `hash` and `search` properties to empty strings. - * - * ```ts - * import { extname } from "@std/path/posix/extname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(extname("https://deno.land/std/path/mod.ts"), ".ts"); - * assertEquals(extname("https://deno.land/std/path/mod.ts?a=b"), ".ts?a=b"); - * assertEquals(extname("https://deno.land/std/path/mod.ts#header"), ".ts#header"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `extname` from `@std/path/posix/unstable-extname`. - * - * @param path The path to get the extension from. - * @returns The extension (ex. for `file.ts` returns `.ts`). - */ function extname(path) { - assertPath(path); - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - for(let i = path.length - 1; i >= 0; --i){ - const code = path.charCodeAt(i); - if (isPosixPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ""; - } - return path.slice(startDot, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function _format(sep, pathObject) { - const dir = pathObject.dir || pathObject.root; - const base = pathObject.base || (pathObject.name ?? "") + (pathObject.ext ?? ""); - if (!dir) return base; - if (base === sep) return dir; - if (dir === pathObject.root) return dir + base; - return dir + sep + base; -} -function assertArg$2(pathObject) { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Generate a path from `ParsedPath` object. - * - * @example Usage - * ```ts - * import { format } from "@std/path/posix/format"; - * import { assertEquals } from "@std/assert"; - * - * const path = format({ - * root: "/", - * dir: "/path/dir", - * base: "file.txt", - * ext: ".txt", - * name: "file" - * }); - * assertEquals(path, "/path/dir/file.txt"); - * ``` - * - * @param pathObject The path object to format. - * @returns The formatted path. - */ function format(pathObject) { - assertArg$2(pathObject); - return _format("/", pathObject); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$1(url) { - url = url instanceof URL ? url : new URL(url); - if (url.protocol !== "file:") { - throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); - } - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a file URL to a path string. - * - * @example Usage - * ```ts - * import { fromFileUrl } from "@std/path/posix/from-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(fromFileUrl(new URL("file:///home/foo")), "/home/foo"); - * ``` - * - * @param url The file URL to convert. - * @returns The path string. - */ function fromFileUrl(url) { - url = assertArg$1(url); - return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25")); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Verifies whether provided path is absolute. - * - * @example Usage - * ```ts - * import { isAbsolute } from "@std/path/posix/is-absolute"; - * import { assert, assertFalse } from "@std/assert"; - * - * assert(isAbsolute("/home/user/Documents/")); - * assertFalse(isAbsolute("home/user/Documents/")); - * ``` - * - * @param path The path to verify. - * @returns Whether the path is absolute. - */ function isAbsolute(path) { - assertPath(path); - return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0)); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Resolves . and .. elements in a path with directory names -function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let code; - for(let i = 0; i <= path.length; ++i){ - if (i < path.length) code = path.charCodeAt(i); - else if (isPathSeparator(code)) break; - else code = CHAR_FORWARD_SLASH; - if (isPathSeparator(code)) { - if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; - } else if (res.length === 2 || res.length === 1) { - res = ""; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) res += `${separator}..`; - else res = ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) res += separator + path.slice(lastSlash + 1, i); - else res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === CHAR_DOT && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Normalize the `path`, resolving `'..'` and `'.'` segments. - * Note that resolving these segments does not necessarily mean that all will be eliminated. - * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`. - * - * @example Usage - * ```ts - * import { normalize } from "@std/path/posix/normalize"; - * import { assertEquals } from "@std/assert"; - * - * const path = normalize("/foo/bar//baz/asdf/quux/.."); - * assertEquals(path, "/foo/bar/baz/asdf"); - * ``` - * - * @example Working with URLs - * - * Note: This function will remove the double slashes from a URL's scheme. - * Hence, do not pass a full URL to this function. Instead, pass the pathname of - * the URL. - * - * ```ts - * import { normalize } from "@std/path/posix/normalize"; - * import { assertEquals } from "@std/assert"; - * - * const url = new URL("https://deno.land"); - * url.pathname = normalize("//std//assert//.//mod.ts"); - * assertEquals(url.href, "https://deno.land/std/assert/mod.ts"); - * - * url.pathname = normalize("std/assert/../async/retry.ts"); - * assertEquals(url.href, "https://deno.land/std/async/retry.ts"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `normalize` from `@std/path/posix/unstable-normalize`. - * - * @param path The path to normalize. - * @returns The normalized path. - */ function normalize(path) { - assertArg(path); - const isAbsolute = isPosixPathSeparator(path.charCodeAt(0)); - const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1)); - // Normalize the path - path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator); - if (path.length === 0 && !isAbsolute) path = "."; - if (path.length > 0 && trailingSeparator) path += "/"; - if (isAbsolute) return `/${path}`; - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * - * @example Usage - * ```ts - * import { join } from "@std/path/posix/join"; - * import { assertEquals } from "@std/assert"; - * - * const path = join("/foo", "bar", "baz/asdf", "quux", ".."); - * assertEquals(path, "/foo/bar/baz/asdf"); - * ``` - * - * @example Working with URLs - * ```ts - * import { join } from "@std/path/posix/join"; - * import { assertEquals } from "@std/assert"; - * - * const url = new URL("https://deno.land"); - * url.pathname = join("std", "path", "mod.ts"); - * assertEquals(url.href, "https://deno.land/std/path/mod.ts"); - * - * url.pathname = join("//std", "path/", "/mod.ts"); - * assertEquals(url.href, "https://deno.land/std/path/mod.ts"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `join` from `@std/path/posix/unstable-join`. - * - * @param paths The paths to join. - * @returns The joined path. - */ function join(...paths) { - if (paths.length === 0) return "."; - paths.forEach((path)=>assertPath(path)); - const joined = paths.filter((path)=>path.length > 0).join("/"); - return joined === "" ? "." : normalize(joined); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return a `ParsedPath` object of the `path`. - * - * @example Usage - * ```ts - * import { parse } from "@std/path/posix/parse"; - * import { assertEquals } from "@std/assert"; - * - * const path = parse("/home/user/file.txt"); - * assertEquals(path, { - * root: "/", - * dir: "/home/user", - * base: "file.txt", - * ext: ".txt", - * name: "file" - * }); - * ``` - * - * @param path The path to parse. - * @returns The parsed path object. - */ function parse(path) { - assertPath(path); - const ret = { - root: "", - dir: "", - base: "", - ext: "", - name: "" - }; - if (path.length === 0) return ret; - const isAbsolute = isPosixPathSeparator(path.charCodeAt(0)); - let start; - if (isAbsolute) { - ret.root = "/"; - start = 1; - } else { - start = 0; - } - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - // Get non-dir info - for(; i >= start; --i){ - const code = path.charCodeAt(i); - if (isPosixPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - if (end !== -1) { - if (startPart === 0 && isAbsolute) { - ret.base = ret.name = path.slice(1, end); - } else { - ret.base = ret.name = path.slice(startPart, end); - } - } - // Fallback to '/' in case there is no basename - ret.base = ret.base || "/"; - } else { - if (startPart === 0 && isAbsolute) { - ret.name = path.slice(1, startDot); - ret.base = path.slice(1, end); - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - } - ret.ext = path.slice(startDot, end); - } - if (startPart > 0) { - ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator); - } else if (isAbsolute) ret.dir = "/"; - return ret; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Resolves path segments into a `path`. - * - * @example Usage - * ```ts - * import { resolve } from "@std/path/posix/resolve"; - * import { assertEquals } from "@std/assert"; - * - * const path = resolve("/foo", "bar", "baz/asdf", "quux", ".."); - * assertEquals(path, "/foo/bar/baz/asdf"); - * ``` - * - * @param pathSegments The path segments to resolve. - * @returns The resolved path. - */ function resolve(...pathSegments) { - let resolvedPath = ""; - let resolvedAbsolute = false; - for(let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--){ - let path; - if (i >= 0) path = pathSegments[i]; - else { - // deno-lint-ignore no-explicit-any - const { Deno } = globalThis; - if (typeof Deno?.cwd !== "function") { - throw new TypeError("Resolved a relative path without a current working directory (CWD)"); - } - path = Deno.cwd(); - } - assertPath(path); - // Skip empty entries - if (path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0)); - } - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when Deno.cwd() fails) - // Normalize the path - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator); - if (resolvedAbsolute) { - if (resolvedPath.length > 0) return `/${resolvedPath}`; - else return "/"; - } else if (resolvedPath.length > 0) return resolvedPath; - else return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArgs(from, to) { - assertPath(from); - assertPath(to); - if (from === to) return ""; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the relative path from `from` to `to` based on current working directory. - * - * If `from` and `to` are the same, return an empty string. - * - * @example Usage - * ```ts - * import { relative } from "@std/path/posix/relative"; - * import { assertEquals } from "@std/assert"; - * - * const path = relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb"); - * assertEquals(path, "../../impl/bbb"); - * ``` - * - * @param from The path to start from. - * @param to The path to reach. - * @returns The relative path. - */ function relative(from, to) { - assertArgs(from, to); - from = resolve(from); - to = resolve(to); - if (from === to) return ""; - // Trim any leading backslashes - let fromStart = 1; - const fromEnd = from.length; - for(; fromStart < fromEnd; ++fromStart){ - if (!isPosixPathSeparator(from.charCodeAt(fromStart))) break; - } - const fromLen = fromEnd - fromStart; - // Trim any leading backslashes - let toStart = 1; - const toEnd = to.length; - for(; toStart < toEnd; ++toStart){ - if (!isPosixPathSeparator(to.charCodeAt(toStart))) break; - } - const toLen = toEnd - toStart; - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for(; i <= length; ++i){ - if (i === length) { - if (toLen > length) { - if (isPosixPathSeparator(to.charCodeAt(toStart + i))) { - // We get here if `from` is the exact base path for `to`. - // For example: from='/foo/bar'; to='/foo/bar/baz' - return to.slice(toStart + i + 1); - } else if (i === 0) { - // We get here if `from` is the root - // For example: from='/'; to='/foo' - return to.slice(toStart + i); - } - } else if (fromLen > length) { - if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) { - // We get here if `to` is the exact base path for `from`. - // For example: from='/foo/bar/baz'; to='/foo/bar' - lastCommonSep = i; - } else if (i === 0) { - // We get here if `to` is the root. - // For example: from='/foo'; to='/' - lastCommonSep = 0; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (isPosixPathSeparator(fromCode)) lastCommonSep = i; - } - let out = ""; - // Generate the relative path based on the path difference between `to` - // and `from` - for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){ - if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) { - if (out.length === 0) out += ".."; - else out += "/.."; - } - } - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) return out + to.slice(toStart + lastCommonSep); - else { - toStart += lastCommonSep; - if (isPosixPathSeparator(to.charCodeAt(toStart))) ++toStart; - return to.slice(toStart); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const WHITESPACE_ENCODINGS = { - "\u0009": "%09", - "\u000A": "%0A", - "\u000B": "%0B", - "\u000C": "%0C", - "\u000D": "%0D", - "\u0020": "%20" -}; -function encodeWhitespace(string) { - return string.replaceAll(/[\s]/g, (c)=>{ - return WHITESPACE_ENCODINGS[c] ?? c; - }); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a path string to a file URL. - * - * @example Usage - * ```ts - * import { toFileUrl } from "@std/path/posix/to-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo")); - * assertEquals(toFileUrl("/home/foo bar"), new URL("file:///home/foo%20bar")); - * ``` - * - * @param path The path to convert. - * @returns The file URL. - */ function toFileUrl(path) { - if (!isAbsolute(path)) { - throw new TypeError(`Path must be absolute: received "${path}"`); - } - const url = new URL("file:///"); - url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C")); - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a path to a namespaced path. This function returns the path as is on posix. - * - * @example Usage - * ```ts - * import { toNamespacedPath } from "@std/path/posix/to-namespaced-path"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(toNamespacedPath("/home/foo"), "/home/foo"); - * ``` - * - * @param path The path. - * @returns The namespaced path. - */ function toNamespacedPath(path) { - // Non-op on posix systems - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function common$1(paths, sep) { - const [first = "", ...remaining] = paths; - const parts = first.split(sep); - let endOfPrefix = parts.length; - let append = ""; - for (const path of remaining){ - const compare = path.split(sep); - if (compare.length <= endOfPrefix) { - endOfPrefix = compare.length; - append = ""; - } - for(let i = 0; i < endOfPrefix; i++){ - if (compare[i] !== parts[i]) { - endOfPrefix = i; - append = i === 0 ? "" : sep; - break; - } - } - } - return parts.slice(0, endOfPrefix).join(sep) + append; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** Determines the common path from a set of paths for POSIX systems. - * - * @example Usage - * ```ts - * import { common } from "@std/path/posix/common"; - * import { assertEquals } from "@std/assert"; - * - * const path = common([ - * "./deno/std/path/mod.ts", - * "./deno/std/fs/mod.ts", - * ]); - * assertEquals(path, "./deno/std/"); - * ``` - * - * @param paths The paths to compare. - * @returns The common path. - */ function common(paths) { - return common$1(paths, SEPARATOR); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Options for {@linkcode globToRegExp}, {@linkcode joinGlobs}, - * {@linkcode normalizeGlob} and {@linkcode expandGlob}. - */ const REG_EXP_ESCAPE_CHARS = [ - "!", - "$", - "(", - ")", - "*", - "+", - ".", - "=", - "?", - "[", - "\\", - "^", - "{", - "|" -]; -const RANGE_ESCAPE_CHARS = [ - "-", - "\\", - "]" -]; -function _globToRegExp(c, glob, { extended = true, globstar: globstarOption = true, // os = osType, -caseInsensitive = false } = {}) { - if (glob === "") { - return /(?!)/; - } - // Remove trailing separators. - let newLength = glob.length; - for(; newLength > 1 && c.seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - let regExpString = ""; - // Terminates correctly. Trust that `j` is incremented every iteration. - for(let j = 0; j < glob.length;){ - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - // Terminates with `i` at the non-inclusive end of the current segment. - for(; i < glob.length && !c.seps.includes(glob[i]); i++){ - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? RANGE_ESCAPE_CHARS : REG_EXP_ESCAPE_CHARS; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - if (glob[i] === c.escapePrefix) { - inEscape = true; - continue; - } - if (glob[i] === "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] === "!") { - i++; - segment += "^"; - } else if (glob[i + 1] === "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] === ":") { - let k = i + 1; - let value = ""; - while(glob[k + 1] !== undefined && glob[k + 1] !== ":"){ - value += glob[k + 1]; - k++; - } - if (glob[k + 1] === ":" && glob[k + 2] === "]") { - i = k + 2; - if (value === "alnum") segment += "\\dA-Za-z"; - else if (value === "alpha") segment += "A-Za-z"; - else if (value === "ascii") segment += "\x00-\x7F"; - else if (value === "blank") segment += "\t "; - else if (value === "cntrl") segment += "\x00-\x1F\x7F"; - else if (value === "digit") segment += "\\d"; - else if (value === "graph") segment += "\x21-\x7E"; - else if (value === "lower") segment += "a-z"; - else if (value === "print") segment += "\x20-\x7E"; - else if (value === "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value === "space") segment += "\\s\v"; - else if (value === "upper") segment += "A-Z"; - else if (value === "word") segment += "\\w"; - else if (value === "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - if (glob[i] === "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - if (inRange) { - segment += glob[i]; - continue; - } - if (glob[i] === ")" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += ")"; - const type = groupStack.pop(); - if (type === "!") { - segment += c.wildcard; - } else if (type !== "@") { - segment += type; - } - continue; - } - if (glob[i] === "|" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "+" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - if (glob[i] === "@" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - if (glob[i] === "?") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - if (glob[i] === "!" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - if (glob[i] === "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - if (glob[i] === "}" && groupStack[groupStack.length - 1] === "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - if (glob[i] === "," && groupStack[groupStack.length - 1] === "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "*") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while(glob[i + 1] === "*"){ - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if (globstarOption && numStars === 2 && [ - ...c.seps, - undefined - ].includes(prevChar) && [ - ...c.seps, - undefined - ].includes(nextChar)) { - segment += c.globstar; - endsWithSep = true; - } else { - segment += c.wildcard; - } - } - continue; - } - segment += REG_EXP_ESCAPE_CHARS.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)){ - segment += REG_EXP_ESCAPE_CHARS.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? c.sep : c.sepMaybe; - endsWithSep = true; - } - // Terminates with `i` at the start of the next segment. - while(c.seps.includes(glob[i]))i++; - j = i; - } - regExpString = `^${regExpString}$`; - return new RegExp(regExpString, caseInsensitive ? "i" : ""); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const constants = { - sep: "/+", - sepMaybe: "/*", - seps: [ - "/" - ], - globstar: "(?:[^/]*(?:/|$)+)*", - wildcard: "[^/]*", - escapePrefix: "\\" -}; -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `?` - Matches any single character. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precedence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occurred. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. - * - * @example Usage - * ```ts - * import { globToRegExp } from "@std/path/posix/glob-to-regexp"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(globToRegExp("*.js"), /^[^/]*\.js\/*$/); - * ``` - * - * @param glob Glob string to convert. - * @param options Conversion options. - * @returns The regular expression equivalent to the glob. - */ function globToRegExp(glob, options = {}) { - return _globToRegExp(constants, glob, options); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Test whether the given string is a glob. - * - * @example Usage - * ```ts - * import { isGlob } from "@std/path/is-glob"; - * import { assert } from "@std/assert"; - * - * assert(!isGlob("foo/bar/../baz")); - * assert(isGlob("foo/*ar/../baz")); - * ``` - * - * @param str String to test. - * @returns `true` if the given string is a glob, otherwise `false` - */ function isGlob(str) { - const chars = { - "{": "}", - "(": ")", - "[": "]" - }; - const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - if (str === "") { - return false; - } - let match; - while(match = regex.exec(str)){ - if (match[2]) return true; - let idx = match.index + match[0].length; - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - str = str.slice(idx); - } - return false; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * ```ts - * import { normalizeGlob } from "@std/path/posix/normalize-glob"; - * import { assertEquals } from "@std/assert"; - * - * const path = normalizeGlob("foo/bar/../*", { globstar: true }); - * assertEquals(path, "foo/*"); - * ``` - * - * @param glob The glob to normalize. - * @param options The options to use. - * @returns The normalized path. - */ function normalizeGlob(glob, { globstar = false } = {}) { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEPARATOR_PATTERN.source; - const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g"); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like join(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * ```ts - * import { joinGlobs } from "@std/path/posix/join-globs"; - * import { assertEquals } from "@std/assert"; - * - * const path = joinGlobs(["foo", "bar", "**"], { globstar: true }); - * assertEquals(path, "foo/bar/**"); - * ``` - * - * @param globs The globs to join. - * @param options The options to use. - * @returns The joined path. - */ function joinGlobs(globs, { extended = true, globstar = false } = {}) { - if (!globstar || globs.length === 0) { - return join(...globs); - } - let joined; - for (const glob of globs){ - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEPARATOR}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { - extended, - globstar - }); -} - -exports.DELIMITER = DELIMITER; -exports.SEPARATOR = SEPARATOR; -exports.SEPARATOR_PATTERN = SEPARATOR_PATTERN; -exports.basename = basename; -exports.common = common; -exports.dirname = dirname; -exports.extname = extname; -exports.format = format; -exports.fromFileUrl = fromFileUrl; -exports.globToRegExp = globToRegExp; -exports.isAbsolute = isAbsolute; -exports.isGlob = isGlob; -exports.join = join; -exports.joinGlobs = joinGlobs; -exports.normalize = normalize; -exports.normalizeGlob = normalizeGlob; -exports.parse = parse; -exports.relative = relative; -exports.resolve = resolve; -exports.toFileUrl = toFileUrl; -exports.toNamespacedPath = toNamespacedPath; diff --git a/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs b/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs deleted file mode 100644 index 9561659..0000000 --- a/node_modules/@eslint/config-array/dist/cjs/std__path/windows.cjs +++ /dev/null @@ -1,1669 +0,0 @@ -'use strict'; - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -function assertPath(path) { - if (typeof path !== "string") { - throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function stripSuffix(name, suffix) { - if (suffix.length >= name.length) { - return name; - } - const lenDiff = name.length - suffix.length; - for(let i = suffix.length - 1; i >= 0; --i){ - if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) { - return name; - } - } - return name.slice(0, -suffix.length); -} -function lastPathSegment(path, isSep, start = 0) { - let matchedNonSeparator = false; - let end = path.length; - for(let i = path.length - 1; i >= start; --i){ - if (isSep(path.charCodeAt(i))) { - if (matchedNonSeparator) { - start = i + 1; - break; - } - } else if (!matchedNonSeparator) { - matchedNonSeparator = true; - end = i + 1; - } - } - return path.slice(start, end); -} -function assertArgs$1(path, suffix) { - assertPath(path); - if (path.length === 0) return path; - if (typeof suffix !== "string") { - throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Alphabet chars. -const CHAR_UPPERCASE_A = 65; /* A */ -const CHAR_LOWERCASE_A = 97; /* a */ -const CHAR_UPPERCASE_Z = 90; /* Z */ -const CHAR_LOWERCASE_Z = 122; /* z */ -// Non-alphabetic chars. -const CHAR_DOT = 46; /* . */ -const CHAR_FORWARD_SLASH = 47; /* / */ -const CHAR_BACKWARD_SLASH = 92; /* \ */ -const CHAR_COLON = 58; /* : */ -const CHAR_QUESTION_MARK = 63; /* ? */ - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function stripTrailingSeparators(segment, isSep) { - if (segment.length <= 1) { - return segment; - } - let end = segment.length; - for(let i = segment.length - 1; i > 0; i--){ - if (isSep(segment.charCodeAt(i))) { - end = i; - } else { - break; - } - } - return segment.slice(0, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function isPosixPathSeparator(code) { - return code === CHAR_FORWARD_SLASH; -} -function isPathSeparator(code) { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -} -function isWindowsDeviceRoot(code) { - return code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z || code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the last portion of a `path`. - * Trailing directory separators are ignored, and optional suffix is removed. - * - * @example Usage - * ```ts - * import { basename } from "@std/path/windows/basename"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(basename("C:\\user\\Documents\\"), "Documents"); - * assertEquals(basename("C:\\user\\Documents\\image.png"), "image.png"); - * assertEquals(basename("C:\\user\\Documents\\image.png", ".png"), "image"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `basename` from `@std/path/windows/unstable-basename`. - * - * @param path The path to extract the name from. - * @param suffix The suffix to remove from extracted name. - * @returns The extracted name. - */ function basename(path, suffix = "") { - assertArgs$1(path, suffix); - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - let start = 0; - if (path.length >= 2) { - const drive = path.charCodeAt(0); - if (isWindowsDeviceRoot(drive)) { - if (path.charCodeAt(1) === CHAR_COLON) start = 2; - } - } - const lastSegment = lastPathSegment(path, isPathSeparator, start); - const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator); - return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * The character used to separate entries in the PATH environment variable. - */ const DELIMITER = ";"; -/** - * The character used to separate components of a file path. - */ const SEPARATOR = "\\"; -/** - * A regular expression that matches one or more path separators. - */ const SEPARATOR_PATTERN = /[\\/]+/; - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$3(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the directory path of a `path`. - * - * @example Usage - * ```ts - * import { dirname } from "@std/path/windows/dirname"; - * import { assertEquals } from "@std/assert"; - * - * const dir = dirname("C:\\foo\\bar\\baz.ext"); - * assertEquals(dir, "C:\\foo\\bar"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `dirname` from `@std/path/windows/unstable-dirname`. - * - * @param path The path to get the directory from. - * @returns The directory path. - */ function dirname(path) { - assertArg$3(path); - const len = path.length; - let rootEnd = -1; - let end = -1; - let matchedSlash = true; - let offset = 0; - const code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - rootEnd = offset = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - return path; - } - if (j !== last) { - // We matched a UNC root with leftovers - // Offset by 1 to include the separator after the UNC root to - // treat it as a "normal root" on top of a (UNC) root - rootEnd = offset = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = offset = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) rootEnd = offset = 3; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - return path; - } - for(let i = len - 1; i >= offset; --i){ - if (isPathSeparator(path.charCodeAt(i))) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - if (end === -1) { - if (rootEnd === -1) return "."; - else end = rootEnd; - } - return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the extension of the `path` with leading period. - * - * @example Usage - * ```ts - * import { extname } from "@std/path/windows/extname"; - * import { assertEquals } from "@std/assert"; - * - * const ext = extname("file.ts"); - * assertEquals(ext, ".ts"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `extname` from `@std/path/windows/unstable-extname`. - * - * @param path The path to get the extension from. - * @returns The extension of the `path`. - */ function extname(path) { - assertPath(path); - let start = 0; - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - if (path.length >= 2 && path.charCodeAt(1) === CHAR_COLON && isWindowsDeviceRoot(path.charCodeAt(0))) { - start = startPart = 2; - } - for(let i = path.length - 1; i >= start; --i){ - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ""; - } - return path.slice(startDot, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function _format(sep, pathObject) { - const dir = pathObject.dir || pathObject.root; - const base = pathObject.base || (pathObject.name ?? "") + (pathObject.ext ?? ""); - if (!dir) return base; - if (base === sep) return dir; - if (dir === pathObject.root) return dir + base; - return dir + sep + base; -} -function assertArg$2(pathObject) { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Generate a path from `ParsedPath` object. - * - * @example Usage - * ```ts - * import { format } from "@std/path/windows/format"; - * import { assertEquals } from "@std/assert"; - * - * const path = format({ - * root: "C:\\", - * dir: "C:\\path\\dir", - * base: "file.txt", - * ext: ".txt", - * name: "file" - * }); - * assertEquals(path, "C:\\path\\dir\\file.txt"); - * ``` - * - * @param pathObject The path object to format. - * @returns The formatted path. - */ function format(pathObject) { - assertArg$2(pathObject); - return _format("\\", pathObject); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$1(url) { - url = url instanceof URL ? url : new URL(url); - if (url.protocol !== "file:") { - throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); - } - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a file URL to a path string. - * - * @example Usage - * ```ts - * import { fromFileUrl } from "@std/path/windows/from-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo"); - * assertEquals(fromFileUrl("file:///C:/Users/foo"), "C:\\Users\\foo"); - * assertEquals(fromFileUrl("file://localhost/home/foo"), "\\home\\foo"); - * ``` - * - * @param url The file URL to convert. - * @returns The path string. - */ function fromFileUrl(url) { - url = assertArg$1(url); - let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); - if (url.hostname !== "") { - // Note: The `URL` implementation guarantees that the drive letter and - // hostname are mutually exclusive. Otherwise it would not have been valid - // to append the hostname and path like this. - path = `\\\\${url.hostname}${path}`; - } - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Verifies whether provided path is absolute. - * - * @example Usage - * ```ts - * import { isAbsolute } from "@std/path/windows/is-absolute"; - * import { assert, assertFalse } from "@std/assert"; - * - * assert(isAbsolute("C:\\foo\\bar")); - * assertFalse(isAbsolute("..\\baz")); - * ``` - * - * @param path The path to verify. - * @returns `true` if the path is absolute, `false` otherwise. - */ function isAbsolute(path) { - assertPath(path); - const len = path.length; - if (len === 0) return false; - const code = path.charCodeAt(0); - if (isPathSeparator(code)) { - return true; - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (len > 2 && path.charCodeAt(1) === CHAR_COLON) { - if (isPathSeparator(path.charCodeAt(2))) return true; - } - } - return false; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Resolves . and .. elements in a path with directory names -function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let code; - for(let i = 0; i <= path.length; ++i){ - if (i < path.length) code = path.charCodeAt(i); - else if (isPathSeparator(code)) break; - else code = CHAR_FORWARD_SLASH; - if (isPathSeparator(code)) { - if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; - } else if (res.length === 2 || res.length === 1) { - res = ""; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) res += `${separator}..`; - else res = ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) res += separator + path.slice(lastSlash + 1, i); - else res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === CHAR_DOT && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Normalize the `path`, resolving `'..'` and `'.'` segments. - * Note that resolving these segments does not necessarily mean that all will be eliminated. - * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`. - * - * @example Usage - * ```ts - * import { normalize } from "@std/path/windows/normalize"; - * import { assertEquals } from "@std/assert"; - * - * const normalized = normalize("C:\\foo\\..\\bar"); - * assertEquals(normalized, "C:\\bar"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `normalize` from `@std/path/windows/unstable-normalize`. - * - * @param path The path to normalize - * @returns The normalized path - */ function normalize(path) { - assertArg(path); - const len = path.length; - let rootEnd = 0; - let device; - let isAbsolute = false; - const code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - // If we started with a separator, we know we at least have an absolute - // path of some kind (UNC or otherwise) - isAbsolute = true; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - // Return the normalized version of the UNC root since there - // is nothing left to process - return `\\\\${firstPart}\\${path.slice(last)}\\`; - } else if (j !== last) { - // We matched a UNC root with leftovers - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid unnecessary - // work - return "\\"; - } - let tail; - if (rootEnd < len) { - tail = normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator); - } else { - tail = ""; - } - if (tail.length === 0 && !isAbsolute) tail = "."; - if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { - tail += "\\"; - } - if (device === undefined) { - if (isAbsolute) { - if (tail.length > 0) return `\\${tail}`; - else return "\\"; - } - return tail; - } else if (isAbsolute) { - if (tail.length > 0) return `${device}\\${tail}`; - else return `${device}\\`; - } - return device + tail; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * - * @example Usage - * ```ts - * import { join } from "@std/path/windows/join"; - * import { assertEquals } from "@std/assert"; - * - * const joined = join("C:\\foo", "bar", "baz\\.."); - * assertEquals(joined, "C:\\foo\\bar"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `join` from `@std/path/windows/unstable-join`. - * - * @param paths The paths to join. - * @returns The joined path. - */ function join(...paths) { - paths.forEach((path)=>assertPath(path)); - paths = paths.filter((path)=>path.length > 0); - if (paths.length === 0) return "."; - // Make sure that the joined path doesn't start with two slashes, because - // normalize() will mistake it for an UNC path then. - // - // This step is skipped when it is very clear that the user actually - // intended to point at an UNC path. This is assumed when the first - // non-empty string arguments starts with exactly two slashes followed by - // at least one more non-slash character. - // - // Note that for normalize() to treat a path as an UNC path it needs to - // have at least 2 components, so we don't filter for that here. - // This means that the user can use join to construct UNC paths from - // a server name and a share name; for example: - // path.join('//server', 'share') -> '\\\\server\\share\\' - let needsReplace = true; - let slashCount = 0; - const firstPart = paths[0]; - if (isPathSeparator(firstPart.charCodeAt(0))) { - ++slashCount; - const firstLen = firstPart.length; - if (firstLen > 1) { - if (isPathSeparator(firstPart.charCodeAt(1))) { - ++slashCount; - if (firstLen > 2) { - if (isPathSeparator(firstPart.charCodeAt(2))) ++slashCount; - else { - // We matched a UNC path in the first part - needsReplace = false; - } - } - } - } - } - let joined = paths.join("\\"); - if (needsReplace) { - // Find any more consecutive slashes we need to replace - for(; slashCount < joined.length; ++slashCount){ - if (!isPathSeparator(joined.charCodeAt(slashCount))) break; - } - // Replace the slashes if needed - if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`; - } - return normalize(joined); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return a `ParsedPath` object of the `path`. - * - * @example Usage - * ```ts - * import { parse } from "@std/path/windows/parse"; - * import { assertEquals } from "@std/assert"; - * - * const parsed = parse("C:\\foo\\bar\\baz.ext"); - * assertEquals(parsed, { - * root: "C:\\", - * dir: "C:\\foo\\bar", - * base: "baz.ext", - * ext: ".ext", - * name: "baz", - * }); - * ``` - * - * @param path The path to parse. - * @returns The `ParsedPath` object. - */ function parse(path) { - assertPath(path); - const ret = { - root: "", - dir: "", - base: "", - ext: "", - name: "" - }; - const len = path.length; - if (len === 0) return ret; - let rootEnd = 0; - let code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - rootEnd = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - rootEnd = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - if (len === 3) { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - ret.base = "\\"; - return ret; - } - rootEnd = 3; - } - } else { - // `path` contains just a relative drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - ret.base = "\\"; - return ret; - } - if (rootEnd > 0) ret.root = path.slice(0, rootEnd); - let startDot = -1; - let startPart = rootEnd; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - // Get non-dir info - for(; i >= rootEnd; --i){ - code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - if (end !== -1) { - ret.base = ret.name = path.slice(startPart, end); - } - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - ret.ext = path.slice(startDot, end); - } - // Fallback to '\' in case there is no basename - ret.base = ret.base || "\\"; - // If the directory is the root, use the entire root as the `dir` including - // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the - // trailing slash (`C:\abc\def` -> `C:\abc`). - if (startPart > 0 && startPart !== rootEnd) { - ret.dir = path.slice(0, startPart - 1); - } else ret.dir = ret.root; - return ret; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Resolves path segments into a `path`. - * - * @example Usage - * ```ts - * import { resolve } from "@std/path/windows/resolve"; - * import { assertEquals } from "@std/assert"; - * - * const resolved = resolve("C:\\foo\\bar", "..\\baz"); - * assertEquals(resolved, "C:\\foo\\baz"); - * ``` - * - * @param pathSegments The path segments to process to path - * @returns The resolved path - */ function resolve(...pathSegments) { - let resolvedDevice = ""; - let resolvedTail = ""; - let resolvedAbsolute = false; - for(let i = pathSegments.length - 1; i >= -1; i--){ - let path; - // deno-lint-ignore no-explicit-any - const { Deno } = globalThis; - if (i >= 0) { - path = pathSegments[i]; - } else if (!resolvedDevice) { - if (typeof Deno?.cwd !== "function") { - throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)"); - } - path = Deno.cwd(); - } else { - if (typeof Deno?.env?.get !== "function" || typeof Deno?.cwd !== "function") { - throw new TypeError("Resolved a relative path without a current working directory (CWD)"); - } - path = Deno.cwd(); - // Verify that a cwd was found and that it actually points - // to our drive. If not, default to the drive's root. - if (path === undefined || path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\`) { - path = `${resolvedDevice}\\`; - } - } - assertPath(path); - const len = path.length; - // Skip empty entries - if (len === 0) continue; - let rootEnd = 0; - let device = ""; - let isAbsolute = false; - const code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - // If we started with a separator, we know we at least have an - // absolute path of some kind (UNC or otherwise) - isAbsolute = true; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - device = `\\\\${firstPart}\\${path.slice(last)}`; - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator - rootEnd = 1; - isAbsolute = true; - } - if (device.length > 0 && resolvedDevice.length > 0 && device.toLowerCase() !== resolvedDevice.toLowerCase()) { - continue; - } - if (resolvedDevice.length === 0 && device.length > 0) { - resolvedDevice = device; - } - if (!resolvedAbsolute) { - resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`; - resolvedAbsolute = isAbsolute; - } - if (resolvedAbsolute && resolvedDevice.length > 0) break; - } - // At this point the path should be resolved to a full absolute path, - // but handle relative paths to be safe (might happen when Deno.cwd() - // fails) - // Normalize the tail path - resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator); - return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArgs(from, to) { - assertPath(from); - assertPath(to); - if (from === to) return ""; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the relative path from `from` to `to` based on current working directory. - * - * An example in windws, for instance: - * from = 'C:\\orandea\\test\\aaa' - * to = 'C:\\orandea\\impl\\bbb' - * The output of the function should be: '..\\..\\impl\\bbb' - * - * @example Usage - * ```ts - * import { relative } from "@std/path/windows/relative"; - * import { assertEquals } from "@std/assert"; - * - * const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb"); - * assertEquals(relativePath, "..\\..\\impl\\bbb"); - * ``` - * - * @param from The path from which to calculate the relative path - * @param to The path to which to calculate the relative path - * @returns The relative path from `from` to `to` - */ function relative(from, to) { - assertArgs(from, to); - const fromOrig = resolve(from); - const toOrig = resolve(to); - if (fromOrig === toOrig) return ""; - from = fromOrig.toLowerCase(); - to = toOrig.toLowerCase(); - if (from === to) return ""; - // Trim any leading backslashes - let fromStart = 0; - let fromEnd = from.length; - for(; fromStart < fromEnd; ++fromStart){ - if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for(; fromEnd - 1 > fromStart; --fromEnd){ - if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - // Trim any leading backslashes - let toStart = 0; - let toEnd = to.length; - for(; toStart < toEnd; ++toStart){ - if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for(; toEnd - 1 > toStart; --toEnd){ - if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const toLen = toEnd - toStart; - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for(; i <= length; ++i){ - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz' - return toOrig.slice(toStart + i + 1); - } else if (i === 2) { - // We get here if `from` is the device root. - // For example: from='C:\\'; to='C:\\foo' - return toOrig.slice(toStart + i); - } - } - if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='C:\\foo\\bar'; to='C:\\foo' - lastCommonSep = i; - } else if (i === 2) { - // We get here if `to` is the device root. - // For example: from='C:\\foo\\bar'; to='C:\\' - lastCommonSep = 3; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_BACKWARD_SLASH) lastCommonSep = i; - } - // We found a mismatch before the first common path separator was seen, so - // return the original `to`. - if (i !== length && lastCommonSep === -1) { - return toOrig; - } - let out = ""; - if (lastCommonSep === -1) lastCommonSep = 0; - // Generate the relative path based on the path difference between `to` and - // `from` - for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){ - if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "\\.."; - } - } - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) { - return out + toOrig.slice(toStart + lastCommonSep, toEnd); - } else { - toStart += lastCommonSep; - if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart; - return toOrig.slice(toStart, toEnd); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const WHITESPACE_ENCODINGS = { - "\u0009": "%09", - "\u000A": "%0A", - "\u000B": "%0B", - "\u000C": "%0C", - "\u000D": "%0D", - "\u0020": "%20" -}; -function encodeWhitespace(string) { - return string.replaceAll(/[\s]/g, (c)=>{ - return WHITESPACE_ENCODINGS[c] ?? c; - }); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a path string to a file URL. - * - * @example Usage - * ```ts - * import { toFileUrl } from "@std/path/windows/to-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo")); - * assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo")); - * assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo")); - * ``` - * @param path The path to convert. - * @returns The file URL. - */ function toFileUrl(path) { - if (!isAbsolute(path)) { - throw new TypeError(`Path must be absolute: received "${path}"`); - } - const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/); - const url = new URL("file:///"); - url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25")); - if (hostname !== undefined && hostname !== "localhost") { - url.hostname = hostname; - if (!url.hostname) { - throw new TypeError(`Invalid hostname: "${url.hostname}"`); - } - } - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Resolves path to a namespace path - * - * @example Usage - * ```ts - * import { toNamespacedPath } from "@std/path/windows/to-namespaced-path"; - * import { assertEquals } from "@std/assert"; - * - * const namespaced = toNamespacedPath("C:\\foo\\bar"); - * assertEquals(namespaced, "\\\\?\\C:\\foo\\bar"); - * ``` - * - * @param path The path to resolve to namespaced path - * @returns The resolved namespaced path - */ function toNamespacedPath(path) { - // Note: this will *probably* throw somewhere. - if (typeof path !== "string") return path; - if (path.length === 0) return ""; - const resolvedPath = resolve(path); - if (resolvedPath.length >= 3) { - if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { - // Possible UNC root - if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { - const code = resolvedPath.charCodeAt(2); - if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { - // Matched non-long UNC root, convert the path to a long UNC path - return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; - } - } - } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) { - // Possible device root - if (resolvedPath.charCodeAt(1) === CHAR_COLON && resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) { - // Matched device root, convert the path to a long UNC path - return `\\\\?\\${resolvedPath}`; - } - } - } - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function common$1(paths, sep) { - const [first = "", ...remaining] = paths; - const parts = first.split(sep); - let endOfPrefix = parts.length; - let append = ""; - for (const path of remaining){ - const compare = path.split(sep); - if (compare.length <= endOfPrefix) { - endOfPrefix = compare.length; - append = ""; - } - for(let i = 0; i < endOfPrefix; i++){ - if (compare[i] !== parts[i]) { - endOfPrefix = i; - append = i === 0 ? "" : sep; - break; - } - } - } - return parts.slice(0, endOfPrefix).join(sep) + append; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Determines the common path from a set of paths for Windows systems. - * - * @example Usage - * ```ts - * import { common } from "@std/path/windows/common"; - * import { assertEquals } from "@std/assert"; - * - * const path = common([ - * "C:\\foo\\bar", - * "C:\\foo\\baz", - * ]); - * assertEquals(path, "C:\\foo\\"); - * ``` - * - * @param paths The paths to compare. - * @returns The common path. - */ function common(paths) { - return common$1(paths, SEPARATOR); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Options for {@linkcode globToRegExp}, {@linkcode joinGlobs}, - * {@linkcode normalizeGlob} and {@linkcode expandGlob}. - */ const REG_EXP_ESCAPE_CHARS = [ - "!", - "$", - "(", - ")", - "*", - "+", - ".", - "=", - "?", - "[", - "\\", - "^", - "{", - "|" -]; -const RANGE_ESCAPE_CHARS = [ - "-", - "\\", - "]" -]; -function _globToRegExp(c, glob, { extended = true, globstar: globstarOption = true, // os = osType, -caseInsensitive = false } = {}) { - if (glob === "") { - return /(?!)/; - } - // Remove trailing separators. - let newLength = glob.length; - for(; newLength > 1 && c.seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - let regExpString = ""; - // Terminates correctly. Trust that `j` is incremented every iteration. - for(let j = 0; j < glob.length;){ - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - // Terminates with `i` at the non-inclusive end of the current segment. - for(; i < glob.length && !c.seps.includes(glob[i]); i++){ - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? RANGE_ESCAPE_CHARS : REG_EXP_ESCAPE_CHARS; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - if (glob[i] === c.escapePrefix) { - inEscape = true; - continue; - } - if (glob[i] === "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] === "!") { - i++; - segment += "^"; - } else if (glob[i + 1] === "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] === ":") { - let k = i + 1; - let value = ""; - while(glob[k + 1] !== undefined && glob[k + 1] !== ":"){ - value += glob[k + 1]; - k++; - } - if (glob[k + 1] === ":" && glob[k + 2] === "]") { - i = k + 2; - if (value === "alnum") segment += "\\dA-Za-z"; - else if (value === "alpha") segment += "A-Za-z"; - else if (value === "ascii") segment += "\x00-\x7F"; - else if (value === "blank") segment += "\t "; - else if (value === "cntrl") segment += "\x00-\x1F\x7F"; - else if (value === "digit") segment += "\\d"; - else if (value === "graph") segment += "\x21-\x7E"; - else if (value === "lower") segment += "a-z"; - else if (value === "print") segment += "\x20-\x7E"; - else if (value === "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value === "space") segment += "\\s\v"; - else if (value === "upper") segment += "A-Z"; - else if (value === "word") segment += "\\w"; - else if (value === "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - if (glob[i] === "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - if (inRange) { - segment += glob[i]; - continue; - } - if (glob[i] === ")" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += ")"; - const type = groupStack.pop(); - if (type === "!") { - segment += c.wildcard; - } else if (type !== "@") { - segment += type; - } - continue; - } - if (glob[i] === "|" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "+" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - if (glob[i] === "@" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - if (glob[i] === "?") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - if (glob[i] === "!" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - if (glob[i] === "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - if (glob[i] === "}" && groupStack[groupStack.length - 1] === "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - if (glob[i] === "," && groupStack[groupStack.length - 1] === "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "*") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while(glob[i + 1] === "*"){ - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if (globstarOption && numStars === 2 && [ - ...c.seps, - undefined - ].includes(prevChar) && [ - ...c.seps, - undefined - ].includes(nextChar)) { - segment += c.globstar; - endsWithSep = true; - } else { - segment += c.wildcard; - } - } - continue; - } - segment += REG_EXP_ESCAPE_CHARS.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)){ - segment += REG_EXP_ESCAPE_CHARS.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? c.sep : c.sepMaybe; - endsWithSep = true; - } - // Terminates with `i` at the start of the next segment. - while(c.seps.includes(glob[i]))i++; - j = i; - } - regExpString = `^${regExpString}$`; - return new RegExp(regExpString, caseInsensitive ? "i" : ""); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const constants = { - sep: "(?:\\\\|/)+", - sepMaybe: "(?:\\\\|/)*", - seps: [ - "\\", - "/" - ], - globstar: "(?:[^\\\\/]*(?:\\\\|/|$)+)*", - wildcard: "[^\\\\/]*", - escapePrefix: "`" -}; -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `?` - Matches any single character. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precedence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occurred. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. - * - * @example Usage - * ```ts - * import { globToRegExp } from "@std/path/windows/glob-to-regexp"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(globToRegExp("*.js"), /^[^\\/]*\.js(?:\\|\/)*$/); - * ``` - * - * @param glob Glob string to convert. - * @param options Conversion options. - * @returns The regular expression equivalent to the glob. - */ function globToRegExp(glob, options = {}) { - return _globToRegExp(constants, glob, options); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Test whether the given string is a glob. - * - * @example Usage - * ```ts - * import { isGlob } from "@std/path/is-glob"; - * import { assert } from "@std/assert"; - * - * assert(!isGlob("foo/bar/../baz")); - * assert(isGlob("foo/*ar/../baz")); - * ``` - * - * @param str String to test. - * @returns `true` if the given string is a glob, otherwise `false` - */ function isGlob(str) { - const chars = { - "{": "}", - "(": ")", - "[": "]" - }; - const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - if (str === "") { - return false; - } - let match; - while(match = regex.exec(str)){ - if (match[2]) return true; - let idx = match.index + match[0].length; - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - str = str.slice(idx); - } - return false; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * ```ts - * import { normalizeGlob } from "@std/path/windows/normalize-glob"; - * import { assertEquals } from "@std/assert"; - * - * const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true }); - * assertEquals(normalized, "**\\bar"); - * ``` - * - * @param glob The glob pattern to normalize. - * @param options The options for glob pattern. - * @returns The normalized glob pattern. - */ function normalizeGlob(glob, { globstar = false } = {}) { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEPARATOR_PATTERN.source; - const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g"); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like join(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * - * ```ts - * import { joinGlobs } from "@std/path/windows/join-globs"; - * import { assertEquals } from "@std/assert"; - * - * const joined = joinGlobs(["foo", "**", "bar"], { globstar: true }); - * assertEquals(joined, "foo\\**\\bar"); - * ``` - * - * @param globs The globs to join. - * @param options The options for glob pattern. - * @returns The joined glob pattern. - */ function joinGlobs(globs, { extended = true, globstar = false } = {}) { - if (!globstar || globs.length === 0) { - return join(...globs); - } - let joined; - for (const glob of globs){ - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEPARATOR}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { - extended, - globstar - }); -} - -exports.DELIMITER = DELIMITER; -exports.SEPARATOR = SEPARATOR; -exports.SEPARATOR_PATTERN = SEPARATOR_PATTERN; -exports.basename = basename; -exports.common = common; -exports.dirname = dirname; -exports.extname = extname; -exports.format = format; -exports.fromFileUrl = fromFileUrl; -exports.globToRegExp = globToRegExp; -exports.isAbsolute = isAbsolute; -exports.isGlob = isGlob; -exports.join = join; -exports.joinGlobs = joinGlobs; -exports.normalize = normalize; -exports.normalizeGlob = normalizeGlob; -exports.parse = parse; -exports.relative = relative; -exports.resolve = resolve; -exports.toFileUrl = toFileUrl; -exports.toNamespacedPath = toNamespacedPath; diff --git a/node_modules/@eslint/config-array/dist/cjs/types.ts b/node_modules/@eslint/config-array/dist/cjs/types.ts deleted file mode 100644 index 1af4011..0000000 --- a/node_modules/@eslint/config-array/dist/cjs/types.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @fileoverview Types for the config-array package. - * @author Nicholas C. Zakas - */ - -export interface ConfigObject { - /** - * The files to include. - */ - files?: string[]; - - /** - * The files to exclude. - */ - ignores?: string[]; - - /** - * The name of the config object. - */ - name?: string; - - // may also have any number of other properties - [key: string]: unknown; -} diff --git a/node_modules/@eslint/config-array/dist/esm/index.d.ts b/node_modules/@eslint/config-array/dist/esm/index.d.ts deleted file mode 100644 index 6fb977e..0000000 --- a/node_modules/@eslint/config-array/dist/esm/index.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -export { ObjectSchema } from "@eslint/object-schema"; -export type PropertyDefinition = import("@eslint/object-schema").PropertyDefinition; -export type ObjectDefinition = import("@eslint/object-schema").ObjectDefinition; -export type ConfigObject = import("./types.ts").ConfigObject; -export type IMinimatchStatic = import("minimatch").IMinimatchStatic; -export type IMinimatch = import("minimatch").IMinimatch; -export type PathImpl = typeof import("@jsr/std__path"); -export type ObjectSchemaInstance = import("@eslint/object-schema").ObjectSchema; -/** - * Represents an array of config objects and provides method for working with - * those config objects. - */ -export 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 {Object} options The options for the ConfigArray. - * @param {string} [options.basePath="/"] The absolute path of the config file directory. - * Defaults to `"/"`. - * @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.extraConfigTypes] List of config types supported. - */ - constructor(configs: Iterable | Function | any, { basePath, normalized, schema: customSchema, extraConfigTypes, }?: { - basePath?: string; - normalized?: boolean; - schema?: any; - extraConfigTypes?: Array; - }); - /** - * The path of the config file that this array was loaded from. - * This is used to calculate filename matches. - * @property basePath - * @type {string} - */ - basePath: string; - /** - * The supported config types. - * @type {Array} - */ - extraConfigTypes: 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(): (string | Function)[]; - /** - * 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(): string[]; - /** - * Indicates if the config array has been normalized. - * @returns {boolean} True if the config array is normalized, false if not. - */ - isNormalized(): boolean; - /** - * Normalizes a config array by flattening embedded arrays and executing - * config functions. - * @param {Object} [context] The context object for config functions. - * @returns {Promise} The current ConfigArray instance. - */ - normalize(context?: any): Promise; - /** - * Normalizes a config array by flattening embedded arrays and executing - * config functions. - * @param {Object} [context] The context object for config functions. - * @returns {ConfigArray} The current ConfigArray instance. - */ - normalizeSync(context?: any): ConfigArray; - /** - * Returns the config object for a given file path and a status that can be used to determine why a file has no config. - * @param {string} filePath The path of a file to get a config for. - * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }} - * An object with an optional property `config` and property `status`. - * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig}, - * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}. - */ - getConfigWithStatus(filePath: string): { - config?: any; - status: "ignored" | "external" | "unconfigured" | "matched"; - }; - /** - * Returns the config object for a given file path. - * @param {string} filePath The path of a file to get a config for. - * @returns {Object|undefined} The config object for this file or `undefined`. - */ - getConfig(filePath: string): any | undefined; - /** - * Determines whether a file has a config or why it doesn't. - * @param {string} filePath The path of the file to check. - * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values: - * * `"ignored"`: the file is ignored - * * `"external"`: the file is outside the base path - * * `"unconfigured"`: the file is not matched by any config - * * `"matched"`: the file has a matching config - */ - getConfigStatus(filePath: string): "ignored" | "external" | "unconfigured" | "matched"; - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - * @deprecated Use `isFileIgnored` instead. - */ - isIgnored(filePath: string): boolean; - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - */ - isFileIgnored(filePath: string): boolean; - /** - * Determines if the given directory is ignored based on the configs. - * This checks only default `ignores` that don't have `files` in the - * same config. A pattern such as `/foo` be considered to ignore the directory - * while a pattern such as `/foo/**` is not considered to ignore the - * directory because it is matching files. - * @param {string} directoryPath The path of a directory to check. - * @returns {boolean} True if the directory is ignored, false if not. Will - * return true for any directory that is not inside of `basePath`. - * @throws {Error} When the `ConfigArray` is not normalized. - */ - isDirectoryIgnored(directoryPath: string): boolean; - #private; -} -export namespace ConfigArraySymbol { - let isNormalized: symbol; - let configCache: symbol; - let schema: symbol; - let finalizeConfig: symbol; - let preprocessConfig: symbol; -} diff --git a/node_modules/@eslint/config-array/dist/esm/index.js b/node_modules/@eslint/config-array/dist/esm/index.js deleted file mode 100644 index 1e68f33..0000000 --- a/node_modules/@eslint/config-array/dist/esm/index.js +++ /dev/null @@ -1,1279 +0,0 @@ -// @ts-self-types="./index.d.ts" -import * as posixPath from './std__path/posix.js'; -import * as windowsPath from './std__path/windows.js'; -import minimatch from 'minimatch'; -import createDebug from 'debug'; -import { ObjectSchema } from '@eslint/object-schema'; -export { ObjectSchema } from '@eslint/object-schema'; - -/** - * @fileoverview ConfigSchema - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - -/** @typedef {import("@eslint/object-schema").PropertyDefinition} PropertyDefinition */ -/** @typedef {import("@eslint/object-schema").ObjectDefinition} ObjectDefinition */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * A strategy that does nothing. - * @type {PropertyDefinition} - */ -const NOOP_STRATEGY = { - required: false, - merge() { - return undefined; - }, - validate() {}, -}; - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The base schema that every ConfigArray uses. - * @type {ObjectDefinition} - */ -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: NOOP_STRATEGY, - ignores: NOOP_STRATEGY, -}); - -/** - * @fileoverview ConfigSchema - * @author Nicholas C. Zakas - */ - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Asserts 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."); - } -} - -/** - * Asserts 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) { - assertIsArray(value); - - if ( - value.some( - item => typeof item !== "string" && typeof item !== "function", - ) - ) { - throw new TypeError( - "Expected array to only contain strings and functions.", - ); - } -} - -/** - * Asserts that a given value is a non-empty array. - * @param {*} value The value to check. - * @returns {void} - * @throws {TypeError} When the value is not an array or an empty array. - */ -function assertIsNonEmptyArray(value) { - if (!Array.isArray(value) || value.length === 0) { - throw new TypeError("Expected value to be a non-empty array."); - } -} - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * The schema for `files` and `ignores` that every ConfigArray uses. - * @type {ObjectDefinition} - */ -const filesAndIgnoresSchema = Object.freeze({ - files: { - required: false, - merge() { - return undefined; - }, - validate(value) { - // first check if it's an array - assertIsNonEmptyArray(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 - */ - - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - -/** @typedef {import("./types.ts").ConfigObject} ConfigObject */ -/** @typedef {import("minimatch").IMinimatchStatic} IMinimatchStatic */ -/** @typedef {import("minimatch").IMinimatch} IMinimatch */ -/** @typedef {import("@jsr/std__path")} PathImpl */ - -/* - * This is a bit of a hack to make TypeScript happy with the Rollup-created - * CommonJS file. Rollup doesn't do object destructuring for imported files - * and instead imports the default via `require()`. This messes up type checking - * for `ObjectSchema`. To work around that, we just import the type manually - * and give it a different name to use in the JSDoc comments. - */ -/** @typedef {import("@eslint/object-schema").ObjectSchema} ObjectSchemaInstance */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const Minimatch = minimatch.Minimatch; -const debug = createDebug("@eslint/config-array"); - -/** - * A cache for minimatch instances. - * @type {Map} - */ -const minimatchCache = new Map(); - -/** - * A cache for negated minimatch instances. - * @type {Map} - */ -const negatedMinimatchCache = new Map(); - -/** - * Options to use with minimatch. - * @type {Object} - */ -const MINIMATCH_OPTIONS = { - // matchBase: true, - dot: true, - allowWindowsEscape: true, -}; - -/** - * The types of config objects that are supported. - * @type {Set} - */ -const CONFIG_TYPES = new Set(["array", "function"]); - -/** - * Fields that are considered metadata and not part of the config object. - * @type {Set} - */ -const META_FIELDS = new Set(["name"]); - -/** - * A schema containing just files and ignores for early validation. - * @type {ObjectSchemaInstance} - */ -const FILES_AND_IGNORES_SCHEMA = new ObjectSchema(filesAndIgnoresSchema); - -// Precomputed constant objects returned by `ConfigArray.getConfigWithStatus`. - -const CONFIG_WITH_STATUS_EXTERNAL = Object.freeze({ status: "external" }); -const CONFIG_WITH_STATUS_IGNORED = Object.freeze({ status: "ignored" }); -const CONFIG_WITH_STATUS_UNCONFIGURED = Object.freeze({ - status: "unconfigured", -}); - -// Match two leading dots followed by a slash or the end of input. -const EXTERNAL_PATH_REGEX = /^\.\.(?:\/|$)/u; - -/** - * Wrapper error for config validation errors that adds a name to the front of the - * error message. - */ -class ConfigError extends Error { - /** - * Creates a new instance. - * @param {string} name The config object name causing the error. - * @param {number} index The index of the config object in the array. - * @param {Object} options The options for the error. - * @param {Error} [options.cause] The error that caused this error. - * @param {string} [options.message] The message to use for the error. - */ - constructor(name, index, { cause, message }) { - const finalMessage = message || cause.message; - - super(`Config ${name}: ${finalMessage}`, { cause }); - - // copy over custom properties that aren't represented - if (cause) { - for (const key of Object.keys(cause)) { - if (!(key in this)) { - this[key] = cause[key]; - } - } - } - - /** - * The name of the error. - * @type {string} - * @readonly - */ - this.name = "ConfigError"; - - /** - * The index of the config object in the array. - * @type {number} - * @readonly - */ - this.index = index; - } -} - -/** - * Gets the name of a config object. - * @param {ConfigObject} config The config object to get the name of. - * @returns {string} The name of the config object. - */ -function getConfigName(config) { - if (config && typeof config.name === "string" && config.name) { - return `"${config.name}"`; - } - - return "(unnamed)"; -} - -/** - * Rethrows a config error with additional information about the config object. - * @param {object} config The config object to get the name of. - * @param {number} index The index of the config object in the array. - * @param {Error} error The error to rethrow. - * @throws {ConfigError} When the error is rethrown for a config. - */ -function rethrowConfigError(config, index, error) { - const configName = getConfigName(config); - throw new ConfigError(configName, index, { cause: error }); -} - -/** - * 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"; -} - -/** - * Creates a function that asserts that the config is valid - * during normalization. This checks that the config is not nullish - * and that files and ignores keys of a config object are valid as per base schema. - * @param {Object} config The config object to check. - * @param {number} index The index of the config object in the array. - * @returns {void} - * @throws {ConfigError} If the files and ignores keys of a config object are not valid. - */ -function assertValidBaseConfig(config, index) { - if (config === null) { - throw new ConfigError(getConfigName(config), index, { - message: "Unexpected null config.", - }); - } - - if (config === undefined) { - throw new ConfigError(getConfigName(config), index, { - message: "Unexpected undefined config.", - }); - } - - if (typeof config !== "object") { - throw new ConfigError(getConfigName(config), index, { - message: "Unexpected non-object config.", - }); - } - - const validateConfig = {}; - - if ("files" in config) { - validateConfig.files = config.files; - } - - if ("ignores" in config) { - validateConfig.ignores = config.ignores; - } - - try { - FILES_AND_IGNORES_SCHEMA.validate(validateConfig); - } catch (validationError) { - rethrowConfigError(config, index, validationError); - } -} - -/** - * Wrapper around minimatch that caches minimatch patterns for - * faster matching speed over multiple file path evaluations. - * @param {string} filepath The file path to match. - * @param {string} pattern The glob pattern to match against. - * @param {object} options The minimatch options to use. - * @returns - */ -function doMatch(filepath, pattern, options = {}) { - let cache = minimatchCache; - - if (options.flipNegate) { - cache = negatedMinimatchCache; - } - - let matcher = cache.get(pattern); - - if (!matcher) { - matcher = new Minimatch( - pattern, - Object.assign({}, MINIMATCH_OPTIONS, options), - ); - cache.set(pattern, matcher); - } - - return matcher.match(filepath); -} - -/** - * 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 unprocessed file path to check. - * @param {string} relativeFilePath The path of the file to check relative to the base path, - * using forward slash (`"/"`) as a separator. - * @returns {boolean} True if the path should be ignored and false if not. - */ -function shouldIgnorePath(ignores, filePath, relativeFilePath) { - return ignores.reduce((ignored, matcher) => { - if (!ignored) { - if (typeof matcher === "function") { - return matcher(filePath); - } - - // don't check negated patterns because we're not ignored yet - if (!matcher.startsWith("!")) { - return doMatch(relativeFilePath, matcher); - } - - // otherwise we're still not ignored - return false; - } - - // only need to check negated patterns because we're ignored - if (typeof matcher === "string" && matcher.startsWith("!")) { - return !doMatch(relativeFilePath, matcher, { - flipNegate: true, - }); - } - - return ignored; - }, false); -} - -/** - * Determines if a given file path is matched by a config based on - * `ignores` only. - * @param {string} filePath The unprocessed file path to check. - * @param {string} relativeFilePath The path of the file to check relative to the base path, - * using forward slash (`"/"`) as a separator. - * @param {Object} config The config object to check. - * @returns {boolean} True if the file path is matched by the config, - * false if not. - */ -function pathMatchesIgnores(filePath, relativeFilePath, config) { - return ( - Object.keys(config).filter(key => !META_FIELDS.has(key)).length > 1 && - !shouldIgnorePath(config.ignores, filePath, relativeFilePath) - ); -} - -/** - * 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 unprocessed file path to check. - * @param {string} relativeFilePath The path of the file to check relative to the base path, - * using forward slash (`"/"`) as a separator. - * @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, relativeFilePath, config) { - // match both strings and functions - function match(pattern) { - if (isString(pattern)) { - return doMatch(relativeFilePath, pattern); - } - - 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 = !shouldIgnorePath( - 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".`, - ); - } - } -} - -/** - * Returns path-handling implementations for Unix or Windows, depending on a given absolute path. - * @param {string} fileOrDirPath The absolute path to check. - * @returns {PathImpl} Path-handling implementations for the specified path. - * @throws An error is thrown if the specified argument is not an absolute path. - */ -function getPathImpl(fileOrDirPath) { - // Posix absolute paths always start with a slash. - if (fileOrDirPath.startsWith("/")) { - return posixPath; - } - - // Windows absolute paths start with a letter followed by a colon and at least one backslash, - // or with two backslashes in the case of UNC paths. - // Forward slashed are automatically normalized to backslashes. - if (/^(?:[A-Za-z]:[/\\]|[/\\]{2})/u.test(fileOrDirPath)) { - return windowsPath; - } - - throw new Error( - `Expected an absolute path but received "${fileOrDirPath}"`, - ); -} - -/** - * Converts a given path to a relative path with all separator characters replaced by forward slashes (`"/"`). - * @param {string} fileOrDirPath The unprocessed path to convert. - * @param {string} namespacedBasePath The namespaced base path of the directory to which the calculated path shall be relative. - * @param {PathImpl} path Path-handling implementations. - * @returns {string} A relative path with all separator characters replaced by forward slashes. - */ -function toRelativePath(fileOrDirPath, namespacedBasePath, path) { - const fullPath = path.resolve(namespacedBasePath, fileOrDirPath); - const namespacedFullPath = path.toNamespacedPath(fullPath); - const relativePath = path.relative(namespacedBasePath, namespacedFullPath); - return relativePath.replaceAll(path.SEPARATOR, "/"); -} - -//------------------------------------------------------------------------------ -// 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 { - /** - * The namespaced path of the config file directory. - * @type {string} - */ - #namespacedBasePath; - - /** - * Path-handling implementations. - * @type {PathImpl} - */ - #path; - - /** - * 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 {Object} options The options for the ConfigArray. - * @param {string} [options.basePath="/"] The absolute path of the config file directory. - * Defaults to `"/"`. - * @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.extraConfigTypes] 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 {ObjectSchemaInstance} - * @private - */ - this[ConfigArraySymbol.schema] = new ObjectSchema( - Object.assign({}, customSchema, baseSchema), - ); - - if (!isString(basePath) || !basePath) { - throw new TypeError("basePath must be a non-empty string"); - } - - /** - * 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. - * @type {Array} - */ - this.extraConfigTypes = [...extraConfigTypes]; - Object.freeze(this.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, { - explicitMatches: new Map(), - directoryMatches: new Map(), - files: undefined, - ignores: undefined, - }); - - // load the configs into this array - if (Array.isArray(configs)) { - this.push(...configs); - } else { - this.push(configs); - } - - // select path-handling implementations depending on the base path - this.#path = getPathImpl(basePath); - - // On Windows, `path.relative()` returns an absolute path when given two paths on different drives. - // The namespaced base path is useful to make sure that calculated relative paths are always relative. - // On Unix, it is identical to the base path. - this.#namespacedBasePath = this.#path.toNamespacedPath(basePath); - } - - /** - * 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. - * @type {ArrayConstructor} 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) { - /* - * We only count ignores if there are no other keys in the object. - * In this case, it acts list a globally ignored pattern. If there - * are additional keys, then ignores act like exclusions. - */ - if ( - config.ignores && - Object.keys(config).filter(key => !META_FIELDS.has(key)) - .length === 1 - ) { - 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 {Object} [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.forEach(assertValidBaseConfig); - 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 {Object} [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].bind(this), - ), - ); - this.forEach(assertValidBaseConfig); - this[ConfigArraySymbol.isNormalized] = true; - - // prevent further changes - Object.freeze(this); - } - - return this; - } - - /* eslint-disable class-methods-use-this -- Desired as instance methods */ - - /** - * 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; - } - - /* eslint-enable class-methods-use-this -- Desired as instance methods */ - - /** - * Returns the config object for a given file path and a status that can be used to determine why a file has no config. - * @param {string} filePath The path of a file to get a config for. - * @returns {{ config?: Object, status: "ignored"|"external"|"unconfigured"|"matched" }} - * An object with an optional property `config` and property `status`. - * `config` is the config object for the specified file as returned by {@linkcode ConfigArray.getConfig}, - * `status` a is one of the constants returned by {@linkcode ConfigArray.getConfigStatus}. - */ - getConfigWithStatus(filePath) { - assertNormalized(this); - - const cache = this[ConfigArraySymbol.configCache]; - - // first check the cache for a filename match to avoid duplicate work - if (cache.has(filePath)) { - return cache.get(filePath); - } - - // check to see if the file is outside the base path - - const relativeFilePath = toRelativePath( - filePath, - this.#namespacedBasePath, - this.#path, - ); - - if (EXTERNAL_PATH_REGEX.test(relativeFilePath)) { - debug(`No config for file ${filePath} outside of base path`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_EXTERNAL); - return CONFIG_WITH_STATUS_EXTERNAL; - } - - // next check to see if the file should be ignored - - // check if this should be ignored due to its directory - if (this.isDirectoryIgnored(this.#path.dirname(filePath))) { - debug(`Ignoring ${filePath} based on directory pattern`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_IGNORED); - return CONFIG_WITH_STATUS_IGNORED; - } - - if (shouldIgnorePath(this.ignores, filePath, relativeFilePath)) { - debug(`Ignoring ${filePath} based on file pattern`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_IGNORED); - return CONFIG_WITH_STATUS_IGNORED; - } - - // filePath isn't automatically ignored, so try to construct config - - const matchingConfigIndices = []; - let matchFound = false; - const universalPattern = /^\*$|\/\*{1,2}$/u; - - this.forEach((config, index) => { - if (!config.files) { - if (!config.ignores) { - debug(`Universal config found for ${filePath}`); - matchingConfigIndices.push(index); - return; - } - - if (pathMatchesIgnores(filePath, relativeFilePath, config)) { - debug( - `Matching config found for ${filePath} (based on ignores: ${config.ignores})`, - ); - matchingConfigIndices.push(index); - return; - } - - debug( - `Skipped config found for ${filePath} (based on ignores: ${config.ignores})`, - ); - return; - } - - /* - * If a config has a files pattern * or patterns ending in /** or /*, - * and the filePath only matches those patterns, then the config is only - * applied if there is another config where the filePath matches - * a file with a specific extensions such as *.js. - */ - - const universalFiles = config.files.filter(pattern => - universalPattern.test(pattern), - ); - - // universal patterns were found so we need to check the config twice - if (universalFiles.length) { - debug("Universal files patterns found. Checking carefully."); - - const nonUniversalFiles = config.files.filter( - pattern => !universalPattern.test(pattern), - ); - - // check that the config matches without the non-universal files first - if ( - nonUniversalFiles.length && - pathMatches(filePath, relativeFilePath, { - files: nonUniversalFiles, - ignores: config.ignores, - }) - ) { - debug(`Matching config found for ${filePath}`); - matchingConfigIndices.push(index); - matchFound = true; - return; - } - - // if there wasn't a match then check if it matches with universal files - if ( - universalFiles.length && - pathMatches(filePath, relativeFilePath, { - files: universalFiles, - ignores: config.ignores, - }) - ) { - debug(`Matching config found for ${filePath}`); - matchingConfigIndices.push(index); - return; - } - - // if we make here, then there was no match - return; - } - - // the normal case - if (pathMatches(filePath, relativeFilePath, config)) { - debug(`Matching config found for ${filePath}`); - matchingConfigIndices.push(index); - matchFound = true; - } - }); - - // if matching both files and ignores, there will be no config to create - if (!matchFound) { - debug(`No matching configs found for ${filePath}`); - - // cache and return result - cache.set(filePath, CONFIG_WITH_STATUS_UNCONFIGURED); - return CONFIG_WITH_STATUS_UNCONFIGURED; - } - - // check to see if there is a config cached by indices - const indicesKey = matchingConfigIndices.toString(); - let configWithStatus = cache.get(indicesKey); - - if (configWithStatus) { - // also store for filename for faster lookup next time - cache.set(filePath, configWithStatus); - - return configWithStatus; - } - - // otherwise construct the config - - // eslint-disable-next-line array-callback-return, consistent-return -- rethrowConfigError always throws an error - let finalConfig = matchingConfigIndices.reduce((result, index) => { - try { - return this[ConfigArraySymbol.schema].merge( - result, - this[index], - ); - } catch (validationError) { - rethrowConfigError(this[index], index, validationError); - } - }, {}); - - finalConfig = this[ConfigArraySymbol.finalizeConfig](finalConfig); - - configWithStatus = Object.freeze({ - config: finalConfig, - status: "matched", - }); - cache.set(filePath, configWithStatus); - cache.set(indicesKey, configWithStatus); - - return configWithStatus; - } - - /** - * Returns the config object for a given file path. - * @param {string} filePath The path of a file to get a config for. - * @returns {Object|undefined} The config object for this file or `undefined`. - */ - getConfig(filePath) { - return this.getConfigWithStatus(filePath).config; - } - - /** - * Determines whether a file has a config or why it doesn't. - * @param {string} filePath The path of the file to check. - * @returns {"ignored"|"external"|"unconfigured"|"matched"} One of the following values: - * * `"ignored"`: the file is ignored - * * `"external"`: the file is outside the base path - * * `"unconfigured"`: the file is not matched by any config - * * `"matched"`: the file has a matching config - */ - getConfigStatus(filePath) { - return this.getConfigWithStatus(filePath).status; - } - - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - * @deprecated Use `isFileIgnored` instead. - */ - isIgnored(filePath) { - return this.isFileIgnored(filePath); - } - - /** - * Determines if the given filepath is ignored based on the configs. - * @param {string} filePath The path of a file to check. - * @returns {boolean} True if the path is ignored, false if not. - */ - isFileIgnored(filePath) { - return this.getConfigStatus(filePath) === "ignored"; - } - - /** - * Determines if the given directory is ignored based on the configs. - * This checks only default `ignores` that don't have `files` in the - * same config. A pattern such as `/foo` be considered to ignore the directory - * while a pattern such as `/foo/**` is not considered to ignore the - * directory because it is matching files. - * @param {string} directoryPath The path of a directory to check. - * @returns {boolean} True if the directory is ignored, false if not. Will - * return true for any directory that is not inside of `basePath`. - * @throws {Error} When the `ConfigArray` is not normalized. - */ - isDirectoryIgnored(directoryPath) { - assertNormalized(this); - - const relativeDirectoryPath = toRelativePath( - directoryPath, - this.#namespacedBasePath, - this.#path, - ); - - // basePath directory can never be ignored - if (relativeDirectoryPath === "") { - return false; - } - - if (EXTERNAL_PATH_REGEX.test(relativeDirectoryPath)) { - return true; - } - - // first check the cache - const cache = dataCache.get(this).directoryMatches; - - if (cache.has(relativeDirectoryPath)) { - return cache.get(relativeDirectoryPath); - } - - const directoryParts = relativeDirectoryPath.split("/"); - let relativeDirectoryToCheck = ""; - let result; - - /* - * In order to get the correct gitignore-style ignores, where an - * ignored parent directory cannot have any descendants unignored, - * we need to check every directory starting at the parent all - * the way down to the actual requested directory. - * - * We aggressively cache all of this info to make sure we don't - * have to recalculate everything for every call. - */ - do { - relativeDirectoryToCheck += `${directoryParts.shift()}/`; - - result = shouldIgnorePath( - this.ignores, - this.#path.join(this.basePath, relativeDirectoryToCheck), - relativeDirectoryToCheck, - ); - - cache.set(relativeDirectoryToCheck, result); - } while (!result && directoryParts.length); - - // also cache the result for the requested path - cache.set(relativeDirectoryPath, result); - - return result; - } -} - -export { ConfigArray, ConfigArraySymbol }; diff --git a/node_modules/@eslint/config-array/dist/esm/std__path/posix.js b/node_modules/@eslint/config-array/dist/esm/std__path/posix.js deleted file mode 100644 index f966096..0000000 --- a/node_modules/@eslint/config-array/dist/esm/std__path/posix.js +++ /dev/null @@ -1,1301 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -function assertPath(path) { - if (typeof path !== "string") { - throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function stripSuffix(name, suffix) { - if (suffix.length >= name.length) { - return name; - } - const lenDiff = name.length - suffix.length; - for(let i = suffix.length - 1; i >= 0; --i){ - if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) { - return name; - } - } - return name.slice(0, -suffix.length); -} -function lastPathSegment(path, isSep, start = 0) { - let matchedNonSeparator = false; - let end = path.length; - for(let i = path.length - 1; i >= start; --i){ - if (isSep(path.charCodeAt(i))) { - if (matchedNonSeparator) { - start = i + 1; - break; - } - } else if (!matchedNonSeparator) { - matchedNonSeparator = true; - end = i + 1; - } - } - return path.slice(start, end); -} -function assertArgs$1(path, suffix) { - assertPath(path); - if (path.length === 0) return path; - if (typeof suffix !== "string") { - throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function stripTrailingSeparators(segment, isSep) { - if (segment.length <= 1) { - return segment; - } - let end = segment.length; - for(let i = segment.length - 1; i > 0; i--){ - if (isSep(segment.charCodeAt(i))) { - end = i; - } else { - break; - } - } - return segment.slice(0, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Alphabet chars. -// Non-alphabetic chars. -const CHAR_DOT = 46; /* . */ -const CHAR_FORWARD_SLASH = 47; /* / */ - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function isPosixPathSeparator(code) { - return code === CHAR_FORWARD_SLASH; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the last portion of a `path`. - * Trailing directory separators are ignored, and optional suffix is removed. - * - * @example Usage - * ```ts - * import { basename } from "@std/path/posix/basename"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(basename("/home/user/Documents/"), "Documents"); - * assertEquals(basename("/home/user/Documents/image.png"), "image.png"); - * assertEquals(basename("/home/user/Documents/image.png", ".png"), "image"); - * ``` - * - * @example Working with URLs - * - * Note: This function doesn't automatically strip hash and query parts from - * URLs. If your URL contains a hash or query, remove them before passing the - * URL to the function. This can be done by passing the URL to `new URL(url)`, - * and setting the `hash` and `search` properties to empty strings. - * - * ```ts - * import { basename } from "@std/path/posix/basename"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(basename("https://deno.land/std/path/mod.ts"), "mod.ts"); - * assertEquals(basename("https://deno.land/std/path/mod.ts", ".ts"), "mod"); - * assertEquals(basename("https://deno.land/std/path/mod.ts?a=b"), "mod.ts?a=b"); - * assertEquals(basename("https://deno.land/std/path/mod.ts#header"), "mod.ts#header"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `basename` from `@std/path/posix/unstable-basename`. - * - * @param path The path to extract the name from. - * @param suffix The suffix to remove from extracted name. - * @returns The extracted name. - */ function basename(path, suffix = "") { - assertArgs$1(path, suffix); - const lastSegment = lastPathSegment(path, isPosixPathSeparator); - const strippedSegment = stripTrailingSeparators(lastSegment, isPosixPathSeparator); - return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * The character used to separate entries in the PATH environment variable. - */ const DELIMITER = ":"; -/** - * The character used to separate components of a file path. - */ const SEPARATOR = "/"; -/** - * A regular expression that matches one or more path separators. - */ const SEPARATOR_PATTERN = /\/+/; - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$3(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the directory path of a `path`. - * - * @example Usage - * ```ts - * import { dirname } from "@std/path/posix/dirname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(dirname("/home/user/Documents/"), "/home/user"); - * assertEquals(dirname("/home/user/Documents/image.png"), "/home/user/Documents"); - * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); - * ``` - * - * @example Working with URLs - * - * ```ts - * import { dirname } from "@std/path/posix/dirname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(dirname("https://deno.land/std/path/mod.ts"), "https://deno.land/std/path"); - * assertEquals(dirname("https://deno.land/std/path/mod.ts?a=b"), "https://deno.land/std/path"); - * assertEquals(dirname("https://deno.land/std/path/mod.ts#header"), "https://deno.land/std/path"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `dirname` from `@std/path/posix/unstable-dirname`. - * - * @param path The path to get the directory from. - * @returns The directory path. - */ function dirname(path) { - assertArg$3(path); - let end = -1; - let matchedNonSeparator = false; - for(let i = path.length - 1; i >= 1; --i){ - if (isPosixPathSeparator(path.charCodeAt(i))) { - if (matchedNonSeparator) { - end = i; - break; - } - } else { - matchedNonSeparator = true; - } - } - // No matches. Fallback based on provided path: - // - // - leading slashes paths - // "/foo" => "/" - // "///foo" => "/" - // - no slash path - // "foo" => "." - if (end === -1) { - return isPosixPathSeparator(path.charCodeAt(0)) ? "/" : "."; - } - return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the extension of the `path` with leading period. - * - * @example Usage - * ```ts - * import { extname } from "@std/path/posix/extname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(extname("/home/user/Documents/file.ts"), ".ts"); - * assertEquals(extname("/home/user/Documents/"), ""); - * assertEquals(extname("/home/user/Documents/image.png"), ".png"); - * ``` - * - * @example Working with URLs - * - * Note: This function doesn't automatically strip hash and query parts from - * URLs. If your URL contains a hash or query, remove them before passing the - * URL to the function. This can be done by passing the URL to `new URL(url)`, - * and setting the `hash` and `search` properties to empty strings. - * - * ```ts - * import { extname } from "@std/path/posix/extname"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(extname("https://deno.land/std/path/mod.ts"), ".ts"); - * assertEquals(extname("https://deno.land/std/path/mod.ts?a=b"), ".ts?a=b"); - * assertEquals(extname("https://deno.land/std/path/mod.ts#header"), ".ts#header"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `extname` from `@std/path/posix/unstable-extname`. - * - * @param path The path to get the extension from. - * @returns The extension (ex. for `file.ts` returns `.ts`). - */ function extname(path) { - assertPath(path); - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - for(let i = path.length - 1; i >= 0; --i){ - const code = path.charCodeAt(i); - if (isPosixPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ""; - } - return path.slice(startDot, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function _format(sep, pathObject) { - const dir = pathObject.dir || pathObject.root; - const base = pathObject.base || (pathObject.name ?? "") + (pathObject.ext ?? ""); - if (!dir) return base; - if (base === sep) return dir; - if (dir === pathObject.root) return dir + base; - return dir + sep + base; -} -function assertArg$2(pathObject) { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Generate a path from `ParsedPath` object. - * - * @example Usage - * ```ts - * import { format } from "@std/path/posix/format"; - * import { assertEquals } from "@std/assert"; - * - * const path = format({ - * root: "/", - * dir: "/path/dir", - * base: "file.txt", - * ext: ".txt", - * name: "file" - * }); - * assertEquals(path, "/path/dir/file.txt"); - * ``` - * - * @param pathObject The path object to format. - * @returns The formatted path. - */ function format(pathObject) { - assertArg$2(pathObject); - return _format("/", pathObject); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$1(url) { - url = url instanceof URL ? url : new URL(url); - if (url.protocol !== "file:") { - throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); - } - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a file URL to a path string. - * - * @example Usage - * ```ts - * import { fromFileUrl } from "@std/path/posix/from-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(fromFileUrl(new URL("file:///home/foo")), "/home/foo"); - * ``` - * - * @param url The file URL to convert. - * @returns The path string. - */ function fromFileUrl(url) { - url = assertArg$1(url); - return decodeURIComponent(url.pathname.replace(/%(?![0-9A-Fa-f]{2})/g, "%25")); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Verifies whether provided path is absolute. - * - * @example Usage - * ```ts - * import { isAbsolute } from "@std/path/posix/is-absolute"; - * import { assert, assertFalse } from "@std/assert"; - * - * assert(isAbsolute("/home/user/Documents/")); - * assertFalse(isAbsolute("home/user/Documents/")); - * ``` - * - * @param path The path to verify. - * @returns Whether the path is absolute. - */ function isAbsolute(path) { - assertPath(path); - return path.length > 0 && isPosixPathSeparator(path.charCodeAt(0)); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Resolves . and .. elements in a path with directory names -function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let code; - for(let i = 0; i <= path.length; ++i){ - if (i < path.length) code = path.charCodeAt(i); - else if (isPathSeparator(code)) break; - else code = CHAR_FORWARD_SLASH; - if (isPathSeparator(code)) { - if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; - } else if (res.length === 2 || res.length === 1) { - res = ""; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) res += `${separator}..`; - else res = ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) res += separator + path.slice(lastSlash + 1, i); - else res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === CHAR_DOT && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Normalize the `path`, resolving `'..'` and `'.'` segments. - * Note that resolving these segments does not necessarily mean that all will be eliminated. - * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`. - * - * @example Usage - * ```ts - * import { normalize } from "@std/path/posix/normalize"; - * import { assertEquals } from "@std/assert"; - * - * const path = normalize("/foo/bar//baz/asdf/quux/.."); - * assertEquals(path, "/foo/bar/baz/asdf"); - * ``` - * - * @example Working with URLs - * - * Note: This function will remove the double slashes from a URL's scheme. - * Hence, do not pass a full URL to this function. Instead, pass the pathname of - * the URL. - * - * ```ts - * import { normalize } from "@std/path/posix/normalize"; - * import { assertEquals } from "@std/assert"; - * - * const url = new URL("https://deno.land"); - * url.pathname = normalize("//std//assert//.//mod.ts"); - * assertEquals(url.href, "https://deno.land/std/assert/mod.ts"); - * - * url.pathname = normalize("std/assert/../async/retry.ts"); - * assertEquals(url.href, "https://deno.land/std/async/retry.ts"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `normalize` from `@std/path/posix/unstable-normalize`. - * - * @param path The path to normalize. - * @returns The normalized path. - */ function normalize(path) { - assertArg(path); - const isAbsolute = isPosixPathSeparator(path.charCodeAt(0)); - const trailingSeparator = isPosixPathSeparator(path.charCodeAt(path.length - 1)); - // Normalize the path - path = normalizeString(path, !isAbsolute, "/", isPosixPathSeparator); - if (path.length === 0 && !isAbsolute) path = "."; - if (path.length > 0 && trailingSeparator) path += "/"; - if (isAbsolute) return `/${path}`; - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * - * @example Usage - * ```ts - * import { join } from "@std/path/posix/join"; - * import { assertEquals } from "@std/assert"; - * - * const path = join("/foo", "bar", "baz/asdf", "quux", ".."); - * assertEquals(path, "/foo/bar/baz/asdf"); - * ``` - * - * @example Working with URLs - * ```ts - * import { join } from "@std/path/posix/join"; - * import { assertEquals } from "@std/assert"; - * - * const url = new URL("https://deno.land"); - * url.pathname = join("std", "path", "mod.ts"); - * assertEquals(url.href, "https://deno.land/std/path/mod.ts"); - * - * url.pathname = join("//std", "path/", "/mod.ts"); - * assertEquals(url.href, "https://deno.land/std/path/mod.ts"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `join` from `@std/path/posix/unstable-join`. - * - * @param paths The paths to join. - * @returns The joined path. - */ function join(...paths) { - if (paths.length === 0) return "."; - paths.forEach((path)=>assertPath(path)); - const joined = paths.filter((path)=>path.length > 0).join("/"); - return joined === "" ? "." : normalize(joined); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return a `ParsedPath` object of the `path`. - * - * @example Usage - * ```ts - * import { parse } from "@std/path/posix/parse"; - * import { assertEquals } from "@std/assert"; - * - * const path = parse("/home/user/file.txt"); - * assertEquals(path, { - * root: "/", - * dir: "/home/user", - * base: "file.txt", - * ext: ".txt", - * name: "file" - * }); - * ``` - * - * @param path The path to parse. - * @returns The parsed path object. - */ function parse(path) { - assertPath(path); - const ret = { - root: "", - dir: "", - base: "", - ext: "", - name: "" - }; - if (path.length === 0) return ret; - const isAbsolute = isPosixPathSeparator(path.charCodeAt(0)); - let start; - if (isAbsolute) { - ret.root = "/"; - start = 1; - } else { - start = 0; - } - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - // Get non-dir info - for(; i >= start; --i){ - const code = path.charCodeAt(i); - if (isPosixPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - if (end !== -1) { - if (startPart === 0 && isAbsolute) { - ret.base = ret.name = path.slice(1, end); - } else { - ret.base = ret.name = path.slice(startPart, end); - } - } - // Fallback to '/' in case there is no basename - ret.base = ret.base || "/"; - } else { - if (startPart === 0 && isAbsolute) { - ret.name = path.slice(1, startDot); - ret.base = path.slice(1, end); - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - } - ret.ext = path.slice(startDot, end); - } - if (startPart > 0) { - ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator); - } else if (isAbsolute) ret.dir = "/"; - return ret; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Resolves path segments into a `path`. - * - * @example Usage - * ```ts - * import { resolve } from "@std/path/posix/resolve"; - * import { assertEquals } from "@std/assert"; - * - * const path = resolve("/foo", "bar", "baz/asdf", "quux", ".."); - * assertEquals(path, "/foo/bar/baz/asdf"); - * ``` - * - * @param pathSegments The path segments to resolve. - * @returns The resolved path. - */ function resolve(...pathSegments) { - let resolvedPath = ""; - let resolvedAbsolute = false; - for(let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--){ - let path; - if (i >= 0) path = pathSegments[i]; - else { - // deno-lint-ignore no-explicit-any - const { Deno } = globalThis; - if (typeof Deno?.cwd !== "function") { - throw new TypeError("Resolved a relative path without a current working directory (CWD)"); - } - path = Deno.cwd(); - } - assertPath(path); - // Skip empty entries - if (path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0)); - } - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when Deno.cwd() fails) - // Normalize the path - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator); - if (resolvedAbsolute) { - if (resolvedPath.length > 0) return `/${resolvedPath}`; - else return "/"; - } else if (resolvedPath.length > 0) return resolvedPath; - else return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArgs(from, to) { - assertPath(from); - assertPath(to); - if (from === to) return ""; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the relative path from `from` to `to` based on current working directory. - * - * If `from` and `to` are the same, return an empty string. - * - * @example Usage - * ```ts - * import { relative } from "@std/path/posix/relative"; - * import { assertEquals } from "@std/assert"; - * - * const path = relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb"); - * assertEquals(path, "../../impl/bbb"); - * ``` - * - * @param from The path to start from. - * @param to The path to reach. - * @returns The relative path. - */ function relative(from, to) { - assertArgs(from, to); - from = resolve(from); - to = resolve(to); - if (from === to) return ""; - // Trim any leading backslashes - let fromStart = 1; - const fromEnd = from.length; - for(; fromStart < fromEnd; ++fromStart){ - if (!isPosixPathSeparator(from.charCodeAt(fromStart))) break; - } - const fromLen = fromEnd - fromStart; - // Trim any leading backslashes - let toStart = 1; - const toEnd = to.length; - for(; toStart < toEnd; ++toStart){ - if (!isPosixPathSeparator(to.charCodeAt(toStart))) break; - } - const toLen = toEnd - toStart; - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for(; i <= length; ++i){ - if (i === length) { - if (toLen > length) { - if (isPosixPathSeparator(to.charCodeAt(toStart + i))) { - // We get here if `from` is the exact base path for `to`. - // For example: from='/foo/bar'; to='/foo/bar/baz' - return to.slice(toStart + i + 1); - } else if (i === 0) { - // We get here if `from` is the root - // For example: from='/'; to='/foo' - return to.slice(toStart + i); - } - } else if (fromLen > length) { - if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) { - // We get here if `to` is the exact base path for `from`. - // For example: from='/foo/bar/baz'; to='/foo/bar' - lastCommonSep = i; - } else if (i === 0) { - // We get here if `to` is the root. - // For example: from='/foo'; to='/' - lastCommonSep = 0; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (isPosixPathSeparator(fromCode)) lastCommonSep = i; - } - let out = ""; - // Generate the relative path based on the path difference between `to` - // and `from` - for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){ - if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) { - if (out.length === 0) out += ".."; - else out += "/.."; - } - } - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) return out + to.slice(toStart + lastCommonSep); - else { - toStart += lastCommonSep; - if (isPosixPathSeparator(to.charCodeAt(toStart))) ++toStart; - return to.slice(toStart); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const WHITESPACE_ENCODINGS = { - "\u0009": "%09", - "\u000A": "%0A", - "\u000B": "%0B", - "\u000C": "%0C", - "\u000D": "%0D", - "\u0020": "%20" -}; -function encodeWhitespace(string) { - return string.replaceAll(/[\s]/g, (c)=>{ - return WHITESPACE_ENCODINGS[c] ?? c; - }); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a path string to a file URL. - * - * @example Usage - * ```ts - * import { toFileUrl } from "@std/path/posix/to-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(toFileUrl("/home/foo"), new URL("file:///home/foo")); - * assertEquals(toFileUrl("/home/foo bar"), new URL("file:///home/foo%20bar")); - * ``` - * - * @param path The path to convert. - * @returns The file URL. - */ function toFileUrl(path) { - if (!isAbsolute(path)) { - throw new TypeError(`Path must be absolute: received "${path}"`); - } - const url = new URL("file:///"); - url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C")); - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a path to a namespaced path. This function returns the path as is on posix. - * - * @example Usage - * ```ts - * import { toNamespacedPath } from "@std/path/posix/to-namespaced-path"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(toNamespacedPath("/home/foo"), "/home/foo"); - * ``` - * - * @param path The path. - * @returns The namespaced path. - */ function toNamespacedPath(path) { - // Non-op on posix systems - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function common$1(paths, sep) { - const [first = "", ...remaining] = paths; - const parts = first.split(sep); - let endOfPrefix = parts.length; - let append = ""; - for (const path of remaining){ - const compare = path.split(sep); - if (compare.length <= endOfPrefix) { - endOfPrefix = compare.length; - append = ""; - } - for(let i = 0; i < endOfPrefix; i++){ - if (compare[i] !== parts[i]) { - endOfPrefix = i; - append = i === 0 ? "" : sep; - break; - } - } - } - return parts.slice(0, endOfPrefix).join(sep) + append; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** Determines the common path from a set of paths for POSIX systems. - * - * @example Usage - * ```ts - * import { common } from "@std/path/posix/common"; - * import { assertEquals } from "@std/assert"; - * - * const path = common([ - * "./deno/std/path/mod.ts", - * "./deno/std/fs/mod.ts", - * ]); - * assertEquals(path, "./deno/std/"); - * ``` - * - * @param paths The paths to compare. - * @returns The common path. - */ function common(paths) { - return common$1(paths, SEPARATOR); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Options for {@linkcode globToRegExp}, {@linkcode joinGlobs}, - * {@linkcode normalizeGlob} and {@linkcode expandGlob}. - */ const REG_EXP_ESCAPE_CHARS = [ - "!", - "$", - "(", - ")", - "*", - "+", - ".", - "=", - "?", - "[", - "\\", - "^", - "{", - "|" -]; -const RANGE_ESCAPE_CHARS = [ - "-", - "\\", - "]" -]; -function _globToRegExp(c, glob, { extended = true, globstar: globstarOption = true, // os = osType, -caseInsensitive = false } = {}) { - if (glob === "") { - return /(?!)/; - } - // Remove trailing separators. - let newLength = glob.length; - for(; newLength > 1 && c.seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - let regExpString = ""; - // Terminates correctly. Trust that `j` is incremented every iteration. - for(let j = 0; j < glob.length;){ - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - // Terminates with `i` at the non-inclusive end of the current segment. - for(; i < glob.length && !c.seps.includes(glob[i]); i++){ - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? RANGE_ESCAPE_CHARS : REG_EXP_ESCAPE_CHARS; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - if (glob[i] === c.escapePrefix) { - inEscape = true; - continue; - } - if (glob[i] === "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] === "!") { - i++; - segment += "^"; - } else if (glob[i + 1] === "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] === ":") { - let k = i + 1; - let value = ""; - while(glob[k + 1] !== undefined && glob[k + 1] !== ":"){ - value += glob[k + 1]; - k++; - } - if (glob[k + 1] === ":" && glob[k + 2] === "]") { - i = k + 2; - if (value === "alnum") segment += "\\dA-Za-z"; - else if (value === "alpha") segment += "A-Za-z"; - else if (value === "ascii") segment += "\x00-\x7F"; - else if (value === "blank") segment += "\t "; - else if (value === "cntrl") segment += "\x00-\x1F\x7F"; - else if (value === "digit") segment += "\\d"; - else if (value === "graph") segment += "\x21-\x7E"; - else if (value === "lower") segment += "a-z"; - else if (value === "print") segment += "\x20-\x7E"; - else if (value === "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value === "space") segment += "\\s\v"; - else if (value === "upper") segment += "A-Z"; - else if (value === "word") segment += "\\w"; - else if (value === "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - if (glob[i] === "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - if (inRange) { - segment += glob[i]; - continue; - } - if (glob[i] === ")" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += ")"; - const type = groupStack.pop(); - if (type === "!") { - segment += c.wildcard; - } else if (type !== "@") { - segment += type; - } - continue; - } - if (glob[i] === "|" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "+" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - if (glob[i] === "@" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - if (glob[i] === "?") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - if (glob[i] === "!" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - if (glob[i] === "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - if (glob[i] === "}" && groupStack[groupStack.length - 1] === "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - if (glob[i] === "," && groupStack[groupStack.length - 1] === "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "*") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while(glob[i + 1] === "*"){ - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if (globstarOption && numStars === 2 && [ - ...c.seps, - undefined - ].includes(prevChar) && [ - ...c.seps, - undefined - ].includes(nextChar)) { - segment += c.globstar; - endsWithSep = true; - } else { - segment += c.wildcard; - } - } - continue; - } - segment += REG_EXP_ESCAPE_CHARS.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)){ - segment += REG_EXP_ESCAPE_CHARS.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? c.sep : c.sepMaybe; - endsWithSep = true; - } - // Terminates with `i` at the start of the next segment. - while(c.seps.includes(glob[i]))i++; - j = i; - } - regExpString = `^${regExpString}$`; - return new RegExp(regExpString, caseInsensitive ? "i" : ""); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const constants = { - sep: "/+", - sepMaybe: "/*", - seps: [ - "/" - ], - globstar: "(?:[^/]*(?:/|$)+)*", - wildcard: "[^/]*", - escapePrefix: "\\" -}; -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `?` - Matches any single character. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precedence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occurred. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. - * - * @example Usage - * ```ts - * import { globToRegExp } from "@std/path/posix/glob-to-regexp"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(globToRegExp("*.js"), /^[^/]*\.js\/*$/); - * ``` - * - * @param glob Glob string to convert. - * @param options Conversion options. - * @returns The regular expression equivalent to the glob. - */ function globToRegExp(glob, options = {}) { - return _globToRegExp(constants, glob, options); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Test whether the given string is a glob. - * - * @example Usage - * ```ts - * import { isGlob } from "@std/path/is-glob"; - * import { assert } from "@std/assert"; - * - * assert(!isGlob("foo/bar/../baz")); - * assert(isGlob("foo/*ar/../baz")); - * ``` - * - * @param str String to test. - * @returns `true` if the given string is a glob, otherwise `false` - */ function isGlob(str) { - const chars = { - "{": "}", - "(": ")", - "[": "]" - }; - const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - if (str === "") { - return false; - } - let match; - while(match = regex.exec(str)){ - if (match[2]) return true; - let idx = match.index + match[0].length; - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - str = str.slice(idx); - } - return false; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * ```ts - * import { normalizeGlob } from "@std/path/posix/normalize-glob"; - * import { assertEquals } from "@std/assert"; - * - * const path = normalizeGlob("foo/bar/../*", { globstar: true }); - * assertEquals(path, "foo/*"); - * ``` - * - * @param glob The glob to normalize. - * @param options The options to use. - * @returns The normalized path. - */ function normalizeGlob(glob, { globstar = false } = {}) { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEPARATOR_PATTERN.source; - const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g"); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like join(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * ```ts - * import { joinGlobs } from "@std/path/posix/join-globs"; - * import { assertEquals } from "@std/assert"; - * - * const path = joinGlobs(["foo", "bar", "**"], { globstar: true }); - * assertEquals(path, "foo/bar/**"); - * ``` - * - * @param globs The globs to join. - * @param options The options to use. - * @returns The joined path. - */ function joinGlobs(globs, { extended = true, globstar = false } = {}) { - if (!globstar || globs.length === 0) { - return join(...globs); - } - let joined; - for (const glob of globs){ - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEPARATOR}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { - extended, - globstar - }); -} - -export { DELIMITER, SEPARATOR, SEPARATOR_PATTERN, basename, common, dirname, extname, format, fromFileUrl, globToRegExp, isAbsolute, isGlob, join, joinGlobs, normalize, normalizeGlob, parse, relative, resolve, toFileUrl, toNamespacedPath }; diff --git a/node_modules/@eslint/config-array/dist/esm/std__path/windows.js b/node_modules/@eslint/config-array/dist/esm/std__path/windows.js deleted file mode 100644 index ae8759d..0000000 --- a/node_modules/@eslint/config-array/dist/esm/std__path/windows.js +++ /dev/null @@ -1,1647 +0,0 @@ -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -function assertPath(path) { - if (typeof path !== "string") { - throw new TypeError(`Path must be a string, received "${JSON.stringify(path)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function stripSuffix(name, suffix) { - if (suffix.length >= name.length) { - return name; - } - const lenDiff = name.length - suffix.length; - for(let i = suffix.length - 1; i >= 0; --i){ - if (name.charCodeAt(lenDiff + i) !== suffix.charCodeAt(i)) { - return name; - } - } - return name.slice(0, -suffix.length); -} -function lastPathSegment(path, isSep, start = 0) { - let matchedNonSeparator = false; - let end = path.length; - for(let i = path.length - 1; i >= start; --i){ - if (isSep(path.charCodeAt(i))) { - if (matchedNonSeparator) { - start = i + 1; - break; - } - } else if (!matchedNonSeparator) { - matchedNonSeparator = true; - end = i + 1; - } - } - return path.slice(start, end); -} -function assertArgs$1(path, suffix) { - assertPath(path); - if (path.length === 0) return path; - if (typeof suffix !== "string") { - throw new TypeError(`Suffix must be a string, received "${JSON.stringify(suffix)}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Alphabet chars. -const CHAR_UPPERCASE_A = 65; /* A */ -const CHAR_LOWERCASE_A = 97; /* a */ -const CHAR_UPPERCASE_Z = 90; /* Z */ -const CHAR_LOWERCASE_Z = 122; /* z */ -// Non-alphabetic chars. -const CHAR_DOT = 46; /* . */ -const CHAR_FORWARD_SLASH = 47; /* / */ -const CHAR_BACKWARD_SLASH = 92; /* \ */ -const CHAR_COLON = 58; /* : */ -const CHAR_QUESTION_MARK = 63; /* ? */ - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function stripTrailingSeparators(segment, isSep) { - if (segment.length <= 1) { - return segment; - } - let end = segment.length; - for(let i = segment.length - 1; i > 0; i--){ - if (isSep(segment.charCodeAt(i))) { - end = i; - } else { - break; - } - } - return segment.slice(0, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -function isPosixPathSeparator(code) { - return code === CHAR_FORWARD_SLASH; -} -function isPathSeparator(code) { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -} -function isWindowsDeviceRoot(code) { - return code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z || code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the last portion of a `path`. - * Trailing directory separators are ignored, and optional suffix is removed. - * - * @example Usage - * ```ts - * import { basename } from "@std/path/windows/basename"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(basename("C:\\user\\Documents\\"), "Documents"); - * assertEquals(basename("C:\\user\\Documents\\image.png"), "image.png"); - * assertEquals(basename("C:\\user\\Documents\\image.png", ".png"), "image"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `basename` from `@std/path/windows/unstable-basename`. - * - * @param path The path to extract the name from. - * @param suffix The suffix to remove from extracted name. - * @returns The extracted name. - */ function basename(path, suffix = "") { - assertArgs$1(path, suffix); - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - let start = 0; - if (path.length >= 2) { - const drive = path.charCodeAt(0); - if (isWindowsDeviceRoot(drive)) { - if (path.charCodeAt(1) === CHAR_COLON) start = 2; - } - } - const lastSegment = lastPathSegment(path, isPathSeparator, start); - const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator); - return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * The character used to separate entries in the PATH environment variable. - */ const DELIMITER = ";"; -/** - * The character used to separate components of a file path. - */ const SEPARATOR = "\\"; -/** - * A regular expression that matches one or more path separators. - */ const SEPARATOR_PATTERN = /[\\/]+/; - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$3(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the directory path of a `path`. - * - * @example Usage - * ```ts - * import { dirname } from "@std/path/windows/dirname"; - * import { assertEquals } from "@std/assert"; - * - * const dir = dirname("C:\\foo\\bar\\baz.ext"); - * assertEquals(dir, "C:\\foo\\bar"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `dirname` from `@std/path/windows/unstable-dirname`. - * - * @param path The path to get the directory from. - * @returns The directory path. - */ function dirname(path) { - assertArg$3(path); - const len = path.length; - let rootEnd = -1; - let end = -1; - let matchedSlash = true; - let offset = 0; - const code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - rootEnd = offset = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - return path; - } - if (j !== last) { - // We matched a UNC root with leftovers - // Offset by 1 to include the separator after the UNC root to - // treat it as a "normal root" on top of a (UNC) root - rootEnd = offset = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = offset = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) rootEnd = offset = 3; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - return path; - } - for(let i = len - 1; i >= offset; --i){ - if (isPathSeparator(path.charCodeAt(i))) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - if (end === -1) { - if (rootEnd === -1) return "."; - else end = rootEnd; - } - return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the extension of the `path` with leading period. - * - * @example Usage - * ```ts - * import { extname } from "@std/path/windows/extname"; - * import { assertEquals } from "@std/assert"; - * - * const ext = extname("file.ts"); - * assertEquals(ext, ".ts"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `extname` from `@std/path/windows/unstable-extname`. - * - * @param path The path to get the extension from. - * @returns The extension of the `path`. - */ function extname(path) { - assertPath(path); - let start = 0; - let startDot = -1; - let startPart = 0; - let end = -1; - let matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - // Check for a drive letter prefix so as not to mistake the following - // path separator as an extra separator at the end of the path that can be - // disregarded - if (path.length >= 2 && path.charCodeAt(1) === CHAR_COLON && isWindowsDeviceRoot(path.charCodeAt(0))) { - start = startPart = 2; - } - for(let i = path.length - 1; i >= start; --i){ - const code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ""; - } - return path.slice(startDot, end); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function _format(sep, pathObject) { - const dir = pathObject.dir || pathObject.root; - const base = pathObject.base || (pathObject.name ?? "") + (pathObject.ext ?? ""); - if (!dir) return base; - if (base === sep) return dir; - if (dir === pathObject.root) return dir + base; - return dir + sep + base; -} -function assertArg$2(pathObject) { - if (pathObject === null || typeof pathObject !== "object") { - throw new TypeError(`The "pathObject" argument must be of type Object, received type "${typeof pathObject}"`); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Generate a path from `ParsedPath` object. - * - * @example Usage - * ```ts - * import { format } from "@std/path/windows/format"; - * import { assertEquals } from "@std/assert"; - * - * const path = format({ - * root: "C:\\", - * dir: "C:\\path\\dir", - * base: "file.txt", - * ext: ".txt", - * name: "file" - * }); - * assertEquals(path, "C:\\path\\dir\\file.txt"); - * ``` - * - * @param pathObject The path object to format. - * @returns The formatted path. - */ function format(pathObject) { - assertArg$2(pathObject); - return _format("\\", pathObject); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg$1(url) { - url = url instanceof URL ? url : new URL(url); - if (url.protocol !== "file:") { - throw new TypeError(`URL must be a file URL: received "${url.protocol}"`); - } - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a file URL to a path string. - * - * @example Usage - * ```ts - * import { fromFileUrl } from "@std/path/windows/from-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(fromFileUrl("file:///home/foo"), "\\home\\foo"); - * assertEquals(fromFileUrl("file:///C:/Users/foo"), "C:\\Users\\foo"); - * assertEquals(fromFileUrl("file://localhost/home/foo"), "\\home\\foo"); - * ``` - * - * @param url The file URL to convert. - * @returns The path string. - */ function fromFileUrl(url) { - url = assertArg$1(url); - let path = decodeURIComponent(url.pathname.replace(/\//g, "\\").replace(/%(?![0-9A-Fa-f]{2})/g, "%25")).replace(/^\\*([A-Za-z]:)(\\|$)/, "$1\\"); - if (url.hostname !== "") { - // Note: The `URL` implementation guarantees that the drive letter and - // hostname are mutually exclusive. Otherwise it would not have been valid - // to append the hostname and path like this. - path = `\\\\${url.hostname}${path}`; - } - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Verifies whether provided path is absolute. - * - * @example Usage - * ```ts - * import { isAbsolute } from "@std/path/windows/is-absolute"; - * import { assert, assertFalse } from "@std/assert"; - * - * assert(isAbsolute("C:\\foo\\bar")); - * assertFalse(isAbsolute("..\\baz")); - * ``` - * - * @param path The path to verify. - * @returns `true` if the path is absolute, `false` otherwise. - */ function isAbsolute(path) { - assertPath(path); - const len = path.length; - if (len === 0) return false; - const code = path.charCodeAt(0); - if (isPathSeparator(code)) { - return true; - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (len > 2 && path.charCodeAt(1) === CHAR_COLON) { - if (isPathSeparator(path.charCodeAt(2))) return true; - } - } - return false; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArg(path) { - assertPath(path); - if (path.length === 0) return "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// Copyright the Browserify authors. MIT License. -// Ported from https://github.com/browserify/path-browserify/ -// This module is browser compatible. -// Resolves . and .. elements in a path with directory names -function normalizeString(path, allowAboveRoot, separator, isPathSeparator) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let code; - for(let i = 0; i <= path.length; ++i){ - if (i < path.length) code = path.charCodeAt(i); - else if (isPathSeparator(code)) break; - else code = CHAR_FORWARD_SLASH; - if (isPathSeparator(code)) { - if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== CHAR_DOT || res.charCodeAt(res.length - 2) !== CHAR_DOT) { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf(separator); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf(separator); - } - lastSlash = i; - dots = 0; - continue; - } else if (res.length === 2 || res.length === 1) { - res = ""; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) res += `${separator}..`; - else res = ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) res += separator + path.slice(lastSlash + 1, i); - else res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === CHAR_DOT && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Normalize the `path`, resolving `'..'` and `'.'` segments. - * Note that resolving these segments does not necessarily mean that all will be eliminated. - * A `'..'` at the top-level will be preserved, and an empty path is canonically `'.'`. - * - * @example Usage - * ```ts - * import { normalize } from "@std/path/windows/normalize"; - * import { assertEquals } from "@std/assert"; - * - * const normalized = normalize("C:\\foo\\..\\bar"); - * assertEquals(normalized, "C:\\bar"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `normalize` from `@std/path/windows/unstable-normalize`. - * - * @param path The path to normalize - * @returns The normalized path - */ function normalize(path) { - assertArg(path); - const len = path.length; - let rootEnd = 0; - let device; - let isAbsolute = false; - const code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - // If we started with a separator, we know we at least have an absolute - // path of some kind (UNC or otherwise) - isAbsolute = true; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - // Return the normalized version of the UNC root since there - // is nothing left to process - return `\\\\${firstPart}\\${path.slice(last)}\\`; - } else if (j !== last) { - // We matched a UNC root with leftovers - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid unnecessary - // work - return "\\"; - } - let tail; - if (rootEnd < len) { - tail = normalizeString(path.slice(rootEnd), !isAbsolute, "\\", isPathSeparator); - } else { - tail = ""; - } - if (tail.length === 0 && !isAbsolute) tail = "."; - if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) { - tail += "\\"; - } - if (device === undefined) { - if (isAbsolute) { - if (tail.length > 0) return `\\${tail}`; - else return "\\"; - } - return tail; - } else if (isAbsolute) { - if (tail.length > 0) return `${device}\\${tail}`; - else return `${device}\\`; - } - return device + tail; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Join all given a sequence of `paths`,then normalizes the resulting path. - * - * @example Usage - * ```ts - * import { join } from "@std/path/windows/join"; - * import { assertEquals } from "@std/assert"; - * - * const joined = join("C:\\foo", "bar", "baz\\.."); - * assertEquals(joined, "C:\\foo\\bar"); - * ``` - * - * Note: If you are working with file URLs, - * use the new version of `join` from `@std/path/windows/unstable-join`. - * - * @param paths The paths to join. - * @returns The joined path. - */ function join(...paths) { - paths.forEach((path)=>assertPath(path)); - paths = paths.filter((path)=>path.length > 0); - if (paths.length === 0) return "."; - // Make sure that the joined path doesn't start with two slashes, because - // normalize() will mistake it for an UNC path then. - // - // This step is skipped when it is very clear that the user actually - // intended to point at an UNC path. This is assumed when the first - // non-empty string arguments starts with exactly two slashes followed by - // at least one more non-slash character. - // - // Note that for normalize() to treat a path as an UNC path it needs to - // have at least 2 components, so we don't filter for that here. - // This means that the user can use join to construct UNC paths from - // a server name and a share name; for example: - // path.join('//server', 'share') -> '\\\\server\\share\\' - let needsReplace = true; - let slashCount = 0; - const firstPart = paths[0]; - if (isPathSeparator(firstPart.charCodeAt(0))) { - ++slashCount; - const firstLen = firstPart.length; - if (firstLen > 1) { - if (isPathSeparator(firstPart.charCodeAt(1))) { - ++slashCount; - if (firstLen > 2) { - if (isPathSeparator(firstPart.charCodeAt(2))) ++slashCount; - else { - // We matched a UNC path in the first part - needsReplace = false; - } - } - } - } - } - let joined = paths.join("\\"); - if (needsReplace) { - // Find any more consecutive slashes we need to replace - for(; slashCount < joined.length; ++slashCount){ - if (!isPathSeparator(joined.charCodeAt(slashCount))) break; - } - // Replace the slashes if needed - if (slashCount >= 2) joined = `\\${joined.slice(slashCount)}`; - } - return normalize(joined); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return a `ParsedPath` object of the `path`. - * - * @example Usage - * ```ts - * import { parse } from "@std/path/windows/parse"; - * import { assertEquals } from "@std/assert"; - * - * const parsed = parse("C:\\foo\\bar\\baz.ext"); - * assertEquals(parsed, { - * root: "C:\\", - * dir: "C:\\foo\\bar", - * base: "baz.ext", - * ext: ".ext", - * name: "baz", - * }); - * ``` - * - * @param path The path to parse. - * @returns The `ParsedPath` object. - */ function parse(path) { - assertPath(path); - const ret = { - root: "", - dir: "", - base: "", - ext: "", - name: "" - }; - const len = path.length; - if (len === 0) return ret; - let rootEnd = 0; - let code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - rootEnd = 1; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - rootEnd = j + 1; - } - } - } - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - if (len === 3) { - // `path` contains just a drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - ret.base = "\\"; - return ret; - } - rootEnd = 3; - } - } else { - // `path` contains just a relative drive root, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - return ret; - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator, exit early to avoid - // unnecessary work - ret.root = ret.dir = path; - ret.base = "\\"; - return ret; - } - if (rootEnd > 0) ret.root = path.slice(0, rootEnd); - let startDot = -1; - let startPart = rootEnd; - let end = -1; - let matchedSlash = true; - let i = path.length - 1; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - let preDotState = 0; - // Get non-dir info - for(; i >= rootEnd; --i){ - code = path.charCodeAt(i); - if (isPathSeparator(code)) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === CHAR_DOT) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i; - else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot - preDotState === 0 || // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - if (end !== -1) { - ret.base = ret.name = path.slice(startPart, end); - } - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - ret.ext = path.slice(startDot, end); - } - // Fallback to '\' in case there is no basename - ret.base = ret.base || "\\"; - // If the directory is the root, use the entire root as the `dir` including - // the trailing slash if any (`C:\abc` -> `C:\`). Otherwise, strip out the - // trailing slash (`C:\abc\def` -> `C:\abc`). - if (startPart > 0 && startPart !== rootEnd) { - ret.dir = path.slice(0, startPart - 1); - } else ret.dir = ret.root; - return ret; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Resolves path segments into a `path`. - * - * @example Usage - * ```ts - * import { resolve } from "@std/path/windows/resolve"; - * import { assertEquals } from "@std/assert"; - * - * const resolved = resolve("C:\\foo\\bar", "..\\baz"); - * assertEquals(resolved, "C:\\foo\\baz"); - * ``` - * - * @param pathSegments The path segments to process to path - * @returns The resolved path - */ function resolve(...pathSegments) { - let resolvedDevice = ""; - let resolvedTail = ""; - let resolvedAbsolute = false; - for(let i = pathSegments.length - 1; i >= -1; i--){ - let path; - // deno-lint-ignore no-explicit-any - const { Deno } = globalThis; - if (i >= 0) { - path = pathSegments[i]; - } else if (!resolvedDevice) { - if (typeof Deno?.cwd !== "function") { - throw new TypeError("Resolved a drive-letter-less path without a current working directory (CWD)"); - } - path = Deno.cwd(); - } else { - if (typeof Deno?.env?.get !== "function" || typeof Deno?.cwd !== "function") { - throw new TypeError("Resolved a relative path without a current working directory (CWD)"); - } - path = Deno.cwd(); - // Verify that a cwd was found and that it actually points - // to our drive. If not, default to the drive's root. - if (path === undefined || path.slice(0, 3).toLowerCase() !== `${resolvedDevice.toLowerCase()}\\`) { - path = `${resolvedDevice}\\`; - } - } - assertPath(path); - const len = path.length; - // Skip empty entries - if (len === 0) continue; - let rootEnd = 0; - let device = ""; - let isAbsolute = false; - const code = path.charCodeAt(0); - // Try to match a root - if (len > 1) { - if (isPathSeparator(code)) { - // Possible UNC root - // If we started with a separator, we know we at least have an - // absolute path of some kind (UNC or otherwise) - isAbsolute = true; - if (isPathSeparator(path.charCodeAt(1))) { - // Matched double path separator at beginning - let j = 2; - let last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - const firstPart = path.slice(last, j); - // Matched! - last = j; - // Match 1 or more path separators - for(; j < len; ++j){ - if (!isPathSeparator(path.charCodeAt(j))) break; - } - if (j < len && j !== last) { - // Matched! - last = j; - // Match 1 or more non-path separators - for(; j < len; ++j){ - if (isPathSeparator(path.charCodeAt(j))) break; - } - if (j === len) { - // We matched a UNC root only - device = `\\\\${firstPart}\\${path.slice(last)}`; - rootEnd = j; - } else if (j !== last) { - // We matched a UNC root with leftovers - device = `\\\\${firstPart}\\${path.slice(last, j)}`; - rootEnd = j; - } - } - } - } else { - rootEnd = 1; - } - } else if (isWindowsDeviceRoot(code)) { - // Possible device root - if (path.charCodeAt(1) === CHAR_COLON) { - device = path.slice(0, 2); - rootEnd = 2; - if (len > 2) { - if (isPathSeparator(path.charCodeAt(2))) { - // Treat separator following drive name as an absolute path - // indicator - isAbsolute = true; - rootEnd = 3; - } - } - } - } - } else if (isPathSeparator(code)) { - // `path` contains just a path separator - rootEnd = 1; - isAbsolute = true; - } - if (device.length > 0 && resolvedDevice.length > 0 && device.toLowerCase() !== resolvedDevice.toLowerCase()) { - continue; - } - if (resolvedDevice.length === 0 && device.length > 0) { - resolvedDevice = device; - } - if (!resolvedAbsolute) { - resolvedTail = `${path.slice(rootEnd)}\\${resolvedTail}`; - resolvedAbsolute = isAbsolute; - } - if (resolvedAbsolute && resolvedDevice.length > 0) break; - } - // At this point the path should be resolved to a full absolute path, - // but handle relative paths to be safe (might happen when Deno.cwd() - // fails) - // Normalize the tail path - resolvedTail = normalizeString(resolvedTail, !resolvedAbsolute, "\\", isPathSeparator); - return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || "."; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function assertArgs(from, to) { - assertPath(from); - assertPath(to); - if (from === to) return ""; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Return the relative path from `from` to `to` based on current working directory. - * - * An example in windws, for instance: - * from = 'C:\\orandea\\test\\aaa' - * to = 'C:\\orandea\\impl\\bbb' - * The output of the function should be: '..\\..\\impl\\bbb' - * - * @example Usage - * ```ts - * import { relative } from "@std/path/windows/relative"; - * import { assertEquals } from "@std/assert"; - * - * const relativePath = relative("C:\\foobar\\test\\aaa", "C:\\foobar\\impl\\bbb"); - * assertEquals(relativePath, "..\\..\\impl\\bbb"); - * ``` - * - * @param from The path from which to calculate the relative path - * @param to The path to which to calculate the relative path - * @returns The relative path from `from` to `to` - */ function relative(from, to) { - assertArgs(from, to); - const fromOrig = resolve(from); - const toOrig = resolve(to); - if (fromOrig === toOrig) return ""; - from = fromOrig.toLowerCase(); - to = toOrig.toLowerCase(); - if (from === to) return ""; - // Trim any leading backslashes - let fromStart = 0; - let fromEnd = from.length; - for(; fromStart < fromEnd; ++fromStart){ - if (from.charCodeAt(fromStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for(; fromEnd - 1 > fromStart; --fromEnd){ - if (from.charCodeAt(fromEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const fromLen = fromEnd - fromStart; - // Trim any leading backslashes - let toStart = 0; - let toEnd = to.length; - for(; toStart < toEnd; ++toStart){ - if (to.charCodeAt(toStart) !== CHAR_BACKWARD_SLASH) break; - } - // Trim trailing backslashes (applicable to UNC paths only) - for(; toEnd - 1 > toStart; --toEnd){ - if (to.charCodeAt(toEnd - 1) !== CHAR_BACKWARD_SLASH) break; - } - const toLen = toEnd - toStart; - // Compare paths to find the longest common path from root - const length = fromLen < toLen ? fromLen : toLen; - let lastCommonSep = -1; - let i = 0; - for(; i <= length; ++i){ - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `from` is the exact base path for `to`. - // For example: from='C:\\foo\\bar'; to='C:\\foo\\bar\\baz' - return toOrig.slice(toStart + i + 1); - } else if (i === 2) { - // We get here if `from` is the device root. - // For example: from='C:\\'; to='C:\\foo' - return toOrig.slice(toStart + i); - } - } - if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === CHAR_BACKWARD_SLASH) { - // We get here if `to` is the exact base path for `from`. - // For example: from='C:\\foo\\bar'; to='C:\\foo' - lastCommonSep = i; - } else if (i === 2) { - // We get here if `to` is the device root. - // For example: from='C:\\foo\\bar'; to='C:\\' - lastCommonSep = 3; - } - } - break; - } - const fromCode = from.charCodeAt(fromStart + i); - const toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) break; - else if (fromCode === CHAR_BACKWARD_SLASH) lastCommonSep = i; - } - // We found a mismatch before the first common path separator was seen, so - // return the original `to`. - if (i !== length && lastCommonSep === -1) { - return toOrig; - } - let out = ""; - if (lastCommonSep === -1) lastCommonSep = 0; - // Generate the relative path based on the path difference between `to` and - // `from` - for(i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i){ - if (i === fromEnd || from.charCodeAt(i) === CHAR_BACKWARD_SLASH) { - if (out.length === 0) out += ".."; - else out += "\\.."; - } - } - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) { - return out + toOrig.slice(toStart + lastCommonSep, toEnd); - } else { - toStart += lastCommonSep; - if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart; - return toOrig.slice(toStart, toEnd); - } -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const WHITESPACE_ENCODINGS = { - "\u0009": "%09", - "\u000A": "%0A", - "\u000B": "%0B", - "\u000C": "%0C", - "\u000D": "%0D", - "\u0020": "%20" -}; -function encodeWhitespace(string) { - return string.replaceAll(/[\s]/g, (c)=>{ - return WHITESPACE_ENCODINGS[c] ?? c; - }); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Converts a path string to a file URL. - * - * @example Usage - * ```ts - * import { toFileUrl } from "@std/path/windows/to-file-url"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(toFileUrl("\\home\\foo"), new URL("file:///home/foo")); - * assertEquals(toFileUrl("C:\\Users\\foo"), new URL("file:///C:/Users/foo")); - * assertEquals(toFileUrl("\\\\127.0.0.1\\home\\foo"), new URL("file://127.0.0.1/home/foo")); - * ``` - * @param path The path to convert. - * @returns The file URL. - */ function toFileUrl(path) { - if (!isAbsolute(path)) { - throw new TypeError(`Path must be absolute: received "${path}"`); - } - const [, hostname, pathname] = path.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/); - const url = new URL("file:///"); - url.pathname = encodeWhitespace(pathname.replace(/%/g, "%25")); - if (hostname !== undefined && hostname !== "localhost") { - url.hostname = hostname; - if (!url.hostname) { - throw new TypeError(`Invalid hostname: "${url.hostname}"`); - } - } - return url; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Resolves path to a namespace path - * - * @example Usage - * ```ts - * import { toNamespacedPath } from "@std/path/windows/to-namespaced-path"; - * import { assertEquals } from "@std/assert"; - * - * const namespaced = toNamespacedPath("C:\\foo\\bar"); - * assertEquals(namespaced, "\\\\?\\C:\\foo\\bar"); - * ``` - * - * @param path The path to resolve to namespaced path - * @returns The resolved namespaced path - */ function toNamespacedPath(path) { - // Note: this will *probably* throw somewhere. - if (typeof path !== "string") return path; - if (path.length === 0) return ""; - const resolvedPath = resolve(path); - if (resolvedPath.length >= 3) { - if (resolvedPath.charCodeAt(0) === CHAR_BACKWARD_SLASH) { - // Possible UNC root - if (resolvedPath.charCodeAt(1) === CHAR_BACKWARD_SLASH) { - const code = resolvedPath.charCodeAt(2); - if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) { - // Matched non-long UNC root, convert the path to a long UNC path - return `\\\\?\\UNC\\${resolvedPath.slice(2)}`; - } - } - } else if (isWindowsDeviceRoot(resolvedPath.charCodeAt(0))) { - // Possible device root - if (resolvedPath.charCodeAt(1) === CHAR_COLON && resolvedPath.charCodeAt(2) === CHAR_BACKWARD_SLASH) { - // Matched device root, convert the path to a long UNC path - return `\\\\?\\${resolvedPath}`; - } - } - } - return path; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -function common$1(paths, sep) { - const [first = "", ...remaining] = paths; - const parts = first.split(sep); - let endOfPrefix = parts.length; - let append = ""; - for (const path of remaining){ - const compare = path.split(sep); - if (compare.length <= endOfPrefix) { - endOfPrefix = compare.length; - append = ""; - } - for(let i = 0; i < endOfPrefix; i++){ - if (compare[i] !== parts[i]) { - endOfPrefix = i; - append = i === 0 ? "" : sep; - break; - } - } - } - return parts.slice(0, endOfPrefix).join(sep) + append; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Determines the common path from a set of paths for Windows systems. - * - * @example Usage - * ```ts - * import { common } from "@std/path/windows/common"; - * import { assertEquals } from "@std/assert"; - * - * const path = common([ - * "C:\\foo\\bar", - * "C:\\foo\\baz", - * ]); - * assertEquals(path, "C:\\foo\\"); - * ``` - * - * @param paths The paths to compare. - * @returns The common path. - */ function common(paths) { - return common$1(paths, SEPARATOR); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Options for {@linkcode globToRegExp}, {@linkcode joinGlobs}, - * {@linkcode normalizeGlob} and {@linkcode expandGlob}. - */ const REG_EXP_ESCAPE_CHARS = [ - "!", - "$", - "(", - ")", - "*", - "+", - ".", - "=", - "?", - "[", - "\\", - "^", - "{", - "|" -]; -const RANGE_ESCAPE_CHARS = [ - "-", - "\\", - "]" -]; -function _globToRegExp(c, glob, { extended = true, globstar: globstarOption = true, // os = osType, -caseInsensitive = false } = {}) { - if (glob === "") { - return /(?!)/; - } - // Remove trailing separators. - let newLength = glob.length; - for(; newLength > 1 && c.seps.includes(glob[newLength - 1]); newLength--); - glob = glob.slice(0, newLength); - let regExpString = ""; - // Terminates correctly. Trust that `j` is incremented every iteration. - for(let j = 0; j < glob.length;){ - let segment = ""; - const groupStack = []; - let inRange = false; - let inEscape = false; - let endsWithSep = false; - let i = j; - // Terminates with `i` at the non-inclusive end of the current segment. - for(; i < glob.length && !c.seps.includes(glob[i]); i++){ - if (inEscape) { - inEscape = false; - const escapeChars = inRange ? RANGE_ESCAPE_CHARS : REG_EXP_ESCAPE_CHARS; - segment += escapeChars.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - continue; - } - if (glob[i] === c.escapePrefix) { - inEscape = true; - continue; - } - if (glob[i] === "[") { - if (!inRange) { - inRange = true; - segment += "["; - if (glob[i + 1] === "!") { - i++; - segment += "^"; - } else if (glob[i + 1] === "^") { - i++; - segment += "\\^"; - } - continue; - } else if (glob[i + 1] === ":") { - let k = i + 1; - let value = ""; - while(glob[k + 1] !== undefined && glob[k + 1] !== ":"){ - value += glob[k + 1]; - k++; - } - if (glob[k + 1] === ":" && glob[k + 2] === "]") { - i = k + 2; - if (value === "alnum") segment += "\\dA-Za-z"; - else if (value === "alpha") segment += "A-Za-z"; - else if (value === "ascii") segment += "\x00-\x7F"; - else if (value === "blank") segment += "\t "; - else if (value === "cntrl") segment += "\x00-\x1F\x7F"; - else if (value === "digit") segment += "\\d"; - else if (value === "graph") segment += "\x21-\x7E"; - else if (value === "lower") segment += "a-z"; - else if (value === "print") segment += "\x20-\x7E"; - else if (value === "punct") { - segment += "!\"#$%&'()*+,\\-./:;<=>?@[\\\\\\]^_‘{|}~"; - } else if (value === "space") segment += "\\s\v"; - else if (value === "upper") segment += "A-Z"; - else if (value === "word") segment += "\\w"; - else if (value === "xdigit") segment += "\\dA-Fa-f"; - continue; - } - } - } - if (glob[i] === "]" && inRange) { - inRange = false; - segment += "]"; - continue; - } - if (inRange) { - segment += glob[i]; - continue; - } - if (glob[i] === ")" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += ")"; - const type = groupStack.pop(); - if (type === "!") { - segment += c.wildcard; - } else if (type !== "@") { - segment += type; - } - continue; - } - if (glob[i] === "|" && groupStack.length > 0 && groupStack[groupStack.length - 1] !== "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "+" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("+"); - segment += "(?:"; - continue; - } - if (glob[i] === "@" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("@"); - segment += "(?:"; - continue; - } - if (glob[i] === "?") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("?"); - segment += "(?:"; - } else { - segment += "."; - } - continue; - } - if (glob[i] === "!" && extended && glob[i + 1] === "(") { - i++; - groupStack.push("!"); - segment += "(?!"; - continue; - } - if (glob[i] === "{") { - groupStack.push("BRACE"); - segment += "(?:"; - continue; - } - if (glob[i] === "}" && groupStack[groupStack.length - 1] === "BRACE") { - groupStack.pop(); - segment += ")"; - continue; - } - if (glob[i] === "," && groupStack[groupStack.length - 1] === "BRACE") { - segment += "|"; - continue; - } - if (glob[i] === "*") { - if (extended && glob[i + 1] === "(") { - i++; - groupStack.push("*"); - segment += "(?:"; - } else { - const prevChar = glob[i - 1]; - let numStars = 1; - while(glob[i + 1] === "*"){ - i++; - numStars++; - } - const nextChar = glob[i + 1]; - if (globstarOption && numStars === 2 && [ - ...c.seps, - undefined - ].includes(prevChar) && [ - ...c.seps, - undefined - ].includes(nextChar)) { - segment += c.globstar; - endsWithSep = true; - } else { - segment += c.wildcard; - } - } - continue; - } - segment += REG_EXP_ESCAPE_CHARS.includes(glob[i]) ? `\\${glob[i]}` : glob[i]; - } - // Check for unclosed groups or a dangling backslash. - if (groupStack.length > 0 || inRange || inEscape) { - // Parse failure. Take all characters from this segment literally. - segment = ""; - for (const c of glob.slice(j, i)){ - segment += REG_EXP_ESCAPE_CHARS.includes(c) ? `\\${c}` : c; - endsWithSep = false; - } - } - regExpString += segment; - if (!endsWithSep) { - regExpString += i < glob.length ? c.sep : c.sepMaybe; - endsWithSep = true; - } - // Terminates with `i` at the start of the next segment. - while(c.seps.includes(glob[i]))i++; - j = i; - } - regExpString = `^${regExpString}$`; - return new RegExp(regExpString, caseInsensitive ? "i" : ""); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -const constants = { - sep: "(?:\\\\|/)+", - sepMaybe: "(?:\\\\|/)*", - seps: [ - "\\", - "/" - ], - globstar: "(?:[^\\\\/]*(?:\\\\|/|$)+)*", - wildcard: "[^\\\\/]*", - escapePrefix: "`" -}; -/** Convert a glob string to a regular expression. - * - * Tries to match bash glob expansion as closely as possible. - * - * Basic glob syntax: - * - `*` - Matches everything without leaving the path segment. - * - `?` - Matches any single character. - * - `{foo,bar}` - Matches `foo` or `bar`. - * - `[abcd]` - Matches `a`, `b`, `c` or `d`. - * - `[a-d]` - Matches `a`, `b`, `c` or `d`. - * - `[!abcd]` - Matches any single character besides `a`, `b`, `c` or `d`. - * - `[[::]]` - Matches any character belonging to ``. - * - `[[:alnum:]]` - Matches any digit or letter. - * - `[[:digit:]abc]` - Matches any digit, `a`, `b` or `c`. - * - See https://facelessuser.github.io/wcmatch/glob/#posix-character-classes - * for a complete list of supported character classes. - * - `\` - Escapes the next character for an `os` other than `"windows"`. - * - \` - Escapes the next character for `os` set to `"windows"`. - * - `/` - Path separator. - * - `\` - Additional path separator only for `os` set to `"windows"`. - * - * Extended syntax: - * - Requires `{ extended: true }`. - * - `?(foo|bar)` - Matches 0 or 1 instance of `{foo,bar}`. - * - `@(foo|bar)` - Matches 1 instance of `{foo,bar}`. They behave the same. - * - `*(foo|bar)` - Matches _n_ instances of `{foo,bar}`. - * - `+(foo|bar)` - Matches _n > 0_ instances of `{foo,bar}`. - * - `!(foo|bar)` - Matches anything other than `{foo,bar}`. - * - See https://www.linuxjournal.com/content/bash-extended-globbing. - * - * Globstar syntax: - * - Requires `{ globstar: true }`. - * - `**` - Matches any number of any path segments. - * - Must comprise its entire path segment in the provided glob. - * - See https://www.linuxjournal.com/content/globstar-new-bash-globbing-option. - * - * Note the following properties: - * - The generated `RegExp` is anchored at both start and end. - * - Repeating and trailing separators are tolerated. Trailing separators in the - * provided glob have no meaning and are discarded. - * - Absolute globs will only match absolute paths, etc. - * - Empty globs will match nothing. - * - Any special glob syntax must be contained to one path segment. For example, - * `?(foo|bar/baz)` is invalid. The separator will take precedence and the - * first segment ends with an unclosed group. - * - If a path segment ends with unclosed groups or a dangling escape prefix, a - * parse error has occurred. Every character for that segment is taken - * literally in this event. - * - * Limitations: - * - A negative group like `!(foo|bar)` will wrongly be converted to a negative - * look-ahead followed by a wildcard. This means that `!(foo).js` will wrongly - * fail to match `foobar.js`, even though `foobar` is not `foo`. Effectively, - * `!(foo|bar)` is treated like `!(@(foo|bar)*)`. This will work correctly if - * the group occurs not nested at the end of the segment. - * - * @example Usage - * ```ts - * import { globToRegExp } from "@std/path/windows/glob-to-regexp"; - * import { assertEquals } from "@std/assert"; - * - * assertEquals(globToRegExp("*.js"), /^[^\\/]*\.js(?:\\|\/)*$/); - * ``` - * - * @param glob Glob string to convert. - * @param options Conversion options. - * @returns The regular expression equivalent to the glob. - */ function globToRegExp(glob, options = {}) { - return _globToRegExp(constants, glob, options); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Test whether the given string is a glob. - * - * @example Usage - * ```ts - * import { isGlob } from "@std/path/is-glob"; - * import { assert } from "@std/assert"; - * - * assert(!isGlob("foo/bar/../baz")); - * assert(isGlob("foo/*ar/../baz")); - * ``` - * - * @param str String to test. - * @returns `true` if the given string is a glob, otherwise `false` - */ function isGlob(str) { - const chars = { - "{": "}", - "(": ")", - "[": "]" - }; - const regex = /\\(.)|(^!|\*|\?|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; - if (str === "") { - return false; - } - let match; - while(match = regex.exec(str)){ - if (match[2]) return true; - let idx = match.index + match[0].length; - // if an open bracket/brace/paren is escaped, - // set the index to the next closing character - const open = match[1]; - const close = open ? chars[open] : null; - if (open && close) { - const n = str.indexOf(close, idx); - if (n !== -1) { - idx = n + 1; - } - } - str = str.slice(idx); - } - return false; -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * ```ts - * import { normalizeGlob } from "@std/path/windows/normalize-glob"; - * import { assertEquals } from "@std/assert"; - * - * const normalized = normalizeGlob("**\\foo\\..\\bar", { globstar: true }); - * assertEquals(normalized, "**\\bar"); - * ``` - * - * @param glob The glob pattern to normalize. - * @param options The options for glob pattern. - * @returns The normalized glob pattern. - */ function normalizeGlob(glob, { globstar = false } = {}) { - if (glob.match(/\0/g)) { - throw new Error(`Glob contains invalid characters: "${glob}"`); - } - if (!globstar) { - return normalize(glob); - } - const s = SEPARATOR_PATTERN.source; - const badParentPattern = new RegExp(`(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, "g"); - return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); -} - -// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// This module is browser compatible. -/** - * Like join(), but doesn't collapse "**\/.." when `globstar` is true. - * - * @example Usage - * - * ```ts - * import { joinGlobs } from "@std/path/windows/join-globs"; - * import { assertEquals } from "@std/assert"; - * - * const joined = joinGlobs(["foo", "**", "bar"], { globstar: true }); - * assertEquals(joined, "foo\\**\\bar"); - * ``` - * - * @param globs The globs to join. - * @param options The options for glob pattern. - * @returns The joined glob pattern. - */ function joinGlobs(globs, { extended = true, globstar = false } = {}) { - if (!globstar || globs.length === 0) { - return join(...globs); - } - let joined; - for (const glob of globs){ - const path = glob; - if (path.length > 0) { - if (!joined) joined = path; - else joined += `${SEPARATOR}${path}`; - } - } - if (!joined) return "."; - return normalizeGlob(joined, { - extended, - globstar - }); -} - -export { DELIMITER, SEPARATOR, SEPARATOR_PATTERN, basename, common, dirname, extname, format, fromFileUrl, globToRegExp, isAbsolute, isGlob, join, joinGlobs, normalize, normalizeGlob, parse, relative, resolve, toFileUrl, toNamespacedPath }; diff --git a/node_modules/@eslint/config-array/dist/esm/types.d.ts b/node_modules/@eslint/config-array/dist/esm/types.d.ts deleted file mode 100644 index a495d94..0000000 --- a/node_modules/@eslint/config-array/dist/esm/types.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @fileoverview Types for the config-array package. - * @author Nicholas C. Zakas - */ -export interface ConfigObject { - /** - * The files to include. - */ - files?: string[]; - /** - * The files to exclude. - */ - ignores?: string[]; - /** - * The name of the config object. - */ - name?: string; - [key: string]: unknown; -} diff --git a/node_modules/@eslint/config-array/dist/esm/types.ts b/node_modules/@eslint/config-array/dist/esm/types.ts deleted file mode 100644 index 1af4011..0000000 --- a/node_modules/@eslint/config-array/dist/esm/types.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @fileoverview Types for the config-array package. - * @author Nicholas C. Zakas - */ - -export interface ConfigObject { - /** - * The files to include. - */ - files?: string[]; - - /** - * The files to exclude. - */ - ignores?: string[]; - - /** - * The name of the config object. - */ - name?: string; - - // may also have any number of other properties - [key: string]: unknown; -} diff --git a/node_modules/@eslint/config-array/package.json b/node_modules/@eslint/config-array/package.json deleted file mode 100644 index 299906b..0000000 --- a/node_modules/@eslint/config-array/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@eslint/config-array", - "version": "0.19.0", - "description": "General purpose glob-based configuration matching.", - "author": "Nicholas C. Zakas", - "type": "module", - "main": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", - "exports": { - "require": { - "types": "./dist/cjs/index.d.cts", - "default": "./dist/cjs/index.cjs" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/rewrite.git" - }, - "bugs": { - "url": "https://github.com/eslint/rewrite/issues" - }, - "homepage": "https://github.com/eslint/rewrite#readme", - "scripts": { - "build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js", - "build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"", - "build:std__path": "rollup -c rollup.std__path-config.js && node fix-std__path-imports", - "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts && npm run build:std__path", - "test:jsr": "npx jsr@latest publish --dry-run", - "pretest": "npm run build", - "test": "mocha tests/", - "test:coverage": "c8 npm test" - }, - "keywords": [ - "configuration", - "configarray", - "config file" - ], - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^2.1.4", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "devDependencies": { - "@jsr/std__path": "^1.0.4", - "@types/minimatch": "^3.0.5", - "c8": "^9.1.0", - "mocha": "^10.4.0", - "rollup": "^4.16.2", - "rollup-plugin-copy": "^3.5.0", - "typescript": "^5.4.5" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/@eslint/core/LICENSE b/node_modules/@eslint/core/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@eslint/core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/core/README.md b/node_modules/@eslint/core/README.md deleted file mode 100644 index 6a2576f..0000000 --- a/node_modules/@eslint/core/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# ESLint Core - -## Overview - -This package is the future home of the rewritten, runtime-agnostic ESLint core. - -Right now, it exports the core types necessary to implement language plugins. - -## License - -Apache 2.0 - - - - -## Sponsors - -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) -to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

-

Automattic Airbnb

Gold Sponsors

-

trunk.io

Silver Sponsors

-

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

-

Technology Sponsors

-Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. -

Netlify Algolia 1Password

- diff --git a/node_modules/@eslint/core/dist/cjs/types.d.cts b/node_modules/@eslint/core/dist/cjs/types.d.cts deleted file mode 100644 index 4ec26b9..0000000 --- a/node_modules/@eslint/core/dist/cjs/types.d.cts +++ /dev/null @@ -1,735 +0,0 @@ -/** - * @fileoverview Shared types for ESLint Core. - */ -import { JSONSchema4 } from "json-schema"; -/** - * Represents an error inside of a file. - */ -export interface FileError { - message: string; - line: number; - column: number; - endLine?: number; - endColumn?: number; -} -/** - * Represents a problem found in a file. - */ -export interface FileProblem { - ruleId: string | null; - message: string; - loc: SourceLocation; -} -/** - * Represents the start and end coordinates of a node inside the source. - */ -export interface SourceLocation { - start: Position; - end: Position; -} -/** - * Represents the start and end coordinates of a node inside the source with an offset. - */ -export interface SourceLocationWithOffset { - start: PositionWithOffset; - end: PositionWithOffset; -} -/** - * Represents a location coordinate inside the source. ESLint-style formats - * have just `line` and `column` while others may have `offset` as well. - */ -export interface Position { - line: number; - column: number; -} -/** - * Represents a location coordinate inside the source with an offset. - */ -export interface PositionWithOffset extends Position { - offset: number; -} -/** - * Represents a range of characters in the source. - */ -export type SourceRange = [number, number]; -/** - * What the rule is responsible for finding: - * - `problem` means the rule has noticed a potential error. - * - `suggestion` means the rule suggests an alternate or better approach. - * - `layout` means the rule is looking at spacing, indentation, etc. - */ -export type RuleType = "problem" | "suggestion" | "layout"; -/** - * The type of fix the rule can provide: - * - `code` means the rule can fix syntax. - * - `whitespace` means the rule can fix spacing and indentation. - */ -export type RuleFixType = "code" | "whitespace"; -/** - * An object containing visitor information for a rule. Each method is either the - * name of a node type or a selector, or is a method that will be called at specific - * times during the traversal. - */ -export interface RuleVisitor { - /** - * Called for each node in the AST or at specific times during the traversal. - */ - [key: string]: (...args: any[]) => void; -} -/** - * Rule meta information used for documentation. - */ -export interface RulesMetaDocs { - /** - * A short description of the rule. - */ - description?: string | undefined; - /** - * The URL to the documentation for the rule. - */ - url?: string | undefined; - /** - * The category the rule falls under. - * @deprecated No longer used. - */ - category?: string | undefined; - /** - * Indicates if the rule is generally recommended for all users. - */ - recommended?: boolean | undefined; -} -/** - * Meta information about a rule. - */ -export interface RulesMeta { - /** - * Properties that are used when documenting the rule. - */ - docs?: (RulesMetaDocs & ExtRuleDocs) | undefined; - /** - * The type of rule. - */ - type?: RuleType | undefined; - /** - * The schema for the rule options. Required if the rule has options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - /** - * The messages that the rule can report. - */ - messages?: Record; - /** - * The deprecated rules for the rule. - */ - deprecated?: boolean | undefined; - /** - * When a rule is deprecated, indicates the rule ID(s) that should be used instead. - */ - replacedBy?: string[] | undefined; - /** - * Indicates if the rule is fixable, and if so, what type of fix it provides. - */ - fixable?: RuleFixType | undefined; - /** - * Indicates if the rule may provide suggestions. - */ - hasSuggestions?: boolean | undefined; -} -/** - * Generic type for `RuleContext`. - */ -export interface RuleContextTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Node: unknown; -} -/** - * Represents the context object that is passed to a rule. This object contains - * information about the current state of the linting process and is the rule's - * view into the outside world. - */ -export interface RuleContext { - /** - * The current working directory for the session. - */ - cwd: string; - /** - * Returns the current working directory for the session. - * @deprecated Use `cwd` instead. - */ - getCwd(): string; - /** - * The filename of the file being linted. - */ - filename: string; - /** - * Returns the filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename(): string; - /** - * The physical filename of the file being linted. - */ - physicalFilename: string; - /** - * Returns the physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename(): string; - /** - * The source code object that the rule is running on. - */ - sourceCode: Options["Code"]; - /** - * Returns the source code object that the rule is running on. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode(): Options["Code"]; - /** - * Shared settings for the configuration. - */ - settings: SettingsConfig; - /** - * Parser-specific options for the configuration. - * @deprecated Use `languageOptions.parserOptions` instead. - */ - parserOptions: Record; - /** - * The language options for the configuration. - */ - languageOptions: Options["LangOptions"]; - /** - * The CommonJS path to the parser used while parsing this file. - * @deprecated No longer used. - */ - parserPath: string | undefined; - /** - * The rule ID. - */ - id: string; - /** - * The rule's configured options. - */ - options: Options["RuleOptions"]; - /** - * The report function that the rule should use to report problems. - * @param violation The violation to report. - */ - report(violation: ViolationReport): void; -} -/** - * Manager of text edits for a rule fix. - */ -export interface RuleTextEditor { - /** - * Inserts text after the specified node or token. - * @param syntaxElement The node or token to insert after. - * @param text The edit to insert after the node or token. - */ - insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text after the specified range. - * @param range The range to insert after. - * @param text The edit to insert after the range. - */ - insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Inserts text before the specified node or token. - * @param syntaxElement A syntax element with location information to insert before. - * @param text The edit to insert before the node or token. - */ - insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text before the specified range. - * @param range The range to insert before. - * @param text The edit to insert before the range. - */ - insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Removes the specified node or token. - * @param syntaxElement A syntax element with location information to remove. - * @returns The edit to remove the node or token. - */ - remove(syntaxElement: EditableSyntaxElement): RuleTextEdit; - /** - * Removes the specified range. - * @param range The range to remove. - * @returns The edit to remove the range. - */ - removeRange(range: SourceRange): RuleTextEdit; - /** - * Replaces the specified node or token with the given text. - * @param syntaxElement A syntax element with location information to replace. - * @param text The text to replace the node or token with. - * @returns The edit to replace the node or token. - */ - replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Replaces the specified range with the given text. - * @param range The range to replace. - * @param text The text to replace the range with. - * @returns The edit to replace the range. - */ - replaceTextRange(range: SourceRange, text: string): RuleTextEdit; -} -/** - * Represents a fix for a rule violation implemented as a text edit. - */ -export interface RuleTextEdit { - /** - * The range to replace. - */ - range: SourceRange; - /** - * The text to insert. - */ - text: string; -} -interface ViolationReportBase { - /** - * The type of node that the violation is for. - * @deprecated May be removed in the future. - */ - nodeType?: string | undefined; - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the violation. - * @param fixer The text editor to apply the fix. - * @returns The fix(es) for the violation. - */ - fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable | null; - /** - * An array of suggested fixes for the problem. These fixes may change the - * behavior of the code, so they are not applied automatically. - */ - suggest?: SuggestedEdit[]; -} -type ViolationMessage = { - message: string; -} | { - messageId: string; -}; -type ViolationLocation = { - loc: SourceLocation; -} | { - node: Node; -}; -export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -interface SuggestedEditBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the suggestion. - * @param fixer The text editor to apply the fix. - * @returns The fix for the suggestion. - */ - fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable | null; -} -type SuggestionMessage = { - desc: string; -} | { - messageId: string; -}; -/** - * A suggested edit for a rule violation. - */ -export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; -/** - * Generic options for the `RuleDefinition` type. - */ -export interface RuleDefinitionTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Visitor: RuleVisitor; - Node: unknown; - MessageIds: string; - ExtRuleDocs: unknown; -} -/** - * The definition of an ESLint rule. - */ -export interface RuleDefinition { - /** - * The meta information for the rule. - */ - meta?: RulesMeta; - /** - * Creates the visitor that ESLint uses to apply the rule during traversal. - * @param context The rule context. - * @returns The rule visitor. - */ - create(context: RuleContext<{ - LangOptions: Options["LangOptions"]; - Code: Options["Code"]; - RuleOptions: Options["RuleOptions"]; - Node: Options["Node"]; - }>): Options["Visitor"]; -} -/** - * The human readable severity level used in a configuration. - */ -export type SeverityName = "off" | "warn" | "error"; -/** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - */ -export type SeverityLevel = 0 | 1 | 2; -/** - * The severity of a rule in a configuration. - */ -export type Severity = SeverityName | SeverityLevel; -/** - * Represents the configuration options for the core linter. - */ -export interface LinterOptionsConfig { - /** - * Indicates whether or not inline configuration is evaluated. - */ - noInlineConfig?: boolean; - /** - * Indicates what to do when an unused disable directive is found. - */ - reportUnusedDisableDirectives?: boolean | Severity; -} -/** - * Shared settings that are accessible from within plugins. - */ -export type SettingsConfig = Record; -/** - * The configuration for a rule. - */ -export type RuleConfig = Severity | [Severity, ...unknown[]]; -/** - * A collection of rules and their configurations. - */ -export type RulesConfig = Record; -/** - * Generic options for the `Language` type. - */ -export interface LanguageTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RootNode: unknown; - Node: unknown; -} -/** - * Represents a plugin language. - */ -export interface Language { - /** - * Indicates how ESLint should read the file. - */ - fileType: "text"; - /** - * First line number returned from the parser (text mode only). - */ - lineStart: 0 | 1; - /** - * First column number returned from the parser (text mode only). - */ - columnStart: 0 | 1; - /** - * The property to read the node type from. Used in selector querying. - */ - nodeTypeKey: string; - /** - * The traversal path that tools should take when evaluating the AST - */ - visitorKeys?: Record; - /** - * Default language options. User-defined options are merged with this object. - */ - defaultLanguageOptions?: LanguageOptions; - /** - * Validates languageOptions for this language. - */ - validateLanguageOptions(languageOptions: Options["LangOptions"]): void; - /** - * Normalizes languageOptions for this language. - */ - normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"]; - /** - * Helper for esquery that allows languages to match nodes against - * class. esquery currently has classes like `function` that will - * match all the various function nodes. This method allows languages - * to implement similar shorthands. - */ - matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean; - /** - * Parses the given file input into its component parts. This file should not - * throws errors for parsing errors but rather should return any parsing - * errors as parse of the ParseResult object. - */ - parse(file: File, context: LanguageContext): ParseResult; - /** - * Creates SourceCode object that ESLint uses to work with a file. - */ - createSourceCode(file: File, input: OkParseResult, context: LanguageContext): Options["Code"]; -} -/** - * Plugin-defined options for the language. - */ -export type LanguageOptions = Record; -/** - * The context object that is passed to the language plugin methods. - */ -export interface LanguageContext { - languageOptions: LangOptions; -} -/** - * Represents a file read by ESLint. - */ -export interface File { - /** - * The path that ESLint uses for this file. May be a virtual path - * if it was returned by a processor. - */ - path: string; - /** - * The path to the file on disk. This always maps directly to a file - * regardless of whether it was returned from a processor. - */ - physicalPath: string; - /** - * Indicates if the original source contained a byte-order marker. - * ESLint strips the BOM from the `body`, but this info is needed - * to correctly apply autofixing. - */ - bom: boolean; - /** - * The body of the file to parse. - */ - body: string | Uint8Array; -} -/** - * Represents the successful result of parsing a file. - */ -export interface OkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: true; - /** - * The abstract syntax tree created by the parser. (only when ok: true) - */ - ast: RootNode; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -/** - * Represents the unsuccessful result of parsing a file. - */ -export interface NotOkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: false; - /** - * Any parsing errors, whether fatal or not. (only when ok: false) - */ - errors: FileError[]; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -export type ParseResult = OkParseResult | NotOkParseResult; -/** - * Represents inline configuration found in the source code. - */ -interface InlineConfigElement { - /** - * The location of the inline config element. - */ - loc: SourceLocation; - /** - * The interpreted configuration from the inline config element. - */ - config: { - rules: RulesConfig; - }; -} -/** - * Generic options for the `SourceCodeBase` type. - */ -interface SourceCodeBaseTypeOptions { - LangOptions: LanguageOptions; - RootNode: unknown; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; -} -/** - * Represents the basic interface for a source code object. - */ -interface SourceCodeBase { - /** - * Root of the AST. - */ - ast: Options["RootNode"]; - /** - * The traversal path that tools should take when evaluating the AST. - * When present, this overrides the `visitorKeys` on the language for - * just this source code object. - */ - visitorKeys?: Record; - /** - * Retrieves the equivalent of `loc` for a given node or token. - * @param syntaxElement The node or token to get the location for. - * @returns The location of the node or token. - */ - getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation; - /** - * Retrieves the equivalent of `range` for a given node or token. - * @param syntaxElement The node or token to get the range for. - * @returns The range of the node or token. - */ - getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange; - /** - * Traversal of AST. - */ - traverse(): Iterable; - /** - * Applies language options passed in from the ESLint core. - */ - applyLanguageOptions?(languageOptions: Options["LangOptions"]): void; - /** - * Return all of the inline areas where ESLint should be disabled/enabled - * along with any problems found in evaluating the directives. - */ - getDisableDirectives?(): { - directives: Directive[]; - problems: FileProblem[]; - }; - /** - * Returns an array of all inline configuration nodes found in the - * source code. - */ - getInlineConfigNodes?(): Options["ConfigNode"][]; - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - */ - applyInlineConfig?(): { - configs: InlineConfigElement[]; - problems: FileProblem[]; - }; - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize?(): void; -} -/** - * Represents the source of a text file being linted. - */ -export interface TextSourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - text: string; -} -/** - * Represents the source of a binary file being linted. - */ -export interface BinarySourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - body: Uint8Array; -} -export type SourceCode = TextSourceCode | BinarySourceCode; -/** - * Represents a traversal step visiting the AST. - */ -export interface VisitTraversalStep { - kind: 1; - target: unknown; - phase: 1 | 2; - args: unknown[]; -} -/** - * Represents a traversal step calling a function. - */ -export interface CallTraversalStep { - kind: 2; - target: string; - phase?: string; - args: unknown[]; -} -export type TraversalStep = VisitTraversalStep | CallTraversalStep; -/** - * The type of disable directive. This determines how ESLint will disable rules. - */ -export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line"; -/** - * Represents a disable directive. - */ -export interface Directive { - /** - * The type of directive. - */ - type: DirectiveType; - /** - * The node of the directive. May be in the AST or a comment/token. - */ - node: unknown; - /** - * The value of the directive. - */ - value: string; - /** - * The justification for the directive. - */ - justification?: string; -} -export {}; diff --git a/node_modules/@eslint/core/dist/esm/types.d.ts b/node_modules/@eslint/core/dist/esm/types.d.ts deleted file mode 100644 index 4ec26b9..0000000 --- a/node_modules/@eslint/core/dist/esm/types.d.ts +++ /dev/null @@ -1,735 +0,0 @@ -/** - * @fileoverview Shared types for ESLint Core. - */ -import { JSONSchema4 } from "json-schema"; -/** - * Represents an error inside of a file. - */ -export interface FileError { - message: string; - line: number; - column: number; - endLine?: number; - endColumn?: number; -} -/** - * Represents a problem found in a file. - */ -export interface FileProblem { - ruleId: string | null; - message: string; - loc: SourceLocation; -} -/** - * Represents the start and end coordinates of a node inside the source. - */ -export interface SourceLocation { - start: Position; - end: Position; -} -/** - * Represents the start and end coordinates of a node inside the source with an offset. - */ -export interface SourceLocationWithOffset { - start: PositionWithOffset; - end: PositionWithOffset; -} -/** - * Represents a location coordinate inside the source. ESLint-style formats - * have just `line` and `column` while others may have `offset` as well. - */ -export interface Position { - line: number; - column: number; -} -/** - * Represents a location coordinate inside the source with an offset. - */ -export interface PositionWithOffset extends Position { - offset: number; -} -/** - * Represents a range of characters in the source. - */ -export type SourceRange = [number, number]; -/** - * What the rule is responsible for finding: - * - `problem` means the rule has noticed a potential error. - * - `suggestion` means the rule suggests an alternate or better approach. - * - `layout` means the rule is looking at spacing, indentation, etc. - */ -export type RuleType = "problem" | "suggestion" | "layout"; -/** - * The type of fix the rule can provide: - * - `code` means the rule can fix syntax. - * - `whitespace` means the rule can fix spacing and indentation. - */ -export type RuleFixType = "code" | "whitespace"; -/** - * An object containing visitor information for a rule. Each method is either the - * name of a node type or a selector, or is a method that will be called at specific - * times during the traversal. - */ -export interface RuleVisitor { - /** - * Called for each node in the AST or at specific times during the traversal. - */ - [key: string]: (...args: any[]) => void; -} -/** - * Rule meta information used for documentation. - */ -export interface RulesMetaDocs { - /** - * A short description of the rule. - */ - description?: string | undefined; - /** - * The URL to the documentation for the rule. - */ - url?: string | undefined; - /** - * The category the rule falls under. - * @deprecated No longer used. - */ - category?: string | undefined; - /** - * Indicates if the rule is generally recommended for all users. - */ - recommended?: boolean | undefined; -} -/** - * Meta information about a rule. - */ -export interface RulesMeta { - /** - * Properties that are used when documenting the rule. - */ - docs?: (RulesMetaDocs & ExtRuleDocs) | undefined; - /** - * The type of rule. - */ - type?: RuleType | undefined; - /** - * The schema for the rule options. Required if the rule has options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - /** - * The messages that the rule can report. - */ - messages?: Record; - /** - * The deprecated rules for the rule. - */ - deprecated?: boolean | undefined; - /** - * When a rule is deprecated, indicates the rule ID(s) that should be used instead. - */ - replacedBy?: string[] | undefined; - /** - * Indicates if the rule is fixable, and if so, what type of fix it provides. - */ - fixable?: RuleFixType | undefined; - /** - * Indicates if the rule may provide suggestions. - */ - hasSuggestions?: boolean | undefined; -} -/** - * Generic type for `RuleContext`. - */ -export interface RuleContextTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Node: unknown; -} -/** - * Represents the context object that is passed to a rule. This object contains - * information about the current state of the linting process and is the rule's - * view into the outside world. - */ -export interface RuleContext { - /** - * The current working directory for the session. - */ - cwd: string; - /** - * Returns the current working directory for the session. - * @deprecated Use `cwd` instead. - */ - getCwd(): string; - /** - * The filename of the file being linted. - */ - filename: string; - /** - * Returns the filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename(): string; - /** - * The physical filename of the file being linted. - */ - physicalFilename: string; - /** - * Returns the physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename(): string; - /** - * The source code object that the rule is running on. - */ - sourceCode: Options["Code"]; - /** - * Returns the source code object that the rule is running on. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode(): Options["Code"]; - /** - * Shared settings for the configuration. - */ - settings: SettingsConfig; - /** - * Parser-specific options for the configuration. - * @deprecated Use `languageOptions.parserOptions` instead. - */ - parserOptions: Record; - /** - * The language options for the configuration. - */ - languageOptions: Options["LangOptions"]; - /** - * The CommonJS path to the parser used while parsing this file. - * @deprecated No longer used. - */ - parserPath: string | undefined; - /** - * The rule ID. - */ - id: string; - /** - * The rule's configured options. - */ - options: Options["RuleOptions"]; - /** - * The report function that the rule should use to report problems. - * @param violation The violation to report. - */ - report(violation: ViolationReport): void; -} -/** - * Manager of text edits for a rule fix. - */ -export interface RuleTextEditor { - /** - * Inserts text after the specified node or token. - * @param syntaxElement The node or token to insert after. - * @param text The edit to insert after the node or token. - */ - insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text after the specified range. - * @param range The range to insert after. - * @param text The edit to insert after the range. - */ - insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Inserts text before the specified node or token. - * @param syntaxElement A syntax element with location information to insert before. - * @param text The edit to insert before the node or token. - */ - insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Inserts text before the specified range. - * @param range The range to insert before. - * @param text The edit to insert before the range. - */ - insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit; - /** - * Removes the specified node or token. - * @param syntaxElement A syntax element with location information to remove. - * @returns The edit to remove the node or token. - */ - remove(syntaxElement: EditableSyntaxElement): RuleTextEdit; - /** - * Removes the specified range. - * @param range The range to remove. - * @returns The edit to remove the range. - */ - removeRange(range: SourceRange): RuleTextEdit; - /** - * Replaces the specified node or token with the given text. - * @param syntaxElement A syntax element with location information to replace. - * @param text The text to replace the node or token with. - * @returns The edit to replace the node or token. - */ - replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit; - /** - * Replaces the specified range with the given text. - * @param range The range to replace. - * @param text The text to replace the range with. - * @returns The edit to replace the range. - */ - replaceTextRange(range: SourceRange, text: string): RuleTextEdit; -} -/** - * Represents a fix for a rule violation implemented as a text edit. - */ -export interface RuleTextEdit { - /** - * The range to replace. - */ - range: SourceRange; - /** - * The text to insert. - */ - text: string; -} -interface ViolationReportBase { - /** - * The type of node that the violation is for. - * @deprecated May be removed in the future. - */ - nodeType?: string | undefined; - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the violation. - * @param fixer The text editor to apply the fix. - * @returns The fix(es) for the violation. - */ - fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable | null; - /** - * An array of suggested fixes for the problem. These fixes may change the - * behavior of the code, so they are not applied automatically. - */ - suggest?: SuggestedEdit[]; -} -type ViolationMessage = { - message: string; -} | { - messageId: string; -}; -type ViolationLocation = { - loc: SourceLocation; -} | { - node: Node; -}; -export type ViolationReport = ViolationReportBase & ViolationMessage & ViolationLocation; -interface SuggestedEditBase { - /** - * The data to insert into the message. - */ - data?: Record | undefined; - /** - * The fix to be applied for the suggestion. - * @param fixer The text editor to apply the fix. - * @returns The fix for the suggestion. - */ - fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable | null; -} -type SuggestionMessage = { - desc: string; -} | { - messageId: string; -}; -/** - * A suggested edit for a rule violation. - */ -export type SuggestedEdit = SuggestedEditBase & SuggestionMessage; -/** - * Generic options for the `RuleDefinition` type. - */ -export interface RuleDefinitionTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RuleOptions: unknown[]; - Visitor: RuleVisitor; - Node: unknown; - MessageIds: string; - ExtRuleDocs: unknown; -} -/** - * The definition of an ESLint rule. - */ -export interface RuleDefinition { - /** - * The meta information for the rule. - */ - meta?: RulesMeta; - /** - * Creates the visitor that ESLint uses to apply the rule during traversal. - * @param context The rule context. - * @returns The rule visitor. - */ - create(context: RuleContext<{ - LangOptions: Options["LangOptions"]; - Code: Options["Code"]; - RuleOptions: Options["RuleOptions"]; - Node: Options["Node"]; - }>): Options["Visitor"]; -} -/** - * The human readable severity level used in a configuration. - */ -export type SeverityName = "off" | "warn" | "error"; -/** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - */ -export type SeverityLevel = 0 | 1 | 2; -/** - * The severity of a rule in a configuration. - */ -export type Severity = SeverityName | SeverityLevel; -/** - * Represents the configuration options for the core linter. - */ -export interface LinterOptionsConfig { - /** - * Indicates whether or not inline configuration is evaluated. - */ - noInlineConfig?: boolean; - /** - * Indicates what to do when an unused disable directive is found. - */ - reportUnusedDisableDirectives?: boolean | Severity; -} -/** - * Shared settings that are accessible from within plugins. - */ -export type SettingsConfig = Record; -/** - * The configuration for a rule. - */ -export type RuleConfig = Severity | [Severity, ...unknown[]]; -/** - * A collection of rules and their configurations. - */ -export type RulesConfig = Record; -/** - * Generic options for the `Language` type. - */ -export interface LanguageTypeOptions { - LangOptions: LanguageOptions; - Code: SourceCode; - RootNode: unknown; - Node: unknown; -} -/** - * Represents a plugin language. - */ -export interface Language { - /** - * Indicates how ESLint should read the file. - */ - fileType: "text"; - /** - * First line number returned from the parser (text mode only). - */ - lineStart: 0 | 1; - /** - * First column number returned from the parser (text mode only). - */ - columnStart: 0 | 1; - /** - * The property to read the node type from. Used in selector querying. - */ - nodeTypeKey: string; - /** - * The traversal path that tools should take when evaluating the AST - */ - visitorKeys?: Record; - /** - * Default language options. User-defined options are merged with this object. - */ - defaultLanguageOptions?: LanguageOptions; - /** - * Validates languageOptions for this language. - */ - validateLanguageOptions(languageOptions: Options["LangOptions"]): void; - /** - * Normalizes languageOptions for this language. - */ - normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"]; - /** - * Helper for esquery that allows languages to match nodes against - * class. esquery currently has classes like `function` that will - * match all the various function nodes. This method allows languages - * to implement similar shorthands. - */ - matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean; - /** - * Parses the given file input into its component parts. This file should not - * throws errors for parsing errors but rather should return any parsing - * errors as parse of the ParseResult object. - */ - parse(file: File, context: LanguageContext): ParseResult; - /** - * Creates SourceCode object that ESLint uses to work with a file. - */ - createSourceCode(file: File, input: OkParseResult, context: LanguageContext): Options["Code"]; -} -/** - * Plugin-defined options for the language. - */ -export type LanguageOptions = Record; -/** - * The context object that is passed to the language plugin methods. - */ -export interface LanguageContext { - languageOptions: LangOptions; -} -/** - * Represents a file read by ESLint. - */ -export interface File { - /** - * The path that ESLint uses for this file. May be a virtual path - * if it was returned by a processor. - */ - path: string; - /** - * The path to the file on disk. This always maps directly to a file - * regardless of whether it was returned from a processor. - */ - physicalPath: string; - /** - * Indicates if the original source contained a byte-order marker. - * ESLint strips the BOM from the `body`, but this info is needed - * to correctly apply autofixing. - */ - bom: boolean; - /** - * The body of the file to parse. - */ - body: string | Uint8Array; -} -/** - * Represents the successful result of parsing a file. - */ -export interface OkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: true; - /** - * The abstract syntax tree created by the parser. (only when ok: true) - */ - ast: RootNode; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -/** - * Represents the unsuccessful result of parsing a file. - */ -export interface NotOkParseResult { - /** - * Indicates if the parse was successful. If true, the parse was successful - * and ESLint should continue on to create a SourceCode object and run rules; - * if false, ESLint should just report the error(s) without doing anything - * else. - */ - ok: false; - /** - * Any parsing errors, whether fatal or not. (only when ok: false) - */ - errors: FileError[]; - /** - * Any additional data that the parser wants to provide. - */ - [key: string]: any; -} -export type ParseResult = OkParseResult | NotOkParseResult; -/** - * Represents inline configuration found in the source code. - */ -interface InlineConfigElement { - /** - * The location of the inline config element. - */ - loc: SourceLocation; - /** - * The interpreted configuration from the inline config element. - */ - config: { - rules: RulesConfig; - }; -} -/** - * Generic options for the `SourceCodeBase` type. - */ -interface SourceCodeBaseTypeOptions { - LangOptions: LanguageOptions; - RootNode: unknown; - SyntaxElementWithLoc: unknown; - ConfigNode: unknown; -} -/** - * Represents the basic interface for a source code object. - */ -interface SourceCodeBase { - /** - * Root of the AST. - */ - ast: Options["RootNode"]; - /** - * The traversal path that tools should take when evaluating the AST. - * When present, this overrides the `visitorKeys` on the language for - * just this source code object. - */ - visitorKeys?: Record; - /** - * Retrieves the equivalent of `loc` for a given node or token. - * @param syntaxElement The node or token to get the location for. - * @returns The location of the node or token. - */ - getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation; - /** - * Retrieves the equivalent of `range` for a given node or token. - * @param syntaxElement The node or token to get the range for. - * @returns The range of the node or token. - */ - getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange; - /** - * Traversal of AST. - */ - traverse(): Iterable; - /** - * Applies language options passed in from the ESLint core. - */ - applyLanguageOptions?(languageOptions: Options["LangOptions"]): void; - /** - * Return all of the inline areas where ESLint should be disabled/enabled - * along with any problems found in evaluating the directives. - */ - getDisableDirectives?(): { - directives: Directive[]; - problems: FileProblem[]; - }; - /** - * Returns an array of all inline configuration nodes found in the - * source code. - */ - getInlineConfigNodes?(): Options["ConfigNode"][]; - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - */ - applyInlineConfig?(): { - configs: InlineConfigElement[]; - problems: FileProblem[]; - }; - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize?(): void; -} -/** - * Represents the source of a text file being linted. - */ -export interface TextSourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - text: string; -} -/** - * Represents the source of a binary file being linted. - */ -export interface BinarySourceCode extends SourceCodeBase { - /** - * The body of the file that you'd like rule developers to access. - */ - body: Uint8Array; -} -export type SourceCode = TextSourceCode | BinarySourceCode; -/** - * Represents a traversal step visiting the AST. - */ -export interface VisitTraversalStep { - kind: 1; - target: unknown; - phase: 1 | 2; - args: unknown[]; -} -/** - * Represents a traversal step calling a function. - */ -export interface CallTraversalStep { - kind: 2; - target: string; - phase?: string; - args: unknown[]; -} -export type TraversalStep = VisitTraversalStep | CallTraversalStep; -/** - * The type of disable directive. This determines how ESLint will disable rules. - */ -export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line"; -/** - * Represents a disable directive. - */ -export interface Directive { - /** - * The type of directive. - */ - type: DirectiveType; - /** - * The node of the directive. May be in the AST or a comment/token. - */ - node: unknown; - /** - * The value of the directive. - */ - value: string; - /** - * The justification for the directive. - */ - justification?: string; -} -export {}; diff --git a/node_modules/@eslint/core/package.json b/node_modules/@eslint/core/package.json deleted file mode 100644 index 797e3a6..0000000 --- a/node_modules/@eslint/core/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@eslint/core", - "version": "0.9.0", - "description": "Runtime-agnostic core of ESLint", - "type": "module", - "types": "./dist/esm/types.d.ts", - "exports": { - "types": { - "import": "./dist/esm/types.d.ts", - "require": "./dist/cjs/types.d.cts" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "scripts": { - "build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"", - "build": "tsc && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/rewrite.git" - }, - "keywords": [ - "eslint", - "core" - ], - "author": "Nicholas C. Zakas", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/eslint/rewrite/issues" - }, - "homepage": "https://github.com/eslint/rewrite#readme", - "devDependencies": { - "json-schema": "^0.4.0", - "typescript": "^5.4.5" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/@eslint/eslintrc/LICENSE b/node_modules/@eslint/eslintrc/LICENSE deleted file mode 100644 index b607bb3..0000000 --- a/node_modules/@eslint/eslintrc/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index cdcf0a6..0000000 --- a/node_modules/@eslint/eslintrc/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# ESLintRC Library - -This repository contains the legacy ESLintRC configuration file format for ESLint. This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs. - -**Note:** This package is frozen except for critical bug fixes as ESLint moves to a new config system. - -## Installation - -You can install the package as follows: - -``` -npm install @eslint/eslintrc --save-dev - -# or - -yarn add @eslint/eslintrc -D -``` - -## Usage (ESM) - -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"; -import js from "@eslint/js"; -import path from "path"; -import { fileURLToPath } from "url"; - -// mimic CommonJS variables -- not needed if using CommonJS -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -const compat = new FlatCompat({ - baseDirectory: __dirname, // optional; default: process.cwd() - resolvePluginsRelativeTo: __dirname, // optional - recommendedConfig: js.configs.recommended, // optional unless you're using "eslint:recommended" - allConfig: js.configs.all, // optional unless you're using "eslint:all" -}); - -export default [ - - // mimic ESLintRC-style extends - ...compat.extends("standard", "example", "plugin:react/recommended"), - - // mimic environments - ...compat.env({ - es2020: true, - node: true - }), - - // mimic plugins - ...compat.plugins("jsx-a11y", "react"), - - // translate an entire config - ...compat.config({ - plugins: ["jsx-a11y", "react"], - extends: "standard", - env: { - es2020: true, - node: true - }, - rules: { - semi: "error" - } - }) -]; -``` - -## Usage (CommonJS) - -Using `FlatCompat` in CommonJS files is similar to ESM, but you'll use `require()` and `module.exports` instead of `import` and `export`. Here's how you use it inside of your `eslint.config.js` CommonJS file: - -```js -const { FlatCompat } = require("@eslint/eslintrc"); -const js = require("@eslint/js"); - -const compat = new FlatCompat({ - baseDirectory: __dirname, // optional; default: process.cwd() - resolvePluginsRelativeTo: __dirname, // optional - recommendedConfig: js.configs.recommended, // optional unless using "eslint:recommended" - allConfig: js.configs.all, // optional unless using "eslint:all" -}); - -module.exports = [ - - // mimic ESLintRC-style extends - ...compat.extends("standard", "example", "plugin:react/recommended"), - - // mimic environments - ...compat.env({ - es2020: true, - node: true - }), - - // mimic plugins - ...compat.plugins("jsx-a11y", "react"), - - // translate an entire config - ...compat.config({ - plugins: ["jsx-a11y", "react"], - extends: "standard", - env: { - es2020: true, - node: true - }, - rules: { - semi: "error" - } - }) -]; -``` - -## Troubleshooting - -**TypeError: Missing parameter 'recommendedConfig' in FlatCompat constructor** - -The `recommendedConfig` option is required when any config uses `eslint:recommended`, including any config in an `extends` clause. To fix this, follow the example above using `@eslint/js` to provide the `eslint:recommended` config. - -**TypeError: Missing parameter 'allConfig' in FlatCompat constructor** - -The `allConfig` option is required when any config uses `eslint:all`, including any config in an `extends` clause. To fix this, follow the example above using `@eslint/js` to provide the `eslint:all` config. - - -## License - -MIT License diff --git a/node_modules/@eslint/eslintrc/conf/config-schema.js b/node_modules/@eslint/eslintrc/conf/config-schema.js deleted file mode 100644 index ada90e1..0000000 --- a/node_modules/@eslint/eslintrc/conf/config-schema.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @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 deleted file mode 100644 index 50d1b1d..0000000 --- a/node_modules/@eslint/eslintrc/conf/environments.js +++ /dev/null @@ -1,215 +0,0 @@ -/** - * @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 - } - }, - es2023: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 14 - } - }, - es2024: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 15 - } - }, - - // 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 deleted file mode 100644 index c0414cf..0000000 --- a/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +++ /dev/null @@ -1,1203 +0,0 @@ -'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 Applies default rule options - * @author JoshuaKGoldberg - */ - -/** - * Check if the variable contains an object strictly rejecting arrays - * @param {unknown} value an object - * @returns {boolean} Whether value is an object - */ -function isObjectNotArray(value) { - return typeof value === "object" && value !== null && !Array.isArray(value); -} - -/** - * Deeply merges second on top of first, creating a new {} object if needed. - * @param {T} first Base, default value. - * @param {U} second User-specified value. - * @returns {T | U | (T & U)} Merged equivalent of second on top of first. - */ -function deepMergeObjects(first, second) { - if (second === void 0) { - return first; - } - - if (!isObjectNotArray(first) || !isObjectNotArray(second)) { - return second; - } - - const result = { ...first, ...second }; - - for (const key of Object.keys(second)) { - if (Object.prototype.propertyIsEnumerable.call(first, key)) { - result[key] = deepMergeObjects(first[key], second[key]); - } - } - - return result; -} - -/** - * Deeply merges second on top of first, creating a new [] array if needed. - * @param {T[] | undefined} first Base, default values. - * @param {U[] | undefined} second User-specified values. - * @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first. - */ -function deepMergeArrays(first, second) { - if (!first || !second) { - return second || first || []; - } - - return [ - ...first.map((value, i) => deepMergeObjects(value, second[i])), - ...second.slice(first.length) - ]; -} - -/** - * @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 - } - }, - es2023: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 14 - } - }, - es2024: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 15 - } - }, - - // 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(); - -// JSON schema that disallows passing any options -const noOptionsSchema = Object.freeze({ - type: "array", - minItems: 0, - maxItems: 0 -}); - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -class ConfigValidator { - constructor({ builtInRules = new Map() } = {}) { - this.builtInRules = builtInRules; - } - - /** - * Gets a complete options schema for a rule. - * @param {Rule} rule A rule object - * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`. - * @returns {Object|null} JSON Schema for the rule's options. - * `null` if rule wasn't passed or its `meta.schema` is `false`. - */ - getRuleOptionsSchema(rule) { - if (!rule) { - return null; - } - - if (!rule.meta) { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - const schema = rule.meta.schema; - - if (typeof schema === "undefined") { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - // `schema:false` is an allowed explicit opt-out of options validation for the rule - if (schema === false) { - return null; - } - - if (typeof schema !== "object" || schema === null) { - throw new TypeError("Rule's `meta.schema` must be an array or object"); - } - - // ESLint-specific array form needs to be converted into a valid JSON Schema definition - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - - // `schema:[]` is an explicit way to specify that the rule does not accept any options - return { ...noOptionsSchema }; - } - - // `schema:` is assumed to be a valid JSON Schema definition - return schema; - } - - /** - * 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)) { - try { - const schema = this.getRuleOptionsSchema(rule); - - if (schema) { - ruleValidators.set(rule, ajv.compile(schema)); - } - } catch (err) { - const errorWithCode = new Error(err.message, { cause: err }); - - errorWithCode.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"; - - throw errorWithCode; - } - } - - const validateRule = ruleValidators.get(rule); - - if (validateRule) { - const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions); - - validateRule(mergedOptions); - - 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) { - let enhancedMessage = err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA" - ? `Error while processing options validation schema of rule '${ruleId}': ${err.message}` - : `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; - - if (typeof source === "string") { - enhancedMessage = `${source}:\n\t${enhancedMessage}`; - } - - const enhancedError = new Error(enhancedMessage, { cause: err }); - - if (err.code) { - enhancedError.code = err.code; - } - - throw enhancedError; - } - } - - /** - * 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 deleted file mode 100644 index c1c8499..0000000 --- a/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"eslintrc-universal.cjs","sources":["../lib/shared/config-ops.js","../lib/shared/deprecation-warnings.js","../lib/shared/ajv.js","../lib/shared/deep-merge-arrays.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 Applies default rule options\n * @author JoshuaKGoldberg\n */\n\n/**\n * Check if the variable contains an object strictly rejecting arrays\n * @param {unknown} value an object\n * @returns {boolean} Whether value is an object\n */\nfunction isObjectNotArray(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Deeply merges second on top of first, creating a new {} object if needed.\n * @param {T} first Base, default value.\n * @param {U} second User-specified value.\n * @returns {T | U | (T & U)} Merged equivalent of second on top of first.\n */\nfunction deepMergeObjects(first, second) {\n if (second === void 0) {\n return first;\n }\n\n if (!isObjectNotArray(first) || !isObjectNotArray(second)) {\n return second;\n }\n\n const result = { ...first, ...second };\n\n for (const key of Object.keys(second)) {\n if (Object.prototype.propertyIsEnumerable.call(first, key)) {\n result[key] = deepMergeObjects(first[key], second[key]);\n }\n }\n\n return result;\n}\n\n/**\n * Deeply merges second on top of first, creating a new [] array if needed.\n * @param {T[] | undefined} first Base, default values.\n * @param {U[] | undefined} second User-specified values.\n * @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first.\n */\nfunction deepMergeArrays(first, second) {\n if (!first || !second) {\n return second || first || [];\n }\n\n return [\n ...first.map((value, i) => deepMergeObjects(value, second[i])),\n ...second.slice(first.length)\n ];\n}\n\nexport { deepMergeArrays };\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 es2023: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 14\n }\n },\n es2024: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 15\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// Typedefs\n//------------------------------------------------------------------------------\n\n/** @typedef {import(\"../shared/types\").Rule} Rule */\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 { deepMergeArrays } from \"./deep-merge-arrays.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// JSON schema that disallows passing any options\nconst noOptionsSchema = Object.freeze({\n type: \"array\",\n minItems: 0,\n maxItems: 0\n});\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 {Rule} rule A rule object\n * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.\n * @returns {Object|null} JSON Schema for the rule's options.\n * `null` if rule wasn't passed or its `meta.schema` is `false`.\n */\n getRuleOptionsSchema(rule) {\n if (!rule) {\n return null;\n }\n\n if (!rule.meta) {\n return { ...noOptionsSchema }; // default if `meta.schema` is not specified\n }\n\n const schema = rule.meta.schema;\n\n if (typeof schema === \"undefined\") {\n return { ...noOptionsSchema }; // default if `meta.schema` is not specified\n }\n\n // `schema:false` is an allowed explicit opt-out of options validation for the rule\n if (schema === false) {\n return null;\n }\n\n if (typeof schema !== \"object\" || schema === null) {\n throw new TypeError(\"Rule's `meta.schema` must be an array or object\");\n }\n\n // ESLint-specific array form needs to be converted into a valid JSON Schema definition\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\n // `schema:[]` is an explicit way to specify that the rule does not accept any options\n return { ...noOptionsSchema };\n }\n\n // `schema:` is assumed to be a valid JSON Schema definition\n return schema;\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 try {\n const schema = this.getRuleOptionsSchema(rule);\n\n if (schema) {\n ruleValidators.set(rule, ajv.compile(schema));\n }\n } catch (err) {\n const errorWithCode = new Error(err.message, { cause: err });\n\n errorWithCode.code = \"ESLINT_INVALID_RULE_OPTIONS_SCHEMA\";\n\n throw errorWithCode;\n }\n }\n\n const validateRule = ruleValidators.get(rule);\n\n if (validateRule) {\n const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions);\n\n validateRule(mergedOptions);\n\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 let enhancedMessage = err.code === \"ESLINT_INVALID_RULE_OPTIONS_SCHEMA\"\n ? `Error while processing options validation schema of rule '${ruleId}': ${err.message}`\n : `Configuration for rule \"${ruleId}\" is invalid:\\n${err.message}`;\n\n if (typeof source === \"string\") {\n enhancedMessage = `${source}:\\n\\t${enhancedMessage}`;\n }\n\n const enhancedError = new Error(enhancedMessage, { cause: err });\n\n if (err.code) {\n enhancedError.code = err.code;\n }\n\n throw enhancedError;\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,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;AACjF;AACA,IAAI,IAAI,aAAa,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,EAAE;AAC3E,QAAQ,OAAO,aAAa,CAAC;AAC7B,KAAK;AACL;AACA,IAAI,IAAI,OAAO,aAAa,KAAK,QAAQ,E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AK,MAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;AAClD,QAAQ,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjD,KAAK;AACL;AACA,IAAI,OAAO,QAAQ,CAAC;AACpB,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,IAAI,EAAE;AACpC,IAAI,MAAM,KAAK,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 deleted file mode 100644 index 756320f..0000000 --- a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +++ /dev/null @@ -1,4431 +0,0 @@ -'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. - * @returns {void} - */ -function collect(pluginId, defs, map) { - if (defs) { - const prefix = pluginId && `${pluginId}/`; - - for (const [key, value] of Object.entries(defs)) { - map.set(`${prefix}${key}`, value); - } - } -} - -/** - * 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); - } - } - - 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 {T} [data.original] The original, non-normalized 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, - original = null, - error = null, - filePath = null, - id, - importerName, - importerPath - }) { - - /** - * The loaded dependency if the loading succeeded. - * @type {T|null} - */ - this.definition = definition; - - /** - * The original dependency as loaded directly from disk if the loading succeeded. - * @type {T|null} - */ - this.original = original; - - /** - * 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: _ignore1, // eslint-disable-line no-unused-vars - original: _ignore2, // 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 Applies default rule options - * @author JoshuaKGoldberg - */ - -/** - * Check if the variable contains an object strictly rejecting arrays - * @param {unknown} value an object - * @returns {boolean} Whether value is an object - */ -function isObjectNotArray(value) { - return typeof value === "object" && value !== null && !Array.isArray(value); -} - -/** - * Deeply merges second on top of first, creating a new {} object if needed. - * @param {T} first Base, default value. - * @param {U} second User-specified value. - * @returns {T | U | (T & U)} Merged equivalent of second on top of first. - */ -function deepMergeObjects(first, second) { - if (second === void 0) { - return first; - } - - if (!isObjectNotArray(first) || !isObjectNotArray(second)) { - return second; - } - - const result = { ...first, ...second }; - - for (const key of Object.keys(second)) { - if (Object.prototype.propertyIsEnumerable.call(first, key)) { - result[key] = deepMergeObjects(first[key], second[key]); - } - } - - return result; -} - -/** - * Deeply merges second on top of first, creating a new [] array if needed. - * @param {T[] | undefined} first Base, default values. - * @param {U[] | undefined} second User-specified values. - * @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first. - */ -function deepMergeArrays(first, second) { - if (!first || !second) { - return second || first || []; - } - - return [ - ...first.map((value, i) => deepMergeObjects(value, second[i])), - ...second.slice(first.length) - ]; -} - -/** - * @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 - } - }, - es2023: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 14 - } - }, - es2024: { - globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, - parserOptions: { - ecmaVersion: 15 - } - }, - - // 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(); - -// JSON schema that disallows passing any options -const noOptionsSchema = Object.freeze({ - type: "array", - minItems: 0, - maxItems: 0 -}); - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -class ConfigValidator { - constructor({ builtInRules = new Map() } = {}) { - this.builtInRules = builtInRules; - } - - /** - * Gets a complete options schema for a rule. - * @param {Rule} rule A rule object - * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`. - * @returns {Object|null} JSON Schema for the rule's options. - * `null` if rule wasn't passed or its `meta.schema` is `false`. - */ - getRuleOptionsSchema(rule) { - if (!rule) { - return null; - } - - if (!rule.meta) { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - const schema = rule.meta.schema; - - if (typeof schema === "undefined") { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - // `schema:false` is an allowed explicit opt-out of options validation for the rule - if (schema === false) { - return null; - } - - if (typeof schema !== "object" || schema === null) { - throw new TypeError("Rule's `meta.schema` must be an array or object"); - } - - // ESLint-specific array form needs to be converted into a valid JSON Schema definition - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - - // `schema:[]` is an explicit way to specify that the rule does not accept any options - return { ...noOptionsSchema }; - } - - // `schema:` is assumed to be a valid JSON Schema definition - return schema; - } - - /** - * 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)) { - try { - const schema = this.getRuleOptionsSchema(rule); - - if (schema) { - ruleValidators.set(rule, ajv.compile(schema)); - } - } catch (err) { - const errorWithCode = new Error(err.message, { cause: err }); - - errorWithCode.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"; - - throw errorWithCode; - } - } - - const validateRule = ruleValidators.get(rule); - - if (validateRule) { - const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions); - - validateRule(mergedOptions); - - 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) { - let enhancedMessage = err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA" - ? `Error while processing options validation schema of rule '${ruleId}': ${err.message}` - : `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; - - if (typeof source === "string") { - enhancedMessage = `${source}:\n\t${enhancedMessage}`; - } - - const enhancedError = new Error(enhancedMessage, { cause: err }); - - if (err.code) { - enhancedError.code = err.code; - } - - throw enhancedError; - } - } - - /** - * 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(); - -/** @type {WeakMap} */ -const normalizedPlugins = 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) { - - // first check the cache - let normalizedPlugin = normalizedPlugins.get(plugin); - - if (normalizedPlugin) { - return normalizedPlugin; - } - - normalizedPlugin = { - configs: plugin.configs || {}, - environments: plugin.environments || {}, - processors: plugin.processors || {}, - rules: plugin.rules || {} - }; - - // save the reference for later - normalizedPlugins.set(plugin, normalizedPlugin); - - return normalizedPlugin; -} - -//------------------------------------------------------------------------------ -// 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), - original: 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), - original: 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 - }), - 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"]; - - // 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 { original: 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({ - criteria: eslintrcConfig.criteria, - ...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({ - criteria: eslintrcConfig.criteria, - ...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, - recommendedConfig, - allConfig - } = {}) { - this.baseDirectory = baseDirectory; - this.resolvePluginsRelativeTo = resolvePluginsRelativeTo; - this[cafactory] = new ConfigArrayFactory({ - cwd: baseDirectory, - resolvePluginsRelativeTo, - getEslintAllConfig: () => { - - if (!allConfig) { - throw new TypeError("Missing parameter 'allConfig' in FlatCompat constructor."); - } - - return allConfig; - }, - getEslintRecommendedConfig: () => { - - if (!recommendedConfig) { - throw new TypeError("Missing parameter 'recommendedConfig' in FlatCompat constructor."); - } - - return recommendedConfig; - } - }); - } - - /** - * 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[]} An array of flag-config objects 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[]} An array of flag-config objects 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[]} An array of flag-config objects 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, - loadConfigFile, - - // 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 deleted file mode 100644 index e789320..0000000 --- a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"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","../lib/shared/deep-merge-arrays.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 * @returns {void}\n */\nfunction collect(pluginId, defs, map) {\n if (defs) {\n const prefix = pluginId && `${pluginId}/`;\n\n for (const [key, value] of Object.entries(defs)) {\n map.set(`${prefix}${key}`, value);\n }\n }\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);\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 {T} [data.original] The original, non-normalized 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 original = 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 original dependency as loaded directly from disk if the loading succeeded.\n * @type {T|null}\n */\n this.original = original;\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: _ignore1, // eslint-disable-line no-unused-vars\n original: _ignore2, // 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 Applies default rule options\n * @author JoshuaKGoldberg\n */\n\n/**\n * Check if the variable contains an object strictly rejecting arrays\n * @param {unknown} value an object\n * @returns {boolean} Whether value is an object\n */\nfunction isObjectNotArray(value) {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Deeply merges second on top of first, creating a new {} object if needed.\n * @param {T} first Base, default value.\n * @param {U} second User-specified value.\n * @returns {T | U | (T & U)} Merged equivalent of second on top of first.\n */\nfunction deepMergeObjects(first, second) {\n if (second === void 0) {\n return first;\n }\n\n if (!isObjectNotArray(first) || !isObjectNotArray(second)) {\n return second;\n }\n\n const result = { ...first, ...second };\n\n for (const key of Object.keys(second)) {\n if (Object.prototype.propertyIsEnumerable.call(first, key)) {\n result[key] = deepMergeObjects(first[key], second[key]);\n }\n }\n\n return result;\n}\n\n/**\n * Deeply merges second on top of first, creating a new [] array if needed.\n * @param {T[] | undefined} first Base, default values.\n * @param {U[] | undefined} second User-specified values.\n * @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first.\n */\nfunction deepMergeArrays(first, second) {\n if (!first || !second) {\n return second || first || [];\n }\n\n return [\n ...first.map((value, i) => deepMergeObjects(value, second[i])),\n ...second.slice(first.length)\n ];\n}\n\nexport { deepMergeArrays };\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 es2023: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 14\n }\n },\n es2024: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 15\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// Typedefs\n//------------------------------------------------------------------------------\n\n/** @typedef {import(\"../shared/types\").Rule} Rule */\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 { deepMergeArrays } from \"./deep-merge-arrays.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// JSON schema that disallows passing any options\nconst noOptionsSchema = Object.freeze({\n type: \"array\",\n minItems: 0,\n maxItems: 0\n});\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 {Rule} rule A rule object\n * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`.\n * @returns {Object|null} JSON Schema for the rule's options.\n * `null` if rule wasn't passed or its `meta.schema` is `false`.\n */\n getRuleOptionsSchema(rule) {\n if (!rule) {\n return null;\n }\n\n if (!rule.meta) {\n return { ...noOptionsSchema }; // default if `meta.schema` is not specified\n }\n\n const schema = rule.meta.schema;\n\n if (typeof schema === \"undefined\") {\n return { ...noOptionsSchema }; // default if `meta.schema` is not specified\n }\n\n // `schema:false` is an allowed explicit opt-out of options validation for the rule\n if (schema === false) {\n return null;\n }\n\n if (typeof schema !== \"object\" || schema === null) {\n throw new TypeError(\"Rule's `meta.schema` must be an array or object\");\n }\n\n // ESLint-specific array form needs to be converted into a valid JSON Schema definition\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\n // `schema:[]` is an explicit way to specify that the rule does not accept any options\n return { ...noOptionsSchema };\n }\n\n // `schema:` is assumed to be a valid JSON Schema definition\n return schema;\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 try {\n const schema = this.getRuleOptionsSchema(rule);\n\n if (schema) {\n ruleValidators.set(rule, ajv.compile(schema));\n }\n } catch (err) {\n const errorWithCode = new Error(err.message, { cause: err });\n\n errorWithCode.code = \"ESLINT_INVALID_RULE_OPTIONS_SCHEMA\";\n\n throw errorWithCode;\n }\n }\n\n const validateRule = ruleValidators.get(rule);\n\n if (validateRule) {\n const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions);\n\n validateRule(mergedOptions);\n\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 let enhancedMessage = err.code === \"ESLINT_INVALID_RULE_OPTIONS_SCHEMA\"\n ? `Error while processing options validation schema of rule '${ruleId}': ${err.message}`\n : `Configuration for rule \"${ruleId}\" is invalid:\\n${err.message}`;\n\n if (typeof source === \"string\") {\n enhancedMessage = `${source}:\\n\\t${enhancedMessage}`;\n }\n\n const enhancedError = new Error(enhancedMessage, { cause: err });\n\n if (err.code) {\n enhancedError.code = err.code;\n }\n\n throw enhancedError;\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/** @type {WeakMap} */\nconst normalizedPlugins = 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\n // first check the cache\n let normalizedPlugin = normalizedPlugins.get(plugin);\n\n if (normalizedPlugin) {\n return normalizedPlugin;\n }\n\n normalizedPlugin = {\n configs: plugin.configs || {},\n environments: plugin.environments || {},\n processors: plugin.processors || {},\n rules: plugin.rules || {}\n };\n\n // save the reference for later\n normalizedPlugins.set(plugin, normalizedPlugin);\n\n return normalizedPlugin;\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 original: 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 original: 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 {\n ConfigArrayFactory,\n createContext,\n loadConfigFile\n};\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 }),\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 // 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 { original: 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({\n criteria: eslintrcConfig.criteria,\n ...environments.get(envName)\n }, {\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({\n criteria: eslintrcConfig.criteria,\n ...pluginEnvironments.get(envName)\n }, {\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 recommendedConfig,\n allConfig\n } = {}) {\n this.baseDirectory = baseDirectory;\n this.resolvePluginsRelativeTo = resolvePluginsRelativeTo;\n this[cafactory] = new ConfigArrayFactory({\n cwd: baseDirectory,\n resolvePluginsRelativeTo,\n getEslintAllConfig: () => {\n\n if (!allConfig) {\n throw new TypeError(\"Missing parameter 'allConfig' in FlatCompat constructor.\");\n }\n\n return allConfig;\n },\n getEslintRecommendedConfig: () => {\n\n if (!recommendedConfig) {\n throw new TypeError(\"Missing parameter 'recommendedConfig' in FlatCompat constructor.\");\n }\n\n return recommendedConfig;\n }\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[]} An array of flag-config objects 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[]} An array of flag-config objects 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[]} An array of flag-config objects 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 loadConfigFile\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 loadConfigFile,\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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AAC/B,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,cAAc;AAClB,IAAI,uBAAuB;AAC3B,IAAI,YAAY;AAChB,IAAI,cAAc;AAClB;AACA;AACA,IAAI,SAAS;AACb,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,MAAM;AACV;;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js b/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js deleted file mode 100644 index 597352e..0000000 --- a/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +++ /dev/null @@ -1,532 +0,0 @@ -/** - * @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 - }), - 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 deleted file mode 100644 index e4b18eb..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array-factory.js +++ /dev/null @@ -1,1155 +0,0 @@ -/** - * @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(); - -/** @type {WeakMap} */ -const normalizedPlugins = 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) { - - // first check the cache - let normalizedPlugin = normalizedPlugins.get(plugin); - - if (normalizedPlugin) { - return normalizedPlugin; - } - - normalizedPlugin = { - configs: plugin.configs || {}, - environments: plugin.environments || {}, - processors: plugin.processors || {}, - rules: plugin.rules || {} - }; - - // save the reference for later - normalizedPlugins.set(plugin, normalizedPlugin); - - return normalizedPlugin; -} - -//------------------------------------------------------------------------------ -// 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), - original: 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), - original: 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, - loadConfigFile -}; diff --git a/node_modules/@eslint/eslintrc/lib/config-array/config-array.js b/node_modules/@eslint/eslintrc/lib/config-array/config-array.js deleted file mode 100644 index 5766fc4..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +++ /dev/null @@ -1,510 +0,0 @@ -/** - * @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. - * @returns {void} - */ -function collect(pluginId, defs, map) { - if (defs) { - const prefix = pluginId && `${pluginId}/`; - - for (const [key, value] of Object.entries(defs)) { - map.set(`${prefix}${key}`, value); - } - } -} - -/** - * 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); - } - } - - 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 deleted file mode 100644 index 080e640..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @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 {T} [data.original] The original, non-normalized 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, - original = null, - error = null, - filePath = null, - id, - importerName, - importerPath - }) { - - /** - * The loaded dependency if the loading succeeded. - * @type {T|null} - */ - this.definition = definition; - - /** - * The original dependency as loaded directly from disk if the loading succeeded. - * @type {T|null} - */ - this.original = original; - - /** - * 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: _ignore1, // eslint-disable-line no-unused-vars - original: _ignore2, // 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 deleted file mode 100644 index e93b0b6..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +++ /dev/null @@ -1,145 +0,0 @@ -/** - * @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 deleted file mode 100644 index 3022ba9..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +++ /dev/null @@ -1,238 +0,0 @@ -/** - * @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 deleted file mode 100644 index 647f02b..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array/index.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @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 deleted file mode 100644 index 460aafc..0000000 --- a/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +++ /dev/null @@ -1,225 +0,0 @@ -/** - * @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 deleted file mode 100644 index 6c307a9..0000000 --- a/node_modules/@eslint/eslintrc/lib/flat-compat.js +++ /dev/null @@ -1,318 +0,0 @@ -/** - * @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"]; - - // 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 { original: 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({ - criteria: eslintrcConfig.criteria, - ...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({ - criteria: eslintrcConfig.criteria, - ...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, - recommendedConfig, - allConfig - } = {}) { - this.baseDirectory = baseDirectory; - this.resolvePluginsRelativeTo = resolvePluginsRelativeTo; - this[cafactory] = new ConfigArrayFactory({ - cwd: baseDirectory, - resolvePluginsRelativeTo, - getEslintAllConfig: () => { - - if (!allConfig) { - throw new TypeError("Missing parameter 'allConfig' in FlatCompat constructor."); - } - - return allConfig; - }, - getEslintRecommendedConfig: () => { - - if (!recommendedConfig) { - throw new TypeError("Missing parameter 'recommendedConfig' in FlatCompat constructor."); - } - - return recommendedConfig; - } - }); - } - - /** - * 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[]} An array of flag-config objects 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[]} An array of flag-config objects 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[]} An array of flag-config objects 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 deleted file mode 100644 index 6f6b302..0000000 --- a/node_modules/@eslint/eslintrc/lib/index-universal.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @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 deleted file mode 100644 index a37e574..0000000 --- a/node_modules/@eslint/eslintrc/lib/index.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Package exports for @eslint/eslintrc - * @author Nicholas C. Zakas - */ -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -import { - ConfigArrayFactory, - createContext as createConfigArrayFactoryContext, - loadConfigFile -} 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, - loadConfigFile, - - // 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 deleted file mode 100644 index b79ad36..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/ajv.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @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 deleted file mode 100644 index d203be0..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @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 deleted file mode 100644 index 0829bf9..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +++ /dev/null @@ -1,374 +0,0 @@ -/** - * @fileoverview Validates configs. - * @author Brandon Mills - */ - -/* eslint class-methods-use-this: "off" */ - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").Rule} Rule */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -import util from "util"; -import * as ConfigOps from "./config-ops.js"; -import { emitDeprecationWarning } from "./deprecation-warnings.js"; -import ajvOrig from "./ajv.js"; -import { deepMergeArrays } from "./deep-merge-arrays.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(); - -// JSON schema that disallows passing any options -const noOptionsSchema = Object.freeze({ - type: "array", - minItems: 0, - maxItems: 0 -}); - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -export default class ConfigValidator { - constructor({ builtInRules = new Map() } = {}) { - this.builtInRules = builtInRules; - } - - /** - * Gets a complete options schema for a rule. - * @param {Rule} rule A rule object - * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`. - * @returns {Object|null} JSON Schema for the rule's options. - * `null` if rule wasn't passed or its `meta.schema` is `false`. - */ - getRuleOptionsSchema(rule) { - if (!rule) { - return null; - } - - if (!rule.meta) { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - const schema = rule.meta.schema; - - if (typeof schema === "undefined") { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - // `schema:false` is an allowed explicit opt-out of options validation for the rule - if (schema === false) { - return null; - } - - if (typeof schema !== "object" || schema === null) { - throw new TypeError("Rule's `meta.schema` must be an array or object"); - } - - // ESLint-specific array form needs to be converted into a valid JSON Schema definition - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - - // `schema:[]` is an explicit way to specify that the rule does not accept any options - return { ...noOptionsSchema }; - } - - // `schema:` is assumed to be a valid JSON Schema definition - return schema; - } - - /** - * 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)) { - try { - const schema = this.getRuleOptionsSchema(rule); - - if (schema) { - ruleValidators.set(rule, ajv.compile(schema)); - } - } catch (err) { - const errorWithCode = new Error(err.message, { cause: err }); - - errorWithCode.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"; - - throw errorWithCode; - } - } - - const validateRule = ruleValidators.get(rule); - - if (validateRule) { - const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, localOptions); - - validateRule(mergedOptions); - - 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) { - let enhancedMessage = err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA" - ? `Error while processing options validation schema of rule '${ruleId}': ${err.message}` - : `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; - - if (typeof source === "string") { - enhancedMessage = `${source}:\n\t${enhancedMessage}`; - } - - const enhancedError = new Error(enhancedMessage, { cause: err }); - - if (err.code) { - enhancedError.code = err.code; - } - - throw enhancedError; - } - } - - /** - * 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/deep-merge-arrays.js b/node_modules/@eslint/eslintrc/lib/shared/deep-merge-arrays.js deleted file mode 100644 index 0c7ec34..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/deep-merge-arrays.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Applies default rule options - * @author JoshuaKGoldberg - */ - -/** - * Check if the variable contains an object strictly rejecting arrays - * @param {unknown} value an object - * @returns {boolean} Whether value is an object - */ -function isObjectNotArray(value) { - return typeof value === "object" && value !== null && !Array.isArray(value); -} - -/** - * Deeply merges second on top of first, creating a new {} object if needed. - * @param {T} first Base, default value. - * @param {U} second User-specified value. - * @returns {T | U | (T & U)} Merged equivalent of second on top of first. - */ -function deepMergeObjects(first, second) { - if (second === void 0) { - return first; - } - - if (!isObjectNotArray(first) || !isObjectNotArray(second)) { - return second; - } - - const result = { ...first, ...second }; - - for (const key of Object.keys(second)) { - if (Object.prototype.propertyIsEnumerable.call(first, key)) { - result[key] = deepMergeObjects(first[key], second[key]); - } - } - - return result; -} - -/** - * Deeply merges second on top of first, creating a new [] array if needed. - * @param {T[] | undefined} first Base, default values. - * @param {U[] | undefined} second User-specified values. - * @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first. - */ -function deepMergeArrays(first, second) { - if (!first || !second) { - return second || first || []; - } - - return [ - ...first.map((value, i) => deepMergeObjects(value, second[i])), - ...second.slice(first.length) - ]; -} - -export { deepMergeArrays }; diff --git a/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js b/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js deleted file mode 100644 index 91907b1..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @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 deleted file mode 100644 index 93df5fc..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/naming.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @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 deleted file mode 100644 index 1df0ca8..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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 deleted file mode 100644 index a32c35e..0000000 --- a/node_modules/@eslint/eslintrc/lib/shared/types.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @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/globals/globals.json b/node_modules/@eslint/eslintrc/node_modules/globals/globals.json deleted file mode 100644 index 4e75173..0000000 --- a/node_modules/@eslint/eslintrc/node_modules/globals/globals.json +++ /dev/null @@ -1,1998 +0,0 @@ -{ - "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, - "ClipboardItem": false, - "close": false, - "closed": false, - "CloseEvent": false, - "Comment": false, - "CompositionEvent": false, - "CompressionStream": 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, - "DecompressionStream": 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, - "FormDataEvent": 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, - "MediaStreamConstraints": 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, - "NavigatorUAData": 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, - "ReadableByteStreamController": false, - "ReadableStream": false, - "ReadableStreamBYOBReader": false, - "ReadableStreamBYOBRequest": false, - "ReadableStreamDefaultController": false, - "ReadableStreamDefaultReader": false, - "registerProcessor": false, - "RemotePlayback": false, - "removeEventListener": false, - "reportError": 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, - "SubmitEvent": 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, - "TextDecoderStream": false, - "TextEncoder": false, - "TextEncoderStream": false, - "TextEvent": false, - "TextMetrics": false, - "TextTrack": false, - "TextTrackCue": false, - "TextTrackCueList": false, - "TextTrackList": false, - "TimeRanges": false, - "ToggleEvent": false, - "toolbar": false, - "top": false, - "Touch": false, - "TouchEvent": false, - "TouchList": false, - "TrackEvent": false, - "TransformStream": false, - "TransformStreamDefaultController": 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, - "WritableStreamDefaultController": false, - "WritableStreamDefaultWriter": false, - "XMLDocument": false, - "XMLHttpRequest": false, - "XMLHttpRequestEventTarget": false, - "XMLHttpRequestUpload": false, - "XMLSerializer": false, - "XPathEvaluator": false, - "XPathExpression": false, - "XPathResult": false, - "XRAnchor": false, - "XRBoundedReferenceSpace": false, - "XRCPUDepthInformation": false, - "XRDepthInformation": false, - "XRFrame": false, - "XRInputSource": false, - "XRInputSourceArray": false, - "XRInputSourceEvent": false, - "XRInputSourcesChangeEvent": false, - "XRPose": false, - "XRReferenceSpace": false, - "XRReferenceSpaceEvent": false, - "XRRenderState": false, - "XRRigidTransform": false, - "XRSession": false, - "XRSessionEvent": false, - "XRSpace": false, - "XRSystem": false, - "XRView": false, - "XRViewerPose": false, - "XRViewport": false, - "XRWebGLBinding": false, - "XRWebGLDepthInformation": false, - "XRWebGLLayer": false, - "XSLTProcessor": false - }, - "worker": { - "addEventListener": false, - "applicationCache": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "ByteLengthQueuingStrategy": false, - "Cache": false, - "caches": false, - "clearInterval": false, - "clearTimeout": false, - "close": true, - "CompressionStream": false, - "console": false, - "CountQueuingStrategy": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CustomEvent": false, - "DecompressionStream": false, - "ErrorEvent": false, - "Event": false, - "fetch": false, - "File": 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, - "MessageEvent": 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, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "postMessage": true, - "Promise": false, - "queueMicrotask": false, - "ReadableByteStreamController": false, - "ReadableStream": false, - "ReadableStreamBYOBReader": false, - "ReadableStreamBYOBRequest": false, - "ReadableStreamDefaultController": false, - "ReadableStreamDefaultReader": false, - "removeEventListener": false, - "reportError": false, - "Request": false, - "Response": false, - "self": true, - "ServiceWorkerRegistration": false, - "setInterval": false, - "setTimeout": false, - "SubtleCrypto": false, - "TextDecoder": false, - "TextDecoderStream": false, - "TextEncoder": false, - "TextEncoderStream": false, - "TransformStream": false, - "TransformStreamDefaultController": false, - "URL": false, - "URLSearchParams": false, - "WebAssembly": false, - "WebSocket": false, - "Worker": false, - "WorkerGlobalScope": false, - "WritableStream": false, - "WritableStreamDefaultController": false, - "WritableStreamDefaultWriter": false, - "XMLHttpRequest": false - }, - "node": { - "__dirname": false, - "__filename": false, - "AbortController": false, - "AbortSignal": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "Buffer": false, - "ByteLengthQueuingStrategy": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "CompressionStream": false, - "console": false, - "CountQueuingStrategy": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CustomEvent": false, - "DecompressionStream": false, - "DOMException": false, - "Event": false, - "EventTarget": false, - "exports": true, - "fetch": false, - "File": false, - "FormData": false, - "global": false, - "Headers": false, - "Intl": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "module": false, - "performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformanceResourceTiming": false, - "process": false, - "queueMicrotask": false, - "ReadableByteStreamController": false, - "ReadableStream": false, - "ReadableStreamBYOBReader": false, - "ReadableStreamBYOBRequest": false, - "ReadableStreamDefaultController": false, - "ReadableStreamDefaultReader": false, - "Request": false, - "require": false, - "Response": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false, - "structuredClone": false, - "SubtleCrypto": false, - "TextDecoder": false, - "TextDecoderStream": false, - "TextEncoder": false, - "TextEncoderStream": false, - "TransformStream": false, - "TransformStreamDefaultController": false, - "URL": false, - "URLSearchParams": false, - "WebAssembly": false, - "WritableStream": false, - "WritableStreamDefaultController": false, - "WritableStreamDefaultWriter": false - }, - "nodeBuiltin": { - "AbortController": false, - "AbortSignal": false, - "atob": false, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "Buffer": false, - "ByteLengthQueuingStrategy": false, - "clearImmediate": false, - "clearInterval": false, - "clearTimeout": false, - "CompressionStream": false, - "console": false, - "CountQueuingStrategy": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CustomEvent": false, - "DecompressionStream": false, - "DOMException": false, - "Event": false, - "EventTarget": false, - "fetch": false, - "File": false, - "FormData": false, - "global": false, - "Headers": false, - "Intl": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformanceResourceTiming": false, - "process": false, - "queueMicrotask": false, - "ReadableByteStreamController": false, - "ReadableStream": false, - "ReadableStreamBYOBReader": false, - "ReadableStreamBYOBRequest": false, - "ReadableStreamDefaultController": false, - "ReadableStreamDefaultReader": false, - "Request": false, - "Response": false, - "setImmediate": false, - "setInterval": false, - "setTimeout": false, - "structuredClone": false, - "SubtleCrypto": false, - "TextDecoder": false, - "TextDecoderStream": false, - "TextEncoder": false, - "TextEncoderStream": false, - "TransformStream": false, - "TransformStreamDefaultController": false, - "URL": false, - "URLSearchParams": false, - "WebAssembly": false, - "WritableStream": false, - "WritableStreamDefaultController": false, - "WritableStreamDefaultWriter": 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, - "ByteLengthQueuingStrategy": false, - "Cache": false, - "caches": false, - "CacheStorage": false, - "clearInterval": false, - "clearTimeout": false, - "Client": false, - "clients": false, - "Clients": false, - "close": true, - "CompressionStream": false, - "console": false, - "CountQueuingStrategy": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CustomEvent": false, - "DecompressionStream": false, - "ErrorEvent": false, - "Event": false, - "ExtendableEvent": false, - "ExtendableMessageEvent": false, - "fetch": false, - "FetchEvent": false, - "File": 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, - "MessageEvent": 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, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformanceResourceTiming": false, - "PerformanceTiming": false, - "postMessage": true, - "Promise": false, - "queueMicrotask": false, - "ReadableByteStreamController": false, - "ReadableStream": false, - "ReadableStreamBYOBReader": false, - "ReadableStreamBYOBRequest": false, - "ReadableStreamDefaultController": false, - "ReadableStreamDefaultReader": 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, - "SubtleCrypto": false, - "TextDecoder": false, - "TextDecoderStream": false, - "TextEncoder": false, - "TextEncoderStream": false, - "TransformStream": false, - "TransformStreamDefaultController": false, - "URL": false, - "URLSearchParams": false, - "WebAssembly": false, - "WebSocket": false, - "WindowClient": false, - "Worker": false, - "WorkerGlobalScope": false, - "WritableStream": false, - "WritableStreamDefaultController": false, - "WritableStreamDefaultWriter": 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, - "Blob": false, - "BroadcastChannel": false, - "btoa": false, - "ByteLengthQueuingStrategy": false, - "clearInterval": false, - "clearTimeout": false, - "CompressionStream": false, - "console": false, - "CountQueuingStrategy": false, - "crypto": false, - "Crypto": false, - "CryptoKey": false, - "CustomEvent": false, - "DecompressionStream": false, - "DOMException": false, - "Event": false, - "EventTarget": false, - "fetch": false, - "File": false, - "FormData": false, - "Headers": false, - "Intl": false, - "MessageChannel": false, - "MessageEvent": false, - "MessagePort": false, - "performance": false, - "PerformanceEntry": false, - "PerformanceMark": false, - "PerformanceMeasure": false, - "PerformanceObserver": false, - "PerformanceObserverEntryList": false, - "PerformanceResourceTiming": false, - "queueMicrotask": false, - "ReadableByteStreamController": false, - "ReadableStream": false, - "ReadableStreamBYOBReader": false, - "ReadableStreamBYOBRequest": false, - "ReadableStreamDefaultController": false, - "ReadableStreamDefaultReader": false, - "Request": false, - "Response": false, - "setInterval": false, - "setTimeout": false, - "structuredClone": false, - "SubtleCrypto": false, - "TextDecoder": false, - "TextDecoderStream": false, - "TextEncoder": false, - "TextEncoderStream": false, - "TransformStream": false, - "TransformStreamDefaultController": false, - "URL": false, - "URLSearchParams": false, - "WebAssembly": false, - "WritableStream": false, - "WritableStreamDefaultController": false, - "WritableStreamDefaultWriter": 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/@eslint/eslintrc/node_modules/globals/index.d.ts b/node_modules/@eslint/eslintrc/node_modules/globals/index.d.ts deleted file mode 100644 index edd861f..0000000 --- a/node_modules/@eslint/eslintrc/node_modules/globals/index.d.ts +++ /dev/null @@ -1,2077 +0,0 @@ -// This file is autogenerated by scripts/generate-types.mjs -// Do NOT modify this file manually - -type GlobalsBuiltin = { - readonly 'AggregateError': false; - readonly 'Array': false; - readonly 'ArrayBuffer': false; - readonly 'Atomics': false; - readonly 'BigInt': false; - readonly 'BigInt64Array': false; - readonly 'BigUint64Array': false; - readonly 'Boolean': false; - readonly 'constructor': false; - readonly 'DataView': false; - readonly 'Date': false; - readonly 'decodeURI': false; - readonly 'decodeURIComponent': false; - readonly 'encodeURI': false; - readonly 'encodeURIComponent': false; - readonly 'Error': false; - readonly 'escape': false; - readonly 'eval': false; - readonly 'EvalError': false; - readonly 'FinalizationRegistry': false; - readonly 'Float32Array': false; - readonly 'Float64Array': false; - readonly 'Function': false; - readonly 'globalThis': false; - readonly 'hasOwnProperty': false; - readonly 'Infinity': false; - readonly 'Int16Array': false; - readonly 'Int32Array': false; - readonly 'Int8Array': false; - readonly 'isFinite': false; - readonly 'isNaN': false; - readonly 'isPrototypeOf': false; - readonly 'JSON': false; - readonly 'Map': false; - readonly 'Math': false; - readonly 'NaN': false; - readonly 'Number': false; - readonly 'Object': false; - readonly 'parseFloat': false; - readonly 'parseInt': false; - readonly 'Promise': false; - readonly 'propertyIsEnumerable': false; - readonly 'Proxy': false; - readonly 'RangeError': false; - readonly 'ReferenceError': false; - readonly 'Reflect': false; - readonly 'RegExp': false; - readonly 'Set': false; - readonly 'SharedArrayBuffer': false; - readonly 'String': false; - readonly 'Symbol': false; - readonly 'SyntaxError': false; - readonly 'toLocaleString': false; - readonly 'toString': false; - readonly 'TypeError': false; - readonly 'Uint16Array': false; - readonly 'Uint32Array': false; - readonly 'Uint8Array': false; - readonly 'Uint8ClampedArray': false; - readonly 'undefined': false; - readonly 'unescape': false; - readonly 'URIError': false; - readonly 'valueOf': false; - readonly 'WeakMap': false; - readonly 'WeakRef': false; - readonly 'WeakSet': false; -} - -type GlobalsEs5 = { - readonly 'Array': false; - readonly 'Boolean': false; - readonly 'constructor': false; - readonly 'Date': false; - readonly 'decodeURI': false; - readonly 'decodeURIComponent': false; - readonly 'encodeURI': false; - readonly 'encodeURIComponent': false; - readonly 'Error': false; - readonly 'escape': false; - readonly 'eval': false; - readonly 'EvalError': false; - readonly 'Function': false; - readonly 'hasOwnProperty': false; - readonly 'Infinity': false; - readonly 'isFinite': false; - readonly 'isNaN': false; - readonly 'isPrototypeOf': false; - readonly 'JSON': false; - readonly 'Math': false; - readonly 'NaN': false; - readonly 'Number': false; - readonly 'Object': false; - readonly 'parseFloat': false; - readonly 'parseInt': false; - readonly 'propertyIsEnumerable': false; - readonly 'RangeError': false; - readonly 'ReferenceError': false; - readonly 'RegExp': false; - readonly 'String': false; - readonly 'SyntaxError': false; - readonly 'toLocaleString': false; - readonly 'toString': false; - readonly 'TypeError': false; - readonly 'undefined': false; - readonly 'unescape': false; - readonly 'URIError': false; - readonly 'valueOf': false; -} - -type GlobalsEs2015 = { - readonly 'Array': false; - readonly 'ArrayBuffer': false; - readonly 'Boolean': false; - readonly 'constructor': false; - readonly 'DataView': false; - readonly 'Date': false; - readonly 'decodeURI': false; - readonly 'decodeURIComponent': false; - readonly 'encodeURI': false; - readonly 'encodeURIComponent': false; - readonly 'Error': false; - readonly 'escape': false; - readonly 'eval': false; - readonly 'EvalError': false; - readonly 'Float32Array': false; - readonly 'Float64Array': false; - readonly 'Function': false; - readonly 'hasOwnProperty': false; - readonly 'Infinity': false; - readonly 'Int16Array': false; - readonly 'Int32Array': false; - readonly 'Int8Array': false; - readonly 'isFinite': false; - readonly 'isNaN': false; - readonly 'isPrototypeOf': false; - readonly 'JSON': false; - readonly 'Map': false; - readonly 'Math': false; - readonly 'NaN': false; - readonly 'Number': false; - readonly 'Object': false; - readonly 'parseFloat': false; - readonly 'parseInt': false; - readonly 'Promise': false; - readonly 'propertyIsEnumerable': false; - readonly 'Proxy': false; - readonly 'RangeError': false; - readonly 'ReferenceError': false; - readonly 'Reflect': false; - readonly 'RegExp': false; - readonly 'Set': false; - readonly 'String': false; - readonly 'Symbol': false; - readonly 'SyntaxError': false; - readonly 'toLocaleString': false; - readonly 'toString': false; - readonly 'TypeError': false; - readonly 'Uint16Array': false; - readonly 'Uint32Array': false; - readonly 'Uint8Array': false; - readonly 'Uint8ClampedArray': false; - readonly 'undefined': false; - readonly 'unescape': false; - readonly 'URIError': false; - readonly 'valueOf': false; - readonly 'WeakMap': false; - readonly 'WeakSet': false; -} - -type GlobalsEs2017 = { - readonly 'Array': false; - readonly 'ArrayBuffer': false; - readonly 'Atomics': false; - readonly 'Boolean': false; - readonly 'constructor': false; - readonly 'DataView': false; - readonly 'Date': false; - readonly 'decodeURI': false; - readonly 'decodeURIComponent': false; - readonly 'encodeURI': false; - readonly 'encodeURIComponent': false; - readonly 'Error': false; - readonly 'escape': false; - readonly 'eval': false; - readonly 'EvalError': false; - readonly 'Float32Array': false; - readonly 'Float64Array': false; - readonly 'Function': false; - readonly 'hasOwnProperty': false; - readonly 'Infinity': false; - readonly 'Int16Array': false; - readonly 'Int32Array': false; - readonly 'Int8Array': false; - readonly 'isFinite': false; - readonly 'isNaN': false; - readonly 'isPrototypeOf': false; - readonly 'JSON': false; - readonly 'Map': false; - readonly 'Math': false; - readonly 'NaN': false; - readonly 'Number': false; - readonly 'Object': false; - readonly 'parseFloat': false; - readonly 'parseInt': false; - readonly 'Promise': false; - readonly 'propertyIsEnumerable': false; - readonly 'Proxy': false; - readonly 'RangeError': false; - readonly 'ReferenceError': false; - readonly 'Reflect': false; - readonly 'RegExp': false; - readonly 'Set': false; - readonly 'SharedArrayBuffer': false; - readonly 'String': false; - readonly 'Symbol': false; - readonly 'SyntaxError': false; - readonly 'toLocaleString': false; - readonly 'toString': false; - readonly 'TypeError': false; - readonly 'Uint16Array': false; - readonly 'Uint32Array': false; - readonly 'Uint8Array': false; - readonly 'Uint8ClampedArray': false; - readonly 'undefined': false; - readonly 'unescape': false; - readonly 'URIError': false; - readonly 'valueOf': false; - readonly 'WeakMap': false; - readonly 'WeakSet': false; -} - -type GlobalsEs2020 = { - readonly 'Array': false; - readonly 'ArrayBuffer': false; - readonly 'Atomics': false; - readonly 'BigInt': false; - readonly 'BigInt64Array': false; - readonly 'BigUint64Array': false; - readonly 'Boolean': false; - readonly 'constructor': false; - readonly 'DataView': false; - readonly 'Date': false; - readonly 'decodeURI': false; - readonly 'decodeURIComponent': false; - readonly 'encodeURI': false; - readonly 'encodeURIComponent': false; - readonly 'Error': false; - readonly 'escape': false; - readonly 'eval': false; - readonly 'EvalError': false; - readonly 'Float32Array': false; - readonly 'Float64Array': false; - readonly 'Function': false; - readonly 'globalThis': false; - readonly 'hasOwnProperty': false; - readonly 'Infinity': false; - readonly 'Int16Array': false; - readonly 'Int32Array': false; - readonly 'Int8Array': false; - readonly 'isFinite': false; - readonly 'isNaN': false; - readonly 'isPrototypeOf': false; - readonly 'JSON': false; - readonly 'Map': false; - readonly 'Math': false; - readonly 'NaN': false; - readonly 'Number': false; - readonly 'Object': false; - readonly 'parseFloat': false; - readonly 'parseInt': false; - readonly 'Promise': false; - readonly 'propertyIsEnumerable': false; - readonly 'Proxy': false; - readonly 'RangeError': false; - readonly 'ReferenceError': false; - readonly 'Reflect': false; - readonly 'RegExp': false; - readonly 'Set': false; - readonly 'SharedArrayBuffer': false; - readonly 'String': false; - readonly 'Symbol': false; - readonly 'SyntaxError': false; - readonly 'toLocaleString': false; - readonly 'toString': false; - readonly 'TypeError': false; - readonly 'Uint16Array': false; - readonly 'Uint32Array': false; - readonly 'Uint8Array': false; - readonly 'Uint8ClampedArray': false; - readonly 'undefined': false; - readonly 'unescape': false; - readonly 'URIError': false; - readonly 'valueOf': false; - readonly 'WeakMap': false; - readonly 'WeakSet': false; -} - -type GlobalsEs2021 = { - readonly 'AggregateError': false; - readonly 'Array': false; - readonly 'ArrayBuffer': false; - readonly 'Atomics': false; - readonly 'BigInt': false; - readonly 'BigInt64Array': false; - readonly 'BigUint64Array': false; - readonly 'Boolean': false; - readonly 'constructor': false; - readonly 'DataView': false; - readonly 'Date': false; - readonly 'decodeURI': false; - readonly 'decodeURIComponent': false; - readonly 'encodeURI': false; - readonly 'encodeURIComponent': false; - readonly 'Error': false; - readonly 'escape': false; - readonly 'eval': false; - readonly 'EvalError': false; - readonly 'FinalizationRegistry': false; - readonly 'Float32Array': false; - readonly 'Float64Array': false; - readonly 'Function': false; - readonly 'globalThis': false; - readonly 'hasOwnProperty': false; - readonly 'Infinity': false; - readonly 'Int16Array': false; - readonly 'Int32Array': false; - readonly 'Int8Array': false; - readonly 'isFinite': false; - readonly 'isNaN': false; - readonly 'isPrototypeOf': false; - readonly 'JSON': false; - readonly 'Map': false; - readonly 'Math': false; - readonly 'NaN': false; - readonly 'Number': false; - readonly 'Object': false; - readonly 'parseFloat': false; - readonly 'parseInt': false; - readonly 'Promise': false; - readonly 'propertyIsEnumerable': false; - readonly 'Proxy': false; - readonly 'RangeError': false; - readonly 'ReferenceError': false; - readonly 'Reflect': false; - readonly 'RegExp': false; - readonly 'Set': false; - readonly 'SharedArrayBuffer': false; - readonly 'String': false; - readonly 'Symbol': false; - readonly 'SyntaxError': false; - readonly 'toLocaleString': false; - readonly 'toString': false; - readonly 'TypeError': false; - readonly 'Uint16Array': false; - readonly 'Uint32Array': false; - readonly 'Uint8Array': false; - readonly 'Uint8ClampedArray': false; - readonly 'undefined': false; - readonly 'unescape': false; - readonly 'URIError': false; - readonly 'valueOf': false; - readonly 'WeakMap': false; - readonly 'WeakRef': false; - readonly 'WeakSet': false; -} - -type GlobalsBrowser = { - readonly 'AbortController': false; - readonly 'AbortSignal': false; - readonly 'addEventListener': false; - readonly 'alert': false; - readonly 'AnalyserNode': false; - readonly 'Animation': false; - readonly 'AnimationEffectReadOnly': false; - readonly 'AnimationEffectTiming': false; - readonly 'AnimationEffectTimingReadOnly': false; - readonly 'AnimationEvent': false; - readonly 'AnimationPlaybackEvent': false; - readonly 'AnimationTimeline': false; - readonly 'applicationCache': false; - readonly 'ApplicationCache': false; - readonly 'ApplicationCacheErrorEvent': false; - readonly 'atob': false; - readonly 'Attr': false; - readonly 'Audio': false; - readonly 'AudioBuffer': false; - readonly 'AudioBufferSourceNode': false; - readonly 'AudioContext': false; - readonly 'AudioDestinationNode': false; - readonly 'AudioListener': false; - readonly 'AudioNode': false; - readonly 'AudioParam': false; - readonly 'AudioProcessingEvent': false; - readonly 'AudioScheduledSourceNode': false; - readonly 'AudioWorkletGlobalScope': false; - readonly 'AudioWorkletNode': false; - readonly 'AudioWorkletProcessor': false; - readonly 'BarProp': false; - readonly 'BaseAudioContext': false; - readonly 'BatteryManager': false; - readonly 'BeforeUnloadEvent': false; - readonly 'BiquadFilterNode': false; - readonly 'Blob': false; - readonly 'BlobEvent': false; - readonly 'blur': false; - readonly 'BroadcastChannel': false; - readonly 'btoa': false; - readonly 'BudgetService': false; - readonly 'ByteLengthQueuingStrategy': false; - readonly 'Cache': false; - readonly 'caches': false; - readonly 'CacheStorage': false; - readonly 'cancelAnimationFrame': false; - readonly 'cancelIdleCallback': false; - readonly 'CanvasCaptureMediaStreamTrack': false; - readonly 'CanvasGradient': false; - readonly 'CanvasPattern': false; - readonly 'CanvasRenderingContext2D': false; - readonly 'ChannelMergerNode': false; - readonly 'ChannelSplitterNode': false; - readonly 'CharacterData': false; - readonly 'clearInterval': false; - readonly 'clearTimeout': false; - readonly 'clientInformation': false; - readonly 'ClipboardEvent': false; - readonly 'ClipboardItem': false; - readonly 'close': false; - readonly 'closed': false; - readonly 'CloseEvent': false; - readonly 'Comment': false; - readonly 'CompositionEvent': false; - readonly 'CompressionStream': false; - readonly 'confirm': false; - readonly 'console': false; - readonly 'ConstantSourceNode': false; - readonly 'ConvolverNode': false; - readonly 'CountQueuingStrategy': false; - readonly 'createImageBitmap': false; - readonly 'Credential': false; - readonly 'CredentialsContainer': false; - readonly 'crypto': false; - readonly 'Crypto': false; - readonly 'CryptoKey': false; - readonly 'CSS': false; - readonly 'CSSConditionRule': false; - readonly 'CSSFontFaceRule': false; - readonly 'CSSGroupingRule': false; - readonly 'CSSImportRule': false; - readonly 'CSSKeyframeRule': false; - readonly 'CSSKeyframesRule': false; - readonly 'CSSMatrixComponent': false; - readonly 'CSSMediaRule': false; - readonly 'CSSNamespaceRule': false; - readonly 'CSSPageRule': false; - readonly 'CSSPerspective': false; - readonly 'CSSRotate': false; - readonly 'CSSRule': false; - readonly 'CSSRuleList': false; - readonly 'CSSScale': false; - readonly 'CSSSkew': false; - readonly 'CSSSkewX': false; - readonly 'CSSSkewY': false; - readonly 'CSSStyleDeclaration': false; - readonly 'CSSStyleRule': false; - readonly 'CSSStyleSheet': false; - readonly 'CSSSupportsRule': false; - readonly 'CSSTransformValue': false; - readonly 'CSSTranslate': false; - readonly 'CustomElementRegistry': false; - readonly 'customElements': false; - readonly 'CustomEvent': false; - readonly 'DataTransfer': false; - readonly 'DataTransferItem': false; - readonly 'DataTransferItemList': false; - readonly 'DecompressionStream': false; - readonly 'defaultstatus': false; - readonly 'defaultStatus': false; - readonly 'DelayNode': false; - readonly 'DeviceMotionEvent': false; - readonly 'DeviceOrientationEvent': false; - readonly 'devicePixelRatio': false; - readonly 'dispatchEvent': false; - readonly 'document': false; - readonly 'Document': false; - readonly 'DocumentFragment': false; - readonly 'DocumentType': false; - readonly 'DOMError': false; - readonly 'DOMException': false; - readonly 'DOMImplementation': false; - readonly 'DOMMatrix': false; - readonly 'DOMMatrixReadOnly': false; - readonly 'DOMParser': false; - readonly 'DOMPoint': false; - readonly 'DOMPointReadOnly': false; - readonly 'DOMQuad': false; - readonly 'DOMRect': false; - readonly 'DOMRectList': false; - readonly 'DOMRectReadOnly': false; - readonly 'DOMStringList': false; - readonly 'DOMStringMap': false; - readonly 'DOMTokenList': false; - readonly 'DragEvent': false; - readonly 'DynamicsCompressorNode': false; - readonly 'Element': false; - readonly 'ErrorEvent': false; - readonly 'event': false; - readonly 'Event': false; - readonly 'EventSource': false; - readonly 'EventTarget': false; - readonly 'external': false; - readonly 'fetch': false; - readonly 'File': false; - readonly 'FileList': false; - readonly 'FileReader': false; - readonly 'find': false; - readonly 'focus': false; - readonly 'FocusEvent': false; - readonly 'FontFace': false; - readonly 'FontFaceSetLoadEvent': false; - readonly 'FormData': false; - readonly 'FormDataEvent': false; - readonly 'frameElement': false; - readonly 'frames': false; - readonly 'GainNode': false; - readonly 'Gamepad': false; - readonly 'GamepadButton': false; - readonly 'GamepadEvent': false; - readonly 'getComputedStyle': false; - readonly 'getSelection': false; - readonly 'HashChangeEvent': false; - readonly 'Headers': false; - readonly 'history': false; - readonly 'History': false; - readonly 'HTMLAllCollection': false; - readonly 'HTMLAnchorElement': false; - readonly 'HTMLAreaElement': false; - readonly 'HTMLAudioElement': false; - readonly 'HTMLBaseElement': false; - readonly 'HTMLBodyElement': false; - readonly 'HTMLBRElement': false; - readonly 'HTMLButtonElement': false; - readonly 'HTMLCanvasElement': false; - readonly 'HTMLCollection': false; - readonly 'HTMLContentElement': false; - readonly 'HTMLDataElement': false; - readonly 'HTMLDataListElement': false; - readonly 'HTMLDetailsElement': false; - readonly 'HTMLDialogElement': false; - readonly 'HTMLDirectoryElement': false; - readonly 'HTMLDivElement': false; - readonly 'HTMLDListElement': false; - readonly 'HTMLDocument': false; - readonly 'HTMLElement': false; - readonly 'HTMLEmbedElement': false; - readonly 'HTMLFieldSetElement': false; - readonly 'HTMLFontElement': false; - readonly 'HTMLFormControlsCollection': false; - readonly 'HTMLFormElement': false; - readonly 'HTMLFrameElement': false; - readonly 'HTMLFrameSetElement': false; - readonly 'HTMLHeadElement': false; - readonly 'HTMLHeadingElement': false; - readonly 'HTMLHRElement': false; - readonly 'HTMLHtmlElement': false; - readonly 'HTMLIFrameElement': false; - readonly 'HTMLImageElement': false; - readonly 'HTMLInputElement': false; - readonly 'HTMLLabelElement': false; - readonly 'HTMLLegendElement': false; - readonly 'HTMLLIElement': false; - readonly 'HTMLLinkElement': false; - readonly 'HTMLMapElement': false; - readonly 'HTMLMarqueeElement': false; - readonly 'HTMLMediaElement': false; - readonly 'HTMLMenuElement': false; - readonly 'HTMLMetaElement': false; - readonly 'HTMLMeterElement': false; - readonly 'HTMLModElement': false; - readonly 'HTMLObjectElement': false; - readonly 'HTMLOListElement': false; - readonly 'HTMLOptGroupElement': false; - readonly 'HTMLOptionElement': false; - readonly 'HTMLOptionsCollection': false; - readonly 'HTMLOutputElement': false; - readonly 'HTMLParagraphElement': false; - readonly 'HTMLParamElement': false; - readonly 'HTMLPictureElement': false; - readonly 'HTMLPreElement': false; - readonly 'HTMLProgressElement': false; - readonly 'HTMLQuoteElement': false; - readonly 'HTMLScriptElement': false; - readonly 'HTMLSelectElement': false; - readonly 'HTMLShadowElement': false; - readonly 'HTMLSlotElement': false; - readonly 'HTMLSourceElement': false; - readonly 'HTMLSpanElement': false; - readonly 'HTMLStyleElement': false; - readonly 'HTMLTableCaptionElement': false; - readonly 'HTMLTableCellElement': false; - readonly 'HTMLTableColElement': false; - readonly 'HTMLTableElement': false; - readonly 'HTMLTableRowElement': false; - readonly 'HTMLTableSectionElement': false; - readonly 'HTMLTemplateElement': false; - readonly 'HTMLTextAreaElement': false; - readonly 'HTMLTimeElement': false; - readonly 'HTMLTitleElement': false; - readonly 'HTMLTrackElement': false; - readonly 'HTMLUListElement': false; - readonly 'HTMLUnknownElement': false; - readonly 'HTMLVideoElement': false; - readonly 'IDBCursor': false; - readonly 'IDBCursorWithValue': false; - readonly 'IDBDatabase': false; - readonly 'IDBFactory': false; - readonly 'IDBIndex': false; - readonly 'IDBKeyRange': false; - readonly 'IDBObjectStore': false; - readonly 'IDBOpenDBRequest': false; - readonly 'IDBRequest': false; - readonly 'IDBTransaction': false; - readonly 'IDBVersionChangeEvent': false; - readonly 'IdleDeadline': false; - readonly 'IIRFilterNode': false; - readonly 'Image': false; - readonly 'ImageBitmap': false; - readonly 'ImageBitmapRenderingContext': false; - readonly 'ImageCapture': false; - readonly 'ImageData': false; - readonly 'indexedDB': false; - readonly 'innerHeight': false; - readonly 'innerWidth': false; - readonly 'InputEvent': false; - readonly 'IntersectionObserver': false; - readonly 'IntersectionObserverEntry': false; - readonly 'Intl': false; - readonly 'isSecureContext': false; - readonly 'KeyboardEvent': false; - readonly 'KeyframeEffect': false; - readonly 'KeyframeEffectReadOnly': false; - readonly 'length': false; - readonly 'localStorage': false; - readonly 'location': true; - readonly 'Location': false; - readonly 'locationbar': false; - readonly 'matchMedia': false; - readonly 'MediaDeviceInfo': false; - readonly 'MediaDevices': false; - readonly 'MediaElementAudioSourceNode': false; - readonly 'MediaEncryptedEvent': false; - readonly 'MediaError': false; - readonly 'MediaKeyMessageEvent': false; - readonly 'MediaKeySession': false; - readonly 'MediaKeyStatusMap': false; - readonly 'MediaKeySystemAccess': false; - readonly 'MediaList': false; - readonly 'MediaMetadata': false; - readonly 'MediaQueryList': false; - readonly 'MediaQueryListEvent': false; - readonly 'MediaRecorder': false; - readonly 'MediaSettingsRange': false; - readonly 'MediaSource': false; - readonly 'MediaStream': false; - readonly 'MediaStreamAudioDestinationNode': false; - readonly 'MediaStreamAudioSourceNode': false; - readonly 'MediaStreamConstraints': false; - readonly 'MediaStreamEvent': false; - readonly 'MediaStreamTrack': false; - readonly 'MediaStreamTrackEvent': false; - readonly 'menubar': false; - readonly 'MessageChannel': false; - readonly 'MessageEvent': false; - readonly 'MessagePort': false; - readonly 'MIDIAccess': false; - readonly 'MIDIConnectionEvent': false; - readonly 'MIDIInput': false; - readonly 'MIDIInputMap': false; - readonly 'MIDIMessageEvent': false; - readonly 'MIDIOutput': false; - readonly 'MIDIOutputMap': false; - readonly 'MIDIPort': false; - readonly 'MimeType': false; - readonly 'MimeTypeArray': false; - readonly 'MouseEvent': false; - readonly 'moveBy': false; - readonly 'moveTo': false; - readonly 'MutationEvent': false; - readonly 'MutationObserver': false; - readonly 'MutationRecord': false; - readonly 'name': false; - readonly 'NamedNodeMap': false; - readonly 'NavigationPreloadManager': false; - readonly 'navigator': false; - readonly 'Navigator': false; - readonly 'NavigatorUAData': false; - readonly 'NetworkInformation': false; - readonly 'Node': false; - readonly 'NodeFilter': false; - readonly 'NodeIterator': false; - readonly 'NodeList': false; - readonly 'Notification': false; - readonly 'OfflineAudioCompletionEvent': false; - readonly 'OfflineAudioContext': false; - readonly 'offscreenBuffering': false; - readonly 'OffscreenCanvas': true; - readonly 'OffscreenCanvasRenderingContext2D': false; - readonly 'onabort': true; - readonly 'onafterprint': true; - readonly 'onanimationend': true; - readonly 'onanimationiteration': true; - readonly 'onanimationstart': true; - readonly 'onappinstalled': true; - readonly 'onauxclick': true; - readonly 'onbeforeinstallprompt': true; - readonly 'onbeforeprint': true; - readonly 'onbeforeunload': true; - readonly 'onblur': true; - readonly 'oncancel': true; - readonly 'oncanplay': true; - readonly 'oncanplaythrough': true; - readonly 'onchange': true; - readonly 'onclick': true; - readonly 'onclose': true; - readonly 'oncontextmenu': true; - readonly 'oncuechange': true; - readonly 'ondblclick': true; - readonly 'ondevicemotion': true; - readonly 'ondeviceorientation': true; - readonly 'ondeviceorientationabsolute': true; - readonly 'ondrag': true; - readonly 'ondragend': true; - readonly 'ondragenter': true; - readonly 'ondragleave': true; - readonly 'ondragover': true; - readonly 'ondragstart': true; - readonly 'ondrop': true; - readonly 'ondurationchange': true; - readonly 'onemptied': true; - readonly 'onended': true; - readonly 'onerror': true; - readonly 'onfocus': true; - readonly 'ongotpointercapture': true; - readonly 'onhashchange': true; - readonly 'oninput': true; - readonly 'oninvalid': true; - readonly 'onkeydown': true; - readonly 'onkeypress': true; - readonly 'onkeyup': true; - readonly 'onlanguagechange': true; - readonly 'onload': true; - readonly 'onloadeddata': true; - readonly 'onloadedmetadata': true; - readonly 'onloadstart': true; - readonly 'onlostpointercapture': true; - readonly 'onmessage': true; - readonly 'onmessageerror': true; - readonly 'onmousedown': true; - readonly 'onmouseenter': true; - readonly 'onmouseleave': true; - readonly 'onmousemove': true; - readonly 'onmouseout': true; - readonly 'onmouseover': true; - readonly 'onmouseup': true; - readonly 'onmousewheel': true; - readonly 'onoffline': true; - readonly 'ononline': true; - readonly 'onpagehide': true; - readonly 'onpageshow': true; - readonly 'onpause': true; - readonly 'onplay': true; - readonly 'onplaying': true; - readonly 'onpointercancel': true; - readonly 'onpointerdown': true; - readonly 'onpointerenter': true; - readonly 'onpointerleave': true; - readonly 'onpointermove': true; - readonly 'onpointerout': true; - readonly 'onpointerover': true; - readonly 'onpointerup': true; - readonly 'onpopstate': true; - readonly 'onprogress': true; - readonly 'onratechange': true; - readonly 'onrejectionhandled': true; - readonly 'onreset': true; - readonly 'onresize': true; - readonly 'onscroll': true; - readonly 'onsearch': true; - readonly 'onseeked': true; - readonly 'onseeking': true; - readonly 'onselect': true; - readonly 'onstalled': true; - readonly 'onstorage': true; - readonly 'onsubmit': true; - readonly 'onsuspend': true; - readonly 'ontimeupdate': true; - readonly 'ontoggle': true; - readonly 'ontransitionend': true; - readonly 'onunhandledrejection': true; - readonly 'onunload': true; - readonly 'onvolumechange': true; - readonly 'onwaiting': true; - readonly 'onwheel': true; - readonly 'open': false; - readonly 'openDatabase': false; - readonly 'opener': false; - readonly 'Option': false; - readonly 'origin': false; - readonly 'OscillatorNode': false; - readonly 'outerHeight': false; - readonly 'outerWidth': false; - readonly 'OverconstrainedError': false; - readonly 'PageTransitionEvent': false; - readonly 'pageXOffset': false; - readonly 'pageYOffset': false; - readonly 'PannerNode': false; - readonly 'parent': false; - readonly 'Path2D': false; - readonly 'PaymentAddress': false; - readonly 'PaymentRequest': false; - readonly 'PaymentRequestUpdateEvent': false; - readonly 'PaymentResponse': false; - readonly 'performance': false; - readonly 'Performance': false; - readonly 'PerformanceEntry': false; - readonly 'PerformanceLongTaskTiming': false; - readonly 'PerformanceMark': false; - readonly 'PerformanceMeasure': false; - readonly 'PerformanceNavigation': false; - readonly 'PerformanceNavigationTiming': false; - readonly 'PerformanceObserver': false; - readonly 'PerformanceObserverEntryList': false; - readonly 'PerformancePaintTiming': false; - readonly 'PerformanceResourceTiming': false; - readonly 'PerformanceTiming': false; - readonly 'PeriodicWave': false; - readonly 'Permissions': false; - readonly 'PermissionStatus': false; - readonly 'personalbar': false; - readonly 'PhotoCapabilities': false; - readonly 'Plugin': false; - readonly 'PluginArray': false; - readonly 'PointerEvent': false; - readonly 'PopStateEvent': false; - readonly 'postMessage': false; - readonly 'Presentation': false; - readonly 'PresentationAvailability': false; - readonly 'PresentationConnection': false; - readonly 'PresentationConnectionAvailableEvent': false; - readonly 'PresentationConnectionCloseEvent': false; - readonly 'PresentationConnectionList': false; - readonly 'PresentationReceiver': false; - readonly 'PresentationRequest': false; - readonly 'print': false; - readonly 'ProcessingInstruction': false; - readonly 'ProgressEvent': false; - readonly 'PromiseRejectionEvent': false; - readonly 'prompt': false; - readonly 'PushManager': false; - readonly 'PushSubscription': false; - readonly 'PushSubscriptionOptions': false; - readonly 'queueMicrotask': false; - readonly 'RadioNodeList': false; - readonly 'Range': false; - readonly 'ReadableByteStreamController': false; - readonly 'ReadableStream': false; - readonly 'ReadableStreamBYOBReader': false; - readonly 'ReadableStreamBYOBRequest': false; - readonly 'ReadableStreamDefaultController': false; - readonly 'ReadableStreamDefaultReader': false; - readonly 'registerProcessor': false; - readonly 'RemotePlayback': false; - readonly 'removeEventListener': false; - readonly 'reportError': false; - readonly 'Request': false; - readonly 'requestAnimationFrame': false; - readonly 'requestIdleCallback': false; - readonly 'resizeBy': false; - readonly 'ResizeObserver': false; - readonly 'ResizeObserverEntry': false; - readonly 'resizeTo': false; - readonly 'Response': false; - readonly 'RTCCertificate': false; - readonly 'RTCDataChannel': false; - readonly 'RTCDataChannelEvent': false; - readonly 'RTCDtlsTransport': false; - readonly 'RTCIceCandidate': false; - readonly 'RTCIceGatherer': false; - readonly 'RTCIceTransport': false; - readonly 'RTCPeerConnection': false; - readonly 'RTCPeerConnectionIceEvent': false; - readonly 'RTCRtpContributingSource': false; - readonly 'RTCRtpReceiver': false; - readonly 'RTCRtpSender': false; - readonly 'RTCSctpTransport': false; - readonly 'RTCSessionDescription': false; - readonly 'RTCStatsReport': false; - readonly 'RTCTrackEvent': false; - readonly 'screen': false; - readonly 'Screen': false; - readonly 'screenLeft': false; - readonly 'ScreenOrientation': false; - readonly 'screenTop': false; - readonly 'screenX': false; - readonly 'screenY': false; - readonly 'ScriptProcessorNode': false; - readonly 'scroll': false; - readonly 'scrollbars': false; - readonly 'scrollBy': false; - readonly 'scrollTo': false; - readonly 'scrollX': false; - readonly 'scrollY': false; - readonly 'SecurityPolicyViolationEvent': false; - readonly 'Selection': false; - readonly 'self': false; - readonly 'ServiceWorker': false; - readonly 'ServiceWorkerContainer': false; - readonly 'ServiceWorkerRegistration': false; - readonly 'sessionStorage': false; - readonly 'setInterval': false; - readonly 'setTimeout': false; - readonly 'ShadowRoot': false; - readonly 'SharedWorker': false; - readonly 'SourceBuffer': false; - readonly 'SourceBufferList': false; - readonly 'speechSynthesis': false; - readonly 'SpeechSynthesisEvent': false; - readonly 'SpeechSynthesisUtterance': false; - readonly 'StaticRange': false; - readonly 'status': false; - readonly 'statusbar': false; - readonly 'StereoPannerNode': false; - readonly 'stop': false; - readonly 'Storage': false; - readonly 'StorageEvent': false; - readonly 'StorageManager': false; - readonly 'structuredClone': false; - readonly 'styleMedia': false; - readonly 'StyleSheet': false; - readonly 'StyleSheetList': false; - readonly 'SubmitEvent': false; - readonly 'SubtleCrypto': false; - readonly 'SVGAElement': false; - readonly 'SVGAngle': false; - readonly 'SVGAnimatedAngle': false; - readonly 'SVGAnimatedBoolean': false; - readonly 'SVGAnimatedEnumeration': false; - readonly 'SVGAnimatedInteger': false; - readonly 'SVGAnimatedLength': false; - readonly 'SVGAnimatedLengthList': false; - readonly 'SVGAnimatedNumber': false; - readonly 'SVGAnimatedNumberList': false; - readonly 'SVGAnimatedPreserveAspectRatio': false; - readonly 'SVGAnimatedRect': false; - readonly 'SVGAnimatedString': false; - readonly 'SVGAnimatedTransformList': false; - readonly 'SVGAnimateElement': false; - readonly 'SVGAnimateMotionElement': false; - readonly 'SVGAnimateTransformElement': false; - readonly 'SVGAnimationElement': false; - readonly 'SVGCircleElement': false; - readonly 'SVGClipPathElement': false; - readonly 'SVGComponentTransferFunctionElement': false; - readonly 'SVGDefsElement': false; - readonly 'SVGDescElement': false; - readonly 'SVGDiscardElement': false; - readonly 'SVGElement': false; - readonly 'SVGEllipseElement': false; - readonly 'SVGFEBlendElement': false; - readonly 'SVGFEColorMatrixElement': false; - readonly 'SVGFEComponentTransferElement': false; - readonly 'SVGFECompositeElement': false; - readonly 'SVGFEConvolveMatrixElement': false; - readonly 'SVGFEDiffuseLightingElement': false; - readonly 'SVGFEDisplacementMapElement': false; - readonly 'SVGFEDistantLightElement': false; - readonly 'SVGFEDropShadowElement': false; - readonly 'SVGFEFloodElement': false; - readonly 'SVGFEFuncAElement': false; - readonly 'SVGFEFuncBElement': false; - readonly 'SVGFEFuncGElement': false; - readonly 'SVGFEFuncRElement': false; - readonly 'SVGFEGaussianBlurElement': false; - readonly 'SVGFEImageElement': false; - readonly 'SVGFEMergeElement': false; - readonly 'SVGFEMergeNodeElement': false; - readonly 'SVGFEMorphologyElement': false; - readonly 'SVGFEOffsetElement': false; - readonly 'SVGFEPointLightElement': false; - readonly 'SVGFESpecularLightingElement': false; - readonly 'SVGFESpotLightElement': false; - readonly 'SVGFETileElement': false; - readonly 'SVGFETurbulenceElement': false; - readonly 'SVGFilterElement': false; - readonly 'SVGForeignObjectElement': false; - readonly 'SVGGElement': false; - readonly 'SVGGeometryElement': false; - readonly 'SVGGradientElement': false; - readonly 'SVGGraphicsElement': false; - readonly 'SVGImageElement': false; - readonly 'SVGLength': false; - readonly 'SVGLengthList': false; - readonly 'SVGLinearGradientElement': false; - readonly 'SVGLineElement': false; - readonly 'SVGMarkerElement': false; - readonly 'SVGMaskElement': false; - readonly 'SVGMatrix': false; - readonly 'SVGMetadataElement': false; - readonly 'SVGMPathElement': false; - readonly 'SVGNumber': false; - readonly 'SVGNumberList': false; - readonly 'SVGPathElement': false; - readonly 'SVGPatternElement': false; - readonly 'SVGPoint': false; - readonly 'SVGPointList': false; - readonly 'SVGPolygonElement': false; - readonly 'SVGPolylineElement': false; - readonly 'SVGPreserveAspectRatio': false; - readonly 'SVGRadialGradientElement': false; - readonly 'SVGRect': false; - readonly 'SVGRectElement': false; - readonly 'SVGScriptElement': false; - readonly 'SVGSetElement': false; - readonly 'SVGStopElement': false; - readonly 'SVGStringList': false; - readonly 'SVGStyleElement': false; - readonly 'SVGSVGElement': false; - readonly 'SVGSwitchElement': false; - readonly 'SVGSymbolElement': false; - readonly 'SVGTextContentElement': false; - readonly 'SVGTextElement': false; - readonly 'SVGTextPathElement': false; - readonly 'SVGTextPositioningElement': false; - readonly 'SVGTitleElement': false; - readonly 'SVGTransform': false; - readonly 'SVGTransformList': false; - readonly 'SVGTSpanElement': false; - readonly 'SVGUnitTypes': false; - readonly 'SVGUseElement': false; - readonly 'SVGViewElement': false; - readonly 'TaskAttributionTiming': false; - readonly 'Text': false; - readonly 'TextDecoder': false; - readonly 'TextDecoderStream': false; - readonly 'TextEncoder': false; - readonly 'TextEncoderStream': false; - readonly 'TextEvent': false; - readonly 'TextMetrics': false; - readonly 'TextTrack': false; - readonly 'TextTrackCue': false; - readonly 'TextTrackCueList': false; - readonly 'TextTrackList': false; - readonly 'TimeRanges': false; - readonly 'ToggleEvent': false; - readonly 'toolbar': false; - readonly 'top': false; - readonly 'Touch': false; - readonly 'TouchEvent': false; - readonly 'TouchList': false; - readonly 'TrackEvent': false; - readonly 'TransformStream': false; - readonly 'TransformStreamDefaultController': false; - readonly 'TransitionEvent': false; - readonly 'TreeWalker': false; - readonly 'UIEvent': false; - readonly 'URL': false; - readonly 'URLSearchParams': false; - readonly 'ValidityState': false; - readonly 'visualViewport': false; - readonly 'VisualViewport': false; - readonly 'VTTCue': false; - readonly 'WaveShaperNode': false; - readonly 'WebAssembly': false; - readonly 'WebGL2RenderingContext': false; - readonly 'WebGLActiveInfo': false; - readonly 'WebGLBuffer': false; - readonly 'WebGLContextEvent': false; - readonly 'WebGLFramebuffer': false; - readonly 'WebGLProgram': false; - readonly 'WebGLQuery': false; - readonly 'WebGLRenderbuffer': false; - readonly 'WebGLRenderingContext': false; - readonly 'WebGLSampler': false; - readonly 'WebGLShader': false; - readonly 'WebGLShaderPrecisionFormat': false; - readonly 'WebGLSync': false; - readonly 'WebGLTexture': false; - readonly 'WebGLTransformFeedback': false; - readonly 'WebGLUniformLocation': false; - readonly 'WebGLVertexArrayObject': false; - readonly 'WebSocket': false; - readonly 'WheelEvent': false; - readonly 'window': false; - readonly 'Window': false; - readonly 'Worker': false; - readonly 'WritableStream': false; - readonly 'WritableStreamDefaultController': false; - readonly 'WritableStreamDefaultWriter': false; - readonly 'XMLDocument': false; - readonly 'XMLHttpRequest': false; - readonly 'XMLHttpRequestEventTarget': false; - readonly 'XMLHttpRequestUpload': false; - readonly 'XMLSerializer': false; - readonly 'XPathEvaluator': false; - readonly 'XPathExpression': false; - readonly 'XPathResult': false; - readonly 'XRAnchor': false; - readonly 'XRBoundedReferenceSpace': false; - readonly 'XRCPUDepthInformation': false; - readonly 'XRDepthInformation': false; - readonly 'XRFrame': false; - readonly 'XRInputSource': false; - readonly 'XRInputSourceArray': false; - readonly 'XRInputSourceEvent': false; - readonly 'XRInputSourcesChangeEvent': false; - readonly 'XRPose': false; - readonly 'XRReferenceSpace': false; - readonly 'XRReferenceSpaceEvent': false; - readonly 'XRRenderState': false; - readonly 'XRRigidTransform': false; - readonly 'XRSession': false; - readonly 'XRSessionEvent': false; - readonly 'XRSpace': false; - readonly 'XRSystem': false; - readonly 'XRView': false; - readonly 'XRViewerPose': false; - readonly 'XRViewport': false; - readonly 'XRWebGLBinding': false; - readonly 'XRWebGLDepthInformation': false; - readonly 'XRWebGLLayer': false; - readonly 'XSLTProcessor': false; -} - -type GlobalsWorker = { - readonly 'addEventListener': false; - readonly 'applicationCache': false; - readonly 'atob': false; - readonly 'Blob': false; - readonly 'BroadcastChannel': false; - readonly 'btoa': false; - readonly 'ByteLengthQueuingStrategy': false; - readonly 'Cache': false; - readonly 'caches': false; - readonly 'clearInterval': false; - readonly 'clearTimeout': false; - readonly 'close': true; - readonly 'CompressionStream': false; - readonly 'console': false; - readonly 'CountQueuingStrategy': false; - readonly 'crypto': false; - readonly 'Crypto': false; - readonly 'CryptoKey': false; - readonly 'CustomEvent': false; - readonly 'DecompressionStream': false; - readonly 'ErrorEvent': false; - readonly 'Event': false; - readonly 'fetch': false; - readonly 'File': false; - readonly 'FileReaderSync': false; - readonly 'FormData': false; - readonly 'Headers': false; - readonly 'IDBCursor': false; - readonly 'IDBCursorWithValue': false; - readonly 'IDBDatabase': false; - readonly 'IDBFactory': false; - readonly 'IDBIndex': false; - readonly 'IDBKeyRange': false; - readonly 'IDBObjectStore': false; - readonly 'IDBOpenDBRequest': false; - readonly 'IDBRequest': false; - readonly 'IDBTransaction': false; - readonly 'IDBVersionChangeEvent': false; - readonly 'ImageData': false; - readonly 'importScripts': true; - readonly 'indexedDB': false; - readonly 'location': false; - readonly 'MessageChannel': false; - readonly 'MessageEvent': false; - readonly 'MessagePort': false; - readonly 'name': false; - readonly 'navigator': false; - readonly 'Notification': false; - readonly 'onclose': true; - readonly 'onconnect': true; - readonly 'onerror': true; - readonly 'onlanguagechange': true; - readonly 'onmessage': true; - readonly 'onoffline': true; - readonly 'ononline': true; - readonly 'onrejectionhandled': true; - readonly 'onunhandledrejection': true; - readonly 'performance': false; - readonly 'Performance': false; - readonly 'PerformanceEntry': false; - readonly 'PerformanceMark': false; - readonly 'PerformanceMeasure': false; - readonly 'PerformanceNavigation': false; - readonly 'PerformanceObserver': false; - readonly 'PerformanceObserverEntryList': false; - readonly 'PerformanceResourceTiming': false; - readonly 'PerformanceTiming': false; - readonly 'postMessage': true; - readonly 'Promise': false; - readonly 'queueMicrotask': false; - readonly 'ReadableByteStreamController': false; - readonly 'ReadableStream': false; - readonly 'ReadableStreamBYOBReader': false; - readonly 'ReadableStreamBYOBRequest': false; - readonly 'ReadableStreamDefaultController': false; - readonly 'ReadableStreamDefaultReader': false; - readonly 'removeEventListener': false; - readonly 'reportError': false; - readonly 'Request': false; - readonly 'Response': false; - readonly 'self': true; - readonly 'ServiceWorkerRegistration': false; - readonly 'setInterval': false; - readonly 'setTimeout': false; - readonly 'SubtleCrypto': false; - readonly 'TextDecoder': false; - readonly 'TextDecoderStream': false; - readonly 'TextEncoder': false; - readonly 'TextEncoderStream': false; - readonly 'TransformStream': false; - readonly 'TransformStreamDefaultController': false; - readonly 'URL': false; - readonly 'URLSearchParams': false; - readonly 'WebAssembly': false; - readonly 'WebSocket': false; - readonly 'Worker': false; - readonly 'WorkerGlobalScope': false; - readonly 'WritableStream': false; - readonly 'WritableStreamDefaultController': false; - readonly 'WritableStreamDefaultWriter': false; - readonly 'XMLHttpRequest': false; -} - -type GlobalsNode = { - readonly '__dirname': false; - readonly '__filename': false; - readonly 'AbortController': false; - readonly 'AbortSignal': false; - readonly 'atob': false; - readonly 'Blob': false; - readonly 'BroadcastChannel': false; - readonly 'btoa': false; - readonly 'Buffer': false; - readonly 'ByteLengthQueuingStrategy': false; - readonly 'clearImmediate': false; - readonly 'clearInterval': false; - readonly 'clearTimeout': false; - readonly 'CompressionStream': false; - readonly 'console': false; - readonly 'CountQueuingStrategy': false; - readonly 'crypto': false; - readonly 'Crypto': false; - readonly 'CryptoKey': false; - readonly 'CustomEvent': false; - readonly 'DecompressionStream': false; - readonly 'DOMException': false; - readonly 'Event': false; - readonly 'EventTarget': false; - readonly 'exports': true; - readonly 'fetch': false; - readonly 'File': false; - readonly 'FormData': false; - readonly 'global': false; - readonly 'Headers': false; - readonly 'Intl': false; - readonly 'MessageChannel': false; - readonly 'MessageEvent': false; - readonly 'MessagePort': false; - readonly 'module': false; - readonly 'performance': false; - readonly 'PerformanceEntry': false; - readonly 'PerformanceMark': false; - readonly 'PerformanceMeasure': false; - readonly 'PerformanceObserver': false; - readonly 'PerformanceObserverEntryList': false; - readonly 'PerformanceResourceTiming': false; - readonly 'process': false; - readonly 'queueMicrotask': false; - readonly 'ReadableByteStreamController': false; - readonly 'ReadableStream': false; - readonly 'ReadableStreamBYOBReader': false; - readonly 'ReadableStreamBYOBRequest': false; - readonly 'ReadableStreamDefaultController': false; - readonly 'ReadableStreamDefaultReader': false; - readonly 'Request': false; - readonly 'require': false; - readonly 'Response': false; - readonly 'setImmediate': false; - readonly 'setInterval': false; - readonly 'setTimeout': false; - readonly 'structuredClone': false; - readonly 'SubtleCrypto': false; - readonly 'TextDecoder': false; - readonly 'TextDecoderStream': false; - readonly 'TextEncoder': false; - readonly 'TextEncoderStream': false; - readonly 'TransformStream': false; - readonly 'TransformStreamDefaultController': false; - readonly 'URL': false; - readonly 'URLSearchParams': false; - readonly 'WebAssembly': false; - readonly 'WritableStream': false; - readonly 'WritableStreamDefaultController': false; - readonly 'WritableStreamDefaultWriter': false; -} - -type GlobalsNodeBuiltin = { - readonly 'AbortController': false; - readonly 'AbortSignal': false; - readonly 'atob': false; - readonly 'Blob': false; - readonly 'BroadcastChannel': false; - readonly 'btoa': false; - readonly 'Buffer': false; - readonly 'ByteLengthQueuingStrategy': false; - readonly 'clearImmediate': false; - readonly 'clearInterval': false; - readonly 'clearTimeout': false; - readonly 'CompressionStream': false; - readonly 'console': false; - readonly 'CountQueuingStrategy': false; - readonly 'crypto': false; - readonly 'Crypto': false; - readonly 'CryptoKey': false; - readonly 'CustomEvent': false; - readonly 'DecompressionStream': false; - readonly 'DOMException': false; - readonly 'Event': false; - readonly 'EventTarget': false; - readonly 'fetch': false; - readonly 'File': false; - readonly 'FormData': false; - readonly 'global': false; - readonly 'Headers': false; - readonly 'Intl': false; - readonly 'MessageChannel': false; - readonly 'MessageEvent': false; - readonly 'MessagePort': false; - readonly 'performance': false; - readonly 'PerformanceEntry': false; - readonly 'PerformanceMark': false; - readonly 'PerformanceMeasure': false; - readonly 'PerformanceObserver': false; - readonly 'PerformanceObserverEntryList': false; - readonly 'PerformanceResourceTiming': false; - readonly 'process': false; - readonly 'queueMicrotask': false; - readonly 'ReadableByteStreamController': false; - readonly 'ReadableStream': false; - readonly 'ReadableStreamBYOBReader': false; - readonly 'ReadableStreamBYOBRequest': false; - readonly 'ReadableStreamDefaultController': false; - readonly 'ReadableStreamDefaultReader': false; - readonly 'Request': false; - readonly 'Response': false; - readonly 'setImmediate': false; - readonly 'setInterval': false; - readonly 'setTimeout': false; - readonly 'structuredClone': false; - readonly 'SubtleCrypto': false; - readonly 'TextDecoder': false; - readonly 'TextDecoderStream': false; - readonly 'TextEncoder': false; - readonly 'TextEncoderStream': false; - readonly 'TransformStream': false; - readonly 'TransformStreamDefaultController': false; - readonly 'URL': false; - readonly 'URLSearchParams': false; - readonly 'WebAssembly': false; - readonly 'WritableStream': false; - readonly 'WritableStreamDefaultController': false; - readonly 'WritableStreamDefaultWriter': false; -} - -type GlobalsCommonjs = { - readonly 'exports': true; - readonly 'global': false; - readonly 'module': false; - readonly 'require': false; -} - -type GlobalsAmd = { - readonly 'define': false; - readonly 'require': false; -} - -type GlobalsMocha = { - readonly 'after': false; - readonly 'afterEach': false; - readonly 'before': false; - readonly 'beforeEach': false; - readonly 'context': false; - readonly 'describe': false; - readonly 'it': false; - readonly 'mocha': false; - readonly 'run': false; - readonly 'setup': false; - readonly 'specify': false; - readonly 'suite': false; - readonly 'suiteSetup': false; - readonly 'suiteTeardown': false; - readonly 'teardown': false; - readonly 'test': false; - readonly 'xcontext': false; - readonly 'xdescribe': false; - readonly 'xit': false; - readonly 'xspecify': false; -} - -type GlobalsJasmine = { - readonly 'afterAll': false; - readonly 'afterEach': false; - readonly 'beforeAll': false; - readonly 'beforeEach': false; - readonly 'describe': false; - readonly 'expect': false; - readonly 'expectAsync': false; - readonly 'fail': false; - readonly 'fdescribe': false; - readonly 'fit': false; - readonly 'it': false; - readonly 'jasmine': false; - readonly 'pending': false; - readonly 'runs': false; - readonly 'spyOn': false; - readonly 'spyOnAllFunctions': false; - readonly 'spyOnProperty': false; - readonly 'waits': false; - readonly 'waitsFor': false; - readonly 'xdescribe': false; - readonly 'xit': false; -} - -type GlobalsJest = { - readonly 'afterAll': false; - readonly 'afterEach': false; - readonly 'beforeAll': false; - readonly 'beforeEach': false; - readonly 'describe': false; - readonly 'expect': false; - readonly 'fdescribe': false; - readonly 'fit': false; - readonly 'it': false; - readonly 'jest': false; - readonly 'pit': false; - readonly 'require': false; - readonly 'test': false; - readonly 'xdescribe': false; - readonly 'xit': false; - readonly 'xtest': false; -} - -type GlobalsQunit = { - readonly 'asyncTest': false; - readonly 'deepEqual': false; - readonly 'equal': false; - readonly 'expect': false; - readonly 'module': false; - readonly 'notDeepEqual': false; - readonly 'notEqual': false; - readonly 'notOk': false; - readonly 'notPropEqual': false; - readonly 'notStrictEqual': false; - readonly 'ok': false; - readonly 'propEqual': false; - readonly 'QUnit': false; - readonly 'raises': false; - readonly 'start': false; - readonly 'stop': false; - readonly 'strictEqual': false; - readonly 'test': false; - readonly 'throws': false; -} - -type GlobalsPhantomjs = { - readonly 'console': true; - readonly 'exports': true; - readonly 'phantom': true; - readonly 'require': true; - readonly 'WebPage': true; -} - -type GlobalsCouch = { - readonly 'emit': false; - readonly 'exports': false; - readonly 'getRow': false; - readonly 'log': false; - readonly 'module': false; - readonly 'provides': false; - readonly 'require': false; - readonly 'respond': false; - readonly 'send': false; - readonly 'start': false; - readonly 'sum': false; -} - -type GlobalsRhino = { - readonly 'defineClass': false; - readonly 'deserialize': false; - readonly 'gc': false; - readonly 'help': false; - readonly 'importClass': false; - readonly 'importPackage': false; - readonly 'java': false; - readonly 'load': false; - readonly 'loadClass': false; - readonly 'Packages': false; - readonly 'print': false; - readonly 'quit': false; - readonly 'readFile': false; - readonly 'readUrl': false; - readonly 'runCommand': false; - readonly 'seal': false; - readonly 'serialize': false; - readonly 'spawn': false; - readonly 'sync': false; - readonly 'toint32': false; - readonly 'version': false; -} - -type GlobalsNashorn = { - readonly '__DIR__': false; - readonly '__FILE__': false; - readonly '__LINE__': false; - readonly 'com': false; - readonly 'edu': false; - readonly 'exit': false; - readonly 'java': false; - readonly 'Java': false; - readonly 'javafx': false; - readonly 'JavaImporter': false; - readonly 'javax': false; - readonly 'JSAdapter': false; - readonly 'load': false; - readonly 'loadWithNewGlobal': false; - readonly 'org': false; - readonly 'Packages': false; - readonly 'print': false; - readonly 'quit': false; -} - -type GlobalsWsh = { - readonly 'ActiveXObject': false; - readonly 'CollectGarbage': false; - readonly 'Debug': false; - readonly 'Enumerator': false; - readonly 'GetObject': false; - readonly 'RuntimeObject': false; - readonly 'ScriptEngine': false; - readonly 'ScriptEngineBuildVersion': false; - readonly 'ScriptEngineMajorVersion': false; - readonly 'ScriptEngineMinorVersion': false; - readonly 'VBArray': false; - readonly 'WScript': false; - readonly 'WSH': false; -} - -type GlobalsJquery = { - readonly '$': false; - readonly 'jQuery': false; -} - -type GlobalsYui = { - readonly 'YAHOO': false; - readonly 'YAHOO_config': false; - readonly 'YUI': false; - readonly 'YUI_config': false; -} - -type GlobalsShelljs = { - readonly 'cat': false; - readonly 'cd': false; - readonly 'chmod': false; - readonly 'config': false; - readonly 'cp': false; - readonly 'dirs': false; - readonly 'echo': false; - readonly 'env': false; - readonly 'error': false; - readonly 'exec': false; - readonly 'exit': false; - readonly 'find': false; - readonly 'grep': false; - readonly 'ln': false; - readonly 'ls': false; - readonly 'mkdir': false; - readonly 'mv': false; - readonly 'popd': false; - readonly 'pushd': false; - readonly 'pwd': false; - readonly 'rm': false; - readonly 'sed': false; - readonly 'set': false; - readonly 'target': false; - readonly 'tempdir': false; - readonly 'test': false; - readonly 'touch': false; - readonly 'which': false; -} - -type GlobalsPrototypejs = { - readonly '$': false; - readonly '$$': false; - readonly '$A': false; - readonly '$break': false; - readonly '$continue': false; - readonly '$F': false; - readonly '$H': false; - readonly '$R': false; - readonly '$w': false; - readonly 'Abstract': false; - readonly 'Ajax': false; - readonly 'Autocompleter': false; - readonly 'Builder': false; - readonly 'Class': false; - readonly 'Control': false; - readonly 'Draggable': false; - readonly 'Draggables': false; - readonly 'Droppables': false; - readonly 'Effect': false; - readonly 'Element': false; - readonly 'Enumerable': false; - readonly 'Event': false; - readonly 'Field': false; - readonly 'Form': false; - readonly 'Hash': false; - readonly 'Insertion': false; - readonly 'ObjectRange': false; - readonly 'PeriodicalExecuter': false; - readonly 'Position': false; - readonly 'Prototype': false; - readonly 'Scriptaculous': false; - readonly 'Selector': false; - readonly 'Sortable': false; - readonly 'SortableObserver': false; - readonly 'Sound': false; - readonly 'Template': false; - readonly 'Toggle': false; - readonly 'Try': false; -} - -type GlobalsMeteor = { - readonly '$': false; - readonly 'Accounts': false; - readonly 'AccountsClient': false; - readonly 'AccountsCommon': false; - readonly 'AccountsServer': false; - readonly 'App': false; - readonly 'Assets': false; - readonly 'Blaze': false; - readonly 'check': false; - readonly 'Cordova': false; - readonly 'DDP': false; - readonly 'DDPRateLimiter': false; - readonly 'DDPServer': false; - readonly 'Deps': false; - readonly 'EJSON': false; - readonly 'Email': false; - readonly 'HTTP': false; - readonly 'Log': false; - readonly 'Match': false; - readonly 'Meteor': false; - readonly 'Mongo': false; - readonly 'MongoInternals': false; - readonly 'Npm': false; - readonly 'Package': false; - readonly 'Plugin': false; - readonly 'process': false; - readonly 'Random': false; - readonly 'ReactiveDict': false; - readonly 'ReactiveVar': false; - readonly 'Router': false; - readonly 'ServiceConfiguration': false; - readonly 'Session': false; - readonly 'share': false; - readonly 'Spacebars': false; - readonly 'Template': false; - readonly 'Tinytest': false; - readonly 'Tracker': false; - readonly 'UI': false; - readonly 'Utils': false; - readonly 'WebApp': false; - readonly 'WebAppInternals': false; -} - -type GlobalsMongo = { - readonly '_isWindows': false; - readonly '_rand': false; - readonly 'BulkWriteResult': false; - readonly 'cat': false; - readonly 'cd': false; - readonly 'connect': false; - readonly 'db': false; - readonly 'getHostName': false; - readonly 'getMemInfo': false; - readonly 'hostname': false; - readonly 'ISODate': false; - readonly 'listFiles': false; - readonly 'load': false; - readonly 'ls': false; - readonly 'md5sumFile': false; - readonly 'mkdir': false; - readonly 'Mongo': false; - readonly 'NumberInt': false; - readonly 'NumberLong': false; - readonly 'ObjectId': false; - readonly 'PlanCache': false; - readonly 'print': false; - readonly 'printjson': false; - readonly 'pwd': false; - readonly 'quit': false; - readonly 'removeFile': false; - readonly 'rs': false; - readonly 'sh': false; - readonly 'UUID': false; - readonly 'version': false; - readonly 'WriteResult': false; -} - -type GlobalsApplescript = { - readonly '$': false; - readonly 'Application': false; - readonly 'Automation': false; - readonly 'console': false; - readonly 'delay': false; - readonly 'Library': false; - readonly 'ObjC': false; - readonly 'ObjectSpecifier': false; - readonly 'Path': false; - readonly 'Progress': false; - readonly 'Ref': false; -} - -type GlobalsServiceworker = { - readonly 'addEventListener': false; - readonly 'applicationCache': false; - readonly 'atob': false; - readonly 'Blob': false; - readonly 'BroadcastChannel': false; - readonly 'btoa': false; - readonly 'ByteLengthQueuingStrategy': false; - readonly 'Cache': false; - readonly 'caches': false; - readonly 'CacheStorage': false; - readonly 'clearInterval': false; - readonly 'clearTimeout': false; - readonly 'Client': false; - readonly 'clients': false; - readonly 'Clients': false; - readonly 'close': true; - readonly 'CompressionStream': false; - readonly 'console': false; - readonly 'CountQueuingStrategy': false; - readonly 'crypto': false; - readonly 'Crypto': false; - readonly 'CryptoKey': false; - readonly 'CustomEvent': false; - readonly 'DecompressionStream': false; - readonly 'ErrorEvent': false; - readonly 'Event': false; - readonly 'ExtendableEvent': false; - readonly 'ExtendableMessageEvent': false; - readonly 'fetch': false; - readonly 'FetchEvent': false; - readonly 'File': false; - readonly 'FileReaderSync': false; - readonly 'FormData': false; - readonly 'Headers': false; - readonly 'IDBCursor': false; - readonly 'IDBCursorWithValue': false; - readonly 'IDBDatabase': false; - readonly 'IDBFactory': false; - readonly 'IDBIndex': false; - readonly 'IDBKeyRange': false; - readonly 'IDBObjectStore': false; - readonly 'IDBOpenDBRequest': false; - readonly 'IDBRequest': false; - readonly 'IDBTransaction': false; - readonly 'IDBVersionChangeEvent': false; - readonly 'ImageData': false; - readonly 'importScripts': false; - readonly 'indexedDB': false; - readonly 'location': false; - readonly 'MessageChannel': false; - readonly 'MessageEvent': false; - readonly 'MessagePort': false; - readonly 'name': false; - readonly 'navigator': false; - readonly 'Notification': false; - readonly 'onclose': true; - readonly 'onconnect': true; - readonly 'onerror': true; - readonly 'onfetch': true; - readonly 'oninstall': true; - readonly 'onlanguagechange': true; - readonly 'onmessage': true; - readonly 'onmessageerror': true; - readonly 'onnotificationclick': true; - readonly 'onnotificationclose': true; - readonly 'onoffline': true; - readonly 'ononline': true; - readonly 'onpush': true; - readonly 'onpushsubscriptionchange': true; - readonly 'onrejectionhandled': true; - readonly 'onsync': true; - readonly 'onunhandledrejection': true; - readonly 'performance': false; - readonly 'Performance': false; - readonly 'PerformanceEntry': false; - readonly 'PerformanceMark': false; - readonly 'PerformanceMeasure': false; - readonly 'PerformanceNavigation': false; - readonly 'PerformanceObserver': false; - readonly 'PerformanceObserverEntryList': false; - readonly 'PerformanceResourceTiming': false; - readonly 'PerformanceTiming': false; - readonly 'postMessage': true; - readonly 'Promise': false; - readonly 'queueMicrotask': false; - readonly 'ReadableByteStreamController': false; - readonly 'ReadableStream': false; - readonly 'ReadableStreamBYOBReader': false; - readonly 'ReadableStreamBYOBRequest': false; - readonly 'ReadableStreamDefaultController': false; - readonly 'ReadableStreamDefaultReader': false; - readonly 'registration': false; - readonly 'removeEventListener': false; - readonly 'Request': false; - readonly 'Response': false; - readonly 'self': false; - readonly 'ServiceWorker': false; - readonly 'ServiceWorkerContainer': false; - readonly 'ServiceWorkerGlobalScope': false; - readonly 'ServiceWorkerMessageEvent': false; - readonly 'ServiceWorkerRegistration': false; - readonly 'setInterval': false; - readonly 'setTimeout': false; - readonly 'skipWaiting': false; - readonly 'SubtleCrypto': false; - readonly 'TextDecoder': false; - readonly 'TextDecoderStream': false; - readonly 'TextEncoder': false; - readonly 'TextEncoderStream': false; - readonly 'TransformStream': false; - readonly 'TransformStreamDefaultController': false; - readonly 'URL': false; - readonly 'URLSearchParams': false; - readonly 'WebAssembly': false; - readonly 'WebSocket': false; - readonly 'WindowClient': false; - readonly 'Worker': false; - readonly 'WorkerGlobalScope': false; - readonly 'WritableStream': false; - readonly 'WritableStreamDefaultController': false; - readonly 'WritableStreamDefaultWriter': false; - readonly 'XMLHttpRequest': false; -} - -type GlobalsAtomtest = { - readonly 'advanceClock': false; - readonly 'atom': false; - readonly 'fakeClearInterval': false; - readonly 'fakeClearTimeout': false; - readonly 'fakeSetInterval': false; - readonly 'fakeSetTimeout': false; - readonly 'resetTimeouts': false; - readonly 'waitsForPromise': false; -} - -type GlobalsEmbertest = { - readonly 'andThen': false; - readonly 'click': false; - readonly 'currentPath': false; - readonly 'currentRouteName': false; - readonly 'currentURL': false; - readonly 'fillIn': false; - readonly 'find': false; - readonly 'findAll': false; - readonly 'findWithAssert': false; - readonly 'keyEvent': false; - readonly 'pauseTest': false; - readonly 'resumeTest': false; - readonly 'triggerEvent': false; - readonly 'visit': false; - readonly 'wait': false; -} - -type GlobalsProtractor = { - readonly '$': false; - readonly '$$': false; - readonly 'browser': false; - readonly 'by': false; - readonly 'By': false; - readonly 'DartObject': false; - readonly 'element': false; - readonly 'protractor': false; -} - -type GlobalsSharednodebrowser = { - readonly 'AbortController': false; - readonly 'AbortSignal': false; - readonly 'atob': false; - readonly 'Blob': false; - readonly 'BroadcastChannel': false; - readonly 'btoa': false; - readonly 'ByteLengthQueuingStrategy': false; - readonly 'clearInterval': false; - readonly 'clearTimeout': false; - readonly 'CompressionStream': false; - readonly 'console': false; - readonly 'CountQueuingStrategy': false; - readonly 'crypto': false; - readonly 'Crypto': false; - readonly 'CryptoKey': false; - readonly 'CustomEvent': false; - readonly 'DecompressionStream': false; - readonly 'DOMException': false; - readonly 'Event': false; - readonly 'EventTarget': false; - readonly 'fetch': false; - readonly 'File': false; - readonly 'FormData': false; - readonly 'Headers': false; - readonly 'Intl': false; - readonly 'MessageChannel': false; - readonly 'MessageEvent': false; - readonly 'MessagePort': false; - readonly 'performance': false; - readonly 'PerformanceEntry': false; - readonly 'PerformanceMark': false; - readonly 'PerformanceMeasure': false; - readonly 'PerformanceObserver': false; - readonly 'PerformanceObserverEntryList': false; - readonly 'PerformanceResourceTiming': false; - readonly 'queueMicrotask': false; - readonly 'ReadableByteStreamController': false; - readonly 'ReadableStream': false; - readonly 'ReadableStreamBYOBReader': false; - readonly 'ReadableStreamBYOBRequest': false; - readonly 'ReadableStreamDefaultController': false; - readonly 'ReadableStreamDefaultReader': false; - readonly 'Request': false; - readonly 'Response': false; - readonly 'setInterval': false; - readonly 'setTimeout': false; - readonly 'structuredClone': false; - readonly 'SubtleCrypto': false; - readonly 'TextDecoder': false; - readonly 'TextDecoderStream': false; - readonly 'TextEncoder': false; - readonly 'TextEncoderStream': false; - readonly 'TransformStream': false; - readonly 'TransformStreamDefaultController': false; - readonly 'URL': false; - readonly 'URLSearchParams': false; - readonly 'WebAssembly': false; - readonly 'WritableStream': false; - readonly 'WritableStreamDefaultController': false; - readonly 'WritableStreamDefaultWriter': false; -} - -type GlobalsWebextensions = { - readonly 'browser': false; - readonly 'chrome': false; - readonly 'opr': false; -} - -type GlobalsGreasemonkey = { - readonly 'cloneInto': false; - readonly 'createObjectIn': false; - readonly 'exportFunction': false; - readonly 'GM': false; - readonly 'GM_addElement': false; - readonly 'GM_addStyle': false; - readonly 'GM_addValueChangeListener': false; - readonly 'GM_deleteValue': false; - readonly 'GM_download': false; - readonly 'GM_getResourceText': false; - readonly 'GM_getResourceURL': false; - readonly 'GM_getTab': false; - readonly 'GM_getTabs': false; - readonly 'GM_getValue': false; - readonly 'GM_info': false; - readonly 'GM_listValues': false; - readonly 'GM_log': false; - readonly 'GM_notification': false; - readonly 'GM_openInTab': false; - readonly 'GM_registerMenuCommand': false; - readonly 'GM_removeValueChangeListener': false; - readonly 'GM_saveTab': false; - readonly 'GM_setClipboard': false; - readonly 'GM_setValue': false; - readonly 'GM_unregisterMenuCommand': false; - readonly 'GM_xmlhttpRequest': false; - readonly 'unsafeWindow': false; -} - -type GlobalsDevtools = { - readonly '$': false; - readonly '$_': false; - readonly '$$': false; - readonly '$0': false; - readonly '$1': false; - readonly '$2': false; - readonly '$3': false; - readonly '$4': false; - readonly '$x': false; - readonly 'chrome': false; - readonly 'clear': false; - readonly 'copy': false; - readonly 'debug': false; - readonly 'dir': false; - readonly 'dirxml': false; - readonly 'getEventListeners': false; - readonly 'inspect': false; - readonly 'keys': false; - readonly 'monitor': false; - readonly 'monitorEvents': false; - readonly 'profile': false; - readonly 'profileEnd': false; - readonly 'queryObjects': false; - readonly 'table': false; - readonly 'undebug': false; - readonly 'unmonitor': false; - readonly 'unmonitorEvents': false; - readonly 'values': false; -} - -type Globals = { - readonly 'builtin': GlobalsBuiltin; - readonly 'es5': GlobalsEs5; - readonly 'es2015': GlobalsEs2015; - readonly 'es2017': GlobalsEs2017; - readonly 'es2020': GlobalsEs2020; - readonly 'es2021': GlobalsEs2021; - readonly 'browser': GlobalsBrowser; - readonly 'worker': GlobalsWorker; - readonly 'node': GlobalsNode; - readonly 'nodeBuiltin': GlobalsNodeBuiltin; - readonly 'commonjs': GlobalsCommonjs; - readonly 'amd': GlobalsAmd; - readonly 'mocha': GlobalsMocha; - readonly 'jasmine': GlobalsJasmine; - readonly 'jest': GlobalsJest; - readonly 'qunit': GlobalsQunit; - readonly 'phantomjs': GlobalsPhantomjs; - readonly 'couch': GlobalsCouch; - readonly 'rhino': GlobalsRhino; - readonly 'nashorn': GlobalsNashorn; - readonly 'wsh': GlobalsWsh; - readonly 'jquery': GlobalsJquery; - readonly 'yui': GlobalsYui; - readonly 'shelljs': GlobalsShelljs; - readonly 'prototypejs': GlobalsPrototypejs; - readonly 'meteor': GlobalsMeteor; - readonly 'mongo': GlobalsMongo; - readonly 'applescript': GlobalsApplescript; - readonly 'serviceworker': GlobalsServiceworker; - readonly 'atomtest': GlobalsAtomtest; - readonly 'embertest': GlobalsEmbertest; - readonly 'protractor': GlobalsProtractor; - readonly 'shared-node-browser': GlobalsSharednodebrowser; - readonly 'webextensions': GlobalsWebextensions; - readonly 'greasemonkey': GlobalsGreasemonkey; - readonly 'devtools': GlobalsDevtools; -} - -declare const globals: Globals; - -export = globals; diff --git a/node_modules/@eslint/eslintrc/node_modules/globals/index.js b/node_modules/@eslint/eslintrc/node_modules/globals/index.js deleted file mode 100644 index a951582..0000000 --- a/node_modules/@eslint/eslintrc/node_modules/globals/index.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -module.exports = require('./globals.json'); diff --git a/node_modules/@eslint/eslintrc/node_modules/globals/license b/node_modules/@eslint/eslintrc/node_modules/globals/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/@eslint/eslintrc/node_modules/globals/license +++ /dev/null @@ -1,9 +0,0 @@ -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/@eslint/eslintrc/node_modules/globals/package.json b/node_modules/@eslint/eslintrc/node_modules/globals/package.json deleted file mode 100644 index fca10a5..0000000 --- a/node_modules/@eslint/eslintrc/node_modules/globals/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "globals", - "version": "14.0.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" - }, - "sideEffects": false, - "engines": { - "node": ">=18" - }, - "scripts": { - "test": "xo && ava && tsd", - "prepare": "npm run --silent update-types", - "update-builtin-globals": "node scripts/get-builtin-globals.mjs", - "update-types": "node scripts/generate-types.mjs > index.d.ts" - }, - "files": [ - "index.js", - "index.d.ts", - "globals.json" - ], - "keywords": [ - "globals", - "global", - "identifiers", - "variables", - "vars", - "jshint", - "eslint", - "environments" - ], - "devDependencies": { - "ava": "^2.4.0", - "cheerio": "^1.0.0-rc.12", - "tsd": "^0.30.4", - "type-fest": "^4.10.2", - "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/@eslint/eslintrc/node_modules/globals/readme.md b/node_modules/@eslint/eslintrc/node_modules/globals/readme.md deleted file mode 100644 index 29442a8..0000000 --- a/node_modules/@eslint/eslintrc/node_modules/globals/readme.md +++ /dev/null @@ -1,44 +0,0 @@ -# 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 - -```sh -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. diff --git a/node_modules/@eslint/eslintrc/package.json b/node_modules/@eslint/eslintrc/package.json deleted file mode 100644 index dac77b4..0000000 --- a/node_modules/@eslint/eslintrc/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "@eslint/eslintrc", - "version": "3.2.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": { - "build": "rollup -c", - "lint": "eslint . --report-unused-disable-directives", - "lint:fix": "npm run lint -- --fix", - "prepare": "npm run build", - "release:generate:latest": "eslint-generate-release", - "release:generate:alpha": "eslint-generate-prerelease alpha", - "release:generate:beta": "eslint-generate-prerelease beta", - "release:generate:rc": "eslint-generate-prerelease rc", - "release:publish": "eslint-publish-release", - "test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'" - }, - "repository": "eslint/eslintrc", - "funding": "https://opencollective.com/eslint", - "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.5", - "sinon": "^11.1.2", - "temp-dir": "^2.0.0" - }, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.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": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/@eslint/eslintrc/universal.js b/node_modules/@eslint/eslintrc/universal.js deleted file mode 100644 index 4e1846e..0000000 --- a/node_modules/@eslint/eslintrc/universal.js +++ /dev/null @@ -1,9 +0,0 @@ -// 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/@eslint/js/LICENSE b/node_modules/@eslint/js/LICENSE deleted file mode 100644 index b607bb3..0000000 --- a/node_modules/@eslint/js/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -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/js/README.md b/node_modules/@eslint/js/README.md deleted file mode 100644 index 04fc5b2..0000000 --- a/node_modules/@eslint/js/README.md +++ /dev/null @@ -1,60 +0,0 @@ -[![npm version](https://img.shields.io/npm/v/@eslint/js.svg)](https://www.npmjs.com/package/@eslint/js) - -# ESLint JavaScript Plugin - -[Website](https://eslint.org) | [Configure ESLint](https://eslint.org/docs/latest/use/configure) | [Rules](https://eslint.org/docs/rules/) | [Contributing](https://eslint.org/docs/latest/contribute) | [Twitter](https://twitter.com/geteslint) | [Chatroom](https://eslint.org/chat) - -The beginnings of separating out JavaScript-specific functionality from ESLint. - -Right now, this plugin contains two configurations: - -* `recommended` - enables the rules recommended by the ESLint team (the replacement for `"eslint:recommended"`) -* `all` - enables all ESLint rules (the replacement for `"eslint:all"`) - -## Installation - -```shell -npm install @eslint/js -D -``` - -## Usage - -Use in your `eslint.config.js` file anytime you want to extend one of the configs: - -```js -import js from "@eslint/js"; - -export default [ - - // apply recommended rules to JS files - { - name: "your-project/recommended-rules", - files: ["**/*.js"], - rules: js.configs.recommended.rules - }, - - // apply recommended rules to JS files with an override - { - name: "your-project/recommended-rules-with-override", - files: ["**/*.js"], - rules: { - ...js.configs.recommended.rules, - "no-unused-vars": "warn" - } - }, - - // apply all rules to JS files - { - name: "your-project/all-rules", - files: ["**/*.js"], - rules: { - ...js.configs.all.rules, - "no-unused-vars": "warn" - } - } -] -``` - -## License - -MIT diff --git a/node_modules/@eslint/js/package.json b/node_modules/@eslint/js/package.json deleted file mode 100644 index a151eaf..0000000 --- a/node_modules/@eslint/js/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@eslint/js", - "version": "9.16.0", - "description": "ESLint JavaScript language implementation", - "main": "./src/index.js", - "types": "./types/index.d.ts", - "scripts": { - "test:types": "tsc -p tests/types/tsconfig.json" - }, - "files": [ - "LICENSE", - "README.md", - "src", - "types" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/eslint/eslint.git", - "directory": "packages/js" - }, - "homepage": "https://eslint.org", - "bugs": "https://github.com/eslint/eslint/issues/", - "keywords": [ - "javascript", - "eslint-plugin", - "eslint" - ], - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/@eslint/js/src/configs/eslint-all.js b/node_modules/@eslint/js/src/configs/eslint-all.js deleted file mode 100644 index e7f4e0e..0000000 --- a/node_modules/@eslint/js/src/configs/eslint-all.js +++ /dev/null @@ -1,217 +0,0 @@ -/* - * WARNING: This file is autogenerated using the tools/update-eslint-all.js - * script. Do not edit manually. - */ -"use strict"; - -/* eslint quote-props: off -- autogenerated so don't lint */ - -/* - * IMPORTANT! - * - * We cannot add a "name" property to this object because it's still used in eslintrc - * which doesn't support the "name" property. If we add a "name" property, it will - * cause an error. - */ - -module.exports = Object.freeze({ - "rules": { - "accessor-pairs": "error", - "array-callback-return": "error", - "arrow-body-style": "error", - "block-scoped-var": "error", - "camelcase": "error", - "capitalized-comments": "error", - "class-methods-use-this": "error", - "complexity": "error", - "consistent-return": "error", - "consistent-this": "error", - "constructor-super": "error", - "curly": "error", - "default-case": "error", - "default-case-last": "error", - "default-param-last": "error", - "dot-notation": "error", - "eqeqeq": "error", - "for-direction": "error", - "func-name-matching": "error", - "func-names": "error", - "func-style": "error", - "getter-return": "error", - "grouped-accessor-pairs": "error", - "guard-for-in": "error", - "id-denylist": "error", - "id-length": "error", - "id-match": "error", - "init-declarations": "error", - "logical-assignment-operators": "error", - "max-classes-per-file": "error", - "max-depth": "error", - "max-lines": "error", - "max-lines-per-function": "error", - "max-nested-callbacks": "error", - "max-params": "error", - "max-statements": "error", - "new-cap": "error", - "no-alert": "error", - "no-array-constructor": "error", - "no-async-promise-executor": "error", - "no-await-in-loop": "error", - "no-bitwise": "error", - "no-caller": "error", - "no-case-declarations": "error", - "no-class-assign": "error", - "no-compare-neg-zero": "error", - "no-cond-assign": "error", - "no-console": "error", - "no-const-assign": "error", - "no-constant-binary-expression": "error", - "no-constant-condition": "error", - "no-constructor-return": "error", - "no-continue": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-div-regex": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-else-if": "error", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-duplicate-imports": "error", - "no-else-return": "error", - "no-empty": "error", - "no-empty-character-class": "error", - "no-empty-function": "error", - "no-empty-pattern": "error", - "no-empty-static-block": "error", - "no-eq-null": "error", - "no-eval": "error", - "no-ex-assign": "error", - "no-extend-native": "error", - "no-extra-bind": "error", - "no-extra-boolean-cast": "error", - "no-extra-label": "error", - "no-fallthrough": "error", - "no-func-assign": "error", - "no-global-assign": "error", - "no-implicit-coercion": "error", - "no-implicit-globals": "error", - "no-implied-eval": "error", - "no-import-assign": "error", - "no-inline-comments": "error", - "no-inner-declarations": "error", - "no-invalid-regexp": "error", - "no-invalid-this": "error", - "no-irregular-whitespace": "error", - "no-iterator": "error", - "no-label-var": "error", - "no-labels": "error", - "no-lone-blocks": "error", - "no-lonely-if": "error", - "no-loop-func": "error", - "no-loss-of-precision": "error", - "no-magic-numbers": "error", - "no-misleading-character-class": "error", - "no-multi-assign": "error", - "no-multi-str": "error", - "no-negated-condition": "error", - "no-nested-ternary": "error", - "no-new": "error", - "no-new-func": "error", - "no-new-native-nonconstructor": "error", - "no-new-wrappers": "error", - "no-nonoctal-decimal-escape": "error", - "no-obj-calls": "error", - "no-object-constructor": "error", - "no-octal": "error", - "no-octal-escape": "error", - "no-param-reassign": "error", - "no-plusplus": "error", - "no-promise-executor-return": "error", - "no-proto": "error", - "no-prototype-builtins": "error", - "no-redeclare": "error", - "no-regex-spaces": "error", - "no-restricted-exports": "error", - "no-restricted-globals": "error", - "no-restricted-imports": "error", - "no-restricted-properties": "error", - "no-restricted-syntax": "error", - "no-return-assign": "error", - "no-script-url": "error", - "no-self-assign": "error", - "no-self-compare": "error", - "no-sequences": "error", - "no-setter-return": "error", - "no-shadow": "error", - "no-shadow-restricted-names": "error", - "no-sparse-arrays": "error", - "no-template-curly-in-string": "error", - "no-ternary": "error", - "no-this-before-super": "error", - "no-throw-literal": "error", - "no-undef": "error", - "no-undef-init": "error", - "no-undefined": "error", - "no-underscore-dangle": "error", - "no-unexpected-multiline": "error", - "no-unmodified-loop-condition": "error", - "no-unneeded-ternary": "error", - "no-unreachable": "error", - "no-unreachable-loop": "error", - "no-unsafe-finally": "error", - "no-unsafe-negation": "error", - "no-unsafe-optional-chaining": "error", - "no-unused-expressions": "error", - "no-unused-labels": "error", - "no-unused-private-class-members": "error", - "no-unused-vars": "error", - "no-use-before-define": "error", - "no-useless-assignment": "error", - "no-useless-backreference": "error", - "no-useless-call": "error", - "no-useless-catch": "error", - "no-useless-computed-key": "error", - "no-useless-concat": "error", - "no-useless-constructor": "error", - "no-useless-escape": "error", - "no-useless-rename": "error", - "no-useless-return": "error", - "no-var": "error", - "no-void": "error", - "no-warning-comments": "error", - "no-with": "error", - "object-shorthand": "error", - "one-var": "error", - "operator-assignment": "error", - "prefer-arrow-callback": "error", - "prefer-const": "error", - "prefer-destructuring": "error", - "prefer-exponentiation-operator": "error", - "prefer-named-capture-group": "error", - "prefer-numeric-literals": "error", - "prefer-object-has-own": "error", - "prefer-object-spread": "error", - "prefer-promise-reject-errors": "error", - "prefer-regex-literals": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", - "prefer-template": "error", - "radix": "error", - "require-atomic-updates": "error", - "require-await": "error", - "require-unicode-regexp": "error", - "require-yield": "error", - "sort-imports": "error", - "sort-keys": "error", - "sort-vars": "error", - "strict": "error", - "symbol-description": "error", - "unicode-bom": "error", - "use-isnan": "error", - "valid-typeof": "error", - "vars-on-top": "error", - "yoda": "error" - } -}); diff --git a/node_modules/@eslint/js/src/configs/eslint-recommended.js b/node_modules/@eslint/js/src/configs/eslint-recommended.js deleted file mode 100644 index 3559267..0000000 --- a/node_modules/@eslint/js/src/configs/eslint-recommended.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @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 */ - -/* - * IMPORTANT! - * - * We cannot add a "name" property to this object because it's still used in eslintrc - * which doesn't support the "name" property. If we add a "name" property, it will - * cause an error. - */ - -module.exports = Object.freeze({ - rules: Object.freeze({ - "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-binary-expression": "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-empty-static-block": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-fallthrough": "error", - "no-func-assign": "error", - "no-global-assign": "error", - "no-import-assign": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "error", - "no-loss-of-precision": "error", - "no-misleading-character-class": "error", - "no-new-native-nonconstructor": "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-private-class-members": "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/js/src/index.js b/node_modules/@eslint/js/src/index.js deleted file mode 100644 index f58dd79..0000000 --- a/node_modules/@eslint/js/src/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @fileoverview Main package entrypoint. - * @author Nicholas C. Zakas - */ - -"use strict"; - -const { version } = require("../package.json"); - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - meta: { - name: "@eslint/js", - version - }, - configs: { - all: require("./configs/eslint-all"), - recommended: require("./configs/eslint-recommended") - } -}; diff --git a/node_modules/@eslint/js/types/index.d.ts b/node_modules/@eslint/js/types/index.d.ts deleted file mode 100644 index 92de943..0000000 --- a/node_modules/@eslint/js/types/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Linter } from "eslint"; - -declare const js: { - readonly meta: { - readonly name: string; - readonly version: string; - }, - readonly configs: { - readonly recommended: { readonly rules: Readonly }; - readonly all: { readonly rules: Readonly }; - }; -}; - -export = js; diff --git a/node_modules/@eslint/object-schema/LICENSE b/node_modules/@eslint/object-schema/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@eslint/object-schema/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/object-schema/README.md b/node_modules/@eslint/object-schema/README.md deleted file mode 100644 index ff1d306..0000000 --- a/node_modules/@eslint/object-schema/README.md +++ /dev/null @@ -1,237 +0,0 @@ -# ObjectSchema Package - -## 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()`. This is used in the [`@eslint/config-array`](https://npmjs.com/package/@eslint/config-array) package but can also be used on its own. - -## Installation - -For Node.js and compatible runtimes: - -```shell -npm install @eslint/object-schema -# or -yarn add @eslint/object-schema -# or -pnpm install @eslint/object-schema -# or -bun install @eslint/object-schema -``` - -For Deno: - -```shell -deno add @eslint/object-schema -``` - -## Usage - -Import the `ObjectSchema` constructor: - -```js -// using ESM -import { ObjectSchema } from "@eslint/object-schema"; - -// using CommonJS -const { ObjectSchema } = require("@eslint/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 - -Apache 2.0 - -## Sponsors - -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) to get your logo on our README and website. - - - -

Platinum Sponsors

-

Automattic

Gold Sponsors

-

Eli Schleifer Salesforce Airbnb

Silver Sponsors

-

JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

notion Anagram Solver Icons8 Discord Ignition Nx HeroCoders

- diff --git a/node_modules/@eslint/object-schema/dist/cjs/index.cjs b/node_modules/@eslint/object-schema/dist/cjs/index.cjs deleted file mode 100644 index a9687a5..0000000 --- a/node_modules/@eslint/object-schema/dist/cjs/index.cjs +++ /dev/null @@ -1,455 +0,0 @@ -'use strict'; - -/** - * @fileoverview Merge Strategy - */ - -//----------------------------------------------------------------------------- -// 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); - } -} - -/** - * @fileoverview Validation Strategy - */ - -//----------------------------------------------------------------------------- -// 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."); - } - } -} - -/** - * @fileoverview Object Schema - */ - - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef {import("./types.ts").ObjectDefinition} ObjectDefinition */ -/** @typedef {import("./types.ts").PropertyDefinition} PropertyDefinition */ - -//----------------------------------------------------------------------------- -// Private -//----------------------------------------------------------------------------- - -/** - * Validates a schema strategy. - * @param {string} name The name of the key this strategy is for. - * @param {PropertyDefinition} definition The strategy for the object 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, definition) { - let hasSchema = false; - if (definition.schema) { - if (typeof definition.schema === "object") { - hasSchema = true; - } else { - throw new TypeError("Schema must be an object."); - } - } - - if (typeof definition.merge === "string") { - if (!(definition.merge in MergeStrategy)) { - throw new TypeError( - `Definition for key "${name}" missing valid merge strategy.`, - ); - } - } else if (!hasSchema && typeof definition.merge !== "function") { - throw new TypeError( - `Definition for key "${name}" must have a merge property.`, - ); - } - - if (typeof definition.validate === "string") { - if (!(definition.validate in ValidationStrategy)) { - throw new TypeError( - `Definition for key "${name}" missing valid validation strategy.`, - ); - } - } else if (!hasSchema && typeof definition.validate !== "function") { - throw new TypeError( - `Definition for key "${name}" must have a validate() method.`, - ); - } -} - -//----------------------------------------------------------------------------- -// Errors -//----------------------------------------------------------------------------- - -/** - * Error when an unexpected key is found. - */ -class UnexpectedKeyError extends Error { - /** - * Creates a new instance. - * @param {string} key The key that was unexpected. - */ - constructor(key) { - super(`Unexpected key "${key}" found.`); - } -} - -/** - * Error when a required key is missing. - */ -class MissingKeyError extends Error { - /** - * Creates a new instance. - * @param {string} key The key that was missing. - */ - constructor(key) { - super(`Missing required key "${key}".`); - } -} - -/** - * Error when a key requires other keys that are missing. - */ -class MissingDependentKeysError extends Error { - /** - * Creates a new instance. - * @param {string} key The key that was unexpected. - * @param {Array} requiredKeys The keys that are required. - */ - constructor(key, requiredKeys) { - super(`Key "${key}" requires keys "${requiredKeys.join('", "')}".`); - } -} - -/** - * Wrapper error for errors occuring during a merge or validate operation. - */ -class WrapperError extends Error { - /** - * Creates a new instance. - * @param {string} key The object key causing the error. - * @param {Error} source The source error. - */ - constructor(key, source) { - super(`Key "${key}": ${source.message}`, { cause: source }); - - // copy over custom properties that aren't represented - for (const sourceKey of Object.keys(source)) { - if (!(sourceKey in this)) { - this[sourceKey] = source[sourceKey]; - } - } - } -} - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- - -/** - * Represents an object validation/merging schema. - */ -class ObjectSchema { - /** - * Track all definitions in the schema by key. - * @type {Map} - */ - #definitions = new Map(); - - /** - * Separately track any keys that are required for faster validtion. - * @type {Map} - */ - #requiredKeys = new Map(); - - /** - * Creates a new instance. - * @param {ObjectDefinition} definitions The schema definitions. - */ - constructor(definitions) { - if (!definitions) { - throw new Error("Schema definitions missing."); - } - - // 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[ - /** @type {string} */ (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[ - /** @type {string} */ (definitions[key].validate) - ], - }; - } - - this.#definitions.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.#definitions.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 TypeError("merge() requires at least two arguments."); - } - - if ( - objects.some( - object => object === null || typeof object !== "object", - ) - ) { - throw new TypeError("All arguments must be objects."); - } - - return objects.reduce((result, object) => { - this.validate(object); - - for (const [key, strategy] of this.#definitions) { - try { - if (key in result || key in object) { - const merge = /** @type {Function} */ (strategy.merge); - const value = merge.call( - this, - result[key], - object[key], - ); - if (value !== undefined) { - result[key] = value; - } - } - } catch (ex) { - throw new WrapperError(key, 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 UnexpectedKeyError(key); - } - - // validate existing keys - const definition = this.#definitions.get(key); - - // first check to see if any other keys are required - if (Array.isArray(definition.requires)) { - if ( - !definition.requires.every(otherKey => otherKey in object) - ) { - throw new MissingDependentKeysError( - key, - definition.requires, - ); - } - } - - // now apply remaining validation strategy - try { - const validate = /** @type {Function} */ (definition.validate); - validate.call(definition, object[key]); - } catch (ex) { - throw new WrapperError(key, ex); - } - } - - // ensure required keys aren't missing - for (const [key] of this.#requiredKeys) { - if (!(key in object)) { - throw new MissingKeyError(key); - } - } - } -} - -exports.MergeStrategy = MergeStrategy; -exports.ObjectSchema = ObjectSchema; -exports.ValidationStrategy = ValidationStrategy; diff --git a/node_modules/@eslint/object-schema/dist/cjs/index.d.cts b/node_modules/@eslint/object-schema/dist/cjs/index.d.cts deleted file mode 100644 index 0775e9a..0000000 --- a/node_modules/@eslint/object-schema/dist/cjs/index.d.cts +++ /dev/null @@ -1,123 +0,0 @@ -export type ObjectDefinition = import("./types.ts").ObjectDefinition; -export type PropertyDefinition = import("./types.ts").PropertyDefinition; -/** - * @fileoverview Merge Strategy - */ -/** - * Container class for several different merge strategies. - */ -export 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: any, value2: any): any; - /** - * 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: any, value2: any): any; - /** - * 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: any, value2: any): any; -} -/** - * Represents an object validation/merging schema. - */ -export class ObjectSchema { - /** - * Creates a new instance. - * @param {ObjectDefinition} definitions The schema definitions. - */ - constructor(definitions: ObjectDefinition); - /** - * 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: string): boolean; - /** - * 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: any[]): any; - /** - * 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: any): void; - #private; -} -/** - * @fileoverview Validation Strategy - */ -/** - * Container class for several different validation strategies. - */ -export 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; -} diff --git a/node_modules/@eslint/object-schema/dist/cjs/types.ts b/node_modules/@eslint/object-schema/dist/cjs/types.ts deleted file mode 100644 index a4ca9a0..0000000 --- a/node_modules/@eslint/object-schema/dist/cjs/types.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @fileoverview Types for object-schema package. - */ - -/** - * Built-in validation strategies. - */ -export type BuiltInValidationStrategy = - | "array" - | "boolean" - | "number" - | "object" - | "object?" - | "string" - | "string!"; - -/** - * Built-in merge strategies. - */ -export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace"; - -/** - * Property definition. - */ -export interface PropertyDefinition { - /** - * Indicates if the property is required. - */ - required: boolean; - - /** - * The other properties that must be present when this property is used. - */ - requires?: string[]; - - /** - * The strategy to merge the property. - */ - merge: BuiltInMergeStrategy | ((target: any, source: any) => any); - - /** - * The strategy to validate the property. - */ - validate: BuiltInValidationStrategy | ((value: any) => void); - - /** - * The schema for the object value of this property. - */ - schema?: ObjectDefinition; -} - -/** - * Object definition. - */ -export type ObjectDefinition = Record; diff --git a/node_modules/@eslint/object-schema/dist/esm/index.d.ts b/node_modules/@eslint/object-schema/dist/esm/index.d.ts deleted file mode 100644 index 0775e9a..0000000 --- a/node_modules/@eslint/object-schema/dist/esm/index.d.ts +++ /dev/null @@ -1,123 +0,0 @@ -export type ObjectDefinition = import("./types.ts").ObjectDefinition; -export type PropertyDefinition = import("./types.ts").PropertyDefinition; -/** - * @fileoverview Merge Strategy - */ -/** - * Container class for several different merge strategies. - */ -export 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: any, value2: any): any; - /** - * 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: any, value2: any): any; - /** - * 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: any, value2: any): any; -} -/** - * Represents an object validation/merging schema. - */ -export class ObjectSchema { - /** - * Creates a new instance. - * @param {ObjectDefinition} definitions The schema definitions. - */ - constructor(definitions: ObjectDefinition); - /** - * 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: string): boolean; - /** - * 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: any[]): any; - /** - * 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: any): void; - #private; -} -/** - * @fileoverview Validation Strategy - */ -/** - * Container class for several different validation strategies. - */ -export 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; - /** - * 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: any): void; -} diff --git a/node_modules/@eslint/object-schema/dist/esm/index.js b/node_modules/@eslint/object-schema/dist/esm/index.js deleted file mode 100644 index 2e7bcd4..0000000 --- a/node_modules/@eslint/object-schema/dist/esm/index.js +++ /dev/null @@ -1,452 +0,0 @@ -// @ts-self-types="./index.d.ts" -/** - * @fileoverview Merge Strategy - */ - -//----------------------------------------------------------------------------- -// 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); - } -} - -/** - * @fileoverview Validation Strategy - */ - -//----------------------------------------------------------------------------- -// 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."); - } - } -} - -/** - * @fileoverview Object Schema - */ - - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef {import("./types.ts").ObjectDefinition} ObjectDefinition */ -/** @typedef {import("./types.ts").PropertyDefinition} PropertyDefinition */ - -//----------------------------------------------------------------------------- -// Private -//----------------------------------------------------------------------------- - -/** - * Validates a schema strategy. - * @param {string} name The name of the key this strategy is for. - * @param {PropertyDefinition} definition The strategy for the object 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, definition) { - let hasSchema = false; - if (definition.schema) { - if (typeof definition.schema === "object") { - hasSchema = true; - } else { - throw new TypeError("Schema must be an object."); - } - } - - if (typeof definition.merge === "string") { - if (!(definition.merge in MergeStrategy)) { - throw new TypeError( - `Definition for key "${name}" missing valid merge strategy.`, - ); - } - } else if (!hasSchema && typeof definition.merge !== "function") { - throw new TypeError( - `Definition for key "${name}" must have a merge property.`, - ); - } - - if (typeof definition.validate === "string") { - if (!(definition.validate in ValidationStrategy)) { - throw new TypeError( - `Definition for key "${name}" missing valid validation strategy.`, - ); - } - } else if (!hasSchema && typeof definition.validate !== "function") { - throw new TypeError( - `Definition for key "${name}" must have a validate() method.`, - ); - } -} - -//----------------------------------------------------------------------------- -// Errors -//----------------------------------------------------------------------------- - -/** - * Error when an unexpected key is found. - */ -class UnexpectedKeyError extends Error { - /** - * Creates a new instance. - * @param {string} key The key that was unexpected. - */ - constructor(key) { - super(`Unexpected key "${key}" found.`); - } -} - -/** - * Error when a required key is missing. - */ -class MissingKeyError extends Error { - /** - * Creates a new instance. - * @param {string} key The key that was missing. - */ - constructor(key) { - super(`Missing required key "${key}".`); - } -} - -/** - * Error when a key requires other keys that are missing. - */ -class MissingDependentKeysError extends Error { - /** - * Creates a new instance. - * @param {string} key The key that was unexpected. - * @param {Array} requiredKeys The keys that are required. - */ - constructor(key, requiredKeys) { - super(`Key "${key}" requires keys "${requiredKeys.join('", "')}".`); - } -} - -/** - * Wrapper error for errors occuring during a merge or validate operation. - */ -class WrapperError extends Error { - /** - * Creates a new instance. - * @param {string} key The object key causing the error. - * @param {Error} source The source error. - */ - constructor(key, source) { - super(`Key "${key}": ${source.message}`, { cause: source }); - - // copy over custom properties that aren't represented - for (const sourceKey of Object.keys(source)) { - if (!(sourceKey in this)) { - this[sourceKey] = source[sourceKey]; - } - } - } -} - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- - -/** - * Represents an object validation/merging schema. - */ -class ObjectSchema { - /** - * Track all definitions in the schema by key. - * @type {Map} - */ - #definitions = new Map(); - - /** - * Separately track any keys that are required for faster validtion. - * @type {Map} - */ - #requiredKeys = new Map(); - - /** - * Creates a new instance. - * @param {ObjectDefinition} definitions The schema definitions. - */ - constructor(definitions) { - if (!definitions) { - throw new Error("Schema definitions missing."); - } - - // 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[ - /** @type {string} */ (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[ - /** @type {string} */ (definitions[key].validate) - ], - }; - } - - this.#definitions.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.#definitions.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 TypeError("merge() requires at least two arguments."); - } - - if ( - objects.some( - object => object === null || typeof object !== "object", - ) - ) { - throw new TypeError("All arguments must be objects."); - } - - return objects.reduce((result, object) => { - this.validate(object); - - for (const [key, strategy] of this.#definitions) { - try { - if (key in result || key in object) { - const merge = /** @type {Function} */ (strategy.merge); - const value = merge.call( - this, - result[key], - object[key], - ); - if (value !== undefined) { - result[key] = value; - } - } - } catch (ex) { - throw new WrapperError(key, 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 UnexpectedKeyError(key); - } - - // validate existing keys - const definition = this.#definitions.get(key); - - // first check to see if any other keys are required - if (Array.isArray(definition.requires)) { - if ( - !definition.requires.every(otherKey => otherKey in object) - ) { - throw new MissingDependentKeysError( - key, - definition.requires, - ); - } - } - - // now apply remaining validation strategy - try { - const validate = /** @type {Function} */ (definition.validate); - validate.call(definition, object[key]); - } catch (ex) { - throw new WrapperError(key, ex); - } - } - - // ensure required keys aren't missing - for (const [key] of this.#requiredKeys) { - if (!(key in object)) { - throw new MissingKeyError(key); - } - } - } -} - -export { MergeStrategy, ObjectSchema, ValidationStrategy }; diff --git a/node_modules/@eslint/object-schema/dist/esm/types.d.ts b/node_modules/@eslint/object-schema/dist/esm/types.d.ts deleted file mode 100644 index 5a5f920..0000000 --- a/node_modules/@eslint/object-schema/dist/esm/types.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @fileoverview Types for object-schema package. - */ -/** - * Built-in validation strategies. - */ -export type BuiltInValidationStrategy = "array" | "boolean" | "number" | "object" | "object?" | "string" | "string!"; -/** - * Built-in merge strategies. - */ -export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace"; -/** - * Property definition. - */ -export interface PropertyDefinition { - /** - * Indicates if the property is required. - */ - required: boolean; - /** - * The other properties that must be present when this property is used. - */ - requires?: string[]; - /** - * The strategy to merge the property. - */ - merge: BuiltInMergeStrategy | ((target: any, source: any) => any); - /** - * The strategy to validate the property. - */ - validate: BuiltInValidationStrategy | ((value: any) => void); - /** - * The schema for the object value of this property. - */ - schema?: ObjectDefinition; -} -/** - * Object definition. - */ -export type ObjectDefinition = Record; diff --git a/node_modules/@eslint/object-schema/dist/esm/types.ts b/node_modules/@eslint/object-schema/dist/esm/types.ts deleted file mode 100644 index a4ca9a0..0000000 --- a/node_modules/@eslint/object-schema/dist/esm/types.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @fileoverview Types for object-schema package. - */ - -/** - * Built-in validation strategies. - */ -export type BuiltInValidationStrategy = - | "array" - | "boolean" - | "number" - | "object" - | "object?" - | "string" - | "string!"; - -/** - * Built-in merge strategies. - */ -export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace"; - -/** - * Property definition. - */ -export interface PropertyDefinition { - /** - * Indicates if the property is required. - */ - required: boolean; - - /** - * The other properties that must be present when this property is used. - */ - requires?: string[]; - - /** - * The strategy to merge the property. - */ - merge: BuiltInMergeStrategy | ((target: any, source: any) => any); - - /** - * The strategy to validate the property. - */ - validate: BuiltInValidationStrategy | ((value: any) => void); - - /** - * The schema for the object value of this property. - */ - schema?: ObjectDefinition; -} - -/** - * Object definition. - */ -export type ObjectDefinition = Record; diff --git a/node_modules/@eslint/object-schema/package.json b/node_modules/@eslint/object-schema/package.json deleted file mode 100644 index 2a09a76..0000000 --- a/node_modules/@eslint/object-schema/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@eslint/object-schema", - "version": "2.1.4", - "description": "An object schema merger/validator", - "type": "module", - "main": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", - "exports": { - "require": { - "types": "./dist/cjs/index.d.cts", - "default": "./dist/cjs/index.cjs" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "directories": { - "test": "tests" - }, - "scripts": { - "build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"", - "build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run", - "test": "mocha tests/", - "test:coverage": "c8 npm test" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/rewrite.git" - }, - "keywords": [ - "object", - "validation", - "schema", - "merge" - ], - "author": "Nicholas C. Zakas", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/eslint/rewrite/issues" - }, - "homepage": "https://github.com/eslint/rewrite#readme", - "devDependencies": { - "c8": "^9.1.0", - "mocha": "^10.4.0", - "rollup": "^4.16.2", - "rollup-plugin-copy": "^3.5.0", - "typescript": "^5.4.5" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } -} diff --git a/node_modules/@eslint/plugin-kit/LICENSE b/node_modules/@eslint/plugin-kit/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@eslint/plugin-kit/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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-kit/README.md b/node_modules/@eslint/plugin-kit/README.md deleted file mode 100644 index bd77edc..0000000 --- a/node_modules/@eslint/plugin-kit/README.md +++ /dev/null @@ -1,273 +0,0 @@ -# ESLint Plugin Kit - -## Description - -A collection of utilities to help build ESLint plugins. - -## Installation - -For Node.js and compatible runtimes: - -```shell -npm install @eslint/plugin-kit -# or -yarn add @eslint/plugin-kit -# or -pnpm install @eslint/plugin-kit -# or -bun install @eslint/plugin-kit -``` - -For Deno: - -```shell -deno add @eslint/plugin-kit -``` - -## Usage - -This package exports the following utilities: - -- `ConfigCommentParser` - used to parse ESLint configuration comments (i.e., `/* eslint-disable rule */`) -- `VisitNodeStep` and `CallMethodStep` - used to help implement `SourceCode#traverse()` -- `Directive` - used to help implement `SourceCode#getDisableDirectives()` -- `TextSourceCodeBase` - base class to help implement the `SourceCode` interface - -### `ConfigCommentParser` - -To use the `ConfigCommentParser` class, import it from the package and create a new instance, such as: - -```js -import { ConfigCommentParser } from "@eslint/plugin-kit"; - -// create a new instance -const commentParser = new ConfigCommentParser(); - -// pass in a comment string without the comment delimiters -const directive = commentParser.parseDirective( - "eslint-disable prefer-const, semi -- I don't want to use these.", -); - -// will be undefined when a directive can't be parsed -if (directive) { - console.log(directive.label); // "eslint-disable" - console.log(directive.value); // "prefer-const, semi" - console.log(directive.justification); // "I don't want to use these" -} -``` - -There are different styles of directive values that you'll need to parse separately to get the correct format: - -```js -import { ConfigCommentParser } from "@eslint/plugin-kit"; - -// create a new instance -const commentParser = new ConfigCommentParser(); - -// list format -const list = commentParser.parseListConfig("prefer-const, semi"); -console.log(Object.entries(list)); // [["prefer-const", true], ["semi", true]] - -// string format -const strings = commentParser.parseStringConfig("foo:off, bar"); -console.log(Object.entries(strings)); // [["foo", "off"], ["bar", null]] - -// JSON-like config format -const jsonLike = commentParser.parseJSONLikeConfig( - "semi:[error, never], prefer-const: warn", -); -console.log(Object.entries(jsonLike.config)); // [["semi", ["error", "never"]], ["prefer-const", "warn"]] -``` - -### `VisitNodeStep` and `CallMethodStep` - -The `VisitNodeStep` and `CallMethodStep` classes represent steps in the traversal of source code. They implement the correct interfaces to return from the `SourceCode#traverse()` method. - -The `VisitNodeStep` class is the more common of the two, where you are describing a visit to a particular node during the traversal. The constructor accepts three arguments: - -- `target` - the node being visited. This is used to determine the method to call inside of a rule. For instance, if the node's type is `Literal` then ESLint will call a method named `Literal()` on the rule (if present). -- `phase` - either 1 for enter or 2 for exit. -- `args` - an array of arguments to pass into the visitor method of a rule. - -For example: - -```js -import { VisitNodeStep } from "@eslint/plugin-kit"; - -class MySourceCode { - traverse() { - const steps = []; - - for (const { node, parent, phase } of iterator(this.ast)) { - steps.push( - new VisitNodeStep({ - target: node, - phase: phase === "enter" ? 1 : 2, - args: [node, parent], - }), - ); - } - - return steps; - } -} -``` - -The `CallMethodStep` class is less common and is used to tell ESLint to call a specific method on the rule. The constructor accepts two arguments: - -- `target` - the name of the method to call, frequently beginning with `"on"` such as `"onCodePathStart"`. -- `args` - an array of arguments to pass to the method. - -For example: - -```js -import { VisitNodeStep, CallMethodStep } from "@eslint/plugin-kit"; - -class MySourceCode { - - traverse() { - - const steps = []; - - for (const { node, parent, phase } of iterator(this.ast)) { - steps.push( - new VisitNodeStep({ - target: node, - phase: phase === "enter" ? 1 : 2, - args: [node, parent], - }), - ); - - // call a method indicating how many times we've been through the loop - steps.push( - new CallMethodStep({ - target: "onIteration", - args: [steps.length] - }); - ) - } - - return steps; - } -} -``` - -### `Directive` - -The `Directive` class represents a disable directive in the source code and implements the `Directive` interface from `@eslint/core`. You can tell ESLint about disable directives using the `SourceCode#getDisableDirectives()` method, where part of the return value is an array of `Directive` objects. Here's an example: - -```js -import { Directive, ConfigCommentParser } from "@eslint/plugin-kit"; - -class MySourceCode { - getDisableDirectives() { - const directives = []; - const problems = []; - const commentParser = new ConfigCommentParser(); - - // read in the inline config nodes to check each one - this.getInlineConfigNodes().forEach(comment => { - // Step 1: Parse the directive - const { label, value, justification } = - commentParser.parseDirective(comment.value); - - // Step 2: Extract the directive value and create the `Directive` object - switch (label) { - case "eslint-disable": - case "eslint-enable": - case "eslint-disable-next-line": - case "eslint-disable-line": { - const directiveType = label.slice("eslint-".length); - - directives.push( - new Directive({ - type: directiveType, - node: comment, - value, - justification, - }), - ); - } - - // ignore any comments that don't begin with known labels - } - }); - - return { - directives, - problems, - }; - } -} -``` - -### `TextSourceCodeBase` - -The `TextSourceCodeBase` class is intended to be a base class that has several of the common members found in `SourceCode` objects already implemented. Those members are: - -- `lines` - an array of text lines that is created automatically when the constructor is called. -- `getLoc(node)` - gets the location of a node. Works for nodes that have the ESLint-style `loc` property and nodes that have the Unist-style [`position` property](https://github.com/syntax-tree/unist?tab=readme-ov-file#position). If you're using an AST with a different location format, you'll still need to implement this method yourself. -- `getRange(node)` - gets the range of a node within the source text. Works for nodes that have the ESLint-style `range` property and nodes that have the Unist-style [`position` property](https://github.com/syntax-tree/unist?tab=readme-ov-file#position). If you're using an AST with a different range format, you'll still need to implement this method yourself. -- `getText(nodeOrToken, charsBefore, charsAfter)` - gets the source text for the given node or token that has range information attached. Optionally, can return additional characters before and after the given node or token. As long as `getRange()` is properly implemented, this method will just work. -- `getAncestors(node)` - returns the ancestry of the node. In order for this to work, you must implement the `getParent()` method yourself. - -Here's an example: - -```js -import { TextSourceCodeBase } from "@eslint/plugin-kit"; - -export class MySourceCode extends TextSourceCodeBase { - #parents = new Map(); - - constructor({ ast, text }) { - super({ ast, text }); - } - - getParent(node) { - return this.#parents.get(node); - } - - traverse() { - const steps = []; - - for (const { node, parent, phase } of iterator(this.ast)) { - //save the parent information - this.#parent.set(node, parent); - - steps.push( - new VisitNodeStep({ - target: node, - phase: phase === "enter" ? 1 : 2, - args: [node, parent], - }), - ); - } - - return steps; - } -} -``` - -In general, it's safe to collect the parent information during the `traverse()` method as `getParent()` and `getAncestor()` will only be called from rules once the AST has been traversed at least once. - -## License - -Apache 2.0 - - - - -## Sponsors - -The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate) -to get your logo on our READMEs and [website](https://eslint.org/sponsors). - -

Platinum Sponsors

-

Automattic Airbnb

Gold Sponsors

-

trunk.io

Silver Sponsors

-

SERP Triumph JetBrains Liftoff American Express Workleap

Bronze Sponsors

-

Cybozu Syntax WordHint Anagram Solver Icons8 Discord GitBook Nx HeroCoders

-

Technology Sponsors

-Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work. -

Netlify Algolia 1Password

- diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs b/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs deleted file mode 100644 index 0445173..0000000 --- a/node_modules/@eslint/plugin-kit/dist/cjs/index.cjs +++ /dev/null @@ -1,610 +0,0 @@ -'use strict'; - -var levn = require('levn'); - -/** - * @fileoverview Config Comment Parser - * @author Nicholas C. Zakas - */ - - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** @typedef {import("@eslint/core").RuleConfig} RuleConfig */ -/** @typedef {import("@eslint/core").RulesConfig} RulesConfig */ -/** @typedef {import("./types.ts").StringConfig} StringConfig */ -/** @typedef {import("./types.ts").BooleanConfig} BooleanConfig */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u; -const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]); - -/** - * Determines if the severity in the rule configuration is valid. - * @param {RuleConfig} ruleConfig A rule's configuration. - */ -function isSeverityValid(ruleConfig) { - const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; - return validSeverities.has(severity); -} - -/** - * Determines if all severities in the rules configuration are valid. - * @param {RulesConfig} rulesConfig The rules configuration to check. - * @returns {boolean} `true` if all severities are valid, otherwise `false`. - */ -function isEverySeverityValid(rulesConfig) { - return Object.values(rulesConfig).every(isSeverityValid); -} - -/** - * Represents a directive comment. - */ -class DirectiveComment { - /** - * The label of the directive, such as "eslint", "eslint-disable", etc. - * @type {string} - */ - label = ""; - - /** - * The value of the directive (the string after the label). - * @type {string} - */ - value = ""; - - /** - * The justification of the directive (the string after the --). - * @type {string} - */ - justification = ""; - - /** - * Creates a new directive comment. - * @param {string} label The label of the directive. - * @param {string} value The value of the directive. - * @param {string} justification The justification of the directive. - */ - constructor(label, value, justification) { - this.label = label; - this.value = value; - this.justification = justification; - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Object to parse ESLint configuration comments. - */ -class ConfigCommentParser { - /** - * Parses a list of "name:string_value" or/and "name" options divided by comma or - * whitespace. Used for "global" comments. - * @param {string} string The string to parse. - * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. - */ - parseStringConfig(string) { - const items = /** @type {StringConfig} */ ({}); - - // Collapse whitespace around `:` and `,` to make parsing easier - const trimmedString = string - .trim() - .replace(/(? { - if (!name) { - return; - } - - // value defaults to null (if not provided), e.g: "foo" => ["foo", null] - const [key, value = null] = name.split(":"); - - items[key] = value; - }); - - return items; - } - - /** - * Parses a JSON-like config. - * @param {string} string The string to parse. - * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object - */ - parseJSONLikeConfig(string) { - // Parses a JSON-like comment by the same way as parsing CLI option. - try { - const items = levn.parse("Object", string) || {}; - - /* - * When the configuration has any invalid severities, it should be completely - * ignored. This is because the configuration is not valid and should not be - * applied. - * - * For example, the following configuration is invalid: - * - * "no-alert: 2 no-console: 2" - * - * This results in a configuration of { "no-alert": "2 no-console: 2" }, which is - * not valid. In this case, the configuration should be ignored. - */ - if (isEverySeverityValid(items)) { - return { - ok: true, - config: items, - }; - } - } catch { - // levn parsing error: 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. - */ - const normalizedString = string - .replace(/([-a-zA-Z0-9/]+):/gu, '"$1":') - .replace(/(\]|[0-9])\s+(?=")/u, "$1,"); - - try { - const items = JSON.parse(`{${normalizedString}}`); - - return { - ok: true, - config: items, - }; - } catch (ex) { - const errorMessage = ex instanceof Error ? ex.message : String(ex); - - return { - ok: false, - error: { - message: `Failed to parse JSON from '${normalizedString}': ${errorMessage}`, - }, - }; - } - } - - /** - * Parses a config of values separated by comma. - * @param {string} string The string to parse. - * @returns {BooleanConfig} Result map of values and true values - */ - parseListConfig(string) { - const items = /** @type {BooleanConfig} */ ({}); - - string.split(",").forEach(name => { - const trimmedName = name - .trim() - .replace( - /^(?['"]?)(?.*)\k$/su, - "$", - ); - - if (trimmedName) { - items[trimmedName] = true; - } - }); - - return items; - } - - /** - * 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. - */ - #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 a directive comment into directive text and value. - * @param {string} string The string with the directive to be parsed. - * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. - */ - parseDirective(string) { - const { directivePart, justificationPart } = - this.#extractDirectiveComment(string); - const match = directivesPattern.exec(directivePart); - - if (!match) { - return undefined; - } - - const directiveText = match[1]; - const directiveValue = directivePart.slice( - match.index + directiveText.length, - ); - - return new DirectiveComment( - directiveText, - directiveValue.trim(), - justificationPart, - ); - } -} - -/** - * @fileoverview A collection of helper classes for implementing `SourceCode`. - * @author Nicholas C. Zakas - */ - -/* eslint class-methods-use-this: off -- Required to complete interface. */ - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** @typedef {import("@eslint/core").VisitTraversalStep} VisitTraversalStep */ -/** @typedef {import("@eslint/core").CallTraversalStep} CallTraversalStep */ -/** @typedef {import("@eslint/core").TextSourceCode} TextSourceCode */ -/** @typedef {import("@eslint/core").TraversalStep} TraversalStep */ -/** @typedef {import("@eslint/core").SourceLocation} SourceLocation */ -/** @typedef {import("@eslint/core").SourceLocationWithOffset} SourceLocationWithOffset */ -/** @typedef {import("@eslint/core").SourceRange} SourceRange */ -/** @typedef {import("@eslint/core").Directive} IDirective */ -/** @typedef {import("@eslint/core").DirectiveType} DirectiveType */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Determines if a node has ESTree-style loc information. - * @param {object} node The node to check. - * @returns {node is {loc:SourceLocation}} `true` if the node has ESTree-style loc information, `false` if not. - */ -function hasESTreeStyleLoc(node) { - return "loc" in node; -} - -/** - * Determines if a node has position-style loc information. - * @param {object} node The node to check. - * @returns {node is {position:SourceLocation}} `true` if the node has position-style range information, `false` if not. - */ -function hasPosStyleLoc(node) { - return "position" in node; -} - -/** - * Determines if a node has ESTree-style range information. - * @param {object} node The node to check. - * @returns {node is {range:SourceRange}} `true` if the node has ESTree-style range information, `false` if not. - */ -function hasESTreeStyleRange(node) { - return "range" in node; -} - -/** - * Determines if a node has position-style range information. - * @param {object} node The node to check. - * @returns {node is {position:SourceLocationWithOffset}} `true` if the node has position-style range information, `false` if not. - */ -function hasPosStyleRange(node) { - return "position" in node; -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class to represent a step in the traversal process where a node is visited. - * @implements {VisitTraversalStep} - */ -class VisitNodeStep { - /** - * The type of the step. - * @type {"visit"} - * @readonly - */ - type = "visit"; - - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {1} - * @readonly - */ - kind = 1; - - /** - * The target of the step. - * @type {object} - */ - target; - - /** - * The phase of the step. - * @type {1|2} - */ - phase; - - /** - * The arguments of the step. - * @type {Array} - */ - args; - - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {object} options.target The target of the step. - * @param {1|2} options.phase The phase of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, phase, args }) { - this.target = target; - this.phase = phase; - this.args = args; - } -} - -/** - * A class to represent a step in the traversal process where a - * method is called. - * @implements {CallTraversalStep} - */ -class CallMethodStep { - /** - * The type of the step. - * @type {"call"} - * @readonly - */ - type = "call"; - - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {2} - * @readonly - */ - kind = 2; - - /** - * The name of the method to call. - * @type {string} - */ - target; - - /** - * The arguments to pass to the method. - * @type {Array} - */ - args; - - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {string} options.target The target of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, args }) { - this.target = target; - this.args = args; - } -} - -/** - * A class to represent a directive comment. - * @implements {IDirective} - */ -class Directive { - /** - * The type of directive. - * @type {DirectiveType} - * @readonly - */ - type; - - /** - * The node representing the directive. - * @type {unknown} - * @readonly - */ - node; - - /** - * Everything after the "eslint-disable" portion of the directive, - * but before the "--" that indicates the justification. - * @type {string} - * @readonly - */ - value; - - /** - * The justification for the directive. - * @type {string} - * @readonly - */ - justification; - - /** - * Creates a new instance. - * @param {Object} options The options for the directive. - * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. - * @param {unknown} options.node The node representing the directive. - * @param {string} options.value The value of the directive. - * @param {string} options.justification The justification for the directive. - */ - constructor({ type, node, value, justification }) { - this.type = type; - this.node = node; - this.value = value; - this.justification = justification; - } -} - -/** - * Source Code Base Object - * @implements {TextSourceCode} - */ -class TextSourceCodeBase { - /** - * The lines of text in the source code. - * @type {Array} - */ - #lines; - - /** - * The AST of the source code. - * @type {object} - */ - ast; - - /** - * The text of the source code. - * @type {string} - */ - text; - - /** - * Creates a new instance. - * @param {Object} options The options for the instance. - * @param {string} options.text The source code text. - * @param {object} options.ast The root AST node. - * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. - */ - constructor({ text, ast, lineEndingPattern = /\r?\n/u }) { - this.ast = ast; - this.text = text; - this.#lines = text.split(lineEndingPattern); - } - - /** - * Returns the loc information for the given node or token. - * @param {object} nodeOrToken The node or token to get the loc information for. - * @returns {SourceLocation} The loc information for the node or token. - */ - getLoc(nodeOrToken) { - if (hasESTreeStyleLoc(nodeOrToken)) { - return nodeOrToken.loc; - } - - if (hasPosStyleLoc(nodeOrToken)) { - return nodeOrToken.position; - } - - throw new Error( - "Custom getLoc() method must be implemented in the subclass.", - ); - } - - /** - * Returns the range information for the given node or token. - * @param {object} nodeOrToken The node or token to get the range information for. - * @returns {SourceRange} The range information for the node or token. - */ - getRange(nodeOrToken) { - if (hasESTreeStyleRange(nodeOrToken)) { - return nodeOrToken.range; - } - - if (hasPosStyleRange(nodeOrToken)) { - return [ - nodeOrToken.position.start.offset, - nodeOrToken.position.end.offset, - ]; - } - - throw new Error( - "Custom getRange() method must be implemented in the subclass.", - ); - } - - /* eslint-disable no-unused-vars -- Required to complete interface. */ - /** - * Returns the parent of the given node. - * @param {object} node The node to get the parent of. - * @returns {object|undefined} The parent of the node. - */ - getParent(node) { - throw new Error("Not implemented."); - } - /* eslint-enable no-unused-vars -- Required to complete interface. */ - - /** - * Gets all the ancestors of a given node - * @param {object} node The node - * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting - * from the root node at index 0 and going inwards to the parent node. - * @throws {TypeError} When `node` is missing. - */ - getAncestors(node) { - if (!node) { - throw new TypeError("Missing required argument: node."); - } - - const ancestorsStartingAtParent = []; - - for ( - let ancestor = this.getParent(node); - ancestor; - ancestor = this.getParent(ancestor) - ) { - ancestorsStartingAtParent.push(ancestor); - } - - return ancestorsStartingAtParent.reverse(); - } - - /** - * Gets the source code for the given node. - * @param {object} [node] The AST node to get the text for. - * @param {number} [beforeCount] The number of characters before the node to retrieve. - * @param {number} [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) { - const range = this.getRange(node); - return this.text.slice( - Math.max(range[0] - (beforeCount || 0), 0), - 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 - */ - get lines() { - return this.#lines; - } - - /** - * Traverse the source code and return the steps that were taken. - * @returns {Iterable} The steps that were taken while traversing the source code. - */ - traverse() { - throw new Error("Not implemented."); - } -} - -exports.CallMethodStep = CallMethodStep; -exports.ConfigCommentParser = ConfigCommentParser; -exports.Directive = Directive; -exports.TextSourceCodeBase = TextSourceCodeBase; -exports.VisitNodeStep = VisitNodeStep; diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts b/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts deleted file mode 100644 index 90b4a31..0000000 --- a/node_modules/@eslint/plugin-kit/dist/cjs/index.d.cts +++ /dev/null @@ -1,286 +0,0 @@ -export type VisitTraversalStep = import("@eslint/core").VisitTraversalStep; -export type CallTraversalStep = import("@eslint/core").CallTraversalStep; -export type TextSourceCode = import("@eslint/core").TextSourceCode; -export type TraversalStep = import("@eslint/core").TraversalStep; -export type SourceLocation = import("@eslint/core").SourceLocation; -export type SourceLocationWithOffset = import("@eslint/core").SourceLocationWithOffset; -export type SourceRange = import("@eslint/core").SourceRange; -export type IDirective = import("@eslint/core").Directive; -export type DirectiveType = import("@eslint/core").DirectiveType; -export type RuleConfig = import("@eslint/core").RuleConfig; -export type RulesConfig = import("@eslint/core").RulesConfig; -export type StringConfig = import("./types.ts").StringConfig; -export type BooleanConfig = import("./types.ts").BooleanConfig; -/** - * A class to represent a step in the traversal process where a - * method is called. - * @implements {CallTraversalStep} - */ -export class CallMethodStep implements CallTraversalStep { - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {string} options.target The target of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, args }: { - target: string; - args: Array; - }); - /** - * The type of the step. - * @type {"call"} - * @readonly - */ - readonly type: "call"; - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {2} - * @readonly - */ - readonly kind: 2; - /** - * The name of the method to call. - * @type {string} - */ - target: string; - /** - * The arguments to pass to the method. - * @type {Array} - */ - args: Array; -} -/** - * Object to parse ESLint configuration comments. - */ -export class ConfigCommentParser { - /** - * Parses a list of "name:string_value" or/and "name" options divided by comma or - * whitespace. Used for "global" comments. - * @param {string} string The string to parse. - * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. - */ - parseStringConfig(string: string): StringConfig; - /** - * Parses a JSON-like config. - * @param {string} string The string to parse. - * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object - */ - parseJSONLikeConfig(string: string): ({ - ok: true; - config: RulesConfig; - } | { - ok: false; - error: { - message: string; - }; - }); - /** - * Parses a config of values separated by comma. - * @param {string} string The string to parse. - * @returns {BooleanConfig} Result map of values and true values - */ - parseListConfig(string: string): BooleanConfig; - /** - * Parses a directive comment into directive text and value. - * @param {string} string The string with the directive to be parsed. - * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. - */ - parseDirective(string: string): DirectiveComment | undefined; - #private; -} -/** - * A class to represent a directive comment. - * @implements {IDirective} - */ -export class Directive implements IDirective { - /** - * Creates a new instance. - * @param {Object} options The options for the directive. - * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. - * @param {unknown} options.node The node representing the directive. - * @param {string} options.value The value of the directive. - * @param {string} options.justification The justification for the directive. - */ - constructor({ type, node, value, justification }: { - type: "disable" | "enable" | "disable-next-line" | "disable-line"; - node: unknown; - value: string; - justification: string; - }); - /** - * The type of directive. - * @type {DirectiveType} - * @readonly - */ - readonly type: DirectiveType; - /** - * The node representing the directive. - * @type {unknown} - * @readonly - */ - readonly node: unknown; - /** - * Everything after the "eslint-disable" portion of the directive, - * but before the "--" that indicates the justification. - * @type {string} - * @readonly - */ - readonly value: string; - /** - * The justification for the directive. - * @type {string} - * @readonly - */ - readonly justification: string; -} -/** - * Source Code Base Object - * @implements {TextSourceCode} - */ -export class TextSourceCodeBase implements TextSourceCode { - /** - * Creates a new instance. - * @param {Object} options The options for the instance. - * @param {string} options.text The source code text. - * @param {object} options.ast The root AST node. - * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. - */ - constructor({ text, ast, lineEndingPattern }: { - text: string; - ast: object; - lineEndingPattern?: RegExp; - }); - /** - * The AST of the source code. - * @type {object} - */ - ast: object; - /** - * The text of the source code. - * @type {string} - */ - text: string; - /** - * Returns the loc information for the given node or token. - * @param {object} nodeOrToken The node or token to get the loc information for. - * @returns {SourceLocation} The loc information for the node or token. - */ - getLoc(nodeOrToken: object): SourceLocation; - /** - * Returns the range information for the given node or token. - * @param {object} nodeOrToken The node or token to get the range information for. - * @returns {SourceRange} The range information for the node or token. - */ - getRange(nodeOrToken: object): SourceRange; - /** - * Returns the parent of the given node. - * @param {object} node The node to get the parent of. - * @returns {object|undefined} The parent of the node. - */ - getParent(node: object): object | undefined; - /** - * Gets all the ancestors of a given node - * @param {object} node The node - * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting - * from the root node at index 0 and going inwards to the parent node. - * @throws {TypeError} When `node` is missing. - */ - getAncestors(node: object): Array; - /** - * Gets the source code for the given node. - * @param {object} [node] The AST node to get the text for. - * @param {number} [beforeCount] The number of characters before the node to retrieve. - * @param {number} [afterCount] The number of characters after the node to retrieve. - * @returns {string} The text representing the AST node. - * @public - */ - public getText(node?: object, beforeCount?: number, afterCount?: number): string; - /** - * Gets the entire source text split into an array of lines. - * @returns {Array} The source text as an array of lines. - * @public - */ - public get lines(): string[]; - /** - * Traverse the source code and return the steps that were taken. - * @returns {Iterable} The steps that were taken while traversing the source code. - */ - traverse(): Iterable; - #private; -} -/** - * A class to represent a step in the traversal process where a node is visited. - * @implements {VisitTraversalStep} - */ -export class VisitNodeStep implements VisitTraversalStep { - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {object} options.target The target of the step. - * @param {1|2} options.phase The phase of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, phase, args }: { - target: object; - phase: 1 | 2; - args: Array; - }); - /** - * The type of the step. - * @type {"visit"} - * @readonly - */ - readonly type: "visit"; - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {1} - * @readonly - */ - readonly kind: 1; - /** - * The target of the step. - * @type {object} - */ - target: object; - /** - * The phase of the step. - * @type {1|2} - */ - phase: 1 | 2; - /** - * The arguments of the step. - * @type {Array} - */ - args: Array; -} -/** - * Represents a directive comment. - */ -declare class DirectiveComment { - /** - * Creates a new directive comment. - * @param {string} label The label of the directive. - * @param {string} value The value of the directive. - * @param {string} justification The justification of the directive. - */ - constructor(label: string, value: string, justification: string); - /** - * The label of the directive, such as "eslint", "eslint-disable", etc. - * @type {string} - */ - label: string; - /** - * The value of the directive (the string after the label). - * @type {string} - */ - value: string; - /** - * The justification of the directive (the string after the --). - * @type {string} - */ - justification: string; -} -export {}; diff --git a/node_modules/@eslint/plugin-kit/dist/cjs/types.ts b/node_modules/@eslint/plugin-kit/dist/cjs/types.ts deleted file mode 100644 index d3f6a88..0000000 --- a/node_modules/@eslint/plugin-kit/dist/cjs/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @fileoverview Types for the plugin-kit package. - * @author Nicholas C. Zakas - */ - -export type StringConfig = Record; -export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts b/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts deleted file mode 100644 index 90b4a31..0000000 --- a/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts +++ /dev/null @@ -1,286 +0,0 @@ -export type VisitTraversalStep = import("@eslint/core").VisitTraversalStep; -export type CallTraversalStep = import("@eslint/core").CallTraversalStep; -export type TextSourceCode = import("@eslint/core").TextSourceCode; -export type TraversalStep = import("@eslint/core").TraversalStep; -export type SourceLocation = import("@eslint/core").SourceLocation; -export type SourceLocationWithOffset = import("@eslint/core").SourceLocationWithOffset; -export type SourceRange = import("@eslint/core").SourceRange; -export type IDirective = import("@eslint/core").Directive; -export type DirectiveType = import("@eslint/core").DirectiveType; -export type RuleConfig = import("@eslint/core").RuleConfig; -export type RulesConfig = import("@eslint/core").RulesConfig; -export type StringConfig = import("./types.ts").StringConfig; -export type BooleanConfig = import("./types.ts").BooleanConfig; -/** - * A class to represent a step in the traversal process where a - * method is called. - * @implements {CallTraversalStep} - */ -export class CallMethodStep implements CallTraversalStep { - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {string} options.target The target of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, args }: { - target: string; - args: Array; - }); - /** - * The type of the step. - * @type {"call"} - * @readonly - */ - readonly type: "call"; - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {2} - * @readonly - */ - readonly kind: 2; - /** - * The name of the method to call. - * @type {string} - */ - target: string; - /** - * The arguments to pass to the method. - * @type {Array} - */ - args: Array; -} -/** - * Object to parse ESLint configuration comments. - */ -export class ConfigCommentParser { - /** - * Parses a list of "name:string_value" or/and "name" options divided by comma or - * whitespace. Used for "global" comments. - * @param {string} string The string to parse. - * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. - */ - parseStringConfig(string: string): StringConfig; - /** - * Parses a JSON-like config. - * @param {string} string The string to parse. - * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object - */ - parseJSONLikeConfig(string: string): ({ - ok: true; - config: RulesConfig; - } | { - ok: false; - error: { - message: string; - }; - }); - /** - * Parses a config of values separated by comma. - * @param {string} string The string to parse. - * @returns {BooleanConfig} Result map of values and true values - */ - parseListConfig(string: string): BooleanConfig; - /** - * Parses a directive comment into directive text and value. - * @param {string} string The string with the directive to be parsed. - * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. - */ - parseDirective(string: string): DirectiveComment | undefined; - #private; -} -/** - * A class to represent a directive comment. - * @implements {IDirective} - */ -export class Directive implements IDirective { - /** - * Creates a new instance. - * @param {Object} options The options for the directive. - * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. - * @param {unknown} options.node The node representing the directive. - * @param {string} options.value The value of the directive. - * @param {string} options.justification The justification for the directive. - */ - constructor({ type, node, value, justification }: { - type: "disable" | "enable" | "disable-next-line" | "disable-line"; - node: unknown; - value: string; - justification: string; - }); - /** - * The type of directive. - * @type {DirectiveType} - * @readonly - */ - readonly type: DirectiveType; - /** - * The node representing the directive. - * @type {unknown} - * @readonly - */ - readonly node: unknown; - /** - * Everything after the "eslint-disable" portion of the directive, - * but before the "--" that indicates the justification. - * @type {string} - * @readonly - */ - readonly value: string; - /** - * The justification for the directive. - * @type {string} - * @readonly - */ - readonly justification: string; -} -/** - * Source Code Base Object - * @implements {TextSourceCode} - */ -export class TextSourceCodeBase implements TextSourceCode { - /** - * Creates a new instance. - * @param {Object} options The options for the instance. - * @param {string} options.text The source code text. - * @param {object} options.ast The root AST node. - * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. - */ - constructor({ text, ast, lineEndingPattern }: { - text: string; - ast: object; - lineEndingPattern?: RegExp; - }); - /** - * The AST of the source code. - * @type {object} - */ - ast: object; - /** - * The text of the source code. - * @type {string} - */ - text: string; - /** - * Returns the loc information for the given node or token. - * @param {object} nodeOrToken The node or token to get the loc information for. - * @returns {SourceLocation} The loc information for the node or token. - */ - getLoc(nodeOrToken: object): SourceLocation; - /** - * Returns the range information for the given node or token. - * @param {object} nodeOrToken The node or token to get the range information for. - * @returns {SourceRange} The range information for the node or token. - */ - getRange(nodeOrToken: object): SourceRange; - /** - * Returns the parent of the given node. - * @param {object} node The node to get the parent of. - * @returns {object|undefined} The parent of the node. - */ - getParent(node: object): object | undefined; - /** - * Gets all the ancestors of a given node - * @param {object} node The node - * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting - * from the root node at index 0 and going inwards to the parent node. - * @throws {TypeError} When `node` is missing. - */ - getAncestors(node: object): Array; - /** - * Gets the source code for the given node. - * @param {object} [node] The AST node to get the text for. - * @param {number} [beforeCount] The number of characters before the node to retrieve. - * @param {number} [afterCount] The number of characters after the node to retrieve. - * @returns {string} The text representing the AST node. - * @public - */ - public getText(node?: object, beforeCount?: number, afterCount?: number): string; - /** - * Gets the entire source text split into an array of lines. - * @returns {Array} The source text as an array of lines. - * @public - */ - public get lines(): string[]; - /** - * Traverse the source code and return the steps that were taken. - * @returns {Iterable} The steps that were taken while traversing the source code. - */ - traverse(): Iterable; - #private; -} -/** - * A class to represent a step in the traversal process where a node is visited. - * @implements {VisitTraversalStep} - */ -export class VisitNodeStep implements VisitTraversalStep { - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {object} options.target The target of the step. - * @param {1|2} options.phase The phase of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, phase, args }: { - target: object; - phase: 1 | 2; - args: Array; - }); - /** - * The type of the step. - * @type {"visit"} - * @readonly - */ - readonly type: "visit"; - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {1} - * @readonly - */ - readonly kind: 1; - /** - * The target of the step. - * @type {object} - */ - target: object; - /** - * The phase of the step. - * @type {1|2} - */ - phase: 1 | 2; - /** - * The arguments of the step. - * @type {Array} - */ - args: Array; -} -/** - * Represents a directive comment. - */ -declare class DirectiveComment { - /** - * Creates a new directive comment. - * @param {string} label The label of the directive. - * @param {string} value The value of the directive. - * @param {string} justification The justification of the directive. - */ - constructor(label: string, value: string, justification: string); - /** - * The label of the directive, such as "eslint", "eslint-disable", etc. - * @type {string} - */ - label: string; - /** - * The value of the directive (the string after the label). - * @type {string} - */ - value: string; - /** - * The justification of the directive (the string after the --). - * @type {string} - */ - justification: string; -} -export {}; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/index.js b/node_modules/@eslint/plugin-kit/dist/esm/index.js deleted file mode 100644 index 92eed6c..0000000 --- a/node_modules/@eslint/plugin-kit/dist/esm/index.js +++ /dev/null @@ -1,605 +0,0 @@ -// @ts-self-types="./index.d.ts" -import levn from 'levn'; - -/** - * @fileoverview Config Comment Parser - * @author Nicholas C. Zakas - */ - - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** @typedef {import("@eslint/core").RuleConfig} RuleConfig */ -/** @typedef {import("@eslint/core").RulesConfig} RulesConfig */ -/** @typedef {import("./types.ts").StringConfig} StringConfig */ -/** @typedef {import("./types.ts").BooleanConfig} BooleanConfig */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const directivesPattern = /^([a-z]+(?:-[a-z]+)*)(?:\s|$)/u; -const validSeverities = new Set([0, 1, 2, "off", "warn", "error"]); - -/** - * Determines if the severity in the rule configuration is valid. - * @param {RuleConfig} ruleConfig A rule's configuration. - */ -function isSeverityValid(ruleConfig) { - const severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; - return validSeverities.has(severity); -} - -/** - * Determines if all severities in the rules configuration are valid. - * @param {RulesConfig} rulesConfig The rules configuration to check. - * @returns {boolean} `true` if all severities are valid, otherwise `false`. - */ -function isEverySeverityValid(rulesConfig) { - return Object.values(rulesConfig).every(isSeverityValid); -} - -/** - * Represents a directive comment. - */ -class DirectiveComment { - /** - * The label of the directive, such as "eslint", "eslint-disable", etc. - * @type {string} - */ - label = ""; - - /** - * The value of the directive (the string after the label). - * @type {string} - */ - value = ""; - - /** - * The justification of the directive (the string after the --). - * @type {string} - */ - justification = ""; - - /** - * Creates a new directive comment. - * @param {string} label The label of the directive. - * @param {string} value The value of the directive. - * @param {string} justification The justification of the directive. - */ - constructor(label, value, justification) { - this.label = label; - this.value = value; - this.justification = justification; - } -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Object to parse ESLint configuration comments. - */ -class ConfigCommentParser { - /** - * Parses a list of "name:string_value" or/and "name" options divided by comma or - * whitespace. Used for "global" comments. - * @param {string} string The string to parse. - * @returns {StringConfig} Result map object of names and string values, or null values if no value was provided. - */ - parseStringConfig(string) { - const items = /** @type {StringConfig} */ ({}); - - // Collapse whitespace around `:` and `,` to make parsing easier - const trimmedString = string - .trim() - .replace(/(? { - if (!name) { - return; - } - - // value defaults to null (if not provided), e.g: "foo" => ["foo", null] - const [key, value = null] = name.split(":"); - - items[key] = value; - }); - - return items; - } - - /** - * Parses a JSON-like config. - * @param {string} string The string to parse. - * @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object - */ - parseJSONLikeConfig(string) { - // Parses a JSON-like comment by the same way as parsing CLI option. - try { - const items = levn.parse("Object", string) || {}; - - /* - * When the configuration has any invalid severities, it should be completely - * ignored. This is because the configuration is not valid and should not be - * applied. - * - * For example, the following configuration is invalid: - * - * "no-alert: 2 no-console: 2" - * - * This results in a configuration of { "no-alert": "2 no-console: 2" }, which is - * not valid. In this case, the configuration should be ignored. - */ - if (isEverySeverityValid(items)) { - return { - ok: true, - config: items, - }; - } - } catch { - // levn parsing error: 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. - */ - const normalizedString = string - .replace(/([-a-zA-Z0-9/]+):/gu, '"$1":') - .replace(/(\]|[0-9])\s+(?=")/u, "$1,"); - - try { - const items = JSON.parse(`{${normalizedString}}`); - - return { - ok: true, - config: items, - }; - } catch (ex) { - const errorMessage = ex instanceof Error ? ex.message : String(ex); - - return { - ok: false, - error: { - message: `Failed to parse JSON from '${normalizedString}': ${errorMessage}`, - }, - }; - } - } - - /** - * Parses a config of values separated by comma. - * @param {string} string The string to parse. - * @returns {BooleanConfig} Result map of values and true values - */ - parseListConfig(string) { - const items = /** @type {BooleanConfig} */ ({}); - - string.split(",").forEach(name => { - const trimmedName = name - .trim() - .replace( - /^(?['"]?)(?.*)\k$/su, - "$", - ); - - if (trimmedName) { - items[trimmedName] = true; - } - }); - - return items; - } - - /** - * 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. - */ - #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 a directive comment into directive text and value. - * @param {string} string The string with the directive to be parsed. - * @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid. - */ - parseDirective(string) { - const { directivePart, justificationPart } = - this.#extractDirectiveComment(string); - const match = directivesPattern.exec(directivePart); - - if (!match) { - return undefined; - } - - const directiveText = match[1]; - const directiveValue = directivePart.slice( - match.index + directiveText.length, - ); - - return new DirectiveComment( - directiveText, - directiveValue.trim(), - justificationPart, - ); - } -} - -/** - * @fileoverview A collection of helper classes for implementing `SourceCode`. - * @author Nicholas C. Zakas - */ - -/* eslint class-methods-use-this: off -- Required to complete interface. */ - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** @typedef {import("@eslint/core").VisitTraversalStep} VisitTraversalStep */ -/** @typedef {import("@eslint/core").CallTraversalStep} CallTraversalStep */ -/** @typedef {import("@eslint/core").TextSourceCode} TextSourceCode */ -/** @typedef {import("@eslint/core").TraversalStep} TraversalStep */ -/** @typedef {import("@eslint/core").SourceLocation} SourceLocation */ -/** @typedef {import("@eslint/core").SourceLocationWithOffset} SourceLocationWithOffset */ -/** @typedef {import("@eslint/core").SourceRange} SourceRange */ -/** @typedef {import("@eslint/core").Directive} IDirective */ -/** @typedef {import("@eslint/core").DirectiveType} DirectiveType */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Determines if a node has ESTree-style loc information. - * @param {object} node The node to check. - * @returns {node is {loc:SourceLocation}} `true` if the node has ESTree-style loc information, `false` if not. - */ -function hasESTreeStyleLoc(node) { - return "loc" in node; -} - -/** - * Determines if a node has position-style loc information. - * @param {object} node The node to check. - * @returns {node is {position:SourceLocation}} `true` if the node has position-style range information, `false` if not. - */ -function hasPosStyleLoc(node) { - return "position" in node; -} - -/** - * Determines if a node has ESTree-style range information. - * @param {object} node The node to check. - * @returns {node is {range:SourceRange}} `true` if the node has ESTree-style range information, `false` if not. - */ -function hasESTreeStyleRange(node) { - return "range" in node; -} - -/** - * Determines if a node has position-style range information. - * @param {object} node The node to check. - * @returns {node is {position:SourceLocationWithOffset}} `true` if the node has position-style range information, `false` if not. - */ -function hasPosStyleRange(node) { - return "position" in node; -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class to represent a step in the traversal process where a node is visited. - * @implements {VisitTraversalStep} - */ -class VisitNodeStep { - /** - * The type of the step. - * @type {"visit"} - * @readonly - */ - type = "visit"; - - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {1} - * @readonly - */ - kind = 1; - - /** - * The target of the step. - * @type {object} - */ - target; - - /** - * The phase of the step. - * @type {1|2} - */ - phase; - - /** - * The arguments of the step. - * @type {Array} - */ - args; - - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {object} options.target The target of the step. - * @param {1|2} options.phase The phase of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, phase, args }) { - this.target = target; - this.phase = phase; - this.args = args; - } -} - -/** - * A class to represent a step in the traversal process where a - * method is called. - * @implements {CallTraversalStep} - */ -class CallMethodStep { - /** - * The type of the step. - * @type {"call"} - * @readonly - */ - type = "call"; - - /** - * The kind of the step. Represents the same data as the `type` property - * but it's a number for performance. - * @type {2} - * @readonly - */ - kind = 2; - - /** - * The name of the method to call. - * @type {string} - */ - target; - - /** - * The arguments to pass to the method. - * @type {Array} - */ - args; - - /** - * Creates a new instance. - * @param {Object} options The options for the step. - * @param {string} options.target The target of the step. - * @param {Array} options.args The arguments of the step. - */ - constructor({ target, args }) { - this.target = target; - this.args = args; - } -} - -/** - * A class to represent a directive comment. - * @implements {IDirective} - */ -class Directive { - /** - * The type of directive. - * @type {DirectiveType} - * @readonly - */ - type; - - /** - * The node representing the directive. - * @type {unknown} - * @readonly - */ - node; - - /** - * Everything after the "eslint-disable" portion of the directive, - * but before the "--" that indicates the justification. - * @type {string} - * @readonly - */ - value; - - /** - * The justification for the directive. - * @type {string} - * @readonly - */ - justification; - - /** - * Creates a new instance. - * @param {Object} options The options for the directive. - * @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive. - * @param {unknown} options.node The node representing the directive. - * @param {string} options.value The value of the directive. - * @param {string} options.justification The justification for the directive. - */ - constructor({ type, node, value, justification }) { - this.type = type; - this.node = node; - this.value = value; - this.justification = justification; - } -} - -/** - * Source Code Base Object - * @implements {TextSourceCode} - */ -class TextSourceCodeBase { - /** - * The lines of text in the source code. - * @type {Array} - */ - #lines; - - /** - * The AST of the source code. - * @type {object} - */ - ast; - - /** - * The text of the source code. - * @type {string} - */ - text; - - /** - * Creates a new instance. - * @param {Object} options The options for the instance. - * @param {string} options.text The source code text. - * @param {object} options.ast The root AST node. - * @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code. - */ - constructor({ text, ast, lineEndingPattern = /\r?\n/u }) { - this.ast = ast; - this.text = text; - this.#lines = text.split(lineEndingPattern); - } - - /** - * Returns the loc information for the given node or token. - * @param {object} nodeOrToken The node or token to get the loc information for. - * @returns {SourceLocation} The loc information for the node or token. - */ - getLoc(nodeOrToken) { - if (hasESTreeStyleLoc(nodeOrToken)) { - return nodeOrToken.loc; - } - - if (hasPosStyleLoc(nodeOrToken)) { - return nodeOrToken.position; - } - - throw new Error( - "Custom getLoc() method must be implemented in the subclass.", - ); - } - - /** - * Returns the range information for the given node or token. - * @param {object} nodeOrToken The node or token to get the range information for. - * @returns {SourceRange} The range information for the node or token. - */ - getRange(nodeOrToken) { - if (hasESTreeStyleRange(nodeOrToken)) { - return nodeOrToken.range; - } - - if (hasPosStyleRange(nodeOrToken)) { - return [ - nodeOrToken.position.start.offset, - nodeOrToken.position.end.offset, - ]; - } - - throw new Error( - "Custom getRange() method must be implemented in the subclass.", - ); - } - - /* eslint-disable no-unused-vars -- Required to complete interface. */ - /** - * Returns the parent of the given node. - * @param {object} node The node to get the parent of. - * @returns {object|undefined} The parent of the node. - */ - getParent(node) { - throw new Error("Not implemented."); - } - /* eslint-enable no-unused-vars -- Required to complete interface. */ - - /** - * Gets all the ancestors of a given node - * @param {object} node The node - * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting - * from the root node at index 0 and going inwards to the parent node. - * @throws {TypeError} When `node` is missing. - */ - getAncestors(node) { - if (!node) { - throw new TypeError("Missing required argument: node."); - } - - const ancestorsStartingAtParent = []; - - for ( - let ancestor = this.getParent(node); - ancestor; - ancestor = this.getParent(ancestor) - ) { - ancestorsStartingAtParent.push(ancestor); - } - - return ancestorsStartingAtParent.reverse(); - } - - /** - * Gets the source code for the given node. - * @param {object} [node] The AST node to get the text for. - * @param {number} [beforeCount] The number of characters before the node to retrieve. - * @param {number} [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) { - const range = this.getRange(node); - return this.text.slice( - Math.max(range[0] - (beforeCount || 0), 0), - 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 - */ - get lines() { - return this.#lines; - } - - /** - * Traverse the source code and return the steps that were taken. - * @returns {Iterable} The steps that were taken while traversing the source code. - */ - traverse() { - throw new Error("Not implemented."); - } -} - -export { CallMethodStep, ConfigCommentParser, Directive, TextSourceCodeBase, VisitNodeStep }; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts b/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts deleted file mode 100644 index e4a442a..0000000 --- a/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @fileoverview Types for the plugin-kit package. - * @author Nicholas C. Zakas - */ -export type StringConfig = Record; -export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/dist/esm/types.ts b/node_modules/@eslint/plugin-kit/dist/esm/types.ts deleted file mode 100644 index d3f6a88..0000000 --- a/node_modules/@eslint/plugin-kit/dist/esm/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @fileoverview Types for the plugin-kit package. - * @author Nicholas C. Zakas - */ - -export type StringConfig = Record; -export type BooleanConfig = Record; diff --git a/node_modules/@eslint/plugin-kit/package.json b/node_modules/@eslint/plugin-kit/package.json deleted file mode 100644 index 155d501..0000000 --- a/node_modules/@eslint/plugin-kit/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "@eslint/plugin-kit", - "version": "0.2.3", - "description": "Utilities for building ESLint plugins.", - "author": "Nicholas C. Zakas", - "type": "module", - "main": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", - "exports": { - "require": { - "types": "./dist/cjs/index.d.cts", - "default": "./dist/cjs/index.cjs" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - } - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/eslint/rewrite.git" - }, - "bugs": { - "url": "https://github.com/eslint/rewrite/issues" - }, - "homepage": "https://github.com/eslint/rewrite#readme", - "scripts": { - "build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js", - "build:cts": "node -e \"fs.copyFileSync('dist/esm/index.d.ts', 'dist/cjs/index.d.cts')\"", - "build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts", - "test:jsr": "npx jsr@latest publish --dry-run", - "pretest": "npm run build", - "test": "mocha tests/", - "test:coverage": "c8 npm test" - }, - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin" - ], - "license": "Apache-2.0", - "devDependencies": { - "@eslint/core": "^0.9.0", - "c8": "^9.1.0", - "mocha": "^10.4.0", - "rollup": "^4.16.2", - "rollup-plugin-copy": "^3.5.0", - "typescript": "^5.4.5" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "dependencies": { - "levn": "^0.4.1" - } -} diff --git a/node_modules/@foundryvtt/foundryvtt-cli/CHANGELOG.md b/node_modules/@foundryvtt/foundryvtt-cli/CHANGELOG.md deleted file mode 100644 index bf287c9..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/CHANGELOG.md +++ /dev/null @@ -1,71 +0,0 @@ -## 1.0.3 - -### Fixes - - Fixed packing and unpacking ignoring Scene Regions. - -## 1.0.2 - -### Improvements - - Added the `--clean` command-line flag for unpack operations that will delete the destination directory before unpacking. - - Throw an error when packing if an entry with the same `_id` would overwrite an entry that had already been packed as part of the same operation. - -## 1.0.1 - -### Fixes - - Fixed issue with YAML serialization. - -## 1.0.0 - -### Improvements - - (Ryan Walder) Appropriately detect files with `.yaml` extensions as YAML files. - - (Ryan Walder) Added the `yamlOptions` parameter to `extractPack` to allow configuring how YAML is serialized. - - Added the `--recursive` command-line flag for pack operations that will recurse into subdirectories when finding source files. - - Added the `jsonOptions` parameter to `extractPack` to allow configuring how JSON is serialized. - - Removed unused `nedb-core` dependency. - -## 1.0.0-rc.4 - -### Fixes - - Fixed issues with packing/unpacking as YAML. - -## 1.0.0-rc.3 - -### Improvements - - (phenomen) Added cyrillic characters to the set of filesystem-safe characters that a Document name can be written as. - - Factored out `extractPack` and `compilePack` functionality into an external API. - -## 1.0.0-rc.2 - -### Fixes - - (DJ4ddi) Fixed path name resolution on Windows. - - Fixed compendium name not being appropriately appended to --in or --out options depending on operation. - -### Improvements - - (DJ4ddi) Added minimum node engine version. - - (DJ4ddi) Re-throw parse errors to provide stack trace output in the console. - -## 1.0.0-rc.1 - -### Fixes - - (DJ4ddi) Log more specific errors when an operation fails. - - (DJ4ddi) Compress LevelDB after packing it. - - Fixed NeDB operations throwing a TypeError. - -### Breaking Changes - - (DJ4ddi) Renamed `--inputDirectory` shorthand option from `--id` to `--in` to fix conflict with package ID `--id` option. - - Renamed `--outputDirectory` shorthand option from `--od` to `--out` to better align with the above change. - - NeDB unpack operations now write source data to the same directory as LevelDB unpack operations by default (`packs/{compendiumName}/_source`). This fixes an issue whereby sequential NeDB unpack operations would mix all their output together into the same `packs/_source` directory, and allows for better inter-operability with LevelDB operations. - - Corresponding to the above change, NeDB pack operations by default will look for source files under `packs/{compendiumName}/_source` instead of `packs/_source`. - - Unpack operations are now consistent between NeDB and LevelDB: Both will unpack primary Document entries to a single file, with all embedded Documents included, rather than LevelDB unpack operations writing every embedded Document to its own file. - -### Improvements - - Improved JSDoc annotations across the project. - - Improved NeDB document type inference to check the manifest of the package the compendium belongs to rather than searching all packages for a compendium with a matching name. - - The CLI should be slightly better-behaved and exit with a non-zero error code if it does encounter an error in most cases. - - When writing JSON files, a newline character is appended to the end of the file to make it more git-friendly. - -### Miscellaneous - - Removed IDE-specific project data from git tracking. - - Refactored codebase to conform with Foundry VTT code style guidelines. - - Added .editorconfig and .eslintrc.json to enforce code style. - - Added .npmignore to strip development-only files from final NPM package. diff --git a/node_modules/@foundryvtt/foundryvtt-cli/LICENSE b/node_modules/@foundryvtt/foundryvtt-cli/LICENSE deleted file mode 100644 index 356ccf4..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Foundry Virtual Tabletop - -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/@foundryvtt/foundryvtt-cli/README.md b/node_modules/@foundryvtt/foundryvtt-cli/README.md deleted file mode 100644 index 5a64a84..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/README.md +++ /dev/null @@ -1,171 +0,0 @@ -# foundryvtt-cli -The official Foundry VTT CLI - -## Installation -```bash -npm install -g @foundryvtt/foundryvtt-cli -``` - -## Usage -### Help -```bash -fvtt --help -``` - -### Current CLI Version -```bash -fvtt --version -``` - -### Configuration -```bash -fvtt configure -``` -Determines if your configuration is correct and if not, prompts you to fix it. - -#### View -```bash -fvtt configure view -``` - -View your current configuration. - - -#### Set -```bash -fvtt configure set "key" "value" -``` - -Set a configuration value. - -#### Get -```bash -fvtt configure get "key" -``` - -Get a configuration value. - -#### Path -```bash -fvtt configure path -``` -Outputs the path to your configuration file. - -### Launch - -```bash -fvtt launch -``` -Launches Foundry VTT. Available options are: -* `--demo` - Launches Foundry VTT in demo mode. -* `--port 30000` - Launches Foundry VTT on a specific port. -* `--world my-world` - Launches Foundry VTT straight into a specific world. -* `--noupnp` - Disable UPnP port forwarding. -* `--noupdate` - Disable automatic update checking. -* `--adminKey "ABC123"` - The admin key to secure Foundry VTT's Setup screen with. - -### Package - -```bash -fvtt package -``` -Output the current working package, if any. - -#### Workon -```bash -fvtt package workon "1001-fish" --type "Module" -``` -Swaps to working on a specific package, eliminating the need to pass `--type` and `--id` to other package commands. - -#### Clear -```bash -fvtt package clear -``` -Clears the current working package. - -#### Unpack -```bash -fvtt package unpack "compendiumName" -``` -Reads a database from the current Package /packs/ directory and writes each document as a serialized Object to its own file. -There are a number of options available to customize the output, check out `fvtt package unpack --help` for more information. - -#### Pack -```bash -fvtt package pack "compendiumName" -``` - -Reads a directory of serialized Objects and writes them to a database in the current Package /packs/ directory. There are a number of options available to customize the operation, check out `fvtt package pack --help` for more information. - -## Example Workflow - -```bash -fvtt configure -fvtt package workon "1001-fish" -fvtt package unpack "fish" -. . . // Make some updates to the files -fvtt package pack "fish" -``` - -## Development -```bash -git clone -cd foundryvtt-cli -npm install -npm run build -npm link -``` - -## API - -Certain internal functionality of the CLI is exposed as an API that can be imported into other projects. - -### Example Usage - -```js -import { compilePack, extractPack } from "@foundryvtt/foundryvtt-cli"; - -// Extract a NeDB compendium pack. -await extractpack("mymodule/packs/actors.db", "mymodule/packs/src/actors", { nedb: true }); - -// Compile a LevelDB compendium pack. -await compilePack("mymodule/packs/src/actors", "mymodule/packs/actors"); -``` - -### `compilePack(src: string, dest: string, options?: object): Promise` - -Compile source files into a compendium pack. - -#### Parameters - -* **src:** *string* The directory containing the source files. -* **dest:** *string* The target compendium pack. -* **options:** *object* - * **nedb:** *boolean = false* Whether to operate on a NeDB database, otherwise a LevelDB database is assumed. - * **yaml:** *boolean = false* Whether the source files are in YAML format, otherwise JSON is assumed. - * **log:** *boolean = false* Whether to log operation progress to the console. - * **recursive:** *boolean = false* Whether to recurse into child directories under **src**, otherwise only source files located directly under **src** will be used. - * **transformEntry:** *(entry: object): Promise* A function that is called on every entry. Returning *false* indicates that the entry should be discarded. - -### `extractPack(src: string, dest: string, options?: object): Promise` - -Extract the contents of a compendium pack into individual source files for each primary Document. - -#### Parameters - -* **src:** *string* The source compendium pack. -* **dest:** *string* The directory to write the extracted files into. -* **options:** *object* - * **nedb:** *boolean = false* Whether to operate on a NeDB database, otherwise a LevelDB database is assumed. - * **yaml:** *boolean = false* Whether the source files are in YAML format, otherwise JSON is assumed. - * **yamlOptions** *object = {}* Options to pass to `yaml.dump` when serializing Documents. - * **log:** *boolean = false* Whether to log operation progress to the console. - * **documentType:** *string* For NeDB operations, a **documentType** must be provided. This should be the same as the pack's *type* field in the *module.json* or *system.json*. - * **transformEntry:** *(entry: object): Promise* A function that is called on every entry. Returning *false* indicates that the entry should be discarded. - * **transformName:** *(entry: object): Promise* A function that is called on every entry. The value returned from this will be used as the entry's filename and must include the appropriate file extension. If nothing is returned, an auto-generated name will be used instead. - * **jsonOptions:** *object* - * **replacer:** *(key: string, value: any): any|Array* A replacer function or an array of property names in the object to include in the resulting string. - * **space:** *string|number* A number of spaces or a string to use as indentation. - -## Contributing -Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. diff --git a/node_modules/@foundryvtt/foundryvtt-cli/commands/configuration.mjs b/node_modules/@foundryvtt/foundryvtt-cli/commands/configuration.mjs deleted file mode 100644 index 528e2a9..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/commands/configuration.mjs +++ /dev/null @@ -1,72 +0,0 @@ -import Config from "../config.mjs"; - -/** - * Get the command object for the configuration command - * @returns {CommandModule} - */ -export function getCommand() { - return { - command: "configure [action] [key] [value]", - describe: "Manage configuration", - builder: yargs => { - yargs.positional("action", { - describe: "The action to perform", - type: "string", - choices: ["get", "set", "path", "view"] - }).positional("key", { - describe: "The configuration key", - type: "string" - }).positional("value", { - describe: "The configuration value", - type: "string" - }); - return yargs; - }, - handler: async argv => { - - // Handle actions - switch ( argv.action ) { - case "get": { - console.log(Config.instance.get(argv.key)); - break; - } - - case "set": { - Config.instance.set(argv.key, argv.value); - console.log(`Set ${argv.key} to ${argv.value}`); - break; - } - - case "view": { - // Output the current configuration - console.log("Current Configuration:", Config.instance.getAll()); - break; - } - - case "path": { - // Output the current configuration file path - console.log("Current Configuration File:", Config.instance.configPath); - break; - } - - default: { - // Determine if the dataPath and installPath are set - const installPath = Config.instance.get("installPath"); - if ( !installPath ) { - console.error("The installation path is not set. Use `configure set installPath ` to set it. " - + "Install paths look like `C:/Program Files/Foundry Virtual Tabletop`"); - } - - const dataPath = Config.instance.get("dataPath"); - if ( !dataPath ) { - console.error("The data path is not set. Use `configure set dataPath ` to set it. " - + "Data paths look like `C:/Users/Example/AppData/Local/FoundryVTT`"); - } - - // If both are set, configuration is complete - if ( installPath && dataPath ) console.log("Configuration complete!"); - } - } - } - } -} diff --git a/node_modules/@foundryvtt/foundryvtt-cli/commands/launch.mjs b/node_modules/@foundryvtt/foundryvtt-cli/commands/launch.mjs deleted file mode 100644 index 6f24bb4..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/commands/launch.mjs +++ /dev/null @@ -1,91 +0,0 @@ -import Config from "../config.mjs"; -import { spawn } from "child_process"; -import path from "path"; - -/** - * Get the command object for the launch command - * @returns {CommandModule} - */ -export function getCommand() { - return { - command: "launch", - describe: "Launch Foundry VTT", - builder: yargs => { - yargs.option("demo", { - describe: "Launch Foundry VTT in demo mode", - type: "boolean", - default: false - }); - - yargs.option("port", { - describe: "The port to launch Foundry VTT on", - type: "number", - default: 30000 - }); - - yargs.option("world", { - describe: "The world to launch Foundry VTT with", - type: "string" - }); - - yargs.option("noupnp", { - describe: "Disable UPnP port forwarding", - type: "boolean", - default: false - }); - - yargs.option("noupdate", { - describe: "Disable automatic update checking", - type: "boolean", - default: false - }); - - yargs.option("adminKey", { - describe: "The admin key to secure Foundry VTT's Setup screen with", - type: "string" - }); - - return yargs; - }, - handler: async argv => { - - // Run the command node main.js --debug --port 30000 - // Launch Foundry VTT in debug mode on port 30000 - const { demo, port, world, noupnp, noupdate, adminKey } = argv; - - // Determine the installation path - const installPath = Config.instance.get("installPath"); - if ( !installPath ) { - console.error("The installation path is not set. Use `configure set installPath ` to set it. " - + "Install paths look like `C:/Program Files/Foundry Virtual Tabletop`"); - process.exitCode = 1; - return; - } - - // Determine the data path - const dataPath = Config.instance.get("dataPath"); - if ( !dataPath ) { - console.error("The data path is not set. Use `configure set dataPath ` to set it. " - + "Data paths look like `C:/Users/Example/AppData/Local/FoundryVTT/Data`"); - process.exitCode = 1; - return; - } - - // Launch Foundry VTT - const foundry = spawn("node", [ - path.normalize(path.join(installPath, "resources", "app", "main.js")), - `--dataPath=${dataPath}`, - `--port=${port}`, - demo ? "--demo" : "", - world ? `--world=${world}` : "", - noupnp ? "--noupnp" : "", - noupdate ? "--noupdate" : "", - adminKey ? `--adminKey=${adminKey}` : "" - ]); - - foundry.stdout.on("data", data => console.log(data.toString())); - foundry.stderr.on("data", data => console.error(data.toString())); - foundry.on("close", code => console.log(`Foundry VTT exited with code ${code}`)); - } - } -} diff --git a/node_modules/@foundryvtt/foundryvtt-cli/commands/package.mjs b/node_modules/@foundryvtt/foundryvtt-cli/commands/package.mjs deleted file mode 100644 index bad4554..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/commands/package.mjs +++ /dev/null @@ -1,438 +0,0 @@ -import Config from "../config.mjs"; -import path from "path"; -import fs from "fs"; -import chalk from "chalk"; -import { compilePack, extractPack, TYPE_COLLECTION_MAP } from "../lib/package.mjs"; - -/** - * @typedef {"Module"|"System"|"World"} PackageType - */ - -/** - * @typedef {object} CLIArgs - * @property {"workon"|"clear"|"unpack"|"pack"} action The action to perform. - * @property {string} value The action value. - * @property {string} [id] Optionally provide the package ID if we are using explicit - * paths. - * @property {PackageType} type The package type. - * @property {string} [compendiumName] The compendium name for pack-based actions. - * @property {DocumentType} [compendiumType] The type of Documents that the compendium houses. Only required - * for NeDB operations. - * @property {string} [inputDirectory] An explicit input directory for pack-based actions. - * @property {string} [outputDirectory] An explicit output directory for pack-based actions. - * @property {boolean} [yaml] Whether to use YAML instead of JSON for serialization. - * @property {boolean} [verbose] Whether to output verbose logging. - * @property {boolean} [nedb] Use NeDB instead of ClassicLevel for database operations. - * @property {boolean} [recursive] When packing, recurse down through all directories in the input - * directory to find source files. - * @property {boolean} [clean] When unpacking, delete the destination directory first. - */ - -/** - * The working package ID. - * @type {string|null} - */ -let currentPackageId = Config.instance.get("currentPackageId"); - -/** - * The working package type. - * @type {PackageType|null} - */ -let currentPackageType = Config.instance.get("currentPackageType"); - -/** - * Get the command object for the package command - * @returns {CommandModule} - */ -export function getCommand() { - return { - command: "package [action] [value]", - describe: "Manage packages", - builder: yargs => { - yargs.positional("action", { - describe: "The action to perform", - type: "string", - choices: ["workon", "clear", "unpack", "pack"] - }); - - yargs.positional("value", { - describe: "The value to use for the action", - type: "string" - }); - - // currentPackageId is only needed if the data path has to be built with it. - yargs.option("id", { - describe: "The package ID", - type: "string", - }); - - yargs.option("type", { - describe: "The package type", - type: "string", - choices: ["Module", "System", "World"] - }); - - yargs.option("compendiumName", { - alias: "n", - describe: "The Compendium name, for Compendium Pack based Actions.", - type: "string" - }); - - yargs.option("compendiumType", { - alias: "t", - describe: "The type of document that the compendium pack stores. Only necessary for NeDB operations.", - type: "string", - choices: Object.keys(TYPE_COLLECTION_MAP) - }); - - yargs.option("inputDirectory", { - alias: "in", - describe: "The directory to read from, for Pack based Actions.", - type: "string" - }); - - yargs.option("outputDirectory", { - alias: "out", - describe: "The directory to write to, for Pack based Actions.", - type: "string" - }); - - yargs.option("yaml", { - describe: "Whether to use YAML instead of JSON for serialization.", - type: "boolean" - }); - - yargs.option("verbose", { - alias: "v", - describe: "Whether to output verbose logging.", - type: "boolean" - }); - - yargs.option("nedb", { - describe: "Whether to use NeDB instead of ClassicLevel for database operations.", - type: "boolean" - }); - - yargs.option("recursive", { - alias: "r", - describe: "When packing, recurse down through all directories in the input directory to find source files.", - type: "boolean" - }); - - yargs.option("clean", { - alias: "c", - describe: "When unpacking, delete the destination directory first.", - type: "boolean" - }); - - return yargs; - }, - handler: async argv => { - if ( argv.id ) currentPackageId = argv.id; - if ( argv.type ) currentPackageType = argv.type; - - // Handle actions - switch ( argv.action ) { - case "workon": handleWorkon(argv); break; - case "clear": handleClear(); break; - case "unpack": await handleUnpack(argv); break; - case "pack": await handlePack(argv); break; - - default: - if ( !currentPackageId ) { - console.error(chalk.red("No package ID is currently set. Use `package workon ` to set it.")); - return; - } - - console.log(`Currently in ${chalk.magenta(currentPackageType)} ${chalk.cyan(currentPackageId)}`); - break; - } - } - } -} - -/* -------------------------------------------- */ -/* Helpers */ -/* -------------------------------------------- */ - -/** - * Read all the package manifests for a given package type, and return a Map of them, keyed by ID. - * @param {string} dataPath The root data path. - * @param {PackageType} type The package type. - * @param {object} [options] - * @param {boolean} [options.verbose=false] Log errors verbosely. - * @returns {Map} - */ -function readPackageManifests(dataPath, type, { verbose=false }={}) { - const typeLC = type.toLowerCase(); - const typePl = `${typeLC}s`; - const dir = `${dataPath}/Data/${typePl}`; - const map = new Map(); - - for ( const file of fs.readdirSync(dir, { withFileTypes: true }) ) { - const manifestPath = path.normalize(`${dir}/${file.name}/${typeLC}.json`); - try { - const data = JSON.parse(fs.readFileSync(manifestPath, "utf8")); - data.type = type; - data.path = manifestPath; - map.set(data.id ?? data.name, data); - } catch ( err ) { - if ( verbose ) console.error(chalk.red(`Error reading ${typeLC}.json for ${chalk.blue(file.name)}: ${err}`)); - } - } - - return map; -} - -/* -------------------------------------------- */ - -/** - * @typedef {object} DiscoveredPackages - * @property {Map} modules A map of module manifest data by ID. - * @property {Map} systems A map of system manifest data by ID. - * @property {Map} worlds A map of world manifest data by ID. - * @property {object[]} packages A list of all packages in the data path. - */ - -/** - * Discover the list of all Packages in the dataPath - * @param {CLIArgs} argv The command line arguments - * @returns {DiscoveredPackages|void} - */ -function discoverPackageDirectory(argv) { - const dataPath = Config.instance.get("dataPath"); - if ( !dataPath ) { - console.error(chalk.red(`No dataPath configured. Call ${chalk.yellow("`configure set dataPath `")} first.`)); - return; - } - const modules = readPackageManifests(dataPath, "Module", { verbose: argv.verbose }); - const systems = readPackageManifests(dataPath, "System", { verbose: argv.verbose }); - const worlds = readPackageManifests(dataPath, "World", { verbose: argv.verbose }); - return { modules, systems, worlds, packages: [...modules.values(), ...systems.values(), ...worlds.values()] }; -} - -/* -------------------------------------------- */ - -/** - * Determine the document type of an NeDB database from the command-line arguments, if specified, or from the database's - * containing package. - * @param {string} packFile The path to the NeDB database. - * @param {CLIArgs} argv The command-line arguments. - * @returns {string|void} The document type of the NeDB database if it could be determined. - */ -function determineDocumentType(packFile, argv) { - // Case 1 - The document type has been explicitly provided. - if ( argv.compendiumType ) return argv.compendiumType; - - // Case 2 - The type can be inferred from the pack name. - const packName = path.basename(packFile, ".db"); - for ( const [type, collection] of Object.entries(TYPE_COLLECTION_MAP) ) { - if ( packName === collection ) return type; - } - - // Case 3 - Attempt to locate this pack's metadata in the manifest of the package that owns it. - const game = discoverPackageDirectory(argv); - const pkg = game.packages.find(p => packFile.startsWith(path.dirname(p.path))); - const pack = pkg?.packs.find(pack => path.resolve(path.dirname(pkg.path), pack.path) === packFile); - if ( !pack ) { - console.error(`Unable to determine document type for NeDB compendium at '${packFile}'. ` - + "Set this manually with -t ."); - return; - } - return pack.type ?? pack.entity; -} - -/* -------------------------------------------- */ - -/** - * Determines whether a file is locked by another process - * @param {string} filepath The file path to test. - * @returns {boolean} - */ -function isFileLocked(filepath) { - try { - // Try to open the file with the 'w' flag, which requests write access - const fd = fs.openSync(filepath, 'w'); - - // If the file was successfully opened, it is not locked - fs.closeSync(fd); - return false; - } catch ( err ) { - if ( err.code === "EBUSY" ) return true; // If the file could not be opened, it is locked - else if ( err.code === "ENOENT" ) return false; // If the file can't be found it's not locked - throw err; - } -} - -/* -------------------------------------------- */ - -/** - * @typedef {object} OperationPaths - * @property {string} source The source data files. - * @property {string} pack The path to the compendium pack. - */ - -/** - * Determine compendium pack and source data paths based on the current configuration or command-line arguments. - * @param {CLIArgs} argv The command-line arguments. - * @param {"pack"|"unpack"} operation The operation. - * @returns {OperationPaths|{}} The paths required for the operation, or nothing if they could not be determined. - */ -function determinePaths(argv, operation) { - const usingDefault = !argv.outputDirectory || !argv.inputDirectory; - if ( usingDefault && (!currentPackageId || !currentPackageType) ) { - console.error("Package ID or type could not be determined. Use `package workon ` to set it."); - return {}; - } - - const dataPath = Config.instance.get("dataPath"); - if ( usingDefault && !dataPath ) { - console.error("No dataPath configured. Use `configure set dataPath ` to set it."); - return {}; - } - - const typeDir = `${currentPackageType.toLowerCase()}s`; - const compendiumName = argv.compendiumName ?? argv.value; - if ( !compendiumName ) { - console.error("No compendium name provided. Use `-n ` to supply it."); - return {}; - } - - let pack = operation === "pack" ? argv.outputDirectory : argv.inputDirectory; - let source = operation === "pack" ? argv.inputDirectory : argv.outputDirectory; - if ( pack ) pack = path.join(pack, compendiumName); - else pack = path.join(dataPath, "Data", typeDir, currentPackageId, "packs", compendiumName); - source ??= path.join(pack, "_source"); - if ( argv.nedb ) pack += ".db"; - return { source: path.resolve(path.normalize(source)), pack: path.resolve(path.normalize(pack)) }; -} - -/* -------------------------------------------- */ -/* Workon */ -/* -------------------------------------------- */ - -/** - * Set the current package ID and type - * @param {CLIArgs} argv The command line arguments - */ -function handleWorkon(argv) { - if ( argv.value ) currentPackageId = argv.value; - Config.instance.set("currentPackageId", currentPackageId); - - // Attempt to automatically determine the package type. - if ( !argv.type ) { - const game = discoverPackageDirectory(argv); - const pkgCount = game.packages.filter(p => p.id === currentPackageId).length; - if ( pkgCount > 1 ) { - console.error(chalk.red(`Multiple packages with ID ${chalk.cyan(currentPackageId)} found. ` - + `Please specify the package type with ${chalk.yellow("--type")}`)); - process.exitCode = 1; - return; - } - const pkg = game.worlds.get(currentPackageId) - ?? game.systems.get(currentPackageId) - ?? game.modules.get(currentPackageId); - if ( !pkg ) { - console.error(chalk.red(`No package with ID ${chalk.cyan(currentPackageId)} found.`)); - process.exitCode = 1; - return; - } - currentPackageType = pkg.type; - } - - Config.instance.set("currentPackageType", currentPackageType); - console.log(`Swapped to ${chalk.magenta(currentPackageType)} ${chalk.cyan(currentPackageId)}`); -} - -/* -------------------------------------------- */ - -/** - * Clear the current package ID and type - */ -function handleClear() { - currentPackageId = null; - currentPackageType = null; - Config.instance.set("currentPackageId", currentPackageId); - Config.instance.set("currentPackageType", currentPackageType); - console.log("Cleared current Package"); -} - -/* -------------------------------------------- */ -/* Unpacking */ -/* -------------------------------------------- */ - -/** - * Load a compendium pack and serialize the DB entries, each to their own file - * @param {CLIArgs} argv The command line arguments - * @returns {Promise} - */ -async function handleUnpack(argv) { - const { source, pack } = determinePaths(argv, "unpack"); - if ( !source || !pack ) { - process.exitCode = 1; - return; - } - - let documentType; - const { nedb, yaml, clean } = argv; - if ( nedb ) { - documentType = determineDocumentType(pack, argv); - if ( !documentType ) { - process.exitCode = 1; - return; - } - } - - if ( !nedb && isFileLocked(path.join(pack, "LOCK")) ) { - console.error(chalk.red(`The pack "${chalk.blue(pack)}" is currently in use by Foundry VTT. ` - + "Please close Foundry VTT and try again.")); - process.exitCode = 1; - return; - } - - const dbMode = nedb ? "nedb" : "classic-level"; - console.log(`[${dbMode}] Unpacking "${chalk.blue(pack)}" to "${chalk.blue(source)}"`); - - try { - await extractPack(pack, source, { nedb, yaml, documentType, clean, log: true }); - } catch ( err ) { - console.error(err); - process.exitCode = 1; - } -} - -/* -------------------------------------------- */ -/* Packing */ -/* -------------------------------------------- */ - -/** - * Read serialized files from a directory and write them to a compendium pack. - * @param {CLIArgs} argv The command line arguments - * @returns {Promise} - * @private - */ -async function handlePack(argv) { - const { source, pack } = determinePaths(argv, "pack"); - if ( !source || !pack ) { - process.exitCode = 1; - return; - } - - const { nedb, yaml, recursive } = argv; - if ( !nedb && isFileLocked(path.join(pack, "LOCK")) ) { - console.error(chalk.red(`The pack "${chalk.blue(pack)}" is currently in use by Foundry VTT. ` - + "Please close Foundry VTT and try again.")); - process.exitCode = 1; - return; - } - - const dbMode = nedb ? "nedb" : "classic-level"; - console.log(`[${dbMode}] Packing "${chalk.blue(source)}" into "${chalk.blue(pack)}"`); - - try { - await compilePack(source, pack, { nedb, yaml, recursive, log: true }); - } catch ( err ) { - console.error(err); - process.exitCode = 1; - } -} diff --git a/node_modules/@foundryvtt/foundryvtt-cli/config.example.yml b/node_modules/@foundryvtt/foundryvtt-cli/config.example.yml deleted file mode 100644 index 2aec889..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/config.example.yml +++ /dev/null @@ -1,4 +0,0 @@ -installPath: C:\Program Files\Foundry Virtual Tabletop -dataPath: C:\Users\Example\AppData\Local\FoundryVTT\Data -currentPackageId: example-id -currentPackageType: World diff --git a/node_modules/@foundryvtt/foundryvtt-cli/config.mjs b/node_modules/@foundryvtt/foundryvtt-cli/config.mjs deleted file mode 100644 index 98aeefd..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/config.mjs +++ /dev/null @@ -1,107 +0,0 @@ -import fs from "fs"; -import yaml from "js-yaml"; -import path from "path"; -import * as os from "os"; - -/** - * Manages the configuration of the CLI. Stored as config.yml - */ -export default class Config { - - /** - * The singleton instance. - * @type {Config|null} - */ - static #instance = null; - - /* -------------------------------------------- */ - - /** - * Get the singleton instance of the Config class - * @returns {Config} - */ - static get instance() { - if ( !this.#instance ) this.#instance = new Config(); - return this.#instance; - } - - /* -------------------------------------------- */ - - constructor() { - - // Set the config file path to the appData directory - let basePath = os.homedir(); - switch ( process.platform ) { - case "win32": basePath = process.env.APPDATA || path.join(basePath, "AppData", "Roaming"); break; - case "darwin": basePath = path.join(basePath, "Library", "Preferences"); break; - case "linux": basePath = process.env.XDG_DATA_HOME || path.join(basePath, ".local", "share"); break; - } - - fs.mkdirSync(basePath, { recursive: true }); - this.configPath = path.join(basePath, ".fvttrc.yml"); - - // Ensure the config file exists - if ( !fs.existsSync(this.configPath) ) fs.writeFileSync(this.configPath, yaml.dump({})); - this.#config = yaml.load(fs.readFileSync(this.configPath, "utf8")); - } - - /* -------------------------------------------- */ - - /** - * The configuration data. - * @type {Record} - */ - #config = {}; - - /* -------------------------------------------- */ - - /** - * The path to the configuration file. - * @type {string} - */ - configPath = ""; - - /* -------------------------------------------- */ - - /** - * Get the entire configuration object - * @returns {Record} - */ - getAll() { - return this.#config; - } - - /* -------------------------------------------- */ - - /** - * Get a specific configuration value - * @param {string} key The configuration key - * @returns {any} - */ - get(key) { - return this.#config[key]; - } - - /* -------------------------------------------- */ - - /** - * Set a specific configuration value - * @param {string} key The configuration key - * @param {any} value The configuration value - */ - set(key, value) { - this.#config[key] = value; - - // Write to disk - this.#writeConfig(); - } - - /* -------------------------------------------- */ - - /** - * Write the configuration to disk - */ - #writeConfig() { - fs.writeFileSync(this.configPath, yaml.dump(this.#config)); - } -} diff --git a/node_modules/@foundryvtt/foundryvtt-cli/fvtt.mjs b/node_modules/@foundryvtt/foundryvtt-cli/fvtt.mjs deleted file mode 100755 index a631be0..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/fvtt.mjs +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env node - -import yargs from "yargs"; -import { hideBin } from "yargs/helpers"; -import { getCommand as configureCommand } from "./commands/configuration.mjs"; -import { getCommand as packageCommand } from "./commands/package.mjs"; -import { getCommand as launchCommand } from "./commands/launch.mjs"; - -const argv = yargs(hideBin(process.argv)) - .usage("Usage: $0 [options]") - .command(configureCommand()) - .command(packageCommand()) - .command(launchCommand()) - .help().alias("help", "h") - .argv; diff --git a/node_modules/@foundryvtt/foundryvtt-cli/index.mjs b/node_modules/@foundryvtt/foundryvtt-cli/index.mjs deleted file mode 100644 index 372d936..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/index.mjs +++ /dev/null @@ -1 +0,0 @@ -export { compilePack, extractPack } from "./lib/package.mjs"; diff --git a/node_modules/@foundryvtt/foundryvtt-cli/lib/package.mjs b/node_modules/@foundryvtt/foundryvtt-cli/lib/package.mjs deleted file mode 100644 index 260a324..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/lib/package.mjs +++ /dev/null @@ -1,552 +0,0 @@ -import fs from "fs"; -import path from "path"; -import Datastore from "nedb-promises"; -import chalk from "chalk"; -import { default as YAML } from "js-yaml"; -import { ClassicLevel } from "classic-level"; - -/* -------------------------------------------- */ -/* Configuration */ -/* -------------------------------------------- */ - -/** - * @typedef { - * "Actor"|"Adventure"|"Cards"|"ChatMessage"|"Combat"|"FogExploration"|"Folder"|"Item"|"JournalEntry"|"Macro"| - * "Playlist"|"RollTable"|"Scene"|"Setting"|"User" - * } DocumentType - */ - -/** - * @typedef { - * "actors"|"adventures"|"cards"|"messages"|"combats"|"fog"|"folders"|"items"|"journal"|"macros"|"playlists"|"tables"| - * "scenes"|"settings"|"users" - * } DocumentCollection - */ - -/** - * @typedef {object} PackageOptions - * @property {boolean} [nedb=false] Whether to operate on a NeDB database, otherwise a LevelDB database is - * assumed. - * @property {boolean} [yaml=false] Whether the source files are in YAML format, otherwise JSON is - * assumed. - * @property {boolean} [log=false] Whether to log operation progress to the console. - * @property {EntryTransformer} [transformEntry] A function that is called on every entry to transform it. - */ - -/** - * @typedef {PackageOptions} CompileOptions - * @property {boolean} [recursive=false] Whether to recurse into child directories to locate source files, otherwise - * only source files located in the root directory will be used. - */ - -/** - * @typedef {PackageOptions} ExtractOptions - * @property {object} [yamlOptions] Options to pass to yaml.dump when serializing Documents. - * @property {JSONOptions} [jsonOptions] Options to pass to JSON.stringify when serializing Documents. - * @property {DocumentType} [documentType] Required only for NeDB packs in order to generate a correct key. - * @property {boolean} [clean] Delete the destination directory before unpacking. - * @property {DocumentCollection} [collection] Required only for NeDB packs in order to generate a correct key. Can be - * used instead of documentType if known. - * @property {NameTransformer} [transformName] A function that is used to generate a filename for the extracted - * Document. If used, the generated name must include the appropriate file - * extension. The generated name will be resolved against the root path - * provided to the operation, and the entry will be written to that - * resolved location. - */ - -/** - * @typedef {object} JSONOptions - * @property {JSONReplacer|Array} [replacer] A replacer function or an array of property names in the - * object to include in the resulting string. - * @property {string|number} [space] A number of spaces or a string to use as indentation. - */ - -/** - * @callback JSONReplacer - * @param {string} key The key being stringified. - * @param {any} value The value being stringified. - * @returns {any} The value returned is substituted instead of the current property's value. - */ - -/** - * @callback EntryTransformer - * @param {object} entry The entry data. - * @returns {Promise} Return boolean false to indicate that this entry should be discarded. - */ - -/** - * @callback NameTransformer - * @param {object} entry The entry data. - * @returns {Promise} If a string is returned, it is used as the filename that the entry will be written - * to. - */ - -/** - * @callback HierarchyApplyCallback - * @param {object} doc The Document being operated on. - * @param {string} collection The Document's collection. - * @param {object} [options] Additional options supplied by the invocation on the level above this one. - * @returns {Promise} Options to supply to the next level of the hierarchy. - */ - -/** - * @callback HierarchyMapCallback - * @param {any} entry The element stored in the collection. - * @param {string} collection The collection name. - * @returns {Promise} - */ - -/** - * A flattened view of the Document hierarchy. The type of the value determines what type of collection it is. Arrays - * represent embedded collections, while objects represent embedded documents. - * @type {Record>} - */ -const HIERARCHY = { - actors: { - items: [], - effects: [] - }, - cards: { - cards: [] - }, - combats: { - combatants: [] - }, - delta: { - items: [], - effects: [] - }, - items: { - effects: [] - }, - journal: { - pages: [] - }, - playlists: { - sounds: [] - }, - regions: { - behaviors: [] - }, - tables: { - results: [] - }, - tokens: { - delta: {} - }, - scenes: { - drawings: [], - tokens: [], - lights: [], - notes: [], - regions: [], - sounds: [], - templates: [], - tiles: [], - walls: [] - } -}; - -/** - * A mapping of primary document types to collection names. - * @type {Record} - */ -export const TYPE_COLLECTION_MAP = { - Actor: "actors", - Adventure: "adventures", - Cards: "cards", - ChatMessage: "messages", - Combat: "combats", - FogExploration: "fog", - Folder: "folders", - Item: "items", - JournalEntry: "journal", - Macro: "macros", - Playlist: "playlists", - RollTable: "tables", - Scene: "scenes", - Setting: "settings", - User: "users" -}; - -/* -------------------------------------------- */ -/* Compiling */ -/* -------------------------------------------- */ - -/** - * Compile source files into a compendium pack. - * @param {string} src The directory containing the source files. - * @param {string} dest The target compendium pack. This should be a directory for LevelDB packs, or a .db file for - * NeDB packs. - * @param {CompileOptions} [options] - * @returns {Promise} - */ -export async function compilePack(src, dest, { - nedb=false, yaml=false, recursive=false, log=false, transformEntry -}={}) { - if ( nedb && (path.extname(dest) !== ".db") ) { - throw new Error("The nedb option was passed to compilePacks, but the target pack does not have a .db extension."); - } - const files = findSourceFiles(src, { yaml, recursive }); - if ( nedb ) return compileNedb(dest, files, { log, transformEntry }); - return compileClassicLevel(dest, files, { log, transformEntry }); -} - -/* -------------------------------------------- */ - -/** - * Compile a set of files into a NeDB compendium pack. - * @param {string} pack The target compendium pack. - * @param {string[]} files The source files. - * @param {Partial} [options] - * @returns {Promise} - */ -async function compileNedb(pack, files, { log, transformEntry }={}) { - // Delete the existing NeDB file if it exists. - try { - fs.unlinkSync(pack); - } catch ( err ) { - if ( err.code !== "ENOENT" ) throw err; - } - - // Create a new NeDB Datastore. - const db = Datastore.create(pack); - const seenKeys = new Set(); - const packDoc = applyHierarchy(doc => { - if ( seenKeys.has(doc._key) ) { - throw new Error(`An entry with key '${key}' was already packed and would be overwritten by this entry.`); - } - seenKeys.add(doc._key); - delete doc._key; - }); - - // Iterate over all source files, writing them to the DB. - for ( const file of files ) { - try { - const contents = fs.readFileSync(file, "utf8"); - const ext = path.extname(file); - const isYaml = ext === ".yml" || ext === ".yaml"; - const doc = isYaml ? YAML.load(contents) : JSON.parse(contents); - const key = doc._key; - const [, collection] = key.split("!"); - // If the key starts with !folders, we should skip packing it as NeDB doesn't support folders. - if ( key.startsWith("!folders") ) continue; - if ( await transformEntry?.(doc) === false ) continue; - await packDoc(doc, collection); - await db.insert(doc); - if ( log ) console.log(`Packed ${chalk.blue(doc._id)}${chalk.blue(doc.name ? ` (${doc.name})` : "")}`); - } catch ( err ) { - if ( log ) console.error(`Failed to pack ${chalk.red(file)}. See error below.`); - throw err; - } - } - - // Compact the DB. - db.stopAutocompaction(); - await new Promise(resolve => db.compactDatafile(resolve)); -} - -/* -------------------------------------------- */ - -/** - * Compile a set of files into a LevelDB compendium pack. - * @param {string} pack The target compendium pack. - * @param {string[]} files The source files. - * @param {Partial} [options] - * @returns {Promise} - */ -async function compileClassicLevel(pack, files, { log, transformEntry }={}) { - // Create the classic level directory if it doesn't already exist. - fs.mkdirSync(pack, { recursive: true }); - - // Load the directory as a ClassicLevel DB. - const db = new ClassicLevel(pack, { keyEncoding: "utf8", valueEncoding: "json" }); - const batch = db.batch(); - const seenKeys = new Set(); - - const packDoc = applyHierarchy(async (doc, collection) => { - const key = doc._key; - delete doc._key; - if ( seenKeys.has(key) ) { - throw new Error(`An entry with key '${key}' was already packed and would be overwritten by this entry.`); - } - seenKeys.add(key); - const value = structuredClone(doc); - await mapHierarchy(value, collection, d => d._id); - batch.put(key, value); - }); - - // Iterate over all files in the input directory, writing them to the DB. - for ( const file of files ) { - try { - const contents = fs.readFileSync(file, "utf8"); - const ext = path.extname(file); - const isYaml = ext === ".yml" || ext === ".yaml"; - const doc = isYaml ? YAML.load(contents) : JSON.parse(contents); - const [, collection] = doc._key.split("!"); - if ( await transformEntry?.(doc) === false ) continue; - await packDoc(doc, collection); - if ( log ) console.log(`Packed ${chalk.blue(doc._id)}${chalk.blue(doc.name ? ` (${doc.name})` : "")}`); - } catch ( err ) { - if ( log ) console.error(`Failed to pack ${chalk.red(file)}. See error below.`); - throw err; - } - } - - // Remove any entries in the DB that are not part of the source set. - for ( const key of await db.keys().all() ) { - if ( !seenKeys.has(key) ) { - batch.del(key); - if ( log ) console.log(`Removed ${chalk.blue(key)}`); - } - } - - await batch.write(); - await compactClassicLevel(db); - await db.close(); -} - -/* -------------------------------------------- */ - -/** - * Flushes the log of the given database to create compressed binary tables. - * @param {ClassicLevel} db The database to compress. - * @returns {Promise} - */ -async function compactClassicLevel(db) { - const forwardIterator = db.keys({ limit: 1, fillCache: false }); - const firstKey = await forwardIterator.next(); - await forwardIterator.close(); - - const backwardIterator = db.keys({ limit: 1, reverse: true, fillCache: false }); - const lastKey = await backwardIterator.next(); - await backwardIterator.close(); - - if ( firstKey && lastKey ) return db.compactRange(firstKey, lastKey, { keyEncoding: "utf8" }); -} - -/* -------------------------------------------- */ -/* Extracting */ -/* -------------------------------------------- */ - -/** - * Extract the contents of a compendium pack into individual source files for each primary Document. - * @param {string} src The source compendium pack. This should be a directory for LevelDB pack, or a .db file for - * NeDB packs. - * @param {string} dest The directory to write the extracted files into. - * @param {ExtractOptions} [options] - * @returns {Promise} - */ -export async function extractPack(src, dest, { - nedb=false, yaml=false, yamlOptions={}, jsonOptions={}, log=false, documentType, collection, clean, transformEntry, - transformName -}={}) { - if ( nedb && (path.extname(src) !== ".db") ) { - throw new Error("The nedb option was passed to extractPacks, but the target pack does not have a .db extension."); - } - collection ??= TYPE_COLLECTION_MAP[documentType]; - if ( nedb && !collection ) { - throw new Error("For NeDB operations, a documentType or collection must be provided."); - } - if ( clean ) fs.rmSync(dest, { force: true, recursive: true, maxRetries: 10 }); - // Create the output directory if it doesn't exist already. - fs.mkdirSync(dest, { recursive: true }); - if ( nedb ) { - return extractNedb(src, dest, { yaml, yamlOptions, jsonOptions, log, collection, transformEntry, transformName }); - } - return extractClassicLevel(src, dest, { yaml, log, yamlOptions, jsonOptions, transformEntry, transformName }); -} - -/* -------------------------------------------- */ - -/** - * Extract a NeDB compendium pack into individual source files for each primary Document. - * @param {string} pack The source compendium pack. - * @param {string} dest The root output directory. - * @param {Partial} [options] - * @returns {Promise} - */ -async function extractNedb(pack, dest, { - yaml, yamlOptions, jsonOptions, log, collection, transformEntry, transformName -}={}) { - // Load the NeDB file. - const db = new Datastore({ filename: pack, autoload: true }); - - const unpackDoc = applyHierarchy((doc, collection, { sublevelPrefix, idPrefix }={}) => { - const sublevel = keyJoin(sublevelPrefix, collection); - const id = keyJoin(idPrefix, doc._id); - doc._key = `!${sublevel}!${id}`; - return { sublevelPrefix: sublevel, idPrefix: id }; - }); - - // Iterate over all entries in the DB, writing them as source files. - const docs = await db.find({}); - for ( const doc of docs ) { - await unpackDoc(doc, collection); - if ( await transformEntry?.(doc) === false ) continue; - let name = await transformName?.(doc); - if ( !name ) { - name = `${doc.name ? `${getSafeFilename(doc.name)}_${doc._id}` : doc._id}.${yaml ? "yml" : "json"}`; - } - const filename = path.join(dest, name); - serializeDocument(doc, filename, { yaml, yamlOptions, jsonOptions }); - if ( log ) console.log(`Wrote ${chalk.blue(name)}`); - } -} - -/* -------------------------------------------- */ - -/** - * Extract a LevelDB pack into individual source files for each primary Document. - * @param {string} pack The source compendium pack. - * @param {string} dest The root output directory. - * @param {Partial} [options] - * @returns {Promise} - */ -async function extractClassicLevel(pack, dest, { - yaml, yamlOptions, jsonOptions, log, transformEntry, transformName -}) { - // Load the directory as a ClassicLevel DB. - const db = new ClassicLevel(pack, { keyEncoding: "utf8", valueEncoding: "json" }); - - const unpackDoc = applyHierarchy(async (doc, collection, { sublevelPrefix, idPrefix }={}) => { - const sublevel = keyJoin(sublevelPrefix, collection); - const id = keyJoin(idPrefix, doc._id); - doc._key = `!${sublevel}!${id}`; - await mapHierarchy(doc, collection, (embeddedId, embeddedCollectionName) => { - return db.get(`!${sublevel}.${embeddedCollectionName}!${id}.${embeddedId}`); - }); - return { sublevelPrefix: sublevel, idPrefix: id }; - }); - - // Iterate over all entries in the DB, writing them as source files. - for await ( const [key, doc] of db.iterator() ) { - const [, collection, id] = key.split("!"); - if ( collection.includes(".") ) continue; // This is not a primary document, skip it. - await unpackDoc(doc, collection); - if ( await transformEntry?.(doc) === false ) continue; - let name = await transformName?.(doc); - if ( !name ) { - name = `${doc.name ? `${getSafeFilename(doc.name)}_${id}` : key}.${yaml ? "yml" : "json"}`; - } - const filename = path.join(dest, name); - serializeDocument(doc, filename, { yaml, yamlOptions, jsonOptions }); - if ( log ) console.log(`Wrote ${chalk.blue(name)}`); - } - - await db.close(); -} - -/* -------------------------------------------- */ -/* Utilities */ -/* -------------------------------------------- */ - -/** - * Wrap a function so that it can be applied recursively to a Document's hierarchy. - * @param {HierarchyApplyCallback} fn The function to wrap. - * @returns {HierarchyApplyCallback} The wrapped function. - */ -function applyHierarchy(fn) { - const apply = async (doc, collection, options={}) => { - const newOptions = await fn(doc, collection, options); - for ( const [embeddedCollectionName, type] of Object.entries(HIERARCHY[collection] ?? {}) ) { - const embeddedValue = doc[embeddedCollectionName]; - if ( Array.isArray(type) && Array.isArray(embeddedValue) ) { - for ( const embeddedDoc of embeddedValue ) await apply(embeddedDoc, embeddedCollectionName, newOptions); - } - else if ( embeddedValue ) await apply(embeddedValue, embeddedCollectionName, newOptions); - } - }; - return apply; -} - -/* -------------------------------------------- */ - -/** - * Transform a Document's embedded collections by applying a function to them. - * @param {object} doc The Document being operated on. - * @param {string} collection The Document's collection. - * @param {HierarchyMapCallback} fn The function to invoke. - */ -async function mapHierarchy(doc, collection, fn) { - for ( const [embeddedCollectionName, type] of Object.entries(HIERARCHY[collection] ?? {}) ) { - const embeddedValue = doc[embeddedCollectionName]; - if ( Array.isArray(type) ) { - if ( Array.isArray(embeddedValue) ) { - doc[embeddedCollectionName] = await Promise.all(embeddedValue.map(entry => { - return fn(entry, embeddedCollectionName); - })); - } - else doc[embeddedCollectionName] = []; - } else { - if ( embeddedValue ) doc[embeddedCollectionName] = await fn(embeddedValue, embeddedCollectionName); - else doc[embeddedCollectionName] = null; - } - } -} - -/* -------------------------------------------- */ - -/** - * Locate all source files in the given directory. - * @param {string} root The root directory to search in. - * @param {Partial} [options] - * @returns {string[]} - */ -function findSourceFiles(root, { yaml=false, recursive=false }={}) { - const files = []; - for ( const entry of fs.readdirSync(root, { withFileTypes: true }) ) { - const name = path.join(root, entry.name); - if ( entry.isDirectory() && recursive ) { - files.push(...findSourceFiles(name, { yaml, recursive })); - continue; - } - if ( !entry.isFile() ) continue; - const ext = path.extname(name); - const isYaml = (ext === ".yml") || (ext === ".yaml"); - if ( yaml && isYaml ) files.push(name); - else if ( !yaml && (ext === ".json") ) files.push(name); - } - return files; -} - -/* -------------------------------------------- */ - -/** - * Serialize a Document and write it to the filesystem. - * @param {object} doc The Document to serialize. - * @param {string} filename The filename to write it to. - * @param {Partial} [options] Options to configure serialization behavior. - */ -function serializeDocument(doc, filename, { yaml, yamlOptions, jsonOptions }={}) { - fs.mkdirSync(path.dirname(filename), { recursive: true }); - let serialized; - if ( yaml ) serialized = YAML.dump(doc, yamlOptions); - else { - const { replacer=null, space=2 } = jsonOptions; - serialized = JSON.stringify(doc, replacer, space); - } - fs.writeFileSync(filename, serialized + "\n"); -} - -/* -------------------------------------------- */ - -/** - * Join non-blank key parts. - * @param {...string} args Key parts. - * @returns {string} - */ -function keyJoin(...args) { - return args.filter(_ => _).join("."); -} - -/* -------------------------------------------- */ - -/** - * Ensure a string is safe for use as a filename. - * @param {string} filename The filename to sanitize - * @returns {string} The sanitized filename - */ -function getSafeFilename(filename) { - return filename.replace(/[^a-zA-Z0-9А-я]/g, '_'); -} diff --git a/node_modules/@foundryvtt/foundryvtt-cli/package.json b/node_modules/@foundryvtt/foundryvtt-cli/package.json deleted file mode 100644 index 91de40b..0000000 --- a/node_modules/@foundryvtt/foundryvtt-cli/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "@foundryvtt/foundryvtt-cli", - "productName": "Foundry VTT CLI", - "description": "The Official CLI for Foundry VTT", - "version": "1.0.3", - "author": { - "name": "Foundry Gaming LLC", - "email": "admin@foundryvtt.com", - "url": "https://foundryvtt.com" - }, - "main": "index.mjs", - "bin": { - "fvtt": "fvtt.mjs" - }, - "homepage": "https://foundryvtt.com", - "license": "MIT", - "private": false, - "dependencies": { - "chalk": "^5.2.0", - "classic-level": "^1.2.0", - "esm": "^3.2.25", - "js-yaml": "^4.1.0", - "mkdirp": "^3.0.0", - "nedb-promises": "^6.2.1", - "yargs": "^17.7.1" - }, - "devDependencies": { - "eslint": "^8.47.0", - "eslint-plugin-jsdoc": "^46.4.6" - }, - "engines": { - "node": ">17.0.0" - } -} diff --git a/node_modules/@gulpjs/messages/LICENSE b/node_modules/@gulpjs/messages/LICENSE deleted file mode 100644 index aa4ff81..0000000 --- a/node_modules/@gulpjs/messages/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2024 Blaine Bublitz and Eric Schoffstall . - -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/@gulpjs/messages/README.md b/node_modules/@gulpjs/messages/README.md deleted file mode 100644 index 14a4def..0000000 --- a/node_modules/@gulpjs/messages/README.md +++ /dev/null @@ -1,47 +0,0 @@ -

- - - -

- -# `@gulpjs/messages` - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Symbols for all messages within gulp-cli. - -## Usage - -In your `.gulp.js` file: - -```js -var messages = require('@gulpjs/messages'); - -module.exports = { - message: function (data) { - if (data.tag === messages.DESCRIPTION) { - return 'Your description override message'; - } - } -}; -``` - -## API - -This project exposes various symbols assigned to keys to use for matching gulp-cli messages. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/@gulpjs/messages.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/@gulpjs/messages -[npm-image]: https://img.shields.io/npm/v/@gulpjs/messages.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/messages/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/messages/dev.yml?branch=master&style=flat-square - -[coveralls-url]: https://coveralls.io/github/gulpjs/messages -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/messages/master.svg?style=flat-square - diff --git a/node_modules/@gulpjs/messages/index.js b/node_modules/@gulpjs/messages/index.js deleted file mode 100644 index bc4482b..0000000 --- a/node_modules/@gulpjs/messages/index.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -module.exports = { - /** - * Liftoff events - */ - PRELOAD_BEFORE: Symbol.for('GULP_CLI_PRELOAD_BEFORE'), - PRELOAD_SUCCESS: Symbol.for('GULP_CLI_PRELOAD_SUCCESS'), - PRELOAD_FAILURE: Symbol.for('GULP_CLI_PRELOAD_FAILURE'), - LOADER_SUCCESS: Symbol.for('GULP_CLI_LOADER_SUCCESS'), - LOADER_FAILURE: Symbol.for('GULP_CLI_LOADER_FAILURE'), - NODE_FLAGS: Symbol.for('GULP_CLI_NODE_FLAGS'), - RESPAWNED: Symbol.for('GULP_CLI_RESPAWNED'), - - /** - * Various problems that might occur - */ - UNSUPPORTED_GULP_VERSION: Symbol.for('GULP_CLI_UNSUPPORTED_GULP_VERSION'), - MISSING_GULPFILE: Symbol.for('GULP_CLI_MISSING_GULPFILE'), - MISSING_NODE_MODULES: Symbol.for('GULP_CLI_MISSING_NODE_MODULES'), - MISSING_GULP: Symbol.for('GULP_CLI_MISSING_GULP'), - YARN_INSTALL: Symbol.for('GULP_CLI_YARN_INSTALL'), - NPM_INSTALL: Symbol.for('GULP_CLI_NPM_INSTALL'), - YARN_INSTALL_GULP: Symbol.for('GULP_CLI_YARN_INSTALL_GULP'), - NPM_INSTALL_GULP: Symbol.for('GULP_CLI_NPM_INSTALL_GULP'), - GULPLOG_DEPRECATED: Symbol.for('GULP_CLI_GULPLOG_DEPRECATED'), - - /** - * Other details - */ - CWD_CHANGED: Symbol.for('GULP_CLI_CWD_CHANGED'), - DESCRIPTION: Symbol.for('GULP_CLI_DESCRIPTION'), - GULPFILE: Symbol.for('GULP_CLI_GULPFILE'), - - /** - * Task system - */ - TASK_START: Symbol.for('GULP_CLI_TASK_START'), - TASK_STOP: Symbol.for('GULP_CLI_TASK_STOP'), - TASK_FAILURE: Symbol.for('GULP_CLI_TASK_FAILURE'), - TASK_MISSING: Symbol.for('GULP_CLI_TASK_MISSING'), - TASK_SYNC: Symbol.for('GULP_CLI_TASK_SYNC'), - - /** - * Completions - */ - COMPLETION_TYPE_MISSING: Symbol.for('GULP_CLI_COMPLETION_TYPE_MISSING'), - COMPLETION_TYPE_UNKNOWN: Symbol.for('GULP_CLI_COMPLETION_TYPE_UNKNOWN'), - - /** - * Errors - */ - PRELOAD_ERROR: Symbol.for('GULP_CLI_PRELOAD_ERROR'), - LOADER_ERROR: Symbol.for('GULP_CLI_LOADER_ERROR'), - ARGV_ERROR: Symbol.for('GULP_CLI_ARGV_ERROR'), - EXEC_ERROR: Symbol.for('GULP_CLI_EXEC_ERROR'), - TASK_ERROR: Symbol.for('GULP_CLI_TASK_ERROR'), - - /** - * Help - */ - USAGE: Symbol.for('GULP_CLI_USAGE'), - FLAG_HELP: Symbol.for('GULP_CLI_FLAG_HELP'), - FLAG_VERSION: Symbol.for('GULP_CLI_FLAG_VERSION'), - FLAG_PRELOAD: Symbol.for('GULP_CLI_FLAG_PRELOAD'), - FLAG_GULPFILE: Symbol.for('GULP_CLI_FLAG_GULPFILE'), - FLAG_CWD: Symbol.for('GULP_CLI_FLAG_CWD'), - FLAG_TASKS: Symbol.for('GULP_CLI_FLAG_TASKS'), - FLAG_TASKS_SIMPLE: Symbol.for('GULP_CLI_FLAG_TASKS_SIMPLE'), - FLAG_TASKS_JSON: Symbol.for('GULP_CLI_FLAG_TASKS_JSON'), - FLAG_TASKS_DEPTH: Symbol.for('GULP_CLI_FLAG_TASKS_DEPTH'), - FLAG_COMPACT_TASKS: Symbol.for('GULP_CLI_FLAG_COMPACT_TASKS'), - FLAG_SORT_TASKS: Symbol.for('GULP_CLI_FLAG_SORT_TASKS'), - FLAG_COLOR: Symbol.for('GULP_CLI_FLAG_COLOR'), - FLAG_NO_COLOR: Symbol.for('GULP_CLI_FLAG_NO_COLOR'), - FLAG_SILENT: Symbol.for('GULP_CLI_FLAG_SILENT'), - FLAG_CONTINUE: Symbol.for('GULP_CLI_FLAG_CONTINUE'), - FLAG_SERIES: Symbol.for('GULP_CLI_FLAG_SERIES'), - FLAG_LOG_LEVEL: Symbol.for('GULP_CLI_FLAG_LOG_LEVEL'), - - /** - * Task tree - */ - TASK_NAME: Symbol.for('GULP_CLI_TASK_NAME'), - TASK_DESCRIPTION: Symbol.for('GULP_CLI_TASK_DESCRIPTION'), - TASK_FLAG: Symbol.for('GULP_CLI_TASK_FLAG'), - TASK_FLAG_DESCRIPTION: Symbol.for('GULP_CLI_TASK_FLAG_DESCRIPTION'), - BOX_DRAWINGS_LIGHT_UP_AND_RIGHT: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_UP_AND_RIGHT'), - BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT'), - BOX_DRAWINGS_LIGHT_HORIZONTAL: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_HORIZONTAL'), - BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL'), - BOX_DRAWINGS_LIGHT_VERTICAL: Symbol.for('GULP_CLI_BOX_DRAWINGS_LIGHT_VERTICAL'), -}; diff --git a/node_modules/@gulpjs/messages/package.json b/node_modules/@gulpjs/messages/package.json deleted file mode 100644 index b05f442..0000000 --- a/node_modules/@gulpjs/messages/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "@gulpjs/messages", - "version": "1.1.0", - "description": "Symbols for all messages within gulp-cli", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/messages", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "index.js", - "LICENSE" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": {}, - "devDependencies": { - "eslint": "^7.0.0", - "eslint-config-gulp": "^5.0.0", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.0.0", - "mocha": "^8.0.0", - "nyc": "^15.0.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "publishConfig": { - "access": "public" - }, - "keywords": [] -} diff --git a/node_modules/@gulpjs/to-absolute-glob/LICENSE b/node_modules/@gulpjs/to-absolute-glob/LICENSE deleted file mode 100644 index b63fab6..0000000 --- a/node_modules/@gulpjs/to-absolute-glob/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2022 Jon Schlinkert , 2023 Blaine Bublitz and Eric Schoffstall - -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/@gulpjs/to-absolute-glob/README.md b/node_modules/@gulpjs/to-absolute-glob/README.md deleted file mode 100644 index e10bb3f..0000000 --- a/node_modules/@gulpjs/to-absolute-glob/README.md +++ /dev/null @@ -1,58 +0,0 @@ -

- - - -

- -# @gulpjs/to-absolute-glob - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled. - -## Usage - -```js -var toAbsoluteGlob = require('@gulpjs/to-absolute-glob'); - -// All these assume your cwd is `/dev/foo/` - -toAbsoluteGlob('a/*.js') === '/dev/foo/a/*.js'; - -// Makes a path absolute -toAbsoluteGlob('a') === '/dev/foo/a'; - -// Retains trailing slashes -toAbsoluteGlob('a/*/') === '/dev/foo/a/*/'; - -// Makes a negative glob absolute -toAbsoluteGlob('!a/*.js') === '!/dev/foo/a/*.js'; - -// Accepts a cwd -toAbsoluteGlob('a/*.js', { cwd: 'foo' }) === '/dev/foo/foo/a/*.js'; - -// Accepts a root path -toAbsoluteGlob('/a/*.js', { root: 'baz' }) === '/dev/foo/baz/a/*.js'; -``` - -## API - -### `toAbsoluteGlob(glob, [options])` - -Takes a `glob` string and an optional `options` object and produces an absolute glob. If the glob is relative, the `root` or `cwd` option (or `process.cwd()` if neither specified) will be used as the base of the glob. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/@gulpjs/to-absolute-glob.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/@gulpjs/to-absolute-glob -[npm-image]: https://img.shields.io/npm/v/@gulpjs/to-absolute-glob.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/to-absolute-glob/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/to-absolute-glob/dev.yml?branch=master&style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/to-absolute-glob -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/to-absolute-glob/master.svg?style=flat-square - diff --git a/node_modules/@gulpjs/to-absolute-glob/index.js b/node_modules/@gulpjs/to-absolute-glob/index.js deleted file mode 100644 index 5e79b44..0000000 --- a/node_modules/@gulpjs/to-absolute-glob/index.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -var path = require('path'); -var isNegated = require('is-negated-glob'); - -module.exports = function (glob, options) { - // default options - var opts = options || {}; - - // ensure cwd is absolute - var cwd = unescape(opts.cwd ? opts.cwd : process.cwd()); - cwd = path.resolve(cwd); - cwd = unixify(cwd); - cwd = escape(cwd); - - var rootDir = opts.root; - // if `options.root` is defined, ensure it's absolute - if (rootDir) { - rootDir = unescape(rootDir); - rootDir = unixify(rootDir); - if (process.platform === 'win32' || !path.isAbsolute(rootDir)) { - rootDir = unixify(path.resolve(rootDir)); - } - rootDir = escape(rootDir); - } - - // store last character before glob is modified - var suffix = glob.slice(-1); - - // check to see if glob is negated (and not a leading negated-extglob) - var ing = isNegated(glob); - glob = ing.pattern; - - // trim starting ./ from glob patterns - if (glob.slice(0, 2) === './') { - glob = glob.slice(2); - } - - // when the glob pattern is only a . use an empty string - if (glob.length === 1 && glob === '.') { - glob = ''; - } - - // make glob absolute - if (rootDir && glob.charAt(0) === '/') { - glob = join(rootDir, glob); - } else if (!path.isAbsolute(glob) || glob.slice(0, 1) === '\\') { - glob = join(cwd, glob); - } - - // if glob had a trailing `/`, re-add it now in case it was removed - if (suffix === '/' && glob.slice(-1) !== '/') { - glob += '/'; - } - - // re-add leading `!` if it was removed - return ing.negated ? '!' + glob : glob; -}; - -function escape(path) { - return path.replace(/([({[\]})*?!])/g, '\\$1'); -} - -function unescape(path) { - return path.replace(/\\([({[\]})*?!])/g, '$1'); -} - -// Before calling unixify, we remove the escapes and then -// we add them back afterwards to avoid double-escaping -function unixify(filepath) { - return filepath.replace(/\\/g, '/'); -} - -function join(dir, glob) { - if (dir.charAt(dir.length - 1) === '/') { - dir = dir.slice(0, -1); - } - if (glob.charAt(0) === '/') { - glob = glob.slice(1); - } - if (!glob) return dir; - - // Resolve `../` segements in the glob - while (glob.slice(0, 3) === '../') { - dir = dir.slice(0, dir.lastIndexOf('/')); - glob = glob.slice(3); - } - - return dir + '/' + glob; -} diff --git a/node_modules/@gulpjs/to-absolute-glob/package.json b/node_modules/@gulpjs/to-absolute-glob/package.json deleted file mode 100644 index 2eae04b..0000000 --- a/node_modules/@gulpjs/to-absolute-glob/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@gulpjs/to-absolute-glob", - "version": "4.0.0", - "description": "Make a glob pattern absolute, ensuring that negative globs and patterns with trailing slashes are correctly handled.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/to-absolute-glob", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha" - }, - "dependencies": { - "is-negated-glob": "^1.0.0" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.4.2", - "mocha": "^8.4.0", - "nyc": "^15.1.0" - }, - "publishConfig": { - "access": "public" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "absolute", - "file", - "filepath", - "glob", - "negate", - "negative", - "path", - "pattern", - "resolve", - "to" - ] -} diff --git a/node_modules/@humanfs/core/LICENSE b/node_modules/@humanfs/core/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@humanfs/core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/@humanfs/core/README.md b/node_modules/@humanfs/core/README.md deleted file mode 100644 index 4f86d14..0000000 --- a/node_modules/@humanfs/core/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# `@humanfs/core` - -by [Nicholas C. Zakas](https://humanwhocodes.com) - -If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. - -## Description - -The core functionality for humanfs that is shared across all implementations for all runtimes. The contents of this package are intentionally runtime agnostic and are not intended to be used alone. - -Currently, this package simply exports the `Hfs` class, which is an abstract base class intended to be inherited from in runtime-specific hfs packages (like `@humanfs/node`). - -> [!WARNING] -> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production! - -## Installation - -### Node.js - -Install using your favorite package manager for Node.js: - -```shell -npm install @humanfs/core - -# or - -pnpm install @humanfs/core - -# or - -yarn add @humanfs/core - -# or - -bun install @humanfs/core -``` - -Then you can import the `Hfs` and `Path` classes like this: - -```js -import { Hfs, Path } from "@humanfs/core"; -``` - -### Deno - -Install using [JSR](https://jsr.io): - -```shell -deno add @humanfs/core - -# or - -jsr add @humanfs/core -``` - -Then you can import the `Hfs` class like this: - -```js -import { Hfs, Path } from "@humanfs/core"; -``` - -### Browser - -It's recommended to import the minified version to save bandwidth: - -```js -import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core?min"; -``` - -However, you can also import the unminified version for debugging purposes: - -```js -import { Hfs, Path } from "https://cdn.skypack.dev/@humanfs/core"; -``` - -## Usage - -### `Hfs` Class - -The `Hfs` class contains all of the basic functionality for an `Hfs` instance *without* a predefined impl. This class is mostly used for creating runtime-specific impls, such as `NodeHfs` and `DenoHfs`. - -You can create your own instance by providing an `impl` directly: - -```js -const hfs = new Hfs({ impl: { async text() {} }}); -``` - -The specified `impl` becomes the base impl for the instance, meaning you can always reset back to it using `resetImpl()`. - -You can also inherit from `Hfs` to create your own class with a preconfigured impl, such as: - -```js -class MyHfs extends Hfs { - constructor() { - super({ - impl: myImpl - }); - } -} -``` - -### `Path` Class - -The `Path` class represents the path to a directory or file within a file system. It's an abstract representation that can be used even outside of traditional file systems where string paths might not make sense. - -```js -const myPath = new Path(["dir", "subdir"]); -console.log(myPath.toString()); // "dir/subdir" - -// add another step -myPath.push("file.txt"); -console.log(myPath.toString()); // "dir/subdir/file.txt" - -// get just the last step -console.log(myPath.name); // "file.txt" - -// change just the last step -myPath.name = "file.json"; -console.log(myPath.name); // "file.json" -console.log(myPath.toString()); // "dir/subdir/file.json" - -// get the size of the path -console.log(myPath.size); // 3 - -// remove the last step -myPath.pop(); -console.log(myPath.toString()); // "dir/subdir" - -// iterate over the steps -for (const step of myPath) { - // do something -} - -// create a new path from a string -const newPath = Path.fromString("/foo/bar"); -``` - -## License - -Apache 2.0 diff --git a/node_modules/@humanfs/core/dist/errors.d.ts b/node_modules/@humanfs/core/dist/errors.d.ts deleted file mode 100644 index c885bbf..0000000 --- a/node_modules/@humanfs/core/dist/errors.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @fileoverview Common error classes - * @author Nicholas C. Zakas - */ -/** - * Error thrown when a file or directory is not found. - */ -export class NotFoundError extends Error { - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message: string); - /** - * Error code. - * @type {string} - */ - code: string; -} -/** - * Error thrown when an operation is not permitted. - */ -export class PermissionError extends Error { - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message: string); - /** - * Error code. - * @type {string} - */ - code: string; -} -/** - * Error thrown when an operation is not allowed on a directory. - */ -export class DirectoryError extends Error { - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message: string); - /** - * Error code. - * @type {string} - */ - code: string; -} -/** - * Error thrown when a directory is not empty. - */ -export class NotEmptyError extends Error { - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message: string); - /** - * Error code. - * @type {string} - */ - code: string; -} diff --git a/node_modules/@humanfs/core/dist/fsx.d.ts b/node_modules/@humanfs/core/dist/fsx.d.ts deleted file mode 100644 index ef85093..0000000 --- a/node_modules/@humanfs/core/dist/fsx.d.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @fileoverview The main file for the hfs package. - * @author Nicholas C. Zakas - */ -/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */ -/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ -/** - * Error to represent when a method is missing on an impl. - */ -export class NoSuchMethodError extends Error { - /** - * Creates a new instance. - * @param {string} methodName The name of the method that was missing. - */ - constructor(methodName: string); -} -/** - * Error to represent when an impl is already set. - */ -export class ImplAlreadySetError extends Error { - /** - * Creates a new instance. - */ - constructor(); -} -/** - * A class representing a log entry. - */ -export class LogEntry { - /** - * Creates a new instance. - * @param {string} type The type of log entry. - * @param {any} [data] The data associated with the log entry. - */ - constructor(type: string, data?: any); - /** - * The time at which the log entry was created. - * @type {number} - */ - timestamp: number; - methodName: string; - data: any; - #private; -} -/** - * A class representing a file system utility library. - * @implements {HfsImpl} - */ -export class Hfs implements HfsImpl { - /** - * Creates a new instance. - * @param {object} options The options for the instance. - * @param {HfsImpl} options.impl The implementation to use. - */ - constructor({ impl }: { - impl: HfsImpl; - }); - /** - * Starts a new log with the given name. - * @param {string} name The name of the log to start; - * @returns {void} - * @throws {Error} When the log already exists. - * @throws {TypeError} When the name is not a non-empty string. - */ - logStart(name: string): void; - /** - * Ends a log with the given name and returns the entries. - * @param {string} name The name of the log to end. - * @returns {Array} The entries in the log. - * @throws {Error} When the log does not exist. - */ - logEnd(name: string): Array; - /** - * Determines if the current implementation is the base implementation. - * @returns {boolean} True if the current implementation is the base implementation. - */ - isBaseImpl(): boolean; - /** - * Sets the implementation for this instance. - * @param {object} impl The implementation to use. - * @returns {void} - */ - setImpl(impl: object): void; - /** - * Resets the implementation for this instance back to its original. - * @returns {void} - */ - resetImpl(): void; - /** - * Reads the given file and returns the contents as text. Assumes UTF-8 encoding. - * @param {string} filePath The file to read. - * @returns {Promise} The contents of the file. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - text(filePath: string): Promise; - /** - * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding. - * @param {string} filePath The file to read. - * @returns {Promise} The contents of the file as JSON. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {SyntaxError} When the file contents are not valid JSON. - * @throws {TypeError} When the file path is not a non-empty string. - */ - json(filePath: string): Promise; - /** - * Reads the given file and returns the contents as an ArrayBuffer. - * @param {string} filePath The file to read. - * @returns {Promise} The contents of the file as an ArrayBuffer. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - * @deprecated Use bytes() instead. - */ - arrayBuffer(filePath: string): Promise; - /** - * Reads the given file and returns the contents as an Uint8Array. - * @param {string} filePath The file to read. - * @returns {Promise} The contents of the file as an Uint8Array. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - bytes(filePath: string): Promise; - /** - * Writes the given data to the given file. Creates any necessary directories along the way. - * If the data is a string, UTF-8 encoding is used. - * @param {string} filePath The file to write. - * @param {any} contents The data to write. - * @returns {Promise} A promise that resolves when the file is written. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - write(filePath: string, contents: any): Promise; - /** - * Determines if the given file exists. - * @param {string} filePath The file to check. - * @returns {Promise} True if the file exists. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - isFile(filePath: string): Promise; - /** - * Determines if the given directory exists. - * @param {string} dirPath The directory to check. - * @returns {Promise} True if the directory exists. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - isDirectory(dirPath: string): Promise; - /** - * Creates the given directory. - * @param {string} dirPath The directory to create. - * @returns {Promise} A promise that resolves when the directory is created. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - createDirectory(dirPath: string): Promise; - /** - * Deletes the given file. - * @param {string} filePath The file to delete. - * @returns {Promise} A promise that resolves when the file is deleted. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - delete(filePath: string): Promise; - /** - * Deletes the given directory. - * @param {string} dirPath The directory to delete. - * @returns {Promise} A promise that resolves when the directory is deleted. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - deleteAll(dirPath: string): Promise; - /** - * Returns a list of directory entries for the given path. - * @param {string} dirPath The path to the directory to read. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string. - * @throws {Error} If the directory cannot be read. - */ - list(dirPath: string): AsyncIterable; - /** - * Returns the size of the given file. - * @param {string} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the size of the file. - * @throws {TypeError} If the file path is not a string. - * @throws {Error} If the file cannot be read. - */ - size(filePath: string): Promise; - #private; -} -export type HfsImpl = import("@humanfs/types").HfsImpl; -export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; diff --git a/node_modules/@humanfs/core/dist/hfs.d.ts b/node_modules/@humanfs/core/dist/hfs.d.ts deleted file mode 100644 index 69ec368..0000000 --- a/node_modules/@humanfs/core/dist/hfs.d.ts +++ /dev/null @@ -1,288 +0,0 @@ -/** - * Error to represent when a method is missing on an impl. - */ -export class NoSuchMethodError extends Error { - /** - * Creates a new instance. - * @param {string} methodName The name of the method that was missing. - */ - constructor(methodName: string); -} -/** - * Error to represent when a method is not supported on an impl. This happens - * when a method on `Hfs` is called with one name and the corresponding method - * on the impl has a different name. (Example: `text()` and `bytes()`.) - */ -export class MethodNotSupportedError extends Error { - /** - * Creates a new instance. - * @param {string} methodName The name of the method that was missing. - */ - constructor(methodName: string); -} -/** - * Error to represent when an impl is already set. - */ -export class ImplAlreadySetError extends Error { - /** - * Creates a new instance. - */ - constructor(); -} -/** - * A class representing a log entry. - */ -export class LogEntry { - /** - * Creates a new instance. - * @param {string} type The type of log entry. - * @param {any} [data] The data associated with the log entry. - */ - constructor(type: string, data?: any); - /** - * The type of log entry. - * @type {string} - */ - type: string; - /** - * The data associated with the log entry. - * @type {any} - */ - data: any; - /** - * The time at which the log entry was created. - * @type {number} - */ - timestamp: number; -} -/** - * A class representing a file system utility library. - * @implements {HfsImpl} - */ -export class Hfs implements HfsImpl { - /** - * Creates a new instance. - * @param {object} options The options for the instance. - * @param {HfsImpl} options.impl The implementation to use. - */ - constructor({ impl }: { - impl: HfsImpl; - }); - /** - * Starts a new log with the given name. - * @param {string} name The name of the log to start; - * @returns {void} - * @throws {Error} When the log already exists. - * @throws {TypeError} When the name is not a non-empty string. - */ - logStart(name: string): void; - /** - * Ends a log with the given name and returns the entries. - * @param {string} name The name of the log to end. - * @returns {Array} The entries in the log. - * @throws {Error} When the log does not exist. - */ - logEnd(name: string): Array; - /** - * Determines if the current implementation is the base implementation. - * @returns {boolean} True if the current implementation is the base implementation. - */ - isBaseImpl(): boolean; - /** - * Sets the implementation for this instance. - * @param {object} impl The implementation to use. - * @returns {void} - */ - setImpl(impl: object): void; - /** - * Resets the implementation for this instance back to its original. - * @returns {void} - */ - resetImpl(): void; - /** - * Reads the given file and returns the contents as text. Assumes UTF-8 encoding. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - text(filePath: string | URL): Promise; - /** - * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file as JSON. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {SyntaxError} When the file contents are not valid JSON. - * @throws {TypeError} When the file path is not a non-empty string. - */ - json(filePath: string | URL): Promise; - /** - * Reads the given file and returns the contents as an ArrayBuffer. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file as an ArrayBuffer. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - * @deprecated Use bytes() instead. - */ - arrayBuffer(filePath: string | URL): Promise; - /** - * Reads the given file and returns the contents as an Uint8Array. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file as an Uint8Array. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - bytes(filePath: string | URL): Promise; - /** - * Writes the given data to the given file. Creates any necessary directories along the way. - * If the data is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The file to write. - * @param {string|ArrayBuffer|ArrayBufferView} contents The data to write. - * @returns {Promise} A promise that resolves when the file is written. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - write(filePath: string | URL, contents: string | ArrayBuffer | ArrayBufferView): Promise; - /** - * Appends the given data to the given file. Creates any necessary directories along the way. - * If the data is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The file to append to. - * @param {string|ArrayBuffer|ArrayBufferView} contents The data to append. - * @returns {Promise} A promise that resolves when the file is appended to. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - * @throws {TypeError} When the file contents are not a string or ArrayBuffer. - * @throws {Error} When the file cannot be appended to. - */ - append(filePath: string | URL, contents: string | ArrayBuffer | ArrayBufferView): Promise; - /** - * Determines if the given file exists. - * @param {string|URL} filePath The file to check. - * @returns {Promise} True if the file exists. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - isFile(filePath: string | URL): Promise; - /** - * Determines if the given directory exists. - * @param {string|URL} dirPath The directory to check. - * @returns {Promise} True if the directory exists. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - isDirectory(dirPath: string | URL): Promise; - /** - * Creates the given directory. - * @param {string|URL} dirPath The directory to create. - * @returns {Promise} A promise that resolves when the directory is created. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - createDirectory(dirPath: string | URL): Promise; - /** - * Deletes the given file or empty directory. - * @param {string|URL} filePath The file to delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - delete(filePath: string | URL): Promise; - /** - * Deletes the given file or directory recursively. - * @param {string|URL} dirPath The directory to delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - deleteAll(dirPath: string | URL): Promise; - /** - * Returns a list of directory entries for the given path. - * @param {string|URL} dirPath The path to the directory to read. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string or URL. - * @throws {Error} If the directory cannot be read. - */ - list(dirPath: string | URL): AsyncIterable; - /** - * Walks a directory using a depth-first traversal and returns the entries - * from the traversal. - * @param {string|URL} dirPath The path to the directory to walk. - * @param {Object} [options] The options for the walk. - * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.directoryFilter] A filter function to determine - * if a directory's entries should be included in the walk. - * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.entryFilter] A filter function to determine if - * an entry should be included in the walk. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string or URL. - * @throws {Error} If the directory cannot be read. - */ - walk(dirPath: string | URL, { directoryFilter, entryFilter }?: { - directoryFilter?: (entry: HfsWalkEntry) => Promise | boolean; - entryFilter?: (entry: HfsWalkEntry) => Promise | boolean; - }): AsyncIterable; - /** - * Returns the size of the given file. - * @param {string|URL} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the size of the file. - * @throws {TypeError} If the file path is not a string or URL. - * @throws {Error} If the file cannot be read. - */ - size(filePath: string | URL): Promise; - /** - * Returns the last modified timestamp of the given file or directory. - * @param {string|URL} fileOrDirPath The path to the file or directory. - * @returns {Promise} A promise that resolves with the last modified date - * or undefined if the file or directory does not exist. - * @throws {TypeError} If the path is not a string or URL. - */ - lastModified(fileOrDirPath: string | URL): Promise; - /** - * Copys a file from one location to another. - * @param {string|URL} source The path to the file to copy. - * @param {string|URL} destination The path to the new file. - * @returns {Promise} A promise that resolves when the file is copied. - * @throws {TypeError} If the file path is not a string or URL. - * @throws {Error} If the file cannot be copied. - */ - copy(source: string | URL, destination: string | URL): Promise; - /** - * Copies a file or directory from one location to another. - * @param {string|URL} source The path to the file or directory to copy. - * @param {string|URL} destination The path to copy the file or directory to. - * @returns {Promise} A promise that resolves when the file or directory is - * copied. - * @throws {TypeError} If the directory path is not a string or URL. - * @throws {Error} If the directory cannot be copied. - */ - copyAll(source: string | URL, destination: string | URL): Promise; - /** - * Moves a file from the source path to the destination path. - * @param {string|URL} source The location of the file to move. - * @param {string|URL} destination The destination of the file to move. - * @returns {Promise} A promise that resolves when the move is complete. - * @throws {TypeError} If the file or directory paths are not strings. - * @throws {Error} If the file or directory cannot be moved. - */ - move(source: string | URL, destination: string | URL): Promise; - /** - * Moves a file or directory from one location to another. - * @param {string|URL} source The path to the file or directory to move. - * @param {string|URL} destination The path to move the file or directory to. - * @returns {Promise} A promise that resolves when the file or directory is - * moved. - * @throws {TypeError} If the source is not a string or URL. - * @throws {TypeError} If the destination is not a string or URL. - * @throws {Error} If the file or directory cannot be moved. - */ - moveAll(source: string | URL, destination: string | URL): Promise; - #private; -} -export type HfsImpl = import("@humanfs/types").HfsImpl; -export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; -export type HfsWalkEntry = import("@humanfs/types").HfsWalkEntry; diff --git a/node_modules/@humanfs/core/dist/index.d.ts b/node_modules/@humanfs/core/dist/index.d.ts deleted file mode 100644 index d2dd30f..0000000 --- a/node_modules/@humanfs/core/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { Hfs } from "./hfs.js"; -export { Path } from "./path.js"; -export * from "./errors.js"; diff --git a/node_modules/@humanfs/core/dist/path.d.ts b/node_modules/@humanfs/core/dist/path.d.ts deleted file mode 100644 index 6e29395..0000000 --- a/node_modules/@humanfs/core/dist/path.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -export class Path { - /** - * Creates a new path based on the argument type. If the argument is a string, - * it is assumed to be a file or directory path and is converted to a Path - * instance. If the argument is a URL, it is assumed to be a file URL and is - * converted to a Path instance. If the argument is a Path instance, it is - * copied into a new Path instance. If the argument is an array, it is assumed - * to be the steps of a path and is used to create a new Path instance. - * @param {string|URL|Path|Array} pathish The value to convert to a Path instance. - * @returns {Path} A new Path instance. - * @throws {TypeError} When pathish is not a string, URL, Path, or Array. - * @throws {TypeError} When pathish is a string and is empty. - */ - static from(pathish: string | URL | Path | Array): Path; - /** - * Creates a new Path instance from a string. - * @param {string} fileOrDirPath The file or directory path to convert. - * @returns {Path} A new Path instance. - * @deprecated Use Path.from() instead. - */ - static fromString(fileOrDirPath: string): Path; - /** - * Creates a new Path instance from a URL. - * @param {URL} url The URL to convert. - * @returns {Path} A new Path instance. - * @throws {TypeError} When url is not a URL instance. - * @throws {TypeError} When url.pathname is empty. - * @throws {TypeError} When url.protocol is not "file:". - * @deprecated Use Path.from() instead. - */ - static fromURL(url: URL): Path; - /** - * Creates a new instance. - * @param {Iterable} [steps] The steps to use for the path. - * @throws {TypeError} When steps is not iterable. - */ - constructor(steps?: Iterable); - /** - * Adds steps to the end of the path. - * @param {...string} steps The steps to add to the path. - * @returns {void} - */ - push(...steps: string[]): void; - /** - * Removes the last step from the path. - * @returns {string} The last step in the path. - */ - pop(): string; - /** - * Returns an iterator for steps in the path. - * @returns {IterableIterator} An iterator for the steps in the path. - */ - steps(): IterableIterator; - /** - * Sets the name (the last step) of the path. - * @type {string} - */ - set name(value: string); - /** - * Retrieves the name (the last step) of the path. - * @type {string} - */ - get name(): string; - /** - * Retrieves the size of the path. - * @type {number} - */ - get size(): number; - /** - * Returns the path as a string. - * @returns {string} The path as a string. - */ - toString(): string; - /** - * Returns an iterator for the steps in the path. - * @returns {IterableIterator} An iterator for the steps in the path. - */ - [Symbol.iterator](): IterableIterator; - #private; -} -export type HfsImpl = import("@humanfs/types").HfsImpl; -export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; diff --git a/node_modules/@humanfs/core/package.json b/node_modules/@humanfs/core/package.json deleted file mode 100644 index e1f9f40..0000000 --- a/node_modules/@humanfs/core/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@humanfs/core", - "version": "0.19.1", - "description": "The core of the humanfs library.", - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - "import": { - "types": "./dist/index.d.ts", - "default": "./src/index.js" - } - }, - "files": [ - "dist", - "src" - ], - "scripts": { - "build": "tsc", - "prepare": "npm run build", - "pretest": "npm run build", - "test": "c8 mocha tests" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/humanfs.git" - }, - "publishConfig": { - "access": "public" - }, - "keywords": [ - "filesystem", - "fs", - "hfs", - "files" - ], - "author": "Nicholas C. Zakas", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/humanwhocodes/humanfs/issues" - }, - "homepage": "https://github.com/humanwhocodes/humanfs#readme", - "engines": { - "node": ">=18.18.0" - }, - "devDependencies": { - "@humanfs/types": "^0.15.0", - "c8": "^9.0.0", - "mocha": "^10.2.0", - "typescript": "^5.2.2" - } -} diff --git a/node_modules/@humanfs/core/src/errors.js b/node_modules/@humanfs/core/src/errors.js deleted file mode 100644 index 8fb35be..0000000 --- a/node_modules/@humanfs/core/src/errors.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @fileoverview Common error classes - * @author Nicholas C. Zakas - */ - -/** - * Error thrown when a file or directory is not found. - */ -export class NotFoundError extends Error { - /** - * Name of the error class. - * @type {string} - */ - name = "NotFoundError"; - - /** - * Error code. - * @type {string} - */ - code = "ENOENT"; - - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message) { - super(`ENOENT: No such file or directory, ${message}`); - } -} - -/** - * Error thrown when an operation is not permitted. - */ -export class PermissionError extends Error { - /** - * Name of the error class. - * @type {string} - */ - name = "PermissionError"; - - /** - * Error code. - * @type {string} - */ - code = "EPERM"; - - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message) { - super(`EPERM: Operation not permitted, ${message}`); - } -} - -/** - * Error thrown when an operation is not allowed on a directory. - */ - -export class DirectoryError extends Error { - /** - * Name of the error class. - * @type {string} - */ - name = "DirectoryError"; - - /** - * Error code. - * @type {string} - */ - code = "EISDIR"; - - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message) { - super(`EISDIR: Illegal operation on a directory, ${message}`); - } -} - -/** - * Error thrown when a directory is not empty. - */ -export class NotEmptyError extends Error { - /** - * Name of the error class. - * @type {string} - */ - name = "NotEmptyError"; - - /** - * Error code. - * @type {string} - */ - code = "ENOTEMPTY"; - - /** - * Creates a new instance. - * @param {string} message The error message. - */ - constructor(message) { - super(`ENOTEMPTY: Directory not empty, ${message}`); - } -} diff --git a/node_modules/@humanfs/core/src/hfs.js b/node_modules/@humanfs/core/src/hfs.js deleted file mode 100644 index 38ee31c..0000000 --- a/node_modules/@humanfs/core/src/hfs.js +++ /dev/null @@ -1,699 +0,0 @@ -/** - * @fileoverview The main file for the humanfs package. - * @author Nicholas C. Zakas - */ - -/* global URL, TextDecoder, TextEncoder */ - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef {import("@humanfs/types").HfsImpl} HfsImpl */ -/** @typedef {import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ -/** @typedef {import("@humanfs/types").HfsWalkEntry} HfsWalkEntry */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const decoder = new TextDecoder(); -const encoder = new TextEncoder(); - -/** - * Error to represent when a method is missing on an impl. - */ -export class NoSuchMethodError extends Error { - /** - * Creates a new instance. - * @param {string} methodName The name of the method that was missing. - */ - constructor(methodName) { - super(`Method "${methodName}" does not exist on impl.`); - } -} - -/** - * Error to represent when a method is not supported on an impl. This happens - * when a method on `Hfs` is called with one name and the corresponding method - * on the impl has a different name. (Example: `text()` and `bytes()`.) - */ -export class MethodNotSupportedError extends Error { - /** - * Creates a new instance. - * @param {string} methodName The name of the method that was missing. - */ - constructor(methodName) { - super(`Method "${methodName}" is not supported on this impl.`); - } -} - -/** - * Error to represent when an impl is already set. - */ -export class ImplAlreadySetError extends Error { - /** - * Creates a new instance. - */ - constructor() { - super(`Implementation already set.`); - } -} - -/** - * Asserts that the given path is a valid file path. - * @param {any} fileOrDirPath The path to check. - * @returns {void} - * @throws {TypeError} When the path is not a non-empty string. - */ -function assertValidFileOrDirPath(fileOrDirPath) { - if ( - !fileOrDirPath || - (!(fileOrDirPath instanceof URL) && typeof fileOrDirPath !== "string") - ) { - throw new TypeError("Path must be a non-empty string or URL."); - } -} - -/** - * Asserts that the given file contents are valid. - * @param {any} contents The contents to check. - * @returns {void} - * @throws {TypeError} When the contents are not a string or ArrayBuffer. - */ -function assertValidFileContents(contents) { - if ( - typeof contents !== "string" && - !(contents instanceof ArrayBuffer) && - !ArrayBuffer.isView(contents) - ) { - throw new TypeError( - "File contents must be a string, ArrayBuffer, or ArrayBuffer view.", - ); - } -} - -/** - * Converts the given contents to Uint8Array. - * @param {any} contents The data to convert. - * @returns {Uint8Array} The converted Uint8Array. - * @throws {TypeError} When the contents are not a string or ArrayBuffer. - */ -function toUint8Array(contents) { - if (contents instanceof Uint8Array) { - return contents; - } - - if (typeof contents === "string") { - return encoder.encode(contents); - } - - if (contents instanceof ArrayBuffer) { - return new Uint8Array(contents); - } - - if (ArrayBuffer.isView(contents)) { - const bytes = contents.buffer.slice( - contents.byteOffset, - contents.byteOffset + contents.byteLength, - ); - return new Uint8Array(bytes); - } - throw new TypeError( - "Invalid contents type. Expected string or ArrayBuffer.", - ); -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class representing a log entry. - */ -export class LogEntry { - /** - * The type of log entry. - * @type {string} - */ - type; - - /** - * The data associated with the log entry. - * @type {any} - */ - data; - - /** - * The time at which the log entry was created. - * @type {number} - */ - timestamp = Date.now(); - - /** - * Creates a new instance. - * @param {string} type The type of log entry. - * @param {any} [data] The data associated with the log entry. - */ - constructor(type, data) { - this.type = type; - this.data = data; - } -} - -/** - * A class representing a file system utility library. - * @implements {HfsImpl} - */ -export class Hfs { - /** - * The base implementation for this instance. - * @type {HfsImpl} - */ - #baseImpl; - - /** - * The current implementation for this instance. - * @type {HfsImpl} - */ - #impl; - - /** - * A map of log names to their corresponding entries. - * @type {Map>} - */ - #logs = new Map(); - - /** - * Creates a new instance. - * @param {object} options The options for the instance. - * @param {HfsImpl} options.impl The implementation to use. - */ - constructor({ impl }) { - this.#baseImpl = impl; - this.#impl = impl; - } - - /** - * Logs an entry onto all currently open logs. - * @param {string} methodName The name of the method being called. - * @param {...*} args The arguments to the method. - * @returns {void} - */ - #log(methodName, ...args) { - for (const logs of this.#logs.values()) { - logs.push(new LogEntry("call", { methodName, args })); - } - } - - /** - * Starts a new log with the given name. - * @param {string} name The name of the log to start; - * @returns {void} - * @throws {Error} When the log already exists. - * @throws {TypeError} When the name is not a non-empty string. - */ - logStart(name) { - if (!name || typeof name !== "string") { - throw new TypeError("Log name must be a non-empty string."); - } - - if (this.#logs.has(name)) { - throw new Error(`Log "${name}" already exists.`); - } - - this.#logs.set(name, []); - } - - /** - * Ends a log with the given name and returns the entries. - * @param {string} name The name of the log to end. - * @returns {Array} The entries in the log. - * @throws {Error} When the log does not exist. - */ - logEnd(name) { - if (this.#logs.has(name)) { - const logs = this.#logs.get(name); - this.#logs.delete(name); - return logs; - } - - throw new Error(`Log "${name}" does not exist.`); - } - - /** - * Determines if the current implementation is the base implementation. - * @returns {boolean} True if the current implementation is the base implementation. - */ - isBaseImpl() { - return this.#impl === this.#baseImpl; - } - - /** - * Sets the implementation for this instance. - * @param {object} impl The implementation to use. - * @returns {void} - */ - setImpl(impl) { - this.#log("implSet", impl); - - if (this.#impl !== this.#baseImpl) { - throw new ImplAlreadySetError(); - } - - this.#impl = impl; - } - - /** - * Resets the implementation for this instance back to its original. - * @returns {void} - */ - resetImpl() { - this.#log("implReset"); - this.#impl = this.#baseImpl; - } - - /** - * Asserts that the given method exists on the current implementation. - * @param {string} methodName The name of the method to check. - * @returns {void} - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - */ - #assertImplMethod(methodName) { - if (typeof this.#impl[methodName] !== "function") { - throw new NoSuchMethodError(methodName); - } - } - - /** - * Asserts that the given method exists on the current implementation, and if not, - * throws an error with a different method name. - * @param {string} methodName The name of the method to check. - * @param {string} targetMethodName The name of the method that should be reported - * as an error when methodName does not exist. - * @returns {void} - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - */ - #assertImplMethodAlt(methodName, targetMethodName) { - if (typeof this.#impl[methodName] !== "function") { - throw new MethodNotSupportedError(targetMethodName); - } - } - - /** - * Calls the given method on the current implementation. - * @param {string} methodName The name of the method to call. - * @param {...any} args The arguments to the method. - * @returns {any} The return value from the method. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - */ - #callImplMethod(methodName, ...args) { - this.#log(methodName, ...args); - this.#assertImplMethod(methodName); - return this.#impl[methodName](...args); - } - - /** - * Calls the given method on the current implementation and doesn't log the call. - * @param {string} methodName The name of the method to call. - * @param {...any} args The arguments to the method. - * @returns {any} The return value from the method. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - */ - #callImplMethodWithoutLog(methodName, ...args) { - this.#assertImplMethod(methodName); - return this.#impl[methodName](...args); - } - - /** - * Calls the given method on the current implementation but logs a different method name. - * @param {string} methodName The name of the method to call. - * @param {string} targetMethodName The name of the method to log. - * @param {...any} args The arguments to the method. - * @returns {any} The return value from the method. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - */ - #callImplMethodAlt(methodName, targetMethodName, ...args) { - this.#log(targetMethodName, ...args); - this.#assertImplMethodAlt(methodName, targetMethodName); - return this.#impl[methodName](...args); - } - - /** - * Reads the given file and returns the contents as text. Assumes UTF-8 encoding. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - async text(filePath) { - assertValidFileOrDirPath(filePath); - - const result = await this.#callImplMethodAlt("bytes", "text", filePath); - return result ? decoder.decode(result) : undefined; - } - - /** - * Reads the given file and returns the contents as JSON. Assumes UTF-8 encoding. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file as JSON. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {SyntaxError} When the file contents are not valid JSON. - * @throws {TypeError} When the file path is not a non-empty string. - */ - async json(filePath) { - assertValidFileOrDirPath(filePath); - - const result = await this.#callImplMethodAlt("bytes", "json", filePath); - return result ? JSON.parse(decoder.decode(result)) : undefined; - } - - /** - * Reads the given file and returns the contents as an ArrayBuffer. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file as an ArrayBuffer. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - * @deprecated Use bytes() instead. - */ - async arrayBuffer(filePath) { - assertValidFileOrDirPath(filePath); - - const result = await this.#callImplMethodAlt( - "bytes", - "arrayBuffer", - filePath, - ); - return result?.buffer; - } - - /** - * Reads the given file and returns the contents as an Uint8Array. - * @param {string|URL} filePath The file to read. - * @returns {Promise} The contents of the file as an Uint8Array. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - async bytes(filePath) { - assertValidFileOrDirPath(filePath); - return this.#callImplMethod("bytes", filePath); - } - - /** - * Writes the given data to the given file. Creates any necessary directories along the way. - * If the data is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The file to write. - * @param {string|ArrayBuffer|ArrayBufferView} contents The data to write. - * @returns {Promise} A promise that resolves when the file is written. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - async write(filePath, contents) { - assertValidFileOrDirPath(filePath); - assertValidFileContents(contents); - this.#log("write", filePath, contents); - - let value = toUint8Array(contents); - return this.#callImplMethodWithoutLog("write", filePath, value); - } - - /** - * Appends the given data to the given file. Creates any necessary directories along the way. - * If the data is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The file to append to. - * @param {string|ArrayBuffer|ArrayBufferView} contents The data to append. - * @returns {Promise} A promise that resolves when the file is appended to. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - * @throws {TypeError} When the file contents are not a string or ArrayBuffer. - * @throws {Error} When the file cannot be appended to. - */ - async append(filePath, contents) { - assertValidFileOrDirPath(filePath); - assertValidFileContents(contents); - this.#log("append", filePath, contents); - - let value = toUint8Array(contents); - return this.#callImplMethodWithoutLog("append", filePath, value); - } - - /** - * Determines if the given file exists. - * @param {string|URL} filePath The file to check. - * @returns {Promise} True if the file exists. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - async isFile(filePath) { - assertValidFileOrDirPath(filePath); - return this.#callImplMethod("isFile", filePath); - } - - /** - * Determines if the given directory exists. - * @param {string|URL} dirPath The directory to check. - * @returns {Promise} True if the directory exists. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - async isDirectory(dirPath) { - assertValidFileOrDirPath(dirPath); - return this.#callImplMethod("isDirectory", dirPath); - } - - /** - * Creates the given directory. - * @param {string|URL} dirPath The directory to create. - * @returns {Promise} A promise that resolves when the directory is created. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - async createDirectory(dirPath) { - assertValidFileOrDirPath(dirPath); - return this.#callImplMethod("createDirectory", dirPath); - } - - /** - * Deletes the given file or empty directory. - * @param {string|URL} filePath The file to delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the file path is not a non-empty string. - */ - async delete(filePath) { - assertValidFileOrDirPath(filePath); - return this.#callImplMethod("delete", filePath); - } - - /** - * Deletes the given file or directory recursively. - * @param {string|URL} dirPath The directory to delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {NoSuchMethodError} When the method does not exist on the current implementation. - * @throws {TypeError} When the directory path is not a non-empty string. - */ - async deleteAll(dirPath) { - assertValidFileOrDirPath(dirPath); - return this.#callImplMethod("deleteAll", dirPath); - } - - /** - * Returns a list of directory entries for the given path. - * @param {string|URL} dirPath The path to the directory to read. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string or URL. - * @throws {Error} If the directory cannot be read. - */ - async *list(dirPath) { - assertValidFileOrDirPath(dirPath); - yield* await this.#callImplMethod("list", dirPath); - } - - /** - * Walks a directory using a depth-first traversal and returns the entries - * from the traversal. - * @param {string|URL} dirPath The path to the directory to walk. - * @param {Object} [options] The options for the walk. - * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.directoryFilter] A filter function to determine - * if a directory's entries should be included in the walk. - * @param {(entry:HfsWalkEntry) => Promise|boolean} [options.entryFilter] A filter function to determine if - * an entry should be included in the walk. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string or URL. - * @throws {Error} If the directory cannot be read. - */ - async *walk( - dirPath, - { directoryFilter = () => true, entryFilter = () => true } = {}, - ) { - assertValidFileOrDirPath(dirPath); - this.#log("walk", dirPath, { directoryFilter, entryFilter }); - - // inner function for recursion without additional logging - const walk = async function* ( - dirPath, - { directoryFilter, entryFilter, parentPath = "", depth = 1 }, - ) { - let dirEntries; - - try { - dirEntries = await this.#callImplMethodWithoutLog( - "list", - dirPath, - ); - } catch (error) { - // if the directory does not exist then return an empty array - if (error.code === "ENOENT") { - return; - } - - // otherwise, rethrow the error - throw error; - } - - for await (const listEntry of dirEntries) { - const walkEntry = { - path: listEntry.name, - depth, - ...listEntry, - }; - - if (parentPath) { - walkEntry.path = `${parentPath}/${walkEntry.path}`; - } - - // first emit the entry but only if the entry filter returns true - let shouldEmitEntry = entryFilter(walkEntry); - if (shouldEmitEntry.then) { - shouldEmitEntry = await shouldEmitEntry; - } - - if (shouldEmitEntry) { - yield walkEntry; - } - - // if it's a directory then yield the entry and walk the directory - if (listEntry.isDirectory) { - // if the directory filter returns false, skip the directory - let shouldWalkDirectory = directoryFilter(walkEntry); - if (shouldWalkDirectory.then) { - shouldWalkDirectory = await shouldWalkDirectory; - } - - if (!shouldWalkDirectory) { - continue; - } - - // make sure there's a trailing slash on the directory path before appending - const directoryPath = - dirPath instanceof URL - ? new URL( - listEntry.name, - dirPath.href.endsWith("/") - ? dirPath.href - : `${dirPath.href}/`, - ) - : `${dirPath.endsWith("/") ? dirPath : `${dirPath}/`}${listEntry.name}`; - - yield* walk(directoryPath, { - directoryFilter, - entryFilter, - parentPath: walkEntry.path, - depth: depth + 1, - }); - } - } - }.bind(this); - - yield* walk(dirPath, { directoryFilter, entryFilter }); - } - - /** - * Returns the size of the given file. - * @param {string|URL} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the size of the file. - * @throws {TypeError} If the file path is not a string or URL. - * @throws {Error} If the file cannot be read. - */ - async size(filePath) { - assertValidFileOrDirPath(filePath); - return this.#callImplMethod("size", filePath); - } - - /** - * Returns the last modified timestamp of the given file or directory. - * @param {string|URL} fileOrDirPath The path to the file or directory. - * @returns {Promise} A promise that resolves with the last modified date - * or undefined if the file or directory does not exist. - * @throws {TypeError} If the path is not a string or URL. - */ - async lastModified(fileOrDirPath) { - assertValidFileOrDirPath(fileOrDirPath); - return this.#callImplMethod("lastModified", fileOrDirPath); - } - - /** - * Copys a file from one location to another. - * @param {string|URL} source The path to the file to copy. - * @param {string|URL} destination The path to the new file. - * @returns {Promise} A promise that resolves when the file is copied. - * @throws {TypeError} If the file path is not a string or URL. - * @throws {Error} If the file cannot be copied. - */ - async copy(source, destination) { - assertValidFileOrDirPath(source); - assertValidFileOrDirPath(destination); - return this.#callImplMethod("copy", source, destination); - } - - /** - * Copies a file or directory from one location to another. - * @param {string|URL} source The path to the file or directory to copy. - * @param {string|URL} destination The path to copy the file or directory to. - * @returns {Promise} A promise that resolves when the file or directory is - * copied. - * @throws {TypeError} If the directory path is not a string or URL. - * @throws {Error} If the directory cannot be copied. - */ - async copyAll(source, destination) { - assertValidFileOrDirPath(source); - assertValidFileOrDirPath(destination); - return this.#callImplMethod("copyAll", source, destination); - } - - /** - * Moves a file from the source path to the destination path. - * @param {string|URL} source The location of the file to move. - * @param {string|URL} destination The destination of the file to move. - * @returns {Promise} A promise that resolves when the move is complete. - * @throws {TypeError} If the file or directory paths are not strings. - * @throws {Error} If the file or directory cannot be moved. - */ - async move(source, destination) { - assertValidFileOrDirPath(source); - assertValidFileOrDirPath(destination); - return this.#callImplMethod("move", source, destination); - } - - /** - * Moves a file or directory from one location to another. - * @param {string|URL} source The path to the file or directory to move. - * @param {string|URL} destination The path to move the file or directory to. - * @returns {Promise} A promise that resolves when the file or directory is - * moved. - * @throws {TypeError} If the source is not a string or URL. - * @throws {TypeError} If the destination is not a string or URL. - * @throws {Error} If the file or directory cannot be moved. - */ - async moveAll(source, destination) { - assertValidFileOrDirPath(source); - assertValidFileOrDirPath(destination); - return this.#callImplMethod("moveAll", source, destination); - } -} diff --git a/node_modules/@humanfs/core/src/index.js b/node_modules/@humanfs/core/src/index.js deleted file mode 100644 index 1b662d4..0000000 --- a/node_modules/@humanfs/core/src/index.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @fileoverview API entrypoint for hfs/core - * @author Nicholas C. Zakas - */ - -export { Hfs } from "./hfs.js"; -export { Path } from "./path.js"; -export * from "./errors.js"; diff --git a/node_modules/@humanfs/core/src/path.js b/node_modules/@humanfs/core/src/path.js deleted file mode 100644 index 4798091..0000000 --- a/node_modules/@humanfs/core/src/path.js +++ /dev/null @@ -1,237 +0,0 @@ -/** - * @fileoverview The Path class. - * @author Nicholas C. Zakas - */ - -/* globals URL */ - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef{import("@humanfs/types").HfsImpl} HfsImpl */ -/** @typedef{import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Normalizes a path to use forward slashes. - * @param {string} filePath The path to normalize. - * @returns {string} The normalized path. - */ -function normalizePath(filePath) { - let startIndex = 0; - let endIndex = filePath.length; - - if (/[a-z]:\//i.test(filePath)) { - startIndex = 3; - } - - if (filePath.startsWith("./")) { - startIndex = 2; - } - - if (filePath.startsWith("/")) { - startIndex = 1; - } - - if (filePath.endsWith("/")) { - endIndex = filePath.length - 1; - } - - return filePath.slice(startIndex, endIndex).replace(/\\/g, "/"); -} - -/** - * Asserts that the given name is a non-empty string, no equal to "." or "..", - * and does not contain a forward slash or backslash. - * @param {string} name The name to check. - * @returns {void} - * @throws {TypeError} When name is not valid. - */ -function assertValidName(name) { - if (typeof name !== "string") { - throw new TypeError("name must be a string"); - } - - if (!name) { - throw new TypeError("name cannot be empty"); - } - - if (name === ".") { - throw new TypeError(`name cannot be "."`); - } - - if (name === "..") { - throw new TypeError(`name cannot be ".."`); - } - - if (name.includes("/") || name.includes("\\")) { - throw new TypeError( - `name cannot contain a slash or backslash: "${name}"`, - ); - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -export class Path { - /** - * The steps in the path. - * @type {Array} - */ - #steps; - - /** - * Creates a new instance. - * @param {Iterable} [steps] The steps to use for the path. - * @throws {TypeError} When steps is not iterable. - */ - constructor(steps = []) { - if (typeof steps[Symbol.iterator] !== "function") { - throw new TypeError("steps must be iterable"); - } - - this.#steps = [...steps]; - this.#steps.forEach(assertValidName); - } - - /** - * Adds steps to the end of the path. - * @param {...string} steps The steps to add to the path. - * @returns {void} - */ - push(...steps) { - steps.forEach(assertValidName); - this.#steps.push(...steps); - } - - /** - * Removes the last step from the path. - * @returns {string} The last step in the path. - */ - pop() { - return this.#steps.pop(); - } - - /** - * Returns an iterator for steps in the path. - * @returns {IterableIterator} An iterator for the steps in the path. - */ - steps() { - return this.#steps.values(); - } - - /** - * Returns an iterator for the steps in the path. - * @returns {IterableIterator} An iterator for the steps in the path. - */ - [Symbol.iterator]() { - return this.steps(); - } - - /** - * Retrieves the name (the last step) of the path. - * @type {string} - */ - get name() { - return this.#steps[this.#steps.length - 1]; - } - - /** - * Sets the name (the last step) of the path. - * @type {string} - */ - set name(value) { - assertValidName(value); - this.#steps[this.#steps.length - 1] = value; - } - - /** - * Retrieves the size of the path. - * @type {number} - */ - get size() { - return this.#steps.length; - } - - /** - * Returns the path as a string. - * @returns {string} The path as a string. - */ - toString() { - return this.#steps.join("/"); - } - - /** - * Creates a new path based on the argument type. If the argument is a string, - * it is assumed to be a file or directory path and is converted to a Path - * instance. If the argument is a URL, it is assumed to be a file URL and is - * converted to a Path instance. If the argument is a Path instance, it is - * copied into a new Path instance. If the argument is an array, it is assumed - * to be the steps of a path and is used to create a new Path instance. - * @param {string|URL|Path|Array} pathish The value to convert to a Path instance. - * @returns {Path} A new Path instance. - * @throws {TypeError} When pathish is not a string, URL, Path, or Array. - * @throws {TypeError} When pathish is a string and is empty. - */ - static from(pathish) { - if (typeof pathish === "string") { - if (!pathish) { - throw new TypeError("argument cannot be empty"); - } - - return Path.fromString(pathish); - } - - if (pathish instanceof URL) { - return Path.fromURL(pathish); - } - - if (pathish instanceof Path || Array.isArray(pathish)) { - return new Path(pathish); - } - - throw new TypeError("argument must be a string, URL, Path, or Array"); - } - - /** - * Creates a new Path instance from a string. - * @param {string} fileOrDirPath The file or directory path to convert. - * @returns {Path} A new Path instance. - * @deprecated Use Path.from() instead. - */ - static fromString(fileOrDirPath) { - return new Path(normalizePath(fileOrDirPath).split("/")); - } - - /** - * Creates a new Path instance from a URL. - * @param {URL} url The URL to convert. - * @returns {Path} A new Path instance. - * @throws {TypeError} When url is not a URL instance. - * @throws {TypeError} When url.pathname is empty. - * @throws {TypeError} When url.protocol is not "file:". - * @deprecated Use Path.from() instead. - */ - static fromURL(url) { - if (!(url instanceof URL)) { - throw new TypeError("url must be a URL instance"); - } - - if (!url.pathname || url.pathname === "/") { - throw new TypeError("url.pathname cannot be empty"); - } - - if (url.protocol !== "file:") { - throw new TypeError(`url.protocol must be "file:"`); - } - - // Remove leading slash in pathname - return new Path(normalizePath(url.pathname.slice(1)).split("/")); - } -} diff --git a/node_modules/@humanfs/node/LICENSE b/node_modules/@humanfs/node/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@humanfs/node/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/@humanfs/node/README.md b/node_modules/@humanfs/node/README.md deleted file mode 100644 index c3e4be4..0000000 --- a/node_modules/@humanfs/node/README.md +++ /dev/null @@ -1,141 +0,0 @@ -# `@humanfs/node` - -by [Nicholas C. Zakas](https://humanwhocodes.com) - -If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. - -## Description - -The `hfs` bindings for use in Node.js and Node.js-compatible runtimes. - -> [!WARNING] -> This project is **experimental** and may change significantly before v1.0.0. Use at your own caution and definitely not in production! - -## Installation - -Install using your favorite package manager: - -```shell -npm install @humanfs/node - -# or - -pnpm install @humanfs/node - -# or - -yarn add @humanfs/node - -# or - -bun install @humanfs/node -``` - -## Usage - -The easiest way to use hfs in your project is to import the `hfs` object: - -```js -import { hfs } from "@humanfs/node"; -``` - -Then, you can use the API methods: - -```js -// 1. Files - -// read from a text file -const text = await hfs.text("file.txt"); - -// read from a JSON file -const json = await hfs.json("file.json"); - -// read raw bytes from a text file -const arrayBuffer = await hfs.arrayBuffer("file.txt"); - -// write text to a file -await hfs.write("file.txt", "Hello world!"); - -// write bytes to a file -await hfs.write("file.txt", new TextEncoder().encode("Hello world!")); - -// append text to a file -await hfs.append("file.txt", "Hello world!"); - -// append bytes to a file -await hfs.append("file.txt", new TextEncoder().encode("Hello world!")); - -// does the file exist? -const found = await hfs.isFile("file.txt"); - -// how big is the file? -const size = await hfs.size("file.txt"); - -// when was the file modified? -const mtime = await hfs.lastModified("file.txt"); - -// copy a file from one location to another -await hfs.copy("file.txt", "file-copy.txt"); - -// move a file from one location to another -await hfs.move("file.txt", "renamed.txt"); - -// delete a file -await hfs.delete("file.txt"); - -// 2. Directories - -// create a directory -await hfs.createDirectory("dir"); - -// create a directory recursively -await hfs.createDirectory("dir/subdir"); - -// does the directory exist? -const dirFound = await hfs.isDirectory("dir"); - -// copy the entire directory -hfs.copyAll("from-dir", "to-dir"); - -// move the entire directory -hfs.moveAll("from-dir", "to-dir"); - -// delete a directory -await hfs.delete("dir"); - -// delete a non-empty directory -await hfs.deleteAll("dir"); -``` - -If you'd like to create your own instance, import the `NodeHfs` constructor: - -```js -import { NodeHfs } from "@humanfs/node"; -import fsp from "fs/promises"; - -const hfs = new NodeHfs(); - -// optionally specify the fs/promises object to use -const hfs = new NodeHfs({ fsp }); -``` - -If you'd like to use just the impl, import the `NodeHfsImpl` constructor: - -```js -import { NodeHfsImpl } from "@humanfs/node"; -import fsp from "fs/promises"; - -const hfs = new NodeHfsImpl(); - -// optionally specify the fs/promises object to use -const hfs = new NodeHfsImpl({ fsp }); -``` - -## Errors Handled - -* `ENOENT` - in most cases, these errors are handled silently. -* `ENFILE` and `EMFILE` - calls that result in these errors are retried for up to 60 seconds before giving up for good. - -## License - -Apache 2.0 diff --git a/node_modules/@humanfs/node/dist/index.d.ts b/node_modules/@humanfs/node/dist/index.d.ts deleted file mode 100644 index c2d1d30..0000000 --- a/node_modules/@humanfs/node/dist/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./node-hfs.js"; -export { Hfs } from "@humanfs/core"; diff --git a/node_modules/@humanfs/node/dist/node-fsx.d.ts b/node_modules/@humanfs/node/dist/node-fsx.d.ts deleted file mode 100644 index 78e8dbd..0000000 --- a/node_modules/@humanfs/node/dist/node-fsx.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/// -/** - * A class representing the Node.js implementation of Hfs. - * @implements {HfsImpl} - */ -export class NodeHfsImpl implements HfsImpl { - /** - * Creates a new instance. - * @param {object} [options] The options for the instance. - * @param {Fsp} [options.fsp] The file system module to use. - */ - constructor({ fsp }?: { - fsp?: Fsp; - }); - /** - * Reads a file and returns the contents as a string. Assumes UTF-8 encoding. - * @param {string} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the contents of - * the file or undefined if the file doesn't exist. - * @throws {TypeError} If the file path is not a string. - * @throws {RangeError} If the file path is empty. - * @throws {RangeError} If the file path is not absolute. - * @throws {RangeError} If the file path is not a file. - * @throws {RangeError} If the file path is not readable. - */ - text(filePath: string): Promise; - /** - * Reads a file and returns the contents as a JSON object. Assumes UTF-8 encoding. - * @param {string} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the contents of - * the file or undefined if the file doesn't exist. - * @throws {SyntaxError} If the file contents are not valid JSON. - * @throws {Error} If the file cannot be read. - * @throws {TypeError} If the file path is not a string. - */ - json(filePath: string): Promise; - /** - * Reads a file and returns the contents as an ArrayBuffer. - * @param {string} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the contents - * of the file or undefined if the file doesn't exist. - * @throws {Error} If the file cannot be read. - * @throws {TypeError} If the file path is not a string. - * @deprecated Use bytes() instead. - */ - arrayBuffer(filePath: string): Promise; - /** - * Reads a file and returns the contents as an Uint8Array. - * @param {string} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the contents - * of the file or undefined if the file doesn't exist. - * @throws {Error} If the file cannot be read. - * @throws {TypeError} If the file path is not a string. - */ - bytes(filePath: string): Promise; - /** - * Writes a value to a file. If the value is a string, UTF-8 encoding is used. - * @param {string} filePath The path to the file to write. - * @param {string|ArrayBuffer|ArrayBufferView} contents The contents to write to the - * file. - * @returns {Promise} A promise that resolves when the file is - * written. - * @throws {TypeError} If the file path is not a string. - * @throws {Error} If the file cannot be written. - */ - write(filePath: string, contents: string | ArrayBuffer | ArrayBufferView): Promise; - /** - * Checks if a file exists. - * @param {string} filePath The path to the file to check. - * @returns {Promise} A promise that resolves with true if the - * file exists or false if it does not. - * @throws {Error} If the operation fails with a code other than ENOENT. - */ - isFile(filePath: string): Promise; - /** - * Checks if a directory exists. - * @param {string} dirPath The path to the directory to check. - * @returns {Promise} A promise that resolves with true if the - * directory exists or false if it does not. - * @throws {Error} If the operation fails with a code other than ENOENT. - */ - isDirectory(dirPath: string): Promise; - /** - * Creates a directory recursively. - * @param {string} dirPath The path to the directory to create. - * @returns {Promise} A promise that resolves when the directory is - * created. - */ - createDirectory(dirPath: string): Promise; - /** - * Deletes a file or empty directory. - * @param {string} fileOrDirPath The path to the file or directory to - * delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted. - * @throws {TypeError} If the file or directory path is not a string. - * @throws {Error} If the file or directory cannot be deleted. - * @throws {Error} If the file or directory is not found. - */ - delete(fileOrDirPath: string): Promise; - /** - * Deletes a file or directory recursively. - * @param {string} fileOrDirPath The path to the file or directory to - * delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted. - * @throws {TypeError} If the file or directory path is not a string. - * @throws {Error} If the file or directory cannot be deleted. - * @throws {Error} If the file or directory is not found. - */ - deleteAll(fileOrDirPath: string): Promise; - /** - * Returns a list of directory entries for the given path. - * @param {string} dirPath The path to the directory to read. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string. - * @throws {Error} If the directory cannot be read. - */ - list(dirPath: string): AsyncIterable; - /** - * Returns the size of a file. - * @param {string} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the size of the - * file in bytes or undefined if the file doesn't exist. - */ - size(filePath: string): Promise; - #private; -} -/** - * A class representing a file system utility library. - * @implements {HfsImpl} - */ -export class NodeHfs extends Hfs implements HfsImpl { - /** - * Creates a new instance. - * @param {object} [options] The options for the instance. - * @param {Fsp} [options.fsp] The file system module to use. - */ - constructor({ fsp }?: { - fsp?: Fsp; - }); -} -export const hfs: NodeHfs; -export type HfsImpl = import("@humanfs/types").HfsImpl; -export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; -export type Fsp = typeof nativeFsp; -export type Dirent = import("fs").Dirent; -import { Hfs } from "@humanfs/core"; -import nativeFsp from "node:fs/promises"; diff --git a/node_modules/@humanfs/node/dist/node-hfs.d.ts b/node_modules/@humanfs/node/dist/node-hfs.d.ts deleted file mode 100644 index 1fd6322..0000000 --- a/node_modules/@humanfs/node/dist/node-hfs.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -/// -/** - * A class representing the Node.js implementation of Hfs. - * @implements {HfsImpl} - */ -export class NodeHfsImpl implements HfsImpl { - /** - * Creates a new instance. - * @param {object} [options] The options for the instance. - * @param {Fsp} [options.fsp] The file system module to use. - */ - constructor({ fsp }?: { - fsp?: Fsp; - }); - /** - * Reads a file and returns the contents as an Uint8Array. - * @param {string|URL} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the contents - * of the file or undefined if the file doesn't exist. - * @throws {Error} If the file cannot be read. - * @throws {TypeError} If the file path is not a string. - */ - bytes(filePath: string | URL): Promise; - /** - * Writes a value to a file. If the value is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The path to the file to write. - * @param {Uint8Array} contents The contents to write to the - * file. - * @returns {Promise} A promise that resolves when the file is - * written. - * @throws {TypeError} If the file path is not a string. - * @throws {Error} If the file cannot be written. - */ - write(filePath: string | URL, contents: Uint8Array): Promise; - /** - * Appends a value to a file. If the value is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The path to the file to append to. - * @param {Uint8Array} contents The contents to append to the - * file. - * @returns {Promise} A promise that resolves when the file is - * written. - * @throws {TypeError} If the file path is not a string. - * @throws {Error} If the file cannot be appended to. - */ - append(filePath: string | URL, contents: Uint8Array): Promise; - /** - * Checks if a file exists. - * @param {string|URL} filePath The path to the file to check. - * @returns {Promise} A promise that resolves with true if the - * file exists or false if it does not. - * @throws {Error} If the operation fails with a code other than ENOENT. - */ - isFile(filePath: string | URL): Promise; - /** - * Checks if a directory exists. - * @param {string|URL} dirPath The path to the directory to check. - * @returns {Promise} A promise that resolves with true if the - * directory exists or false if it does not. - * @throws {Error} If the operation fails with a code other than ENOENT. - */ - isDirectory(dirPath: string | URL): Promise; - /** - * Creates a directory recursively. - * @param {string|URL} dirPath The path to the directory to create. - * @returns {Promise} A promise that resolves when the directory is - * created. - */ - createDirectory(dirPath: string | URL): Promise; - /** - * Deletes a file or empty directory. - * @param {string|URL} fileOrDirPath The path to the file or directory to - * delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {TypeError} If the file or directory path is not a string. - * @throws {Error} If the file or directory cannot be deleted. - */ - delete(fileOrDirPath: string | URL): Promise; - /** - * Deletes a file or directory recursively. - * @param {string|URL} fileOrDirPath The path to the file or directory to - * delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {TypeError} If the file or directory path is not a string. - * @throws {Error} If the file or directory cannot be deleted. - */ - deleteAll(fileOrDirPath: string | URL): Promise; - /** - * Returns a list of directory entries for the given path. - * @param {string|URL} dirPath The path to the directory to read. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string. - * @throws {Error} If the directory cannot be read. - */ - list(dirPath: string | URL): AsyncIterable; - /** - * Returns the size of a file. This method handles ENOENT errors - * and returns undefined in that case. - * @param {string|URL} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the size of the - * file in bytes or undefined if the file doesn't exist. - */ - size(filePath: string | URL): Promise; - /** - * Returns the last modified date of a file or directory. This method handles ENOENT errors - * and returns undefined in that case. - * @param {string|URL} fileOrDirPath The path to the file to read. - * @returns {Promise} A promise that resolves with the last modified - * date of the file or directory, or undefined if the file doesn't exist. - */ - lastModified(fileOrDirPath: string | URL): Promise; - /** - * Copies a file from one location to another. - * @param {string|URL} source The path to the file to copy. - * @param {string|URL} destination The path to copy the file to. - * @returns {Promise} A promise that resolves when the file is copied. - * @throws {Error} If the source file does not exist. - * @throws {Error} If the source file is a directory. - * @throws {Error} If the destination file is a directory. - */ - copy(source: string | URL, destination: string | URL): Promise; - /** - * Copies a file or directory from one location to another. - * @param {string|URL} source The path to the file or directory to copy. - * @param {string|URL} destination The path to copy the file or directory to. - * @returns {Promise} A promise that resolves when the file or directory is - * copied. - * @throws {Error} If the source file or directory does not exist. - * @throws {Error} If the destination file or directory is a directory. - */ - copyAll(source: string | URL, destination: string | URL): Promise; - /** - * Moves a file from the source path to the destination path. - * @param {string|URL} source The location of the file to move. - * @param {string|URL} destination The destination of the file to move. - * @returns {Promise} A promise that resolves when the move is complete. - * @throws {TypeError} If the file paths are not strings. - * @throws {Error} If the file cannot be moved. - */ - move(source: string | URL, destination: string | URL): Promise; - /** - * Moves a file or directory from the source path to the destination path. - * @param {string|URL} source The location of the file or directory to move. - * @param {string|URL} destination The destination of the file or directory to move. - * @returns {Promise} A promise that resolves when the move is complete. - * @throws {TypeError} If the file paths are not strings. - * @throws {Error} If the file or directory cannot be moved. - */ - moveAll(source: string | URL, destination: string | URL): Promise; - #private; -} -/** - * A class representing a file system utility library. - * @implements {HfsImpl} - */ -export class NodeHfs extends Hfs implements HfsImpl { - /** - * Creates a new instance. - * @param {object} [options] The options for the instance. - * @param {Fsp} [options.fsp] The file system module to use. - */ - constructor({ fsp }?: { - fsp?: Fsp; - }); -} -export const hfs: NodeHfs; -export type HfsImpl = import("@humanfs/types").HfsImpl; -export type HfsDirectoryEntry = import("@humanfs/types").HfsDirectoryEntry; -export type Fsp = typeof nativeFsp; -export type Dirent = import("fs").Dirent; -import { Hfs } from "@humanfs/core"; -import nativeFsp from "node:fs/promises"; diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/LICENSE b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/@humanfs/node/node_modules/@humanwhocodes/retry/README.md b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/README.md deleted file mode 100644 index c419ef1..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/README.md +++ /dev/null @@ -1,138 +0,0 @@ -# Retry utility - -by [Nicholas C. Zakas](https://humanwhocodes.com) - -If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. - -## Description - -A utility for retrying failed async JavaScript calls based on the error returned. - -## Usage - -### Node.js - -Install using [npm][npm] or [yarn][yarn]: - -``` -npm install @humanwhocodes/retry - -# or - -yarn add @humanwhocodes/retry -``` - -Import into your Node.js project: - -```js -// CommonJS -const { Retrier } = require("@humanwhocodes/retry"); - -// ESM -import { Retrier } from "@humanwhocodes/retry"; -``` - -### Deno - -Install using [JSR](https://jsr.io): - -```shell -deno add @humanwhocodes/retry - -#or - -jsr add @humanwhocodes/retry -``` - -Then import into your Deno project: - -```js -import { Retrier } from "@humanwhocodes/retry"; -``` - -### Bun - -Install using this command: - -``` -bun add @humanwhocodes/retry -``` - -Import into your Bun project: - -```js -import { Retrier } from "@humanwhocodes/retry"; -``` - -### Browser - -It's recommended to import the minified version to save bandwidth: - -```js -import { Retrier } from "https://cdn.skypack.dev/@humanwhocodes/retry?min"; -``` - -However, you can also import the unminified version for debugging purposes: - -```js -import { Retrier } from "https://cdn.skypack.dev/@humanwhocodes/retry"; -``` - -## API - -After importing, create a new instance of `Retrier` and specify the function to run on the error. This function should return `true` if you want the call retried and `false` if not. - -```js -// this instance will retry if the specific error code is found -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}); -``` - -Then, call the `retry()` method around the function you'd like to retry, such as: - -```js -import fs from "fs/promises"; - -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}); - -const text = await retrier.retry(() => fs.readFile("README.md", "utf8")); -``` - -The `retry()` method will either pass through the result on success or wait and retry on failure. Any error that isn't caught by the retrier is automatically rejected so the end result is a transparent passing through of both success and failure. - -You can also pass an `AbortSignal` to cancel a retry: - -```js -import fs from "fs/promises"; - -const controller = new AbortController(); -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}); - -const text = await retrier.retry( - () => fs.readFile("README.md", "utf8"), - { signal: controller.signal } -); -``` - -## Developer Setup - -1. Fork the repository -2. Clone your fork -3. Run `npm install` to setup dependencies -4. Run `npm test` to run tests - -## License - -Apache 2.0 - -## Prior Art - -This utility is inspired by, and contains code from [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). - -[npm]: https://npmjs.com/ -[yarn]: https://yarnpkg.com/ diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.cjs b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.cjs deleted file mode 100644 index 5e06a42..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.cjs +++ /dev/null @@ -1,303 +0,0 @@ -'use strict'; - -/** - * @fileoverview A utility for retrying failed async method calls. - */ - -/* global setTimeout, clearTimeout */ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const MAX_TASK_TIMEOUT = 60000; -const MAX_TASK_DELAY = 100; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/* - * The following logic has been extracted from graceful-fs. - * - * The ISC License - * - * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, 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. - */ - -/** - * Checks if it is time to retry a task based on the timestamp and last attempt time. - * @param {RetryTask} task The task to check. - * @param {number} maxDelay The maximum delay for the queue. - * @returns {boolean} true if it is time to retry, false otherwise. - */ -function isTimeToRetry(task, maxDelay) { - const timeSinceLastAttempt = Date.now() - task.lastAttempt; - const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); - const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); - - return timeSinceLastAttempt >= desiredDelay; -} - -/** - * Checks if it is time to bail out based on the given timestamp. - * @param {RetryTask} task The task to check. - * @param {number} timeout The timeout for the queue. - * @returns {boolean} true if it is time to bail, false otherwise. - */ -function isTimeToBail(task, timeout) { - return task.age > timeout; -} - - -/** - * A class to represent a task in the retry queue. - */ -class RetryTask { - - /** - * The unique ID for the task. - * @type {string} - */ - id = Math.random().toString(36).slice(2); - - /** - * The function to call. - * @type {Function} - */ - fn; - - /** - * The error that was thrown. - * @type {Error} - */ - error; - - /** - * The timestamp of the task. - * @type {number} - */ - timestamp = Date.now(); - - /** - * The timestamp of the last attempt. - * @type {number} - */ - lastAttempt = this.timestamp; - - /** - * The resolve function for the promise. - * @type {Function} - */ - resolve; - - /** - * The reject function for the promise. - * @type {Function} - */ - reject; - - /** - * The AbortSignal to monitor for cancellation. - * @type {AbortSignal|undefined} - */ - signal; - - /** - * Creates a new instance. - * @param {Function} fn The function to call. - * @param {Error} error The error that was thrown. - * @param {Function} resolve The resolve function for the promise. - * @param {Function} reject The reject function for the promise. - * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. - */ - constructor(fn, error, resolve, reject, signal) { - this.fn = fn; - this.error = error; - this.timestamp = Date.now(); - this.lastAttempt = Date.now(); - this.resolve = resolve; - this.reject = reject; - this.signal = signal; - } - - /** - * Gets the age of the task. - * @returns {number} The age of the task in milliseconds. - * @readonly - */ - get age() { - return Date.now() - this.timestamp; - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class that manages a queue of retry jobs. - */ -class Retrier { - - /** - * Represents the queue for processing tasks. - * @type {Array} - */ - #queue = []; - - /** - * The timeout for the queue. - * @type {number} - */ - #timeout; - - /** - * The maximum delay for the queue. - * @type {number} - */ - #maxDelay; - - /** - * The setTimeout() timer ID. - * @type {NodeJS.Timeout|undefined} - */ - #timerId; - - /** - * The function to call. - * @type {Function} - */ - #check; - - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - */ - constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY } = {}) { - - if (typeof check !== "function") { - throw new Error("Missing function to check errors"); - } - - this.#check = check; - this.#timeout = timeout; - this.#maxDelay = maxDelay; - } - - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn, { signal } = {}) { - - signal?.throwIfAborted(); - - let result; - - try { - result = fn(); - } catch (/** @type {any} */ error) { - return Promise.reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); - } - - // if the result is not a promise then reject an error - if (!result || typeof result.then !== "function") { - return Promise.reject(new Error("Result is not a promise.")); - } - - // call the original function and catch any ENFILE or EMFILE errors - // @ts-ignore because we know it's any - return Promise.resolve(result).catch(error => { - if (!this.#check(error)) { - throw error; - } - - return new Promise((resolve, reject) => { - this.#queue.push(new RetryTask(fn, error, resolve, reject, signal)); - - signal?.addEventListener("abort", () => { - reject(signal.reason); - }); - - this.#processQueue(); - }); - }); - } - - /** - * Processes the queue. - * @returns {void} - */ - #processQueue() { - // clear any timer because we're going to check right now - clearTimeout(this.#timerId); - this.#timerId = undefined; - - // if there's nothing in the queue, we're done - const task = this.#queue.shift(); - if (!task) { - return; - } - const processAgain = () => { - this.#timerId = setTimeout(() => this.#processQueue(), 0); - }; - - // if it's time to bail, then bail - if (isTimeToBail(task, this.#timeout)) { - task.reject(task.error); - processAgain(); - return; - } - - // if it's not time to retry, then wait and try again - if (!isTimeToRetry(task, this.#maxDelay)) { - this.#queue.push(task); - processAgain(); - return; - } - - // otherwise, try again - task.lastAttempt = Date.now(); - - // Promise.resolve needed in case it's a thenable but not a Promise - Promise.resolve(task.fn()) - // @ts-ignore because we know it's any - .then(result => task.resolve(result)) - - // @ts-ignore because we know it's any - .catch(error => { - if (!this.#check(error)) { - task.reject(error); - return; - } - - // update the task timestamp and push to back of queue to try again - task.lastAttempt = Date.now(); - this.#queue.push(task); - - }) - .finally(() => this.#processQueue()); - } -} - -exports.Retrier = Retrier; diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.cts b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.cts deleted file mode 100644 index f152965..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.cts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A class that manages a queue of retry jobs. - */ -export class Retrier { - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - */ - constructor(check: Function, { timeout, maxDelay }?: { - timeout?: number | undefined; - maxDelay?: number | undefined; - } | undefined); - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn: Function, { signal }?: { - signal?: AbortSignal | undefined; - } | undefined): Promise; - #private; -} diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.ts b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.ts deleted file mode 100644 index f152965..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A class that manages a queue of retry jobs. - */ -export class Retrier { - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - */ - constructor(check: Function, { timeout, maxDelay }?: { - timeout?: number | undefined; - maxDelay?: number | undefined; - } | undefined); - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn: Function, { signal }?: { - signal?: AbortSignal | undefined; - } | undefined): Promise; - #private; -} diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.js b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.js deleted file mode 100644 index 4343d58..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.js +++ /dev/null @@ -1,302 +0,0 @@ -// @ts-self-types="./retrier.d.ts" -/** - * @fileoverview A utility for retrying failed async method calls. - */ - -/* global setTimeout, clearTimeout */ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const MAX_TASK_TIMEOUT = 60000; -const MAX_TASK_DELAY = 100; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/* - * The following logic has been extracted from graceful-fs. - * - * The ISC License - * - * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, 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. - */ - -/** - * Checks if it is time to retry a task based on the timestamp and last attempt time. - * @param {RetryTask} task The task to check. - * @param {number} maxDelay The maximum delay for the queue. - * @returns {boolean} true if it is time to retry, false otherwise. - */ -function isTimeToRetry(task, maxDelay) { - const timeSinceLastAttempt = Date.now() - task.lastAttempt; - const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); - const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); - - return timeSinceLastAttempt >= desiredDelay; -} - -/** - * Checks if it is time to bail out based on the given timestamp. - * @param {RetryTask} task The task to check. - * @param {number} timeout The timeout for the queue. - * @returns {boolean} true if it is time to bail, false otherwise. - */ -function isTimeToBail(task, timeout) { - return task.age > timeout; -} - - -/** - * A class to represent a task in the retry queue. - */ -class RetryTask { - - /** - * The unique ID for the task. - * @type {string} - */ - id = Math.random().toString(36).slice(2); - - /** - * The function to call. - * @type {Function} - */ - fn; - - /** - * The error that was thrown. - * @type {Error} - */ - error; - - /** - * The timestamp of the task. - * @type {number} - */ - timestamp = Date.now(); - - /** - * The timestamp of the last attempt. - * @type {number} - */ - lastAttempt = this.timestamp; - - /** - * The resolve function for the promise. - * @type {Function} - */ - resolve; - - /** - * The reject function for the promise. - * @type {Function} - */ - reject; - - /** - * The AbortSignal to monitor for cancellation. - * @type {AbortSignal|undefined} - */ - signal; - - /** - * Creates a new instance. - * @param {Function} fn The function to call. - * @param {Error} error The error that was thrown. - * @param {Function} resolve The resolve function for the promise. - * @param {Function} reject The reject function for the promise. - * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. - */ - constructor(fn, error, resolve, reject, signal) { - this.fn = fn; - this.error = error; - this.timestamp = Date.now(); - this.lastAttempt = Date.now(); - this.resolve = resolve; - this.reject = reject; - this.signal = signal; - } - - /** - * Gets the age of the task. - * @returns {number} The age of the task in milliseconds. - * @readonly - */ - get age() { - return Date.now() - this.timestamp; - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class that manages a queue of retry jobs. - */ -class Retrier { - - /** - * Represents the queue for processing tasks. - * @type {Array} - */ - #queue = []; - - /** - * The timeout for the queue. - * @type {number} - */ - #timeout; - - /** - * The maximum delay for the queue. - * @type {number} - */ - #maxDelay; - - /** - * The setTimeout() timer ID. - * @type {NodeJS.Timeout|undefined} - */ - #timerId; - - /** - * The function to call. - * @type {Function} - */ - #check; - - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - */ - constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY } = {}) { - - if (typeof check !== "function") { - throw new Error("Missing function to check errors"); - } - - this.#check = check; - this.#timeout = timeout; - this.#maxDelay = maxDelay; - } - - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn, { signal } = {}) { - - signal?.throwIfAborted(); - - let result; - - try { - result = fn(); - } catch (/** @type {any} */ error) { - return Promise.reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); - } - - // if the result is not a promise then reject an error - if (!result || typeof result.then !== "function") { - return Promise.reject(new Error("Result is not a promise.")); - } - - // call the original function and catch any ENFILE or EMFILE errors - // @ts-ignore because we know it's any - return Promise.resolve(result).catch(error => { - if (!this.#check(error)) { - throw error; - } - - return new Promise((resolve, reject) => { - this.#queue.push(new RetryTask(fn, error, resolve, reject, signal)); - - signal?.addEventListener("abort", () => { - reject(signal.reason); - }); - - this.#processQueue(); - }); - }); - } - - /** - * Processes the queue. - * @returns {void} - */ - #processQueue() { - // clear any timer because we're going to check right now - clearTimeout(this.#timerId); - this.#timerId = undefined; - - // if there's nothing in the queue, we're done - const task = this.#queue.shift(); - if (!task) { - return; - } - const processAgain = () => { - this.#timerId = setTimeout(() => this.#processQueue(), 0); - }; - - // if it's time to bail, then bail - if (isTimeToBail(task, this.#timeout)) { - task.reject(task.error); - processAgain(); - return; - } - - // if it's not time to retry, then wait and try again - if (!isTimeToRetry(task, this.#maxDelay)) { - this.#queue.push(task); - processAgain(); - return; - } - - // otherwise, try again - task.lastAttempt = Date.now(); - - // Promise.resolve needed in case it's a thenable but not a Promise - Promise.resolve(task.fn()) - // @ts-ignore because we know it's any - .then(result => task.resolve(result)) - - // @ts-ignore because we know it's any - .catch(error => { - if (!this.#check(error)) { - task.reject(error); - return; - } - - // update the task timestamp and push to back of queue to try again - task.lastAttempt = Date.now(); - this.#queue.push(task); - - }) - .finally(() => this.#processQueue()); - } -} - -export { Retrier }; diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.min.js b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.min.js deleted file mode 100644 index 6021e1a..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.min.js +++ /dev/null @@ -1 +0,0 @@ -class RetryTask{id=Math.random().toString(36).slice(2);fn;error;timestamp=Date.now();lastAttempt=this.timestamp;resolve;reject;signal;constructor(t,e,r,s,i){this.fn=t,this.error=e,this.timestamp=Date.now(),this.lastAttempt=Date.now(),this.resolve=r,this.reject=s,this.signal=i}get age(){return Date.now()-this.timestamp}}class Retrier{#t=[];#e;#r;#s;#i;constructor(t,{timeout:e=6e4,maxDelay:r=100}={}){if("function"!=typeof t)throw new Error("Missing function to check errors");this.#i=t,this.#e=e,this.#r=r}retry(t,{signal:e}={}){let r;e?.throwIfAborted();try{r=t()}catch(t){return Promise.reject(new Error(`Synchronous error: ${t.message}`,{cause:t}))}return r&&"function"==typeof r.then?Promise.resolve(r).catch((r=>{if(!this.#i(r))throw r;return new Promise(((s,i)=>{this.#t.push(new RetryTask(t,r,s,i,e)),e?.addEventListener("abort",(()=>{i(e.reason)})),this.#o()}))})):Promise.reject(new Error("Result is not a promise."))}#o(){clearTimeout(this.#s),this.#s=void 0;const t=this.#t.shift();if(!t)return;const e=()=>{this.#s=setTimeout((()=>this.#o()),0)};return function(t,e){return t.age>e}(t,this.#e)?(t.reject(t.error),void e()):function(t,e){const r=Date.now()-t.lastAttempt,s=Math.max(t.lastAttempt-t.timestamp,1);return r>=Math.min(1.2*s,e)}(t,this.#r)?(t.lastAttempt=Date.now(),void Promise.resolve(t.fn()).then((e=>t.resolve(e))).catch((e=>{this.#i(e)?(t.lastAttempt=Date.now(),this.#t.push(t)):t.reject(e)})).finally((()=>this.#o()))):(this.#t.push(t),void e())}}export{Retrier}; diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.mjs b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.mjs deleted file mode 100644 index 6794621..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/dist/retrier.mjs +++ /dev/null @@ -1,301 +0,0 @@ -/** - * @fileoverview A utility for retrying failed async method calls. - */ - -/* global setTimeout, clearTimeout */ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const MAX_TASK_TIMEOUT = 60000; -const MAX_TASK_DELAY = 100; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/* - * The following logic has been extracted from graceful-fs. - * - * The ISC License - * - * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, 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. - */ - -/** - * Checks if it is time to retry a task based on the timestamp and last attempt time. - * @param {RetryTask} task The task to check. - * @param {number} maxDelay The maximum delay for the queue. - * @returns {boolean} true if it is time to retry, false otherwise. - */ -function isTimeToRetry(task, maxDelay) { - const timeSinceLastAttempt = Date.now() - task.lastAttempt; - const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); - const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); - - return timeSinceLastAttempt >= desiredDelay; -} - -/** - * Checks if it is time to bail out based on the given timestamp. - * @param {RetryTask} task The task to check. - * @param {number} timeout The timeout for the queue. - * @returns {boolean} true if it is time to bail, false otherwise. - */ -function isTimeToBail(task, timeout) { - return task.age > timeout; -} - - -/** - * A class to represent a task in the retry queue. - */ -class RetryTask { - - /** - * The unique ID for the task. - * @type {string} - */ - id = Math.random().toString(36).slice(2); - - /** - * The function to call. - * @type {Function} - */ - fn; - - /** - * The error that was thrown. - * @type {Error} - */ - error; - - /** - * The timestamp of the task. - * @type {number} - */ - timestamp = Date.now(); - - /** - * The timestamp of the last attempt. - * @type {number} - */ - lastAttempt = this.timestamp; - - /** - * The resolve function for the promise. - * @type {Function} - */ - resolve; - - /** - * The reject function for the promise. - * @type {Function} - */ - reject; - - /** - * The AbortSignal to monitor for cancellation. - * @type {AbortSignal|undefined} - */ - signal; - - /** - * Creates a new instance. - * @param {Function} fn The function to call. - * @param {Error} error The error that was thrown. - * @param {Function} resolve The resolve function for the promise. - * @param {Function} reject The reject function for the promise. - * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. - */ - constructor(fn, error, resolve, reject, signal) { - this.fn = fn; - this.error = error; - this.timestamp = Date.now(); - this.lastAttempt = Date.now(); - this.resolve = resolve; - this.reject = reject; - this.signal = signal; - } - - /** - * Gets the age of the task. - * @returns {number} The age of the task in milliseconds. - * @readonly - */ - get age() { - return Date.now() - this.timestamp; - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class that manages a queue of retry jobs. - */ -class Retrier { - - /** - * Represents the queue for processing tasks. - * @type {Array} - */ - #queue = []; - - /** - * The timeout for the queue. - * @type {number} - */ - #timeout; - - /** - * The maximum delay for the queue. - * @type {number} - */ - #maxDelay; - - /** - * The setTimeout() timer ID. - * @type {NodeJS.Timeout|undefined} - */ - #timerId; - - /** - * The function to call. - * @type {Function} - */ - #check; - - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - */ - constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY } = {}) { - - if (typeof check !== "function") { - throw new Error("Missing function to check errors"); - } - - this.#check = check; - this.#timeout = timeout; - this.#maxDelay = maxDelay; - } - - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn, { signal } = {}) { - - signal?.throwIfAborted(); - - let result; - - try { - result = fn(); - } catch (/** @type {any} */ error) { - return Promise.reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); - } - - // if the result is not a promise then reject an error - if (!result || typeof result.then !== "function") { - return Promise.reject(new Error("Result is not a promise.")); - } - - // call the original function and catch any ENFILE or EMFILE errors - // @ts-ignore because we know it's any - return Promise.resolve(result).catch(error => { - if (!this.#check(error)) { - throw error; - } - - return new Promise((resolve, reject) => { - this.#queue.push(new RetryTask(fn, error, resolve, reject, signal)); - - signal?.addEventListener("abort", () => { - reject(signal.reason); - }); - - this.#processQueue(); - }); - }); - } - - /** - * Processes the queue. - * @returns {void} - */ - #processQueue() { - // clear any timer because we're going to check right now - clearTimeout(this.#timerId); - this.#timerId = undefined; - - // if there's nothing in the queue, we're done - const task = this.#queue.shift(); - if (!task) { - return; - } - const processAgain = () => { - this.#timerId = setTimeout(() => this.#processQueue(), 0); - }; - - // if it's time to bail, then bail - if (isTimeToBail(task, this.#timeout)) { - task.reject(task.error); - processAgain(); - return; - } - - // if it's not time to retry, then wait and try again - if (!isTimeToRetry(task, this.#maxDelay)) { - this.#queue.push(task); - processAgain(); - return; - } - - // otherwise, try again - task.lastAttempt = Date.now(); - - // Promise.resolve needed in case it's a thenable but not a Promise - Promise.resolve(task.fn()) - // @ts-ignore because we know it's any - .then(result => task.resolve(result)) - - // @ts-ignore because we know it's any - .catch(error => { - if (!this.#check(error)) { - task.reject(error); - return; - } - - // update the task timestamp and push to back of queue to try again - task.lastAttempt = Date.now(); - this.#queue.push(task); - - }) - .finally(() => this.#processQueue()); - } -} - -export { Retrier }; diff --git a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/package.json b/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/package.json deleted file mode 100644 index a33e749..0000000 --- a/node_modules/@humanfs/node/node_modules/@humanwhocodes/retry/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "@humanwhocodes/retry", - "version": "0.3.1", - "description": "A utility to retry failed async methods.", - "type": "module", - "main": "dist/retrier.cjs", - "module": "dist/retrier.js", - "types": "dist/retrier.d.ts", - "exports": { - "require": { - "types": "./dist/retrier.d.cts", - "default": "./dist/retrier.cjs" - }, - "import": { - "types": "./dist/retrier.d.ts", - "default": "./dist/retrier.js" - } - }, - "files": [ - "dist" - ], - "engines": { - "node": ">=18.18" - }, - "publishConfig": { - "access": "public" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.js": [ - "eslint --fix" - ] - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - }, - "scripts": { - "build:cts-types": "node -e \"fs.copyFileSync('dist/retrier.d.ts', 'dist/retrier.d.cts')\"", - "build": "rollup -c && tsc && npm run build:cts-types", - "prepare": "npm run build", - "lint": "eslint src/ tests/", - "pretest": "npm run build", - "test:unit": "mocha tests/retrier.test.js", - "test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs", - "test:jsr": "npx jsr@latest publish --dry-run", - "test:emfile": "node tools/check-emfile-handling.js", - "test": "npm run test:unit && npm run test:build" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/retry.git" - }, - "keywords": [ - "nodejs", - "retry", - "async", - "promises" - ], - "author": "Nicholas C. Zaks", - "license": "Apache-2.0", - "devDependencies": { - "@eslint/js": "^8.49.0", - "@rollup/plugin-terser": "0.4.4", - "@tsconfig/node16": "^16.1.1", - "@types/mocha": "^10.0.3", - "@types/node": "20.12.6", - "eslint": "^8.21.0", - "lint-staged": "15.2.1", - "mocha": "^10.3.0", - "rollup": "3.29.4", - "typescript": "5.4.4", - "yorkie": "2.0.0" - } -} diff --git a/node_modules/@humanfs/node/package.json b/node_modules/@humanfs/node/package.json deleted file mode 100644 index 5b303fa..0000000 --- a/node_modules/@humanfs/node/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@humanfs/node", - "version": "0.16.6", - "description": "The Node.js bindings of the humanfs library.", - "type": "module", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "exports": { - "import": { - "types": "./dist/index.d.ts", - "default": "./src/index.js" - } - }, - "files": [ - "dist", - "src" - ], - "scripts": { - "build": "tsc", - "prepare": "npm run build", - "pretest": "npm run build", - "test": "mocha ./tests/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/humanfs.git" - }, - "publishConfig": { - "access": "public" - }, - "keywords": [ - "filesystem", - "fs", - "hfs", - "files" - ], - "author": "Nicholas C. Zakas", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/humanwhocodes/humanfs/issues" - }, - "homepage": "https://github.com/humanwhocodes/humanfs#readme", - "engines": { - "node": ">=18.18.0" - }, - "devDependencies": { - "@types/node": "^20.9.4", - "@humanfs/test": "^0.15.0", - "@humanfs/types": "^0.15.0", - "mocha": "^10.2.0", - "typescript": "^5.2.2" - }, - "dependencies": { - "@humanwhocodes/retry": "^0.3.0", - "@humanfs/core": "^0.19.1" - } -} diff --git a/node_modules/@humanfs/node/src/index.js b/node_modules/@humanfs/node/src/index.js deleted file mode 100644 index 6d551aa..0000000 --- a/node_modules/@humanfs/node/src/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @fileoverview This file exports everything for this package. - * @author Nicholas C. Zakas - */ - -export * from "./node-hfs.js"; -export { Hfs } from "@humanfs/core"; diff --git a/node_modules/@humanfs/node/src/node-hfs.js b/node_modules/@humanfs/node/src/node-hfs.js deleted file mode 100644 index 7840c87..0000000 --- a/node_modules/@humanfs/node/src/node-hfs.js +++ /dev/null @@ -1,452 +0,0 @@ -/** - * @fileoverview The main file for the hfs package. - * @author Nicholas C. Zakas - */ -/* global Buffer:readonly, URL */ - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef {import("@humanfs/types").HfsImpl} HfsImpl */ -/** @typedef {import("@humanfs/types").HfsDirectoryEntry} HfsDirectoryEntry */ -/** @typedef {import("node:fs/promises")} Fsp */ -/** @typedef {import("fs").Dirent} Dirent */ - -//----------------------------------------------------------------------------- -// Imports -//----------------------------------------------------------------------------- - -import { Hfs } from "@humanfs/core"; -import path from "node:path"; -import { Retrier } from "@humanwhocodes/retry"; -import nativeFsp from "node:fs/promises"; -import { fileURLToPath } from "node:url"; - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const RETRY_ERROR_CODES = new Set(["ENFILE", "EMFILE"]); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * A class representing a directory entry. - * @implements {HfsDirectoryEntry} - */ -class NodeHfsDirectoryEntry { - /** - * The name of the directory entry. - * @type {string} - */ - name; - - /** - * True if the entry is a file. - * @type {boolean} - */ - isFile; - - /** - * True if the entry is a directory. - * @type {boolean} - */ - isDirectory; - - /** - * True if the entry is a symbolic link. - * @type {boolean} - */ - isSymlink; - - /** - * Creates a new instance. - * @param {Dirent} dirent The directory entry to wrap. - */ - constructor(dirent) { - this.name = dirent.name; - this.isFile = dirent.isFile(); - this.isDirectory = dirent.isDirectory(); - this.isSymlink = dirent.isSymbolicLink(); - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class representing the Node.js implementation of Hfs. - * @implements {HfsImpl} - */ -export class NodeHfsImpl { - /** - * The file system module to use. - * @type {Fsp} - */ - #fsp; - - /** - * The retryer object used for retrying operations. - * @type {Retrier} - */ - #retrier; - - /** - * Creates a new instance. - * @param {object} [options] The options for the instance. - * @param {Fsp} [options.fsp] The file system module to use. - */ - constructor({ fsp = nativeFsp } = {}) { - this.#fsp = fsp; - this.#retrier = new Retrier(error => RETRY_ERROR_CODES.has(error.code)); - } - - /** - * Reads a file and returns the contents as an Uint8Array. - * @param {string|URL} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the contents - * of the file or undefined if the file doesn't exist. - * @throws {Error} If the file cannot be read. - * @throws {TypeError} If the file path is not a string. - */ - bytes(filePath) { - return this.#retrier - .retry(() => this.#fsp.readFile(filePath)) - .then(buffer => new Uint8Array(buffer.buffer)) - .catch(error => { - if (error.code === "ENOENT") { - return undefined; - } - - throw error; - }); - } - - /** - * Writes a value to a file. If the value is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The path to the file to write. - * @param {Uint8Array} contents The contents to write to the - * file. - * @returns {Promise} A promise that resolves when the file is - * written. - * @throws {TypeError} If the file path is not a string. - * @throws {Error} If the file cannot be written. - */ - async write(filePath, contents) { - const value = Buffer.from(contents); - - return this.#retrier - .retry(() => this.#fsp.writeFile(filePath, value)) - .catch(error => { - // the directory may not exist, so create it - if (error.code === "ENOENT") { - const dirPath = path.dirname( - filePath instanceof URL - ? fileURLToPath(filePath) - : filePath, - ); - - return this.#fsp - .mkdir(dirPath, { recursive: true }) - .then(() => this.#fsp.writeFile(filePath, value)); - } - - throw error; - }); - } - - /** - * Appends a value to a file. If the value is a string, UTF-8 encoding is used. - * @param {string|URL} filePath The path to the file to append to. - * @param {Uint8Array} contents The contents to append to the - * file. - * @returns {Promise} A promise that resolves when the file is - * written. - * @throws {TypeError} If the file path is not a string. - * @throws {Error} If the file cannot be appended to. - */ - async append(filePath, contents) { - const value = Buffer.from(contents); - - return this.#retrier - .retry(() => this.#fsp.appendFile(filePath, value)) - .catch(error => { - // the directory may not exist, so create it - if (error.code === "ENOENT") { - const dirPath = path.dirname( - filePath instanceof URL - ? fileURLToPath(filePath) - : filePath, - ); - - return this.#fsp - .mkdir(dirPath, { recursive: true }) - .then(() => this.#fsp.appendFile(filePath, value)); - } - - throw error; - }); - } - - /** - * Checks if a file exists. - * @param {string|URL} filePath The path to the file to check. - * @returns {Promise} A promise that resolves with true if the - * file exists or false if it does not. - * @throws {Error} If the operation fails with a code other than ENOENT. - */ - isFile(filePath) { - return this.#fsp - .stat(filePath) - .then(stat => stat.isFile()) - .catch(error => { - if (error.code === "ENOENT") { - return false; - } - - throw error; - }); - } - - /** - * Checks if a directory exists. - * @param {string|URL} dirPath The path to the directory to check. - * @returns {Promise} A promise that resolves with true if the - * directory exists or false if it does not. - * @throws {Error} If the operation fails with a code other than ENOENT. - */ - isDirectory(dirPath) { - return this.#fsp - .stat(dirPath) - .then(stat => stat.isDirectory()) - .catch(error => { - if (error.code === "ENOENT") { - return false; - } - - throw error; - }); - } - - /** - * Creates a directory recursively. - * @param {string|URL} dirPath The path to the directory to create. - * @returns {Promise} A promise that resolves when the directory is - * created. - */ - async createDirectory(dirPath) { - await this.#fsp.mkdir(dirPath, { recursive: true }); - } - - /** - * Deletes a file or empty directory. - * @param {string|URL} fileOrDirPath The path to the file or directory to - * delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {TypeError} If the file or directory path is not a string. - * @throws {Error} If the file or directory cannot be deleted. - */ - delete(fileOrDirPath) { - return this.#fsp - .rm(fileOrDirPath) - .then(() => true) - .catch(error => { - if (error.code === "ERR_FS_EISDIR") { - return this.#fsp.rmdir(fileOrDirPath).then(() => true); - } - - if (error.code === "ENOENT") { - return false; - } - - throw error; - }); - } - - /** - * Deletes a file or directory recursively. - * @param {string|URL} fileOrDirPath The path to the file or directory to - * delete. - * @returns {Promise} A promise that resolves when the file or - * directory is deleted, true if the file or directory is deleted, false - * if the file or directory does not exist. - * @throws {TypeError} If the file or directory path is not a string. - * @throws {Error} If the file or directory cannot be deleted. - */ - deleteAll(fileOrDirPath) { - return this.#fsp - .rm(fileOrDirPath, { recursive: true }) - .then(() => true) - .catch(error => { - if (error.code === "ENOENT") { - return false; - } - - throw error; - }); - } - - /** - * Returns a list of directory entries for the given path. - * @param {string|URL} dirPath The path to the directory to read. - * @returns {AsyncIterable} A promise that resolves with the - * directory entries. - * @throws {TypeError} If the directory path is not a string. - * @throws {Error} If the directory cannot be read. - */ - async *list(dirPath) { - const entries = await this.#fsp.readdir(dirPath, { - withFileTypes: true, - }); - - for (const entry of entries) { - yield new NodeHfsDirectoryEntry(entry); - } - } - - /** - * Returns the size of a file. This method handles ENOENT errors - * and returns undefined in that case. - * @param {string|URL} filePath The path to the file to read. - * @returns {Promise} A promise that resolves with the size of the - * file in bytes or undefined if the file doesn't exist. - */ - size(filePath) { - return this.#fsp - .stat(filePath) - .then(stat => stat.size) - .catch(error => { - if (error.code === "ENOENT") { - return undefined; - } - - throw error; - }); - } - - /** - * Returns the last modified date of a file or directory. This method handles ENOENT errors - * and returns undefined in that case. - * @param {string|URL} fileOrDirPath The path to the file to read. - * @returns {Promise} A promise that resolves with the last modified - * date of the file or directory, or undefined if the file doesn't exist. - */ - lastModified(fileOrDirPath) { - return this.#fsp - .stat(fileOrDirPath) - .then(stat => stat.mtime) - .catch(error => { - if (error.code === "ENOENT") { - return undefined; - } - - throw error; - }); - } - - /** - * Copies a file from one location to another. - * @param {string|URL} source The path to the file to copy. - * @param {string|URL} destination The path to copy the file to. - * @returns {Promise} A promise that resolves when the file is copied. - * @throws {Error} If the source file does not exist. - * @throws {Error} If the source file is a directory. - * @throws {Error} If the destination file is a directory. - */ - copy(source, destination) { - return this.#fsp.copyFile(source, destination); - } - - /** - * Copies a file or directory from one location to another. - * @param {string|URL} source The path to the file or directory to copy. - * @param {string|URL} destination The path to copy the file or directory to. - * @returns {Promise} A promise that resolves when the file or directory is - * copied. - * @throws {Error} If the source file or directory does not exist. - * @throws {Error} If the destination file or directory is a directory. - */ - async copyAll(source, destination) { - // for files use copy() and exit - if (await this.isFile(source)) { - return this.copy(source, destination); - } - - const sourceStr = - source instanceof URL ? fileURLToPath(source) : source; - - const destinationStr = - destination instanceof URL - ? fileURLToPath(destination) - : destination; - - // for directories, create the destination directory and copy each entry - await this.createDirectory(destination); - - for await (const entry of this.list(source)) { - const fromEntryPath = path.join(sourceStr, entry.name); - const toEntryPath = path.join(destinationStr, entry.name); - - if (entry.isDirectory) { - await this.copyAll(fromEntryPath, toEntryPath); - } else { - await this.copy(fromEntryPath, toEntryPath); - } - } - } - - /** - * Moves a file from the source path to the destination path. - * @param {string|URL} source The location of the file to move. - * @param {string|URL} destination The destination of the file to move. - * @returns {Promise} A promise that resolves when the move is complete. - * @throws {TypeError} If the file paths are not strings. - * @throws {Error} If the file cannot be moved. - */ - move(source, destination) { - return this.#fsp.stat(source).then(stat => { - if (stat.isDirectory()) { - throw new Error( - `EISDIR: illegal operation on a directory, move '${source}' -> '${destination}'`, - ); - } - - return this.#fsp.rename(source, destination); - }); - } - - /** - * Moves a file or directory from the source path to the destination path. - * @param {string|URL} source The location of the file or directory to move. - * @param {string|URL} destination The destination of the file or directory to move. - * @returns {Promise} A promise that resolves when the move is complete. - * @throws {TypeError} If the file paths are not strings. - * @throws {Error} If the file or directory cannot be moved. - */ - async moveAll(source, destination) { - return this.#fsp.rename(source, destination); - } -} - -/** - * A class representing a file system utility library. - * @implements {HfsImpl} - */ -export class NodeHfs extends Hfs { - /** - * Creates a new instance. - * @param {object} [options] The options for the instance. - * @param {Fsp} [options.fsp] The file system module to use. - */ - constructor({ fsp } = {}) { - super({ impl: new NodeHfsImpl({ fsp }) }); - } -} - -export const hfs = new NodeHfs(); diff --git a/node_modules/@humanwhocodes/module-importer/CHANGELOG.md b/node_modules/@humanwhocodes/module-importer/CHANGELOG.md deleted file mode 100644 index 1b442a1..0000000 --- a/node_modules/@humanwhocodes/module-importer/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -# Changelog - -## [1.0.1](https://github.com/humanwhocodes/module-importer/compare/v1.0.0...v1.0.1) (2022-08-18) - - -### Bug Fixes - -* Ensure CommonJS mode works correctly. ([cf54a0b](https://github.com/humanwhocodes/module-importer/commit/cf54a0b998085066fbe1776dd0b4cacd808cc192)), closes [#6](https://github.com/humanwhocodes/module-importer/issues/6) - -## 1.0.0 (2022-08-17) - - -### Features - -* Implement ModuleImporter ([3ce4e82](https://www.github.com/humanwhocodes/module-importer/commit/3ce4e820c30c114e787bfed00a0966ac4772f563)) diff --git a/node_modules/@humanwhocodes/module-importer/LICENSE b/node_modules/@humanwhocodes/module-importer/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@humanwhocodes/module-importer/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/module-importer/README.md b/node_modules/@humanwhocodes/module-importer/README.md deleted file mode 100644 index 3de07a7..0000000 --- a/node_modules/@humanwhocodes/module-importer/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# ModuleImporter - -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 utility for seamlessly importing modules in Node.js regardless if they are CommonJS or ESM format. Under the hood, this uses `import()` and relies on Node.js's CommonJS compatibility to work correctly. This ensures that the correct locations and formats are used for CommonJS so you can call one method and not worry about any compatibility issues. - -The problem with the default `import()` is that it always resolves relative to the file location in which it is called. If you want to resolve from a different location, you need to jump through a few hoops to achieve that. This package makes it easy to both resolve and import modules from any directory. - -## Usage - -### Node.js - -Install using [npm][npm] or [yarn][yarn]: - -``` -npm install @humanwhocodes/module-importer - -# or - -yarn add @humanwhocodes/module-importer -``` - -Import into your Node.js project: - -```js -// CommonJS -const { ModuleImporter } = require("@humanwhocodes/module-importer"); - -// ESM -import { ModuleImporter } from "@humanwhocodes/module-importer"; -``` - -### Bun - -Install using this command: - -``` -bun add @humanwhocodes/module-importer -``` - -Import into your Bun project: - -```js -import { ModuleImporter } from "@humanwhocodes/module-importer"; -``` - -## API - -After importing, create a new instance of `ModuleImporter` to start emitting events: - -```js -// cwd can be omitted to use process.cwd() -const importer = new ModuleImporter(cwd); - -// you can resolve the location of any package -const location = importer.resolve("./some-file.cjs"); - -// you can also import directly -const module = importer.import("./some-file.cjs"); -``` - -For both `resolve()` and `import()`, you can pass in package names and filenames. - -## Developer Setup - -1. Fork the repository -2. Clone your fork -3. Run `npm install` to setup dependencies -4. Run `npm test` to run tests - -## License - -Apache 2.0 - -[npm]: https://npmjs.com/ -[yarn]: https://yarnpkg.com/ diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs b/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs deleted file mode 100644 index 779e0cf..0000000 --- a/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var module$1 = require('module'); -var url = require('url'); -var path = require('path'); - -/** - * @fileoverview Universal module importer - */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('module-importer.cjs', document.baseURI).href))); -const __dirname$1 = path.dirname(__filename$1); -const require$1 = module$1.createRequire(__dirname$1 + "/"); -const { ModuleImporter } = require$1("./module-importer.cjs"); - -exports.ModuleImporter = ModuleImporter; diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts b/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts deleted file mode 100644 index a1acbb6..0000000 --- a/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts +++ /dev/null @@ -1,27 +0,0 @@ -export class ModuleImporter { - /** - * Creates a new instance. - * @param {string} [cwd] The current working directory to resolve from. - */ - constructor(cwd?: string); - /** - * The base directory from which paths should be resolved. - * @type {string} - */ - cwd: string; - /** - * Resolves a module based on its name or location. - * @param {string} specifier Either an npm package name or - * relative file path. - * @returns {string|undefined} The location of the import. - * @throws {Error} If specifier cannot be located. - */ - resolve(specifier: string): string | undefined; - /** - * Imports a module based on its name or location. - * @param {string} specifier Either an npm package name or - * relative file path. - * @returns {Promise} The module's object. - */ - import(specifier: string): Promise; -} diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts b/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts deleted file mode 100644 index 498f0a2..0000000 --- a/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { ModuleImporter }; -import { ModuleImporter } from "./module-importer.cjs"; diff --git a/node_modules/@humanwhocodes/module-importer/dist/module-importer.js b/node_modules/@humanwhocodes/module-importer/dist/module-importer.js deleted file mode 100644 index 26e052d..0000000 --- a/node_modules/@humanwhocodes/module-importer/dist/module-importer.js +++ /dev/null @@ -1,18 +0,0 @@ -import { createRequire } from 'module'; -import { fileURLToPath } from 'url'; -import { dirname } from 'path'; - -/** - * @fileoverview Universal module importer - */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); -const require = createRequire(__dirname + "/"); -const { ModuleImporter } = require("./module-importer.cjs"); - -export { ModuleImporter }; diff --git a/node_modules/@humanwhocodes/module-importer/package.json b/node_modules/@humanwhocodes/module-importer/package.json deleted file mode 100644 index 8ece071..0000000 --- a/node_modules/@humanwhocodes/module-importer/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@humanwhocodes/module-importer", - "version": "1.0.1", - "description": "Universal module importer for Node.js", - "main": "src/module-importer.cjs", - "module": "src/module-importer.js", - "type": "module", - "types": "dist/module-importer.d.ts", - "exports": { - "require": "./src/module-importer.cjs", - "import": "./src/module-importer.js" - }, - "files": [ - "dist", - "src" - ], - "publishConfig": { - "access": "public" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.js": [ - "eslint --fix" - ] - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - }, - "scripts": { - "build": "rollup -c && tsc", - "prepare": "npm run build", - "lint": "eslint src/ tests/", - "test:unit": "c8 mocha tests/module-importer.test.js", - "test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs", - "test": "npm run test:unit && npm run test:build" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/module-importer.git" - }, - "keywords": [ - "modules", - "esm", - "commonjs" - ], - "engines": { - "node": ">=12.22" - }, - "author": "Nicholas C. Zaks", - "license": "Apache-2.0", - "devDependencies": { - "@types/node": "^18.7.6", - "c8": "7.12.0", - "chai": "4.3.6", - "eslint": "8.22.0", - "lint-staged": "13.0.3", - "mocha": "9.2.2", - "rollup": "2.78.0", - "typescript": "4.7.4", - "yorkie": "2.0.0" - } -} diff --git a/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs b/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs deleted file mode 100644 index 3efb095..0000000 --- a/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @fileoverview Universal module importer - */ - -//----------------------------------------------------------------------------- -// Imports -//----------------------------------------------------------------------------- - -const { createRequire } = require("module"); -const { pathToFileURL } = require("url"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const SLASHES = new Set(["/", "\\"]); - -/** - * Normalizes directories to have a trailing slash. - * Resolve is pretty finicky -- if the directory name doesn't have - * a trailing slash then it tries to look in the parent directory. - * i.e., if the directory is "/usr/nzakas/foo" it will start the - * search in /usr/nzakas. However, if the directory is "/user/nzakas/foo/", - * then it will start the search in /user/nzakas/foo. - * @param {string} directory The directory to check. - * @returns {string} The normalized directory. - */ -function normalizeDirectory(directory) { - if (!SLASHES.has(directory[directory.length-1])) { - return directory + "/"; - } - - return directory; -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * Class for importing both CommonJS and ESM modules in Node.js. - */ -exports.ModuleImporter = class ModuleImporter { - - /** - * Creates a new instance. - * @param {string} [cwd] The current working directory to resolve from. - */ - constructor(cwd = process.cwd()) { - - /** - * The base directory from which paths should be resolved. - * @type {string} - */ - this.cwd = normalizeDirectory(cwd); - } - - /** - * Resolves a module based on its name or location. - * @param {string} specifier Either an npm package name or - * relative file path. - * @returns {string|undefined} The location of the import. - * @throws {Error} If specifier cannot be located. - */ - resolve(specifier) { - const require = createRequire(this.cwd); - return require.resolve(specifier); - } - - /** - * Imports a module based on its name or location. - * @param {string} specifier Either an npm package name or - * relative file path. - * @returns {Promise} The module's object. - */ - import(specifier) { - const location = this.resolve(specifier); - return import(pathToFileURL(location).href); - } - -} diff --git a/node_modules/@humanwhocodes/module-importer/src/module-importer.js b/node_modules/@humanwhocodes/module-importer/src/module-importer.js deleted file mode 100644 index f5464e1..0000000 --- a/node_modules/@humanwhocodes/module-importer/src/module-importer.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @fileoverview Universal module importer - */ - -//----------------------------------------------------------------------------- -// Imports -//----------------------------------------------------------------------------- - -import { createRequire } from "module"; -import { fileURLToPath } from "url"; -import { dirname } from "path"; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); -const require = createRequire(__dirname + "/"); -const { ModuleImporter } = require("./module-importer.cjs"); - -export { ModuleImporter }; diff --git a/node_modules/@humanwhocodes/retry/LICENSE b/node_modules/@humanwhocodes/retry/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/@humanwhocodes/retry/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/retry/README.md b/node_modules/@humanwhocodes/retry/README.md deleted file mode 100644 index 0ec7a47..0000000 --- a/node_modules/@humanwhocodes/retry/README.md +++ /dev/null @@ -1,177 +0,0 @@ -# Retry utility - -by [Nicholas C. Zakas](https://humanwhocodes.com) - -If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate) or [nominate me](https://stars.github.com/nominate/) for a GitHub Star. - -## Description - -A utility for retrying failed async JavaScript calls based on the error returned. - -## Usage - -### Node.js - -Install using [npm][npm] or [yarn][yarn]: - -``` -npm install @humanwhocodes/retry - -# or - -yarn add @humanwhocodes/retry -``` - -Import into your Node.js project: - -```js -// CommonJS -const { Retrier } = require("@humanwhocodes/retry"); - -// ESM -import { Retrier } from "@humanwhocodes/retry"; -``` - -### Deno - -Install using [JSR](https://jsr.io): - -```shell -deno add @humanwhocodes/retry - -#or - -jsr add @humanwhocodes/retry -``` - -Then import into your Deno project: - -```js -import { Retrier } from "@humanwhocodes/retry"; -``` - -### Bun - -Install using this command: - -``` -bun add @humanwhocodes/retry -``` - -Import into your Bun project: - -```js -import { Retrier } from "@humanwhocodes/retry"; -``` - -### Browser - -It's recommended to import the minified version to save bandwidth: - -```js -import { Retrier } from "https://cdn.skypack.dev/@humanwhocodes/retry?min"; -``` - -However, you can also import the unminified version for debugging purposes: - -```js -import { Retrier } from "https://cdn.skypack.dev/@humanwhocodes/retry"; -``` - -## API - -After importing, create a new instance of `Retrier` and specify the function to run on the error. This function should return `true` if you want the call retried and `false` if not. - -```js -// this instance will retry if the specific error code is found -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}); -``` - -Then, call the `retry()` method around the function you'd like to retry, such as: - -```js -import fs from "fs/promises"; - -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}); - -const text = await retrier.retry(() => fs.readFile("README.md", "utf8")); -``` - -The `retry()` method will either pass through the result on success or wait and retry on failure. Any error that isn't caught by the retrier is automatically rejected so the end result is a transparent passing through of both success and failure. - -### Setting a Timeout - -You can control how long a task will attempt to retry before giving up by passing the `timeout` option to the `Retrier` constructor. By default, the timeout is one minute. - -```js -import fs from "fs/promises"; - -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}, { timeout: 100_000 }); - -const text = await retrier.retry(() => fs.readFile("README.md", "utf8")); -``` - -When a call times out, it rejects the first error that was received from calling the function. - -### Setting a Concurrency Limit - -When processing a large number of function calls, you can limit the number of concurrent function calls by passing the `concurrency` option to the `Retrier` constructor. By default, `concurrency` is 1000. - -```js -import fs from "fs/promises"; - -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}, { concurrency: 100 }); - -const filenames = getFilenames(); -const contents = await Promise.all( - filenames.map(filename => retrier.retry(() => fs.readFile(filename, "utf8")) -); -``` - -### Aborting with `AbortSignal` - -You can also pass an `AbortSignal` to cancel a retry: - -```js -import fs from "fs/promises"; - -const controller = new AbortController(); -const retrier = new Retrier(error => { - return error.code === "ENFILE" || error.code === "EMFILE"; -}); - -const text = await retrier.retry( - () => fs.readFile("README.md", "utf8"), - { signal: controller.signal } -); -``` - -## Developer Setup - -1. Fork the repository -2. Clone your fork -3. Run `npm install` to setup dependencies -4. Run `npm test` to run tests - -### Debug Output - -Enable debugging output by setting the `DEBUG` environment variable to `"@hwc/retry"` before running. - -## License - -Apache 2.0 - -## Prior Art - -This utility is inspired by, and contains code from [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). - -[npm]: https://npmjs.com/ -[yarn]: https://yarnpkg.com/ diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.cjs b/node_modules/@humanwhocodes/retry/dist/retrier.cjs deleted file mode 100644 index b189704..0000000 --- a/node_modules/@humanwhocodes/retry/dist/retrier.cjs +++ /dev/null @@ -1,477 +0,0 @@ -'use strict'; - -/** - * @fileoverview A utility for retrying failed async method calls. - */ - -/* global setTimeout, clearTimeout */ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const MAX_TASK_TIMEOUT = 60000; -const MAX_TASK_DELAY = 100; -const MAX_CONCURRENCY = 1000; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Logs a message to the console if the DEBUG environment variable is set. - * @param {string} message The message to log. - * @returns {void} - */ -function debug(message) { - if (globalThis?.process?.env.DEBUG === "@hwc/retry") { - console.debug(message); - } -} - -/* - * The following logic has been extracted from graceful-fs. - * - * The ISC License - * - * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, 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. - */ - -/** - * Checks if it is time to retry a task based on the timestamp and last attempt time. - * @param {RetryTask} task The task to check. - * @param {number} maxDelay The maximum delay for the queue. - * @returns {boolean} true if it is time to retry, false otherwise. - */ -function isTimeToRetry(task, maxDelay) { - const timeSinceLastAttempt = Date.now() - task.lastAttempt; - const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); - const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); - - return timeSinceLastAttempt >= desiredDelay; -} - -/** - * Checks if it is time to bail out based on the given timestamp. - * @param {RetryTask} task The task to check. - * @param {number} timeout The timeout for the queue. - * @returns {boolean} true if it is time to bail, false otherwise. - */ -function isTimeToBail(task, timeout) { - return task.age > timeout; -} - -/** - * Creates a new promise with resolve and reject functions. - * @returns {{promise:Promise, resolve:(value:any) => any, reject: (value:any) => any}} A new promise. - */ -function createPromise() { - if (Promise.withResolvers) { - return Promise.withResolvers(); - } - - let resolve, reject; - - const promise = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); - - if (resolve === undefined || reject === undefined) { - throw new Error("Promise executor did not initialize resolve or reject."); - } - - return { promise, resolve, reject }; -} - - -/** - * A class to represent a task in the retry queue. - */ -class RetryTask { - - /** - * The unique ID for the task. - * @type {string} - */ - id = Math.random().toString(36).slice(2); - - /** - * The function to call. - * @type {Function} - */ - fn; - - /** - * The error that was thrown. - * @type {Error} - */ - error; - - /** - * The timestamp of the task. - * @type {number} - */ - timestamp = Date.now(); - - /** - * The timestamp of the last attempt. - * @type {number} - */ - lastAttempt = this.timestamp; - - /** - * The resolve function for the promise. - * @type {Function} - */ - resolve; - - /** - * The reject function for the promise. - * @type {Function} - */ - reject; - - /** - * The AbortSignal to monitor for cancellation. - * @type {AbortSignal|undefined} - */ - signal; - - /** - * Creates a new instance. - * @param {Function} fn The function to call. - * @param {Error} error The error that was thrown. - * @param {Function} resolve The resolve function for the promise. - * @param {Function} reject The reject function for the promise. - * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. - */ - constructor(fn, error, resolve, reject, signal) { - this.fn = fn; - this.error = error; - this.timestamp = Date.now(); - this.lastAttempt = Date.now(); - this.resolve = resolve; - this.reject = reject; - this.signal = signal; - } - - /** - * Gets the age of the task. - * @returns {number} The age of the task in milliseconds. - * @readonly - */ - get age() { - return Date.now() - this.timestamp; - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class that manages a queue of retry jobs. - */ -class Retrier { - - /** - * Represents the queue for processing tasks. - * @type {Array} - */ - #retrying = []; - - /** - * Represents the queue for pending tasks. - * @type {Array} - */ - #pending = []; - - /** - * The number of tasks currently being processed. - * @type {number} - */ - #working = 0; - - /** - * The timeout for the queue. - * @type {number} - */ - #timeout; - - /** - * The maximum delay for the queue. - * @type {number} - */ - #maxDelay; - - /** - * The setTimeout() timer ID. - * @type {NodeJS.Timeout|undefined} - */ - #timerId; - - /** - * The function to call. - * @type {Function} - */ - #check; - - /** - * The maximum number of concurrent tasks. - * @type {number} - */ - #concurrency; - - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - * @param {number} [options.concurrency] The maximum number of concurrent tasks. - */ - constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) { - - if (typeof check !== "function") { - throw new Error("Missing function to check errors"); - } - - this.#check = check; - this.#timeout = timeout; - this.#maxDelay = maxDelay; - this.#concurrency = concurrency; - } - - /** - * Gets the number of tasks waiting to be retried. - * @returns {number} The number of tasks in the retry queue. - */ - get retrying() { - return this.#retrying.length; - } - - /** - * Gets the number of tasks waiting to be processed in the pending queue. - * @returns {number} The number of tasks in the pending queue. - */ - get pending() { - return this.#pending.length; - } - - /** - * Gets the number of tasks currently being processed. - * @returns {number} The number of tasks currently being processed. - */ - get working() { - return this.#working; - } - - /** - * Calls the function and retries if it fails. - * @param {Function} fn The function to call. - * @param {Object} options The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @param {Promise} options.promise The promise to return when the function settles. - * @param {Function} options.resolve The resolve function for the promise. - * @param {Function} options.reject The reject function for the promise. - * @returns {Promise} A promise that resolves when the function is - * called successfully. - */ - #call(fn, { signal, promise, resolve, reject }) { - - let result; - - try { - result = fn(); - } catch (/** @type {any} */ error) { - reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); - return promise; - } - - // if the result is not a promise then reject an error - if (!result || typeof result.then !== "function") { - reject(new Error("Result is not a promise.")); - return promise; - } - - this.#working++; - promise.finally(() => { - this.#working--; - this.#processPending(); - }); - - // call the original function and catch any ENFILE or EMFILE errors - // @ts-ignore because we know it's any - return Promise.resolve(result) - .then(value => { - debug("Function called successfully without retry."); - resolve(value); - return promise; - }) - .catch(error => { - if (!this.#check(error)) { - reject(error); - return promise; - } - - const task = new RetryTask(fn, error, resolve, reject, signal); - - debug(`Function failed, queuing for retry with task ${task.id}.`); - this.#retrying.push(task); - - signal?.addEventListener("abort", () => { - debug(`Task ${task.id} was aborted due to AbortSignal.`); - reject(signal.reason); - }); - - this.#processQueue(); - - return promise; - }); - } - - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn, { signal } = {}) { - - signal?.throwIfAborted(); - - const { promise, resolve, reject } = createPromise(); - - this.#pending.push(() => this.#call(fn, { signal, promise, resolve, reject })); - this.#processPending(); - - return promise; - } - - - /** - * Processes the pending queue and the retry queue. - * @returns {void} - */ - #processAll() { - if (this.pending) { - this.#processPending(); - } - - if (this.retrying) { - this.#processQueue(); - } - } - - /** - * Processes the pending queue to see which tasks can be started. - * @returns {void} - */ - #processPending() { - - debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`); - - const available = this.#concurrency - this.working; - - if (available <= 0) { - return; - } - - const count = Math.min(this.pending, available); - - for (let i = 0; i < count; i++) { - const task = this.#pending.shift(); - task?.(); - } - - debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`); - } - - /** - * Processes the queue. - * @returns {void} - */ - #processQueue() { - // clear any timer because we're going to check right now - clearTimeout(this.#timerId); - this.#timerId = undefined; - - debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`); - - const processAgain = () => { - this.#timerId = setTimeout(() => this.#processAll(), 0); - }; - - // if there's nothing in the queue, we're done - const task = this.#retrying.shift(); - if (!task) { - debug("Queue is empty, exiting."); - - if (this.pending) { - processAgain(); - } - return; - } - - // if it's time to bail, then bail - if (isTimeToBail(task, this.#timeout)) { - debug(`Task ${task.id} was abandoned due to timeout.`); - task.reject(task.error); - processAgain(); - return; - } - - // if it's not time to retry, then wait and try again - if (!isTimeToRetry(task, this.#maxDelay)) { - debug(`Task ${task.id} is not ready to retry, skipping.`); - this.#retrying.push(task); - processAgain(); - return; - } - - // otherwise, try again - task.lastAttempt = Date.now(); - - // Promise.resolve needed in case it's a thenable but not a Promise - Promise.resolve(task.fn()) - // @ts-ignore because we know it's any - .then(result => { - debug(`Task ${task.id} succeeded after ${task.age}ms.`); - task.resolve(result); - }) - - // @ts-ignore because we know it's any - .catch(error => { - if (!this.#check(error)) { - debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`); - task.reject(error); - return; - } - - // update the task timestamp and push to back of queue to try again - task.lastAttempt = Date.now(); - this.#retrying.push(task); - debug(`Task ${task.id} failed, requeueing to try again.`); - }) - .finally(() => { - this.#processAll(); - }); - } -} - -exports.Retrier = Retrier; diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.d.cts b/node_modules/@humanwhocodes/retry/dist/retrier.d.cts deleted file mode 100644 index 4b60d6f..0000000 --- a/node_modules/@humanwhocodes/retry/dist/retrier.d.cts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A class that manages a queue of retry jobs. - */ -export class Retrier { - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - * @param {number} [options.concurrency] The maximum number of concurrent tasks. - */ - constructor(check: Function, { timeout, maxDelay, concurrency }?: { - timeout?: number | undefined; - maxDelay?: number | undefined; - concurrency?: number | undefined; - } | undefined); - /** - * Gets the number of tasks waiting to be retried. - * @returns {number} The number of tasks in the retry queue. - */ - get retrying(): number; - /** - * Gets the number of tasks waiting to be processed in the pending queue. - * @returns {number} The number of tasks in the pending queue. - */ - get pending(): number; - /** - * Gets the number of tasks currently being processed. - * @returns {number} The number of tasks currently being processed. - */ - get working(): number; - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn: Function, { signal }?: { - signal?: AbortSignal | undefined; - } | undefined): Promise; - #private; -} diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.d.ts b/node_modules/@humanwhocodes/retry/dist/retrier.d.ts deleted file mode 100644 index 4b60d6f..0000000 --- a/node_modules/@humanwhocodes/retry/dist/retrier.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A class that manages a queue of retry jobs. - */ -export class Retrier { - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - * @param {number} [options.concurrency] The maximum number of concurrent tasks. - */ - constructor(check: Function, { timeout, maxDelay, concurrency }?: { - timeout?: number | undefined; - maxDelay?: number | undefined; - concurrency?: number | undefined; - } | undefined); - /** - * Gets the number of tasks waiting to be retried. - * @returns {number} The number of tasks in the retry queue. - */ - get retrying(): number; - /** - * Gets the number of tasks waiting to be processed in the pending queue. - * @returns {number} The number of tasks in the pending queue. - */ - get pending(): number; - /** - * Gets the number of tasks currently being processed. - * @returns {number} The number of tasks currently being processed. - */ - get working(): number; - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn: Function, { signal }?: { - signal?: AbortSignal | undefined; - } | undefined): Promise; - #private; -} diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.js b/node_modules/@humanwhocodes/retry/dist/retrier.js deleted file mode 100644 index 4d52580..0000000 --- a/node_modules/@humanwhocodes/retry/dist/retrier.js +++ /dev/null @@ -1,476 +0,0 @@ -// @ts-self-types="./retrier.d.ts" -/** - * @fileoverview A utility for retrying failed async method calls. - */ - -/* global setTimeout, clearTimeout */ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const MAX_TASK_TIMEOUT = 60000; -const MAX_TASK_DELAY = 100; -const MAX_CONCURRENCY = 1000; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Logs a message to the console if the DEBUG environment variable is set. - * @param {string} message The message to log. - * @returns {void} - */ -function debug(message) { - if (globalThis?.process?.env.DEBUG === "@hwc/retry") { - console.debug(message); - } -} - -/* - * The following logic has been extracted from graceful-fs. - * - * The ISC License - * - * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, 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. - */ - -/** - * Checks if it is time to retry a task based on the timestamp and last attempt time. - * @param {RetryTask} task The task to check. - * @param {number} maxDelay The maximum delay for the queue. - * @returns {boolean} true if it is time to retry, false otherwise. - */ -function isTimeToRetry(task, maxDelay) { - const timeSinceLastAttempt = Date.now() - task.lastAttempt; - const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); - const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); - - return timeSinceLastAttempt >= desiredDelay; -} - -/** - * Checks if it is time to bail out based on the given timestamp. - * @param {RetryTask} task The task to check. - * @param {number} timeout The timeout for the queue. - * @returns {boolean} true if it is time to bail, false otherwise. - */ -function isTimeToBail(task, timeout) { - return task.age > timeout; -} - -/** - * Creates a new promise with resolve and reject functions. - * @returns {{promise:Promise, resolve:(value:any) => any, reject: (value:any) => any}} A new promise. - */ -function createPromise() { - if (Promise.withResolvers) { - return Promise.withResolvers(); - } - - let resolve, reject; - - const promise = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); - - if (resolve === undefined || reject === undefined) { - throw new Error("Promise executor did not initialize resolve or reject."); - } - - return { promise, resolve, reject }; -} - - -/** - * A class to represent a task in the retry queue. - */ -class RetryTask { - - /** - * The unique ID for the task. - * @type {string} - */ - id = Math.random().toString(36).slice(2); - - /** - * The function to call. - * @type {Function} - */ - fn; - - /** - * The error that was thrown. - * @type {Error} - */ - error; - - /** - * The timestamp of the task. - * @type {number} - */ - timestamp = Date.now(); - - /** - * The timestamp of the last attempt. - * @type {number} - */ - lastAttempt = this.timestamp; - - /** - * The resolve function for the promise. - * @type {Function} - */ - resolve; - - /** - * The reject function for the promise. - * @type {Function} - */ - reject; - - /** - * The AbortSignal to monitor for cancellation. - * @type {AbortSignal|undefined} - */ - signal; - - /** - * Creates a new instance. - * @param {Function} fn The function to call. - * @param {Error} error The error that was thrown. - * @param {Function} resolve The resolve function for the promise. - * @param {Function} reject The reject function for the promise. - * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. - */ - constructor(fn, error, resolve, reject, signal) { - this.fn = fn; - this.error = error; - this.timestamp = Date.now(); - this.lastAttempt = Date.now(); - this.resolve = resolve; - this.reject = reject; - this.signal = signal; - } - - /** - * Gets the age of the task. - * @returns {number} The age of the task in milliseconds. - * @readonly - */ - get age() { - return Date.now() - this.timestamp; - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class that manages a queue of retry jobs. - */ -class Retrier { - - /** - * Represents the queue for processing tasks. - * @type {Array} - */ - #retrying = []; - - /** - * Represents the queue for pending tasks. - * @type {Array} - */ - #pending = []; - - /** - * The number of tasks currently being processed. - * @type {number} - */ - #working = 0; - - /** - * The timeout for the queue. - * @type {number} - */ - #timeout; - - /** - * The maximum delay for the queue. - * @type {number} - */ - #maxDelay; - - /** - * The setTimeout() timer ID. - * @type {NodeJS.Timeout|undefined} - */ - #timerId; - - /** - * The function to call. - * @type {Function} - */ - #check; - - /** - * The maximum number of concurrent tasks. - * @type {number} - */ - #concurrency; - - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - * @param {number} [options.concurrency] The maximum number of concurrent tasks. - */ - constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) { - - if (typeof check !== "function") { - throw new Error("Missing function to check errors"); - } - - this.#check = check; - this.#timeout = timeout; - this.#maxDelay = maxDelay; - this.#concurrency = concurrency; - } - - /** - * Gets the number of tasks waiting to be retried. - * @returns {number} The number of tasks in the retry queue. - */ - get retrying() { - return this.#retrying.length; - } - - /** - * Gets the number of tasks waiting to be processed in the pending queue. - * @returns {number} The number of tasks in the pending queue. - */ - get pending() { - return this.#pending.length; - } - - /** - * Gets the number of tasks currently being processed. - * @returns {number} The number of tasks currently being processed. - */ - get working() { - return this.#working; - } - - /** - * Calls the function and retries if it fails. - * @param {Function} fn The function to call. - * @param {Object} options The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @param {Promise} options.promise The promise to return when the function settles. - * @param {Function} options.resolve The resolve function for the promise. - * @param {Function} options.reject The reject function for the promise. - * @returns {Promise} A promise that resolves when the function is - * called successfully. - */ - #call(fn, { signal, promise, resolve, reject }) { - - let result; - - try { - result = fn(); - } catch (/** @type {any} */ error) { - reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); - return promise; - } - - // if the result is not a promise then reject an error - if (!result || typeof result.then !== "function") { - reject(new Error("Result is not a promise.")); - return promise; - } - - this.#working++; - promise.finally(() => { - this.#working--; - this.#processPending(); - }); - - // call the original function and catch any ENFILE or EMFILE errors - // @ts-ignore because we know it's any - return Promise.resolve(result) - .then(value => { - debug("Function called successfully without retry."); - resolve(value); - return promise; - }) - .catch(error => { - if (!this.#check(error)) { - reject(error); - return promise; - } - - const task = new RetryTask(fn, error, resolve, reject, signal); - - debug(`Function failed, queuing for retry with task ${task.id}.`); - this.#retrying.push(task); - - signal?.addEventListener("abort", () => { - debug(`Task ${task.id} was aborted due to AbortSignal.`); - reject(signal.reason); - }); - - this.#processQueue(); - - return promise; - }); - } - - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn, { signal } = {}) { - - signal?.throwIfAborted(); - - const { promise, resolve, reject } = createPromise(); - - this.#pending.push(() => this.#call(fn, { signal, promise, resolve, reject })); - this.#processPending(); - - return promise; - } - - - /** - * Processes the pending queue and the retry queue. - * @returns {void} - */ - #processAll() { - if (this.pending) { - this.#processPending(); - } - - if (this.retrying) { - this.#processQueue(); - } - } - - /** - * Processes the pending queue to see which tasks can be started. - * @returns {void} - */ - #processPending() { - - debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`); - - const available = this.#concurrency - this.working; - - if (available <= 0) { - return; - } - - const count = Math.min(this.pending, available); - - for (let i = 0; i < count; i++) { - const task = this.#pending.shift(); - task?.(); - } - - debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`); - } - - /** - * Processes the queue. - * @returns {void} - */ - #processQueue() { - // clear any timer because we're going to check right now - clearTimeout(this.#timerId); - this.#timerId = undefined; - - debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`); - - const processAgain = () => { - this.#timerId = setTimeout(() => this.#processAll(), 0); - }; - - // if there's nothing in the queue, we're done - const task = this.#retrying.shift(); - if (!task) { - debug("Queue is empty, exiting."); - - if (this.pending) { - processAgain(); - } - return; - } - - // if it's time to bail, then bail - if (isTimeToBail(task, this.#timeout)) { - debug(`Task ${task.id} was abandoned due to timeout.`); - task.reject(task.error); - processAgain(); - return; - } - - // if it's not time to retry, then wait and try again - if (!isTimeToRetry(task, this.#maxDelay)) { - debug(`Task ${task.id} is not ready to retry, skipping.`); - this.#retrying.push(task); - processAgain(); - return; - } - - // otherwise, try again - task.lastAttempt = Date.now(); - - // Promise.resolve needed in case it's a thenable but not a Promise - Promise.resolve(task.fn()) - // @ts-ignore because we know it's any - .then(result => { - debug(`Task ${task.id} succeeded after ${task.age}ms.`); - task.resolve(result); - }) - - // @ts-ignore because we know it's any - .catch(error => { - if (!this.#check(error)) { - debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`); - task.reject(error); - return; - } - - // update the task timestamp and push to back of queue to try again - task.lastAttempt = Date.now(); - this.#retrying.push(task); - debug(`Task ${task.id} failed, requeueing to try again.`); - }) - .finally(() => { - this.#processAll(); - }); - } -} - -export { Retrier }; diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.min.js b/node_modules/@humanwhocodes/retry/dist/retrier.min.js deleted file mode 100644 index 61a88b0..0000000 --- a/node_modules/@humanwhocodes/retry/dist/retrier.min.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){"@hwc/retry"===globalThis?.process?.env.DEBUG&&console.debug(e)}class RetryTask{id=Math.random().toString(36).slice(2);fn;error;timestamp=Date.now();lastAttempt=this.timestamp;resolve;reject;signal;constructor(e,t,r,i,s){this.fn=e,this.error=t,this.timestamp=Date.now(),this.lastAttempt=Date.now(),this.resolve=r,this.reject=i,this.signal=s}get age(){return Date.now()-this.timestamp}}class Retrier{#e=[];#t=[];#r=0;#i;#s;#n;#o;#c;constructor(e,{timeout:t=6e4,maxDelay:r=100,concurrency:i=1e3}={}){if("function"!=typeof e)throw new Error("Missing function to check errors");this.#o=e,this.#i=t,this.#s=r,this.#c=i}get retrying(){return this.#e.length}get pending(){return this.#t.length}get working(){return this.#r}#a(t,{signal:r,promise:i,resolve:s,reject:n}){let o;try{o=t()}catch(e){return n(new Error(`Synchronous error: ${e.message}`,{cause:e})),i}return o&&"function"==typeof o.then?(this.#r++,i.finally((()=>{this.#r--,this.#h()})),Promise.resolve(o).then((t=>(e("Function called successfully without retry."),s(t),i))).catch((o=>{if(!this.#o(o))return n(o),i;const c=new RetryTask(t,o,s,n,r);return e(`Function failed, queuing for retry with task ${c.id}.`),this.#e.push(c),r?.addEventListener("abort",(()=>{e(`Task ${c.id} was aborted due to AbortSignal.`),n(r.reason)})),this.#g(),i}))):(n(new Error("Result is not a promise.")),i)}retry(e,{signal:t}={}){t?.throwIfAborted();const{promise:r,resolve:i,reject:s}=function(){if(Promise.withResolvers)return Promise.withResolvers();let e,t;const r=new Promise(((r,i)=>{e=r,t=i}));if(void 0===e||void 0===t)throw new Error("Promise executor did not initialize resolve or reject.");return{promise:r,resolve:e,reject:t}}();return this.#t.push((()=>this.#a(e,{signal:t,promise:r,resolve:i,reject:s}))),this.#h(),r}#u(){this.pending&&this.#h(),this.retrying&&this.#g()}#h(){e(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`);const t=this.#c-this.working;if(t<=0)return;const r=Math.min(this.pending,t);for(let e=0;e{this.#n=setTimeout((()=>this.#u()),0)},r=this.#e.shift();return r?function(e,t){return e.age>t}(r,this.#i)?(e(`Task ${r.id} was abandoned due to timeout.`),r.reject(r.error),void t()):function(e,t){const r=Date.now()-e.lastAttempt,i=Math.max(e.lastAttempt-e.timestamp,1);return r>=Math.min(1.2*i,t)}(r,this.#s)?(r.lastAttempt=Date.now(),void Promise.resolve(r.fn()).then((t=>{e(`Task ${r.id} succeeded after ${r.age}ms.`),r.resolve(t)})).catch((t=>{if(!this.#o(t))return e(`Task ${r.id} failed with non-retryable error: ${t.message}.`),void r.reject(t);r.lastAttempt=Date.now(),this.#e.push(r),e(`Task ${r.id} failed, requeueing to try again.`)})).finally((()=>{this.#u()}))):(e(`Task ${r.id} is not ready to retry, skipping.`),this.#e.push(r),void t()):(e("Queue is empty, exiting."),void(this.pending&&t()))}}export{Retrier}; diff --git a/node_modules/@humanwhocodes/retry/dist/retrier.mjs b/node_modules/@humanwhocodes/retry/dist/retrier.mjs deleted file mode 100644 index 85cdbfc..0000000 --- a/node_modules/@humanwhocodes/retry/dist/retrier.mjs +++ /dev/null @@ -1,475 +0,0 @@ -/** - * @fileoverview A utility for retrying failed async method calls. - */ - -/* global setTimeout, clearTimeout */ - -//----------------------------------------------------------------------------- -// Constants -//----------------------------------------------------------------------------- - -const MAX_TASK_TIMEOUT = 60000; -const MAX_TASK_DELAY = 100; -const MAX_CONCURRENCY = 1000; - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Logs a message to the console if the DEBUG environment variable is set. - * @param {string} message The message to log. - * @returns {void} - */ -function debug(message) { - if (globalThis?.process?.env.DEBUG === "@hwc/retry") { - console.debug(message); - } -} - -/* - * The following logic has been extracted from graceful-fs. - * - * The ISC License - * - * Copyright (c) 2011-2023 Isaac Z. Schlueter, Ben Noordhuis, 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. - */ - -/** - * Checks if it is time to retry a task based on the timestamp and last attempt time. - * @param {RetryTask} task The task to check. - * @param {number} maxDelay The maximum delay for the queue. - * @returns {boolean} true if it is time to retry, false otherwise. - */ -function isTimeToRetry(task, maxDelay) { - const timeSinceLastAttempt = Date.now() - task.lastAttempt; - const timeSinceStart = Math.max(task.lastAttempt - task.timestamp, 1); - const desiredDelay = Math.min(timeSinceStart * 1.2, maxDelay); - - return timeSinceLastAttempt >= desiredDelay; -} - -/** - * Checks if it is time to bail out based on the given timestamp. - * @param {RetryTask} task The task to check. - * @param {number} timeout The timeout for the queue. - * @returns {boolean} true if it is time to bail, false otherwise. - */ -function isTimeToBail(task, timeout) { - return task.age > timeout; -} - -/** - * Creates a new promise with resolve and reject functions. - * @returns {{promise:Promise, resolve:(value:any) => any, reject: (value:any) => any}} A new promise. - */ -function createPromise() { - if (Promise.withResolvers) { - return Promise.withResolvers(); - } - - let resolve, reject; - - const promise = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); - - if (resolve === undefined || reject === undefined) { - throw new Error("Promise executor did not initialize resolve or reject."); - } - - return { promise, resolve, reject }; -} - - -/** - * A class to represent a task in the retry queue. - */ -class RetryTask { - - /** - * The unique ID for the task. - * @type {string} - */ - id = Math.random().toString(36).slice(2); - - /** - * The function to call. - * @type {Function} - */ - fn; - - /** - * The error that was thrown. - * @type {Error} - */ - error; - - /** - * The timestamp of the task. - * @type {number} - */ - timestamp = Date.now(); - - /** - * The timestamp of the last attempt. - * @type {number} - */ - lastAttempt = this.timestamp; - - /** - * The resolve function for the promise. - * @type {Function} - */ - resolve; - - /** - * The reject function for the promise. - * @type {Function} - */ - reject; - - /** - * The AbortSignal to monitor for cancellation. - * @type {AbortSignal|undefined} - */ - signal; - - /** - * Creates a new instance. - * @param {Function} fn The function to call. - * @param {Error} error The error that was thrown. - * @param {Function} resolve The resolve function for the promise. - * @param {Function} reject The reject function for the promise. - * @param {AbortSignal|undefined} signal The AbortSignal to monitor for cancellation. - */ - constructor(fn, error, resolve, reject, signal) { - this.fn = fn; - this.error = error; - this.timestamp = Date.now(); - this.lastAttempt = Date.now(); - this.resolve = resolve; - this.reject = reject; - this.signal = signal; - } - - /** - * Gets the age of the task. - * @returns {number} The age of the task in milliseconds. - * @readonly - */ - get age() { - return Date.now() - this.timestamp; - } -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * A class that manages a queue of retry jobs. - */ -class Retrier { - - /** - * Represents the queue for processing tasks. - * @type {Array} - */ - #retrying = []; - - /** - * Represents the queue for pending tasks. - * @type {Array} - */ - #pending = []; - - /** - * The number of tasks currently being processed. - * @type {number} - */ - #working = 0; - - /** - * The timeout for the queue. - * @type {number} - */ - #timeout; - - /** - * The maximum delay for the queue. - * @type {number} - */ - #maxDelay; - - /** - * The setTimeout() timer ID. - * @type {NodeJS.Timeout|undefined} - */ - #timerId; - - /** - * The function to call. - * @type {Function} - */ - #check; - - /** - * The maximum number of concurrent tasks. - * @type {number} - */ - #concurrency; - - /** - * Creates a new instance. - * @param {Function} check The function to call. - * @param {object} [options] The options for the instance. - * @param {number} [options.timeout] The timeout for the queue. - * @param {number} [options.maxDelay] The maximum delay for the queue. - * @param {number} [options.concurrency] The maximum number of concurrent tasks. - */ - constructor(check, { timeout = MAX_TASK_TIMEOUT, maxDelay = MAX_TASK_DELAY, concurrency = MAX_CONCURRENCY } = {}) { - - if (typeof check !== "function") { - throw new Error("Missing function to check errors"); - } - - this.#check = check; - this.#timeout = timeout; - this.#maxDelay = maxDelay; - this.#concurrency = concurrency; - } - - /** - * Gets the number of tasks waiting to be retried. - * @returns {number} The number of tasks in the retry queue. - */ - get retrying() { - return this.#retrying.length; - } - - /** - * Gets the number of tasks waiting to be processed in the pending queue. - * @returns {number} The number of tasks in the pending queue. - */ - get pending() { - return this.#pending.length; - } - - /** - * Gets the number of tasks currently being processed. - * @returns {number} The number of tasks currently being processed. - */ - get working() { - return this.#working; - } - - /** - * Calls the function and retries if it fails. - * @param {Function} fn The function to call. - * @param {Object} options The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @param {Promise} options.promise The promise to return when the function settles. - * @param {Function} options.resolve The resolve function for the promise. - * @param {Function} options.reject The reject function for the promise. - * @returns {Promise} A promise that resolves when the function is - * called successfully. - */ - #call(fn, { signal, promise, resolve, reject }) { - - let result; - - try { - result = fn(); - } catch (/** @type {any} */ error) { - reject(new Error(`Synchronous error: ${error.message}`, { cause: error })); - return promise; - } - - // if the result is not a promise then reject an error - if (!result || typeof result.then !== "function") { - reject(new Error("Result is not a promise.")); - return promise; - } - - this.#working++; - promise.finally(() => { - this.#working--; - this.#processPending(); - }); - - // call the original function and catch any ENFILE or EMFILE errors - // @ts-ignore because we know it's any - return Promise.resolve(result) - .then(value => { - debug("Function called successfully without retry."); - resolve(value); - return promise; - }) - .catch(error => { - if (!this.#check(error)) { - reject(error); - return promise; - } - - const task = new RetryTask(fn, error, resolve, reject, signal); - - debug(`Function failed, queuing for retry with task ${task.id}.`); - this.#retrying.push(task); - - signal?.addEventListener("abort", () => { - debug(`Task ${task.id} was aborted due to AbortSignal.`); - reject(signal.reason); - }); - - this.#processQueue(); - - return promise; - }); - } - - /** - * Adds a new retry job to the queue. - * @param {Function} fn The function to call. - * @param {object} [options] The options for the job. - * @param {AbortSignal} [options.signal] The AbortSignal to monitor for cancellation. - * @returns {Promise} A promise that resolves when the queue is - * processed. - */ - retry(fn, { signal } = {}) { - - signal?.throwIfAborted(); - - const { promise, resolve, reject } = createPromise(); - - this.#pending.push(() => this.#call(fn, { signal, promise, resolve, reject })); - this.#processPending(); - - return promise; - } - - - /** - * Processes the pending queue and the retry queue. - * @returns {void} - */ - #processAll() { - if (this.pending) { - this.#processPending(); - } - - if (this.retrying) { - this.#processQueue(); - } - } - - /** - * Processes the pending queue to see which tasks can be started. - * @returns {void} - */ - #processPending() { - - debug(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`); - - const available = this.#concurrency - this.working; - - if (available <= 0) { - return; - } - - const count = Math.min(this.pending, available); - - for (let i = 0; i < count; i++) { - const task = this.#pending.shift(); - task?.(); - } - - debug(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`); - } - - /** - * Processes the queue. - * @returns {void} - */ - #processQueue() { - // clear any timer because we're going to check right now - clearTimeout(this.#timerId); - this.#timerId = undefined; - - debug(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`); - - const processAgain = () => { - this.#timerId = setTimeout(() => this.#processAll(), 0); - }; - - // if there's nothing in the queue, we're done - const task = this.#retrying.shift(); - if (!task) { - debug("Queue is empty, exiting."); - - if (this.pending) { - processAgain(); - } - return; - } - - // if it's time to bail, then bail - if (isTimeToBail(task, this.#timeout)) { - debug(`Task ${task.id} was abandoned due to timeout.`); - task.reject(task.error); - processAgain(); - return; - } - - // if it's not time to retry, then wait and try again - if (!isTimeToRetry(task, this.#maxDelay)) { - debug(`Task ${task.id} is not ready to retry, skipping.`); - this.#retrying.push(task); - processAgain(); - return; - } - - // otherwise, try again - task.lastAttempt = Date.now(); - - // Promise.resolve needed in case it's a thenable but not a Promise - Promise.resolve(task.fn()) - // @ts-ignore because we know it's any - .then(result => { - debug(`Task ${task.id} succeeded after ${task.age}ms.`); - task.resolve(result); - }) - - // @ts-ignore because we know it's any - .catch(error => { - if (!this.#check(error)) { - debug(`Task ${task.id} failed with non-retryable error: ${error.message}.`); - task.reject(error); - return; - } - - // update the task timestamp and push to back of queue to try again - task.lastAttempt = Date.now(); - this.#retrying.push(task); - debug(`Task ${task.id} failed, requeueing to try again.`); - }) - .finally(() => { - this.#processAll(); - }); - } -} - -export { Retrier }; diff --git a/node_modules/@humanwhocodes/retry/package.json b/node_modules/@humanwhocodes/retry/package.json deleted file mode 100644 index 337e108..0000000 --- a/node_modules/@humanwhocodes/retry/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "@humanwhocodes/retry", - "version": "0.4.1", - "description": "A utility to retry failed async methods.", - "type": "module", - "main": "dist/retrier.cjs", - "module": "dist/retrier.js", - "types": "dist/retrier.d.ts", - "exports": { - "require": { - "types": "./dist/retrier.d.cts", - "default": "./dist/retrier.cjs" - }, - "import": { - "types": "./dist/retrier.d.ts", - "default": "./dist/retrier.js" - } - }, - "files": [ - "dist" - ], - "engines": { - "node": ">=18.18" - }, - "publishConfig": { - "access": "public" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.js": [ - "eslint --fix" - ] - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - }, - "scripts": { - "build:cts-types": "node -e \"fs.copyFileSync('dist/retrier.d.ts', 'dist/retrier.d.cts')\"", - "build": "rollup -c && tsc && npm run build:cts-types", - "prepare": "npm run build", - "lint": "eslint src/ tests/", - "pretest": "npm run build", - "test:unit": "mocha tests/retrier.test.js", - "test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs", - "test:jsr": "npx jsr@latest publish --dry-run", - "test:emfile": "node tools/check-emfile-handling.js", - "test": "npm run test:unit && npm run test:build" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/retry.git" - }, - "keywords": [ - "nodejs", - "retry", - "async", - "promises" - ], - "author": "Nicholas C. Zaks", - "license": "Apache-2.0", - "devDependencies": { - "@eslint/js": "^8.49.0", - "@rollup/plugin-terser": "0.4.4", - "@tsconfig/node16": "^16.1.1", - "@types/mocha": "^10.0.3", - "@types/node": "20.12.6", - "eslint": "^8.21.0", - "lint-staged": "15.2.1", - "mocha": "^10.3.0", - "rollup": "3.29.4", - "typescript": "5.4.4", - "yorkie": "2.0.0" - } -} diff --git a/node_modules/@pkgr/core/lib/constants.d.ts b/node_modules/@pkgr/core/lib/constants.d.ts deleted file mode 100644 index 1348891..0000000 --- a/node_modules/@pkgr/core/lib/constants.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/// -export declare const CWD: string; -export declare const cjsRequire: NodeRequire; -export declare const EXTENSIONS: string[]; diff --git a/node_modules/@pkgr/core/lib/constants.js b/node_modules/@pkgr/core/lib/constants.js deleted file mode 100644 index 374f420..0000000 --- a/node_modules/@pkgr/core/lib/constants.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createRequire } from 'node:module'; -export const CWD = process.cwd(); -export const cjsRequire = typeof require === 'undefined' ? createRequire(import.meta.url) : require; -export const EXTENSIONS = ['.ts', '.tsx', ...Object.keys(cjsRequire.extensions)]; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/node_modules/@pkgr/core/lib/constants.js.map b/node_modules/@pkgr/core/lib/constants.js.map deleted file mode 100644 index 8721e26..0000000 --- a/node_modules/@pkgr/core/lib/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;AAEhC,MAAM,CAAC,MAAM,UAAU,GACrB,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AAG3E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@pkgr/core/lib/helpers.d.ts b/node_modules/@pkgr/core/lib/helpers.d.ts deleted file mode 100644 index 4b84d03..0000000 --- a/node_modules/@pkgr/core/lib/helpers.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare const tryPkg: (pkg: string) => string | undefined; -export declare const isPkgAvailable: (pkg: string) => boolean; -export declare const tryFile: (filePath?: string[] | string, includeDir?: boolean) => string; -export declare const tryExtensions: (filepath: string, extensions?: string[]) => string; -export declare const findUp: (searchEntry: string, searchFileOrIncludeDir?: boolean | string, includeDir?: boolean) => string; diff --git a/node_modules/@pkgr/core/lib/helpers.js b/node_modules/@pkgr/core/lib/helpers.js deleted file mode 100644 index 08e3330..0000000 --- a/node_modules/@pkgr/core/lib/helpers.js +++ /dev/null @@ -1,49 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { CWD, EXTENSIONS, cjsRequire } from './constants.js'; -export const tryPkg = (pkg) => { - try { - return cjsRequire.resolve(pkg); - } - catch (_a) { } -}; -export const isPkgAvailable = (pkg) => !!tryPkg(pkg); -export const tryFile = (filePath, includeDir = false) => { - if (typeof filePath === 'string') { - return fs.existsSync(filePath) && - (includeDir || fs.statSync(filePath).isFile()) - ? filePath - : ''; - } - for (const file of filePath !== null && filePath !== void 0 ? filePath : []) { - if (tryFile(file, includeDir)) { - return file; - } - } - return ''; -}; -export const tryExtensions = (filepath, extensions = EXTENSIONS) => { - const ext = [...extensions, ''].find(ext => tryFile(filepath + ext)); - return ext == null ? '' : filepath + ext; -}; -export const findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => { - console.assert(path.isAbsolute(searchEntry)); - if (!tryFile(searchEntry, true) || - (searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep))) { - return ''; - } - searchEntry = path.resolve(fs.statSync(searchEntry).isDirectory() - ? searchEntry - : path.resolve(searchEntry, '..')); - const isSearchFile = typeof searchFileOrIncludeDir === 'string'; - const searchFile = isSearchFile ? searchFileOrIncludeDir : 'package.json'; - do { - const searched = tryFile(path.resolve(searchEntry, searchFile), isSearchFile && includeDir); - if (searched) { - return searched; - } - searchEntry = path.resolve(searchEntry, '..'); - } while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep)); - return ''; -}; -//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/node_modules/@pkgr/core/lib/helpers.js.map b/node_modules/@pkgr/core/lib/helpers.js.map deleted file mode 100644 index aaf8d4f..0000000 --- a/node_modules/@pkgr/core/lib/helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE5D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE;IACpC,IAAI,CAAC;QACH,OAAO,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC;IAAC,WAAM,CAAC,CAAA,CAAC;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAE5D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAA4B,EAAE,UAAU,GAAG,KAAK,EAAE,EAAE;IAC1E,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC5B,CAAC,UAAU,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;YAC9C,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,EAAE,CAAA;IACR,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,EAAE,CAAC;QAClC,IAA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AM,QAAQ,GAAG,OAAO,CACtB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,EACrC,YAAY,IAAI,UAAU,CAC3B,CAAA;QACD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAA;QACjB,CAAC;QACD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC,QAAQ,WAAW,KAAK,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,EAAC;IAEvE,OAAO,EAAE,CAAA;AACX,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/@pkgr/core/lib/index.cjs b/node_modules/@pkgr/core/lib/index.cjs deleted file mode 100644 index 8c63baf..0000000 --- a/node_modules/@pkgr/core/lib/index.cjs +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -var node_module = require('node:module'); -var fs = require('node:fs'); -var path = require('node:path'); - -const import_meta = {}; -const CWD = process.cwd(); -const cjsRequire = typeof require === "undefined" ? node_module.createRequire(import_meta.url) : require; -const EXTENSIONS = [".ts", ".tsx", ...Object.keys(cjsRequire.extensions)]; - -const tryPkg = (pkg) => { - try { - return cjsRequire.resolve(pkg); - } catch (e) { - } -}; -const isPkgAvailable = (pkg) => !!tryPkg(pkg); -const tryFile = (filePath, includeDir = false) => { - if (typeof filePath === "string") { - return fs.existsSync(filePath) && (includeDir || fs.statSync(filePath).isFile()) ? filePath : ""; - } - for (const file of filePath != null ? filePath : []) { - if (tryFile(file, includeDir)) { - return file; - } - } - return ""; -}; -const tryExtensions = (filepath, extensions = EXTENSIONS) => { - const ext = [...extensions, ""].find((ext2) => tryFile(filepath + ext2)); - return ext == null ? "" : filepath + ext; -}; -const findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => { - console.assert(path.isAbsolute(searchEntry)); - if (!tryFile(searchEntry, true) || searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep)) { - return ""; - } - searchEntry = path.resolve( - fs.statSync(searchEntry).isDirectory() ? searchEntry : path.resolve(searchEntry, "..") - ); - const isSearchFile = typeof searchFileOrIncludeDir === "string"; - const searchFile = isSearchFile ? searchFileOrIncludeDir : "package.json"; - do { - const searched = tryFile( - path.resolve(searchEntry, searchFile), - isSearchFile && includeDir - ); - if (searched) { - return searched; - } - searchEntry = path.resolve(searchEntry, ".."); - } while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep)); - return ""; -}; - -exports.CWD = CWD; -exports.EXTENSIONS = EXTENSIONS; -exports.cjsRequire = cjsRequire; -exports.findUp = findUp; -exports.isPkgAvailable = isPkgAvailable; -exports.tryExtensions = tryExtensions; -exports.tryFile = tryFile; -exports.tryPkg = tryPkg; diff --git a/node_modules/@pkgr/core/lib/index.d.ts b/node_modules/@pkgr/core/lib/index.d.ts deleted file mode 100644 index 0d6045d..0000000 --- a/node_modules/@pkgr/core/lib/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './constants.js'; -export * from './helpers.js'; diff --git a/node_modules/@pkgr/core/lib/index.js b/node_modules/@pkgr/core/lib/index.js deleted file mode 100644 index e543553..0000000 --- a/node_modules/@pkgr/core/lib/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from './constants.js'; -export * from './helpers.js'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/@pkgr/core/lib/index.js.map b/node_modules/@pkgr/core/lib/index.js.map deleted file mode 100644 index e7c2203..0000000 --- a/node_modules/@pkgr/core/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/@pkgr/core/package.json b/node_modules/@pkgr/core/package.json deleted file mode 100644 index 6760bd5..0000000 --- a/node_modules/@pkgr/core/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@pkgr/core", - "version": "0.1.1", - "type": "module", - "description": "Shared core module for `@pkgr` packages or any package else", - "repository": "git+https://github.com/un-ts/pkgr.git", - "homepage": "https://github.com/un-ts/pkgr/blob/master/packages/core", - "author": "JounQin (https://www.1stG.me) ", - "funding": "https://opencollective.com/unts", - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" - }, - "main": "./lib/index.cjs", - "module": "./lib/index.js", - "exports": { - "types": "./lib/index.d.ts", - "import": "./lib/index.js", - "require": "./lib/index.cjs" - }, - "types": "./lib/index.d.ts", - "files": [ - "lib" - ], - "publishConfig": { - "access": "public" - }, - "sideEffects": false -} diff --git a/node_modules/@seald-io/binary-search-tree/CHANGELOG.md b/node_modules/@seald-io/binary-search-tree/CHANGELOG.md deleted file mode 100644 index 0143ebd..0000000 --- a/node_modules/@seald-io/binary-search-tree/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ -# 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). - -## [1.0.3] - 2023-01-19 - -### Changed - -- Correctly log object keys [#1](https://github.com/seald/node-binary-search-tree/pull/1) - - -## [1.0.2] - 2021-05-19 - -### Changed - -- Specify files to be included in published version, v1.0.1 contained cache, - which contains, a now revoked, npm authentication token. - -## [1.0.1] - 2021-05-19 - -### Added - -- Added a changelog. - -### Changed - -- Removed `underscore` dependency which was used only in the tests. - -## [1.0.0] - 2021-05-17 - -This version should be a drop-in replacement for `binary-search-tree@0.2.6` -provided you use modern browsers / versions of Node.js since ES6 features are -now used (such as `class` and `const` / `let`). - -### Changed - -- Update `homepage` & `repository` fields in the `package.json` -- New maintainer [seald](https://github.com/seald/) and new package - name [@seald-io/binary-search-tree](https://www.npmjs.com/package/@seald-io/binary-search-tree) - ; -- Added `lockfileVersion: 2` `package-lock.json`; -- Modernized some of the code with ES6 features (`class`, `const` & `let`); -- Uses [`standard`](https://standardjs.com/) to lint the code (which removes all - unnecessary semicolons); -- Updated dependencies; - -### Removed - -- Compatibility with old browsers and old version of Node.js that don't support - ES6 features. - -### Security - -- This version no longer - uses [a vulnerable version of `underscore`](https://github.com/advisories/GHSA-cf4h-3jhx-xvhq) - . - -## [0.2.6] - 2016-02-28 - -See [original repo](https://github.com/louischatriot/node-binary-search-tree) diff --git a/node_modules/@seald-io/binary-search-tree/LICENSE.md b/node_modules/@seald-io/binary-search-tree/LICENSE.md deleted file mode 100644 index 2ad6a72..0000000 --- a/node_modules/@seald-io/binary-search-tree/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Louis Chatriot <louis.chatriot@gmail.com> -Copyright (c) 2021 Seald [contact@seald.io](mailto:contact@seald.io); - -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/@seald-io/binary-search-tree/README.md b/node_modules/@seald-io/binary-search-tree/README.md deleted file mode 100644 index 7b8180a..0000000 --- a/node_modules/@seald-io/binary-search-tree/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# Binary search trees for Node.js - -This module is a fork -of [node-binary-search-tree](https://github.com/louischatriot/node-binary-search-tree) -written by Louis Chatriot for storing indexes -in [nedb](https://github.com/louischatriot/nedb). - -Since the original maintainer doesn't support these packages anymore, we forked -them (here is [nedb](https://github.com/seald/nedb)) and maintain them for the -needs of [Seald](https://www.seald.io). - -Two implementations of binary search -tree: [basic](http://en.wikipedia.org/wiki/Binary_search_tree) -and [AVL](http://en.wikipedia.org/wiki/AVL_tree) (a kind of self-balancing -binmary search tree). - -## Installation and tests - -Package name is `@seald-io/binary-search-tree`. - -```bash -npm install @seald-io/binary-search-tree -``` - -If you want to run the tests, you'll have to clone the repository: - -```bash -git clone https://github.com/seald/node-binary-search-tree -npm install -npm test -``` - -## Usage - -The API mainly provides 3 functions: `insert`, `search` and `delete`. If you do -not create a unique-type binary search tree, you can store multiple pieces of -data for the same key. Doing so with a unique-type BST will result in an error -being thrown. Data is always returned as an array, and you can delete all data -relating to a given key, or just one piece of data. - -Values inserted can be anything except `undefined`. - -```javascript -const BinarySearchTree = require('binary-search-tree').BinarySearchTree -const AVLTree = require('binary-search-tree').AVLTree // Same API as BinarySearchTree - -// Creating a binary search tree -const bst = new BinarySearchTree() - -// Inserting some data -bst.insert(15, 'some data for key 15') -bst.insert(12, 'something else') -bst.insert(18, 'hello') - -// You can insert multiple pieces of data for the same key -// if your tree doesn't enforce a unique constraint -bst.insert(18, 'world') - -// Retrieving data (always returned as an array of all data stored for this key) -bst.search(15) // Equal to ['some data for key 15'] -bst.search(18) // Equal to ['hello', 'world'] -bst.search(1) // Equal to [] - -// Search between bounds with a MongoDB-like query -// Data is returned in key order -// Note the difference between $lt (less than) and $gte (less than OR EQUAL) -bst.betweenBounds({ $lt: 18, $gte: 12 }) // Equal to ['something else', 'some data for key 15'] - -// Deleting all the data relating to a key -bst.delete(15) // bst.search(15) will now give [] -bst.delete(18, 'world') // bst.search(18) will now give ['hello'] -``` - -There are three optional parameters you can pass the BST constructor, allowing -you to enforce a key-uniqueness constraint, use a custom function to compare -keys and use a custom function to check whether values are equal. These -parameters are all passed in an object. - -### Uniqueness - -```javascript -const bst = new BinarySearchTree({ unique: true }); -bst.insert(10, 'hello'); -bst.insert(10, 'world'); // Will throw an error -``` - -### Custom key comparison - -```javascript -// Custom key comparison function -// It needs to return a negative number if a is less than b, -// a positive number if a is greater than b -// and 0 if they are equal -// If none is provided, the default one can compare numbers, dates and strings -// which are the most common usecases -const compareKeys = (a, b) => { - if (a.age < b.age) return -1 - if (a.age > b.age) return 1 - - return 0 -} - -// Now we can use objects with an 'age' property as keys -const bst = new BinarySearchTree({ compareKeys }) -bst.insert({ age: 23 }, 'Mark') -bst.insert({ age: 47 }, 'Franck') -``` - -### Custom value checking - -```javascript -// Custom value equality checking function used when we try to just delete one piece of data -// Returns true if a and b are considered the same, false otherwise -// The default function is able to compare numbers and strings -const checkValueEquality = (a, b) => a.length === b.length - -var bst = new BinarySearchTree({ checkValueEquality }) -bst.insert(10, 'hello') -bst.insert(10, 'world') -bst.insert(10, 'howdoyoudo') - -bst.delete(10, 'abcde') -bst.search(10) // Returns ['howdoyoudo'] -``` - -## License - -The package is released under the MIT License as the original package. - -See LICENSE.md. diff --git a/node_modules/@seald-io/binary-search-tree/index.js b/node_modules/@seald-io/binary-search-tree/index.js deleted file mode 100644 index 3ab6504..0000000 --- a/node_modules/@seald-io/binary-search-tree/index.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports.BinarySearchTree = require('./lib/bst') -module.exports.AVLTree = require('./lib/avltree') diff --git a/node_modules/@seald-io/binary-search-tree/lib/avltree.js b/node_modules/@seald-io/binary-search-tree/lib/avltree.js deleted file mode 100644 index 5cca64c..0000000 --- a/node_modules/@seald-io/binary-search-tree/lib/avltree.js +++ /dev/null @@ -1,412 +0,0 @@ -/** - * Self-balancing binary search tree using the AVL implementation - */ -const BinarySearchTree = require('./bst') -const customUtils = require('./customUtils') - -class AVLTree { - /** - * Constructor - * We can't use a direct pointer to the root node (as in the simple binary search tree) - * as the root will change during tree rotations - * @param {Boolean} options.unique Whether to enforce a 'unique' constraint on the key or not - * @param {Function} options.compareKeys Initialize this BST's compareKeys - */ - constructor (options) { - this.tree = new _AVLTree(options) - } - - checkIsAVLT () { this.tree.checkIsAVLT() } - - // Insert in the internal tree, update the pointer to the root if needed - insert (key, value) { - const newTree = this.tree.insert(key, value) - - // If newTree is undefined, that means its structure was not modified - if (newTree) { this.tree = newTree } - } - - // Delete a value - delete (key, value) { - const newTree = this.tree.delete(key, value) - - // If newTree is undefined, that means its structure was not modified - if (newTree) { this.tree = newTree } - } -} - -class _AVLTree extends BinarySearchTree { - /** - * Constructor of the internal AVLTree - * @param {Object} options Optional - * @param {Boolean} options.unique Whether to enforce a 'unique' constraint on the key or not - * @param {Key} options.key Initialize this BST's key with key - * @param {Value} options.value Initialize this BST's data with [value] - * @param {Function} options.compareKeys Initialize this BST's compareKeys - */ - constructor (options) { - super() - options = options || {} - - this.left = null - this.right = null - this.parent = options.parent !== undefined ? options.parent : null - if (Object.prototype.hasOwnProperty.call(options, 'key')) this.key = options.key - this.data = Object.prototype.hasOwnProperty.call(options, 'value') ? [options.value] : [] - this.unique = options.unique || false - - this.compareKeys = options.compareKeys || customUtils.defaultCompareKeysFunction - this.checkValueEquality = options.checkValueEquality || customUtils.defaultCheckValueEquality - } - - /** - * Check the recorded height is correct for every node - * Throws if one height doesn't match - */ - checkHeightCorrect () { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { return } // Empty tree - - if (this.left && this.left.height === undefined) { throw new Error('Undefined height for node ' + this.left.key) } - if (this.right && this.right.height === undefined) { throw new Error('Undefined height for node ' + this.right.key) } - if (this.height === undefined) { throw new Error('Undefined height for node ' + this.key) } - - const leftH = this.left ? this.left.height : 0 - const rightH = this.right ? this.right.height : 0 - - if (this.height !== 1 + Math.max(leftH, rightH)) { throw new Error('Height constraint failed for node ' + this.key) } - if (this.left) { this.left.checkHeightCorrect() } - if (this.right) { this.right.checkHeightCorrect() } - } - - /** - * Return the balance factor - */ - balanceFactor () { - const leftH = this.left ? this.left.height : 0 - const rightH = this.right ? this.right.height : 0 - return leftH - rightH - } - - /** - * Check that the balance factors are all between -1 and 1 - */ - checkBalanceFactors () { - if (Math.abs(this.balanceFactor()) > 1) { throw new Error('Tree is unbalanced at node ' + this.key) } - - if (this.left) { this.left.checkBalanceFactors() } - if (this.right) { this.right.checkBalanceFactors() } - } - - /** - * When checking if the BST conditions are met, also check that the heights are correct - * and the tree is balanced - */ - checkIsAVLT () { - super.checkIsBST() - this.checkHeightCorrect() - this.checkBalanceFactors() - } - - /** - * Perform a right rotation of the tree if possible - * and return the root of the resulting tree - * The resulting tree's nodes' heights are also updated - */ - rightRotation () { - const q = this - const p = this.left - - if (!p) return q // No change - - const b = p.right - - // Alter tree structure - if (q.parent) { - p.parent = q.parent - if (q.parent.left === q) q.parent.left = p - else q.parent.right = p - } else { - p.parent = null - } - p.right = q - q.parent = p - q.left = b - if (b) { b.parent = q } - - // Update heights - const ah = p.left ? p.left.height : 0 - const bh = b ? b.height : 0 - const ch = q.right ? q.right.height : 0 - q.height = Math.max(bh, ch) + 1 - p.height = Math.max(ah, q.height) + 1 - - return p - } - - /** - * Perform a left rotation of the tree if possible - * and return the root of the resulting tree - * The resulting tree's nodes' heights are also updated - */ - leftRotation () { - const p = this - const q = this.right - - if (!q) { return this } // No change - - const b = q.left - - // Alter tree structure - if (p.parent) { - q.parent = p.parent - if (p.parent.left === p) p.parent.left = q - else p.parent.right = q - } else { - q.parent = null - } - q.left = p - p.parent = q - p.right = b - if (b) { b.parent = p } - - // Update heights - const ah = p.left ? p.left.height : 0 - const bh = b ? b.height : 0 - const ch = q.right ? q.right.height : 0 - p.height = Math.max(ah, bh) + 1 - q.height = Math.max(ch, p.height) + 1 - - return q - } - - /** - * Modify the tree if its right subtree is too small compared to the left - * Return the new root if any - */ - rightTooSmall () { - if (this.balanceFactor() <= 1) return this // Right is not too small, don't change - - if (this.left.balanceFactor() < 0) this.left.leftRotation() - - return this.rightRotation() - } - - /** - * Modify the tree if its left subtree is too small compared to the right - * Return the new root if any - */ - leftTooSmall () { - if (this.balanceFactor() >= -1) { return this } // Left is not too small, don't change - - if (this.right.balanceFactor() > 0) this.right.rightRotation() - - return this.leftRotation() - } - - /** - * Rebalance the tree along the given path. The path is given reversed (as he was calculated - * in the insert and delete functions). - * Returns the new root of the tree - * Of course, the first element of the path must be the root of the tree - */ - rebalanceAlongPath (path) { - let newRoot = this - let rotated - let i - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { - delete this.height - return this - } // Empty tree - - // Rebalance the tree and update all heights - for (i = path.length - 1; i >= 0; i -= 1) { - path[i].height = 1 + Math.max(path[i].left ? path[i].left.height : 0, path[i].right ? path[i].right.height : 0) - - if (path[i].balanceFactor() > 1) { - rotated = path[i].rightTooSmall() - if (i === 0) newRoot = rotated - } - - if (path[i].balanceFactor() < -1) { - rotated = path[i].leftTooSmall() - if (i === 0) newRoot = rotated - } - } - - return newRoot - } - - /** - * Insert a key, value pair in the tree while maintaining the AVL tree height constraint - * Return a pointer to the root node, which may have changed - */ - insert (key, value) { - const insertPath = [] - let currentNode = this - - // Empty tree, insert as root - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { - this.key = key - this.data.push(value) - this.height = 1 - return this - } - - // Insert new leaf at the right place - while (true) { - // Same key: no change in the tree structure - if (currentNode.compareKeys(currentNode.key, key) === 0) { - if (currentNode.unique) { - const err = new Error(`Can't insert key ${JSON.stringify(key)}, it violates the unique constraint`) - err.key = key - err.errorType = 'uniqueViolated' - throw err - } else currentNode.data.push(value) - return this - } - - insertPath.push(currentNode) - - if (currentNode.compareKeys(key, currentNode.key) < 0) { - if (!currentNode.left) { - insertPath.push(currentNode.createLeftChild({ key: key, value: value })) - break - } else currentNode = currentNode.left - } else { - if (!currentNode.right) { - insertPath.push(currentNode.createRightChild({ key: key, value: value })) - break - } else currentNode = currentNode.right - } - } - - return this.rebalanceAlongPath(insertPath) - } - - /** - * Delete a key or just a value and return the new root of the tree - * @param {Key} key - * @param {Value} value Optional. If not set, the whole key is deleted. If set, only this value is deleted - */ - delete (key, value) { - const newData = [] - let replaceWith - let currentNode = this - const deletePath = [] - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return this // Empty tree - - // Either no match is found and the function will return from within the loop - // Or a match is found and deletePath will contain the path from the root to the node to delete after the loop - while (true) { - if (currentNode.compareKeys(key, currentNode.key) === 0) { break } - - deletePath.push(currentNode) - - if (currentNode.compareKeys(key, currentNode.key) < 0) { - if (currentNode.left) { - currentNode = currentNode.left - } else return this // Key not found, no modification - } else { - // currentNode.compareKeys(key, currentNode.key) is > 0 - if (currentNode.right) { - currentNode = currentNode.right - } else return this // Key not found, no modification - } - } - - // Delete only a value (no tree modification) - if (currentNode.data.length > 1 && value !== undefined) { - currentNode.data.forEach(function (d) { - if (!currentNode.checkValueEquality(d, value)) newData.push(d) - }) - currentNode.data = newData - return this - } - - // Delete a whole node - - // Leaf - if (!currentNode.left && !currentNode.right) { - if (currentNode === this) { // This leaf is also the root - delete currentNode.key - currentNode.data = [] - delete currentNode.height - return this - } else { - if (currentNode.parent.left === currentNode) currentNode.parent.left = null - else currentNode.parent.right = null - return this.rebalanceAlongPath(deletePath) - } - } - - // Node with only one child - if (!currentNode.left || !currentNode.right) { - replaceWith = currentNode.left ? currentNode.left : currentNode.right - - if (currentNode === this) { // This node is also the root - replaceWith.parent = null - return replaceWith // height of replaceWith is necessarily 1 because the tree was balanced before deletion - } else { - if (currentNode.parent.left === currentNode) { - currentNode.parent.left = replaceWith - replaceWith.parent = currentNode.parent - } else { - currentNode.parent.right = replaceWith - replaceWith.parent = currentNode.parent - } - - return this.rebalanceAlongPath(deletePath) - } - } - - // Node with two children - // Use the in-order predecessor (no need to randomize since we actively rebalance) - deletePath.push(currentNode) - replaceWith = currentNode.left - - // Special case: the in-order predecessor is right below the node to delete - if (!replaceWith.right) { - currentNode.key = replaceWith.key - currentNode.data = replaceWith.data - currentNode.left = replaceWith.left - if (replaceWith.left) { replaceWith.left.parent = currentNode } - return this.rebalanceAlongPath(deletePath) - } - - // After this loop, replaceWith is the right-most leaf in the left subtree - // and deletePath the path from the root (inclusive) to replaceWith (exclusive) - while (true) { - if (replaceWith.right) { - deletePath.push(replaceWith) - replaceWith = replaceWith.right - } else break - } - - currentNode.key = replaceWith.key - currentNode.data = replaceWith.data - - replaceWith.parent.right = replaceWith.left - if (replaceWith.left) replaceWith.left.parent = replaceWith.parent - - return this.rebalanceAlongPath(deletePath) - } -} - -/** - * Keep a pointer to the internal tree constructor for testing purposes - */ -AVLTree._AVLTree = _AVLTree; - -/** - * Other functions we want to use on an AVLTree as if it were the internal _AVLTree - */ -['getNumberOfKeys', 'search', 'betweenBounds', 'prettyPrint', 'executeOnEveryNode'].forEach(function (fn) { - AVLTree.prototype[fn] = function () { - return this.tree[fn].apply(this.tree, arguments) - } -}) - -// Interface -module.exports = AVLTree diff --git a/node_modules/@seald-io/binary-search-tree/lib/bst.js b/node_modules/@seald-io/binary-search-tree/lib/bst.js deleted file mode 100644 index cf6e4a5..0000000 --- a/node_modules/@seald-io/binary-search-tree/lib/bst.js +++ /dev/null @@ -1,452 +0,0 @@ -/** - * Simple binary search tree - */ -const customUtils = require('./customUtils') - -class BinarySearchTree { - /** - * Constructor - * @param {Object} options Optional - * @param {Boolean} options.unique Whether to enforce a 'unique' constraint on the key or not - * @param {Key} options.key Initialize this BST's key with key - * @param {Value} options.value Initialize this BST's data with [value] - * @param {Function} options.compareKeys Initialize this BST's compareKeys - */ - constructor (options) { - options = options || {} - - this.left = null - this.right = null - this.parent = options.parent !== undefined ? options.parent : null - if (Object.prototype.hasOwnProperty.call(options, 'key')) { this.key = options.key } - this.data = Object.prototype.hasOwnProperty.call(options, 'value') ? [options.value] : [] - this.unique = options.unique || false - - this.compareKeys = options.compareKeys || customUtils.defaultCompareKeysFunction - this.checkValueEquality = options.checkValueEquality || customUtils.defaultCheckValueEquality - } - - /** - * Get the descendant with max key - */ - getMaxKeyDescendant () { - if (this.right) return this.right.getMaxKeyDescendant() - else return this - } - - /** - * Get the maximum key - */ - getMaxKey () { - return this.getMaxKeyDescendant().key - } - - /** - * Get the descendant with min key - */ - getMinKeyDescendant () { - if (this.left) return this.left.getMinKeyDescendant() - else return this - } - - /** - * Get the minimum key - */ - getMinKey () { - return this.getMinKeyDescendant().key - } - - /** - * Check that all nodes (incl. leaves) fullfil condition given by fn - * test is a function passed every (key, data) and which throws if the condition is not met - */ - checkAllNodesFullfillCondition (test) { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return - - test(this.key, this.data) - if (this.left) this.left.checkAllNodesFullfillCondition(test) - if (this.right) this.right.checkAllNodesFullfillCondition(test) - } - - /** - * Check that the core BST properties on node ordering are verified - * Throw if they aren't - */ - checkNodeOrdering () { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return - - if (this.left) { - this.left.checkAllNodesFullfillCondition(k => { - if (this.compareKeys(k, this.key) >= 0) throw new Error(`Tree with root ${this.key} is not a binary search tree`) - }) - this.left.checkNodeOrdering() - } - - if (this.right) { - this.right.checkAllNodesFullfillCondition(k => { - if (this.compareKeys(k, this.key) <= 0) throw new Error(`Tree with root ${this.key} is not a binary search tree`) - }) - this.right.checkNodeOrdering() - } - } - - /** - * Check that all pointers are coherent in this tree - */ - checkInternalPointers () { - if (this.left) { - if (this.left.parent !== this) throw new Error(`Parent pointer broken for key ${this.key}`) - this.left.checkInternalPointers() - } - - if (this.right) { - if (this.right.parent !== this) throw new Error(`Parent pointer broken for key ${this.key}`) - this.right.checkInternalPointers() - } - } - - /** - * Check that a tree is a BST as defined here (node ordering and pointer references) - */ - checkIsBST () { - this.checkNodeOrdering() - this.checkInternalPointers() - if (this.parent) throw new Error("The root shouldn't have a parent") - } - - /** - * Get number of keys inserted - */ - getNumberOfKeys () { - let res - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return 0 - - res = 1 - if (this.left) res += this.left.getNumberOfKeys() - if (this.right) res += this.right.getNumberOfKeys() - - return res - } - - /** - * Create a BST similar (i.e. same options except for key and value) to the current one - * Use the same constructor (i.e. BinarySearchTree, AVLTree etc) - * @param {Object} options see constructor - */ - createSimilar (options) { - options = options || {} - options.unique = this.unique - options.compareKeys = this.compareKeys - options.checkValueEquality = this.checkValueEquality - - return new this.constructor(options) - } - - /** - * Create the left child of this BST and return it - */ - createLeftChild (options) { - const leftChild = this.createSimilar(options) - leftChild.parent = this - this.left = leftChild - - return leftChild - } - - /** - * Create the right child of this BST and return it - */ - createRightChild (options) { - const rightChild = this.createSimilar(options) - rightChild.parent = this - this.right = rightChild - - return rightChild - } - - /** - * Insert a new element - */ - insert (key, value) { - // Empty tree, insert as root - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { - this.key = key - this.data.push(value) - return - } - - // Same key as root - if (this.compareKeys(this.key, key) === 0) { - if (this.unique) { - const err = new Error(`Can't insert key ${JSON.stringify(key)}, it violates the unique constraint`) - err.key = key - err.errorType = 'uniqueViolated' - throw err - } else this.data.push(value) - return - } - - if (this.compareKeys(key, this.key) < 0) { - // Insert in left subtree - if (this.left) this.left.insert(key, value) - else this.createLeftChild({ key: key, value: value }) - } else { - // Insert in right subtree - if (this.right) this.right.insert(key, value) - else this.createRightChild({ key: key, value: value }) - } - } - - /** - * Search for all data corresponding to a key - */ - search (key) { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return [] - - if (this.compareKeys(this.key, key) === 0) return this.data - - if (this.compareKeys(key, this.key) < 0) { - if (this.left) return this.left.search(key) - else return [] - } else { - if (this.right) return this.right.search(key) - else return [] - } - } - - /** - * Return a function that tells whether a given key matches a lower bound - */ - getLowerBoundMatcher (query) { - // No lower bound - if (!Object.prototype.hasOwnProperty.call(query, '$gt') && !Object.prototype.hasOwnProperty.call(query, '$gte')) return () => true - - if (Object.prototype.hasOwnProperty.call(query, '$gt') && Object.prototype.hasOwnProperty.call(query, '$gte')) { - if (this.compareKeys(query.$gte, query.$gt) === 0) return key => this.compareKeys(key, query.$gt) > 0 - - if (this.compareKeys(query.$gte, query.$gt) > 0) return key => this.compareKeys(key, query.$gte) >= 0 - else return key => this.compareKeys(key, query.$gt) > 0 - } - - if (Object.prototype.hasOwnProperty.call(query, '$gt')) return key => this.compareKeys(key, query.$gt) > 0 - else return key => this.compareKeys(key, query.$gte) >= 0 - } - - /** - * Return a function that tells whether a given key matches an upper bound - */ - getUpperBoundMatcher (query) { - // No lower bound - if (!Object.prototype.hasOwnProperty.call(query, '$lt') && !Object.prototype.hasOwnProperty.call(query, '$lte')) return () => true - - if (Object.prototype.hasOwnProperty.call(query, '$lt') && Object.prototype.hasOwnProperty.call(query, '$lte')) { - if (this.compareKeys(query.$lte, query.$lt) === 0) return key => this.compareKeys(key, query.$lt) < 0 - - if (this.compareKeys(query.$lte, query.$lt) < 0) return key => this.compareKeys(key, query.$lte) <= 0 - else return key => this.compareKeys(key, query.$lt) < 0 - } - - if (Object.prototype.hasOwnProperty.call(query, '$lt')) return key => this.compareKeys(key, query.$lt) < 0 - else return key => this.compareKeys(key, query.$lte) <= 0 - } - - /** - * Get all data for a key between bounds - * Return it in key order - * @param {Object} query Mongo-style query where keys are $lt, $lte, $gt or $gte (other keys are not considered) - * @param {Functions} lbm/ubm matching functions calculated at the first recursive step - */ - betweenBounds (query, lbm, ubm) { - const res = [] - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return [] // Empty tree - - lbm = lbm || this.getLowerBoundMatcher(query) - ubm = ubm || this.getUpperBoundMatcher(query) - - if (lbm(this.key) && this.left) append(res, this.left.betweenBounds(query, lbm, ubm)) - if (lbm(this.key) && ubm(this.key)) append(res, this.data) - if (ubm(this.key) && this.right) append(res, this.right.betweenBounds(query, lbm, ubm)) - - return res - } - - /** - * Delete the current node if it is a leaf - * Return true if it was deleted - */ - deleteIfLeaf () { - if (this.left || this.right) return false - - // The leaf is itself a root - if (!this.parent) { - delete this.key - this.data = [] - return true - } - - if (this.parent.left === this) this.parent.left = null - else this.parent.right = null - - return true - } - - /** - * Delete the current node if it has only one child - * Return true if it was deleted - */ - deleteIfOnlyOneChild () { - let child - - if (this.left && !this.right) child = this.left - if (!this.left && this.right) child = this.right - if (!child) return false - - // Root - if (!this.parent) { - this.key = child.key - this.data = child.data - - this.left = null - if (child.left) { - this.left = child.left - child.left.parent = this - } - - this.right = null - if (child.right) { - this.right = child.right - child.right.parent = this - } - - return true - } - - if (this.parent.left === this) { - this.parent.left = child - child.parent = this.parent - } else { - this.parent.right = child - child.parent = this.parent - } - - return true - } - - /** - * Delete a key or just a value - * @param {Key} key - * @param {Value} value Optional. If not set, the whole key is deleted. If set, only this value is deleted - */ - delete (key, value) { - const newData = [] - let replaceWith - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return - - if (this.compareKeys(key, this.key) < 0) { - if (this.left) this.left.delete(key, value) - return - } - - if (this.compareKeys(key, this.key) > 0) { - if (this.right) this.right.delete(key, value) - return - } - - if (!this.compareKeys(key, this.key) === 0) return - - // Delete only a value - if (this.data.length > 1 && value !== undefined) { - this.data.forEach(d => { - if (!this.checkValueEquality(d, value)) newData.push(d) - }) - this.data = newData - return - } - - // Delete the whole node - if (this.deleteIfLeaf()) return - - if (this.deleteIfOnlyOneChild()) return - - // We are in the case where the node to delete has two children - if (Math.random() >= 0.5) { // Randomize replacement to avoid unbalancing the tree too much - // Use the in-order predecessor - replaceWith = this.left.getMaxKeyDescendant() - - this.key = replaceWith.key - this.data = replaceWith.data - - if (this === replaceWith.parent) { // Special case - this.left = replaceWith.left - if (replaceWith.left) replaceWith.left.parent = replaceWith.parent - } else { - replaceWith.parent.right = replaceWith.left - if (replaceWith.left) replaceWith.left.parent = replaceWith.parent - } - } else { - // Use the in-order successor - replaceWith = this.right.getMinKeyDescendant() - - this.key = replaceWith.key - this.data = replaceWith.data - - if (this === replaceWith.parent) { // Special case - this.right = replaceWith.right - if (replaceWith.right) replaceWith.right.parent = replaceWith.parent - } else { - replaceWith.parent.left = replaceWith.right - if (replaceWith.right) replaceWith.right.parent = replaceWith.parent - } - } - } - - /** - * Execute a function on every node of the tree, in key order - * @param {Function} fn Signature: node. Most useful will probably be node.key and node.data - */ - executeOnEveryNode (fn) { - if (this.left) this.left.executeOnEveryNode(fn) - fn(this) - if (this.right) this.right.executeOnEveryNode(fn) - } - - /** - * Pretty print a tree - * @param {Boolean} printData To print the nodes' data along with the key - */ - prettyPrint (printData, spacing) { - spacing = spacing || '' - - console.log(`${spacing}* ${this.key}`) - if (printData) console.log(`${spacing}* ${this.data}`) - - if (!this.left && !this.right) return - - if (this.left) this.left.prettyPrint(printData, `${spacing} `) - else console.log(`${spacing} *`) - - if (this.right) this.right.prettyPrint(printData, `${spacing} `) - else console.log(`${spacing} *`) - } -} - -// ================================ -// Methods used to test the tree -// ================================ - -// ============================================ -// Methods used to actually work on the tree -// ============================================ - -// Append all elements in toAppend to array -function append (array, toAppend) { - for (let i = 0; i < toAppend.length; i += 1) { - array.push(toAppend[i]) - } -} - -// Interface -module.exports = BinarySearchTree diff --git a/node_modules/@seald-io/binary-search-tree/lib/customUtils.js b/node_modules/@seald-io/binary-search-tree/lib/customUtils.js deleted file mode 100644 index ec42ef5..0000000 --- a/node_modules/@seald-io/binary-search-tree/lib/customUtils.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Return an array with the numbers from 0 to n-1, in a random order - */ -const getRandomArray = n => { - if (n === 0) return [] - if (n === 1) return [0] - - const res = getRandomArray(n - 1) - const next = Math.floor(Math.random() * n) - res.splice(next, 0, n - 1) // Add n-1 at a random position in the array - - return res -} - -module.exports.getRandomArray = getRandomArray - -/* - * Default compareKeys function will work for numbers, strings and dates - */ -const defaultCompareKeysFunction = (a, b) => { - if (a < b) return -1 - if (a > b) return 1 - if (a === b) return 0 - - const err = new Error("Couldn't compare elements") - err.a = a - err.b = b - throw err -} - -module.exports.defaultCompareKeysFunction = defaultCompareKeysFunction - -/** - * Check whether two values are equal (used in non-unique deletion) - */ -const defaultCheckValueEquality = (a, b) => a === b - -module.exports.defaultCheckValueEquality = defaultCheckValueEquality diff --git a/node_modules/@seald-io/binary-search-tree/package.json b/node_modules/@seald-io/binary-search-tree/package.json deleted file mode 100644 index 24174ad..0000000 --- a/node_modules/@seald-io/binary-search-tree/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "@seald-io/binary-search-tree", - "version": "1.0.3", - "author": { - "name": "Timothée Rebours", - "email": "tim@seald.io", - "url": "https://www.seald.io/" - }, - "files": [ - "lib/**/*.js", - "index.js" - ], - "contributors": [ - { - "name": "Louis Chatriot", - "email": "louis.chatriot@gmail.com" - }, - { - "name": "Timothée Rebours", - "email": "tim@seald.io", - "url": "https://www.seald.io/" - } - ], - "description": "Different binary search tree implementations, including a self-balancing one (AVL)", - "keywords": [ - "AVL tree", - "binary search tree", - "self-balancing", - "AVL tree" - ], - "homepage": "https://github.com/seald/node-binary-search-tree", - "repository": { - "type": "git", - "url": "git@github.com:seald/node-binary-search-tree.git" - }, - "devDependencies": { - "chai": "^4.3.4", - "mocha": "^8.4.0", - "semver": "^7.3.5", - "standard": "^16.0.3" - }, - "scripts": { - "test": "mocha --reporter spec --timeout 10000", - "lint": "standard" - }, - "main": "index.js", - "licence": "MIT", - "publishConfig": { - "access": "public" - } -} diff --git a/node_modules/@seald-io/nedb/LICENSE.md b/node_modules/@seald-io/nedb/LICENSE.md deleted file mode 100644 index 2ad6a72..0000000 --- a/node_modules/@seald-io/nedb/LICENSE.md +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Louis Chatriot <louis.chatriot@gmail.com> -Copyright (c) 2021 Seald [contact@seald.io](mailto:contact@seald.io); - -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/@seald-io/nedb/README.md b/node_modules/@seald-io/nedb/README.md deleted file mode 100755 index 1e92b89..0000000 --- a/node_modules/@seald-io/nedb/README.md +++ /dev/null @@ -1,905 +0,0 @@ - - -## The JavaScript Database - -This module is a fork of [nedb](https://github.com/louischatriot/nedb) -written by Louis Chatriot. - -Since the original maintainer doesn't support this package anymore, we forked it -and maintain it for the needs of [Seald](https://www.seald.io). - -**Embedded persistent or in memory database for Node.js, Electron and browsers, -100% JavaScript, no binary dependency**. API is a subset of MongoDB's and it's -[plenty fast](#speed). - -## Installation - -Module name on npm is [`@seald-io/nedb`](https://www.npmjs.com/package/@seald-io/nedb). - -``` -npm install @seald-io/nedb -``` - -Then to import, you just have to: - -```js -const Datastore = require('@seald-io/nedb') -``` - -## Documentation -The API is a subset of MongoDB's API (the most used operations). - -Since version [3.0.0](./CHANGELOG.md#300---2022-03-16), NeDB provides a Promise-based equivalent for each function -which is suffixed with `Async`, for example `loadDatabaseAsync`. - -The original callback-based interface is still available, fully retro-compatible -(as far as the test suites can tell) and are a shim to this Promise-based -version. - -Don't hesitate to open an issue if it breaks something in your project. - -The rest of the readme will only show the Promise-based API, the full -documentation is available in the [`API.md`](./API.md) file at the root of the -repository. It is generated by running `npm run generateDocs:markdown`. - -* [Creating/loading a database](#creatingloading-a-database) -* [Dropping a database](#dropping-a-database) -* [Persistence](#persistence) -* [Inserting documents](#inserting-documents) -* [Finding documents](#finding-documents) - * [Basic Querying](#basic-querying) - * [Operators ($lt, $lte, $gt, $gte, $in, $nin, $ne, $exists, $regex)](#operators-lt-lte-gt-gte-in-nin-ne-stat-regex) - * [Array fields](#array-fields) - * [Logical operators $or, $and, $not, $where](#logical-operators-or-and-not-where) - * [Sorting and paginating](#sorting-and-paginating) - * [Projections](#projections) -* [Counting documents](#counting-documents) -* [Updating documents](#updating-documents) -* [Removing documents](#removing-documents) -* [Indexing](#indexing) -* [Other environments](#other-environments) - -### Creating/loading a database - -You can use NeDB as an in-memory only datastore or as a persistent datastore. -One datastore is the equivalent of a MongoDB collection. The constructor is used -as follows [`new Datastore(options)` where `options` is an object](./API.md#new_Datastore_new). - -If the Datastore is persistent (if you give it [`options.filename`](./API.md#Datastore+filename), -you'll need to load the database using [Datastore#loadDatabaseAsync](./API.md#Datastore+loadDatabaseAsync), -or using [`options.autoload`](./API.md#Datastore+autoload). - -```javascript -// Type 1: In-memory only datastore (no need to load the database) -const Datastore = require('@seald-io/nedb') -const db = new Datastore() - -// Type 2: Persistent datastore with manual loading -const Datastore = require('@seald-io/nedb') -const db = new Datastore({ filename: 'path/to/datafile' }) -try { - await db.loadDatabaseAsync() -} catch (error) { - // loading has failed -} -// loading has succeeded - -// Type 3: Persistent datastore with automatic loading -const Datastore = require('@seald-io/nedb') -const db = new Datastore({ filename: 'path/to/datafile', autoload: true }) // You can await db.autoloadPromise to catch a potential error when autoloading. -// You can issue commands right away - -// Of course you can create multiple datastores if you need several -// collections. In this case it's usually a good idea to use autoload for all collections. -db = {} -db.users = new Datastore('path/to/users.db') -db.robots = new Datastore('path/to/robots.db') - -// You need to load each database -await db.users.loadDatabaseAsync() -await db.robots.loadDatabaseAsync() -``` - -### Dropping a database - -Since v3.0.0, you can drop the database by using [`Datastore#dropDatabaseAsync`](./API.md#Datastore+dropDatabaseAsync): -```js -const Datastore = require('@seald-io/nedb') -const db = new Datastore() -await d.insertAsync({ hello: 'world' }) -await d.dropDatabaseAsync() -assert.equal(d.getAllData().length, 0) -assert.equal(await exists(testDb), false) -``` - -It is not recommended to keep using an instance of Datastore when its database -has been dropped as it may have some unintended side effects. - -### Persistence - -Under the hood, NeDB's [persistence](./API.md#Persistence) uses an append-only -format, meaning that all updates and deletes actually result in lines added at -the end of the datafile, for performance reasons. The database is automatically -compacted (i.e. put back in the one-line-per-document format) every time you -load each database within your application. - -**Breaking change**: [since v3.0.0](./CHANGELOG.md#300---unreleased), calling methods of `yourDatabase.persistence` -is deprecated. The same functions exists directly on the `Datastore`. - -You can manually call the compaction function -with [`yourDatabase#compactDatafileAsync`](./API.md#Datastore+compactDatafileAsync). - -You can also set automatic compaction at regular intervals -with [`yourDatabase#setAutocompactionInterval`](./API.md#Datastore+setAutocompactionInterval), -and stop automatic compaction with [`yourDatabase#stopAutocompaction`](./API.md#Datastore+stopAutocompaction). - -### Inserting documents - -The native types are `String`, `Number`, `Boolean`, `Date` and `null`. You can -also use arrays and subdocuments (objects). If a field is `undefined`, it will -not be saved (this is different from MongoDB which transforms `undefined` -in `null`, something I find counter-intuitive). - -If the document does not contain an `_id` field, NeDB will automatically -generate one for you (a 16-characters alphanumerical string). The `_id` of a -document, once set, cannot be modified. - -Field names cannot start with '$' or contain the characters '.' and ','. - -```javascript -const doc = { - hello: 'world', - n: 5, - today: new Date(), - nedbIsAwesome: true, - notthere: null, - notToBeSaved: undefined, // Will not be saved - fruits: ['apple', 'orange', 'pear'], - infos: { name: '@seald-io/nedb' } -} - -try { - const newDoc = await db.insertAsync(doc) - // newDoc is the newly inserted document, including its _id - // newDoc has no key called notToBeSaved since its value was undefined -} catch (error) { - // if an error happens -} -``` - -You can also bulk-insert an array of documents. This operation is atomic, -meaning that if one insert fails due to a unique constraint being violated, all -changes are rolled back. - -```javascript -const newDocs = await db.insertAsync([{ a: 5 }, { a: 42 }]) -// Two documents were inserted in the database -// newDocs is an array with these documents, augmented with their _id - - -// If there is a unique constraint on field 'a', this will fail -try { - await db.insertAsync([{ a: 5 }, { a: 42 }, { a: 5 }]) -} catch (error) { - // err is a 'uniqueViolated' error - // The database was not modified -} -``` - -### Finding documents - -Use `findAsync` to look for multiple documents matching you query, or `findOneAsync` to -look for one specific document. You can select documents based on field equality -or use comparison operators (`$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$nin`, `$ne`) -. You can also use logical operators `$or`, `$and`, `$not` and `$where`. See -below for the syntax. - -You can use regular expressions in two ways: in basic querying in place of a -string, or with the `$regex` operator. - -You can sort and paginate results using the cursor API (see below). - -You can use standard projections to restrict the fields to appear in the -results (see below). - -#### Basic querying - -Basic querying means are looking for documents whose fields match the ones you -specify. You can use regular expression to match strings. You can use the dot -notation to navigate inside nested documents, arrays, arrays of subdocuments and -to match a specific element of an array. - -```javascript -// Let's say our datastore contains the following collection -// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false, satellites: ['Phobos', 'Deimos'] } -// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true, humans: { genders: 2, eyes: true } } -// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } -// { _id: 'id4', planet: 'Omicron Persei 8', system: 'futurama', inhabited: true, humans: { genders: 7 } } -// { _id: 'id5', completeData: { planets: [ { name: 'Earth', number: 3 }, { name: 'Mars', number: 2 }, { name: 'Pluton', number: 9 } ] } } - -// Finding all planets in the solar system -const docs = await db.findAsync({ system: 'solar' }) -// docs is an array containing documents Mars, Earth, Jupiter -// If no document is found, docs is equal to [] - - -// Finding all planets whose name contain the substring 'ar' using a regular expression -const docs = await db.findAsync({ planet: /ar/ }) -// docs contains Mars and Earth - -// Finding all inhabited planets in the solar system -const docs = await db.findAsync({ system: 'solar', inhabited: true }) -// docs is an array containing document Earth only - -// Use the dot-notation to match fields in subdocuments -const docs = await db.findAsync({ 'humans.genders': 2 }) -// docs contains Earth - - -// Use the dot-notation to navigate arrays of subdocuments -const docs = await db.findAsync({ 'completeData.planets.name': 'Mars' }) -// docs contains document 5 - -const docs = await db.findAsync({ 'completeData.planets.name': 'Jupiter' }) -// docs is empty - -const docs = await db.findAsync({ 'completeData.planets.0.name': 'Earth' }) -// docs contains document 5 -// If we had tested against 'Mars' docs would be empty because we are matching against a specific array element - - -// You can also deep-compare objects. Don't confuse this with dot-notation! -const docs = await db.findAsync({ humans: { genders: 2 } }) -// docs is empty, because { genders: 2 } is not equal to { genders: 2, eyes: true } - - -// Find all documents in the collection -const docs = await db.findAsync({}) - -// The same rules apply when you want to only find one document -const doc = await db.findOneAsync({ _id: 'id1' }) -// doc is the document Mars -// If no document is found, doc is null -``` - -#### Operators ($lt, $lte, $gt, $gte, $in, $nin, $ne, $exists, $regex) - -The syntax is `{ field: { $op: value } }` where `$op` is any comparison -operator: - -* `$lt`, `$lte`: less than, less than or equal -* `$gt`, `$gte`: greater than, greater than or equal -* `$in`: member of. `value` must be an array of values -* `$ne`, `$nin`: not equal, not a member of -* `$exists`: checks whether the document posses the property `field`. `value` - should be true or false -* `$regex`: checks whether a string is matched by the regular expression. - Contrary to MongoDB, the use of `$options` with `$regex` is not supported, - because it doesn't give you more power than regex flags. Basic queries are - more readable so only use the `$regex` operator when you need to use another - operator with it (see example below) - -```javascript -// $lt, $lte, $gt and $gte work on numbers and strings -const docs = await db.findAsync({ 'humans.genders': { $gt: 5 } }) -// docs contains Omicron Persei 8, whose humans have more than 5 genders (7). - -// When used with strings, lexicographical order is used -const docs = await db.findAsync({ planet: { $gt: 'Mercury' } }) -// docs contains Omicron Persei 8 - -// Using $in. $nin is used in the same way -const docs = await db.findAsync({ planet: { $in: ['Earth', 'Jupiter'] } }) -// docs contains Earth and Jupiter - -// Using $exists -const docs = await db.findAsync({ satellites: { $exists: true } }) -// docs contains only Mars - -// Using $regex with another operator -const docs = await db.findAsync({ - planet: { - $regex: /ar/, - $nin: ['Jupiter', 'Earth'] - } -}) -// docs only contains Mars because Earth was excluded from the match by $nin -``` - -#### Array fields - -When a field in a document is an array, NeDB first tries to see if the query -value is an array to perform an exact match, then whether there is an -array-specific comparison function (for now there is only `$size` -and `$elemMatch`) being used. If not, the query is treated as a query on every -element and there is a match if at least one element matches. - -* `$size`: match on the size of the array -* `$elemMatch`: matches if at least one array element matches the query entirely - -```javascript -// Exact match -const docs = await db.findAsync({ satellites: ['Phobos', 'Deimos'] }) -// docs contains Mars - -const docs = await db.findAsync({ satellites: ['Deimos', 'Phobos'] }) -// docs is empty - -// Using an array-specific comparison function -// $elemMatch operator will provide match for a document, if an element from the array field satisfies all the conditions specified with the `$elemMatch` operator -const docs = await db.findAsync({ - completeData: { - planets: { - $elemMatch: { - name: 'Earth', - number: 3 - } - } - } -}) -// docs contains documents with id 5 (completeData) - -const docs = await db.findAsync({ - completeData: { - planets: { - $elemMatch: { - name: 'Earth', - number: 5 - } - } - } -}) -// docs is empty - -// You can use inside #elemMatch query any known document query operator -const docs = await db.findAsync({ - completeData: { - planets: { - $elemMatch: { - name: 'Earth', - number: { $gt: 2 } - } - } - } -}) -// docs contains documents with id 5 (completeData) - -// Note: you can't use nested comparison functions, e.g. { $size: { $lt: 5 } } will throw an error -const docs = await db.findAsync({ satellites: { $size: 2 } }) -// docs contains Mars - -const docs = await db.findAsync({ satellites: { $size: 1 } }) -// docs is empty - -// If a document's field is an array, matching it means matching any element of the array -const docs = await db.findAsync({ satellites: 'Phobos' }) -// docs contains Mars. Result would have been the same if query had been { satellites: 'Deimos' } - -// This also works for queries that use comparison operators -const docs = await db.findAsync({ satellites: { $lt: 'Amos' } }) -// docs is empty since Phobos and Deimos are after Amos in lexicographical order - -// This also works with the $in and $nin operator -const docs = await db.findAsync({ satellites: { $in: ['Moon', 'Deimos'] } }) -// docs contains Mars (the Earth document is not complete!) -``` - -#### Logical operators $or, $and, $not, $where - -You can combine queries using logical operators: - -* For `$or` and `$and`, the syntax is `{ $op: [query1, query2, ...] }`. -* For `$not`, the syntax is `{ $not: query }` -* For `$where`, the syntax - is `{ $where: function () { /* object is 'this', return a boolean */ } }` - -```javascript -const docs = await db.findAsync({ $or: [{ planet: 'Earth' }, { planet: 'Mars' }] }) -// docs contains Earth and Mars - -const docs = await db.findAsync({ $not: { planet: 'Earth' } }) -// docs contains Mars, Jupiter, Omicron Persei 8 - -const docs = await db.findAsync({ $where: function () { return Object.keys(this) > 6 } }) -// docs with more than 6 properties - -// You can mix normal queries, comparison queries and logical operators -const docs = await db.findAsync({ - $or: [{ planet: 'Earth' }, { planet: 'Mars' }], - inhabited: true -}) -// docs contains Earth -``` - -#### Sorting and paginating - -[`Datastore#findAsync`](./API.md#Datastore+findAsync), -[`Datastore#findOneAsync`](./API.md#Datastore+findOneAsync) and -[`Datastore#countAsync`](./API.md#Datastore+countAsync) don't -actually return a `Promise`, but a [`Cursor`](./API.md#Cursor) which is a -[`Thenable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#thenable_objects) -which calls [`Cursor#execAsync`](./API.md#Cursor+execAsync) when awaited. - -This pattern allows to chain [`Cursor#sort`](./API.md#Cursor+sort), -[`Cursor#skip`](./API.md#Cursor+skip), -[`Cursor#limit`](./API.md#Cursor+limit) and -[`Cursor#projection`](./API.md#Cursor+projection) and await the result. - -```javascript -// Let's say the database contains these 4 documents -// doc1 = { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false, satellites: ['Phobos', 'Deimos'] } -// doc2 = { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true, humans: { genders: 2, eyes: true } } -// doc3 = { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } -// doc4 = { _id: 'id4', planet: 'Omicron Persei 8', system: 'futurama', inhabited: true, humans: { genders: 7 } } - -// No query used means all results are returned (before the Cursor modifiers) -const docs = await db.findAsync({}).sort({ planet: 1 }).skip(1).limit(2) -// docs is [doc3, doc1] - -// You can sort in reverse order like this -const docs = await db.findAsync({ system: 'solar' }).sort({ planet: -1 }) -// docs is [doc1, doc3, doc2] - -// You can sort on one field, then another, and so on like this: -const docs = await db.findAsync({}).sort({ firstField: 1, secondField: -1 }) -// ... You understand how this works! -``` - -#### Projections - -You can give `findAsync` and `findOneAsync` an optional second argument, `projections`. -The syntax is the same as MongoDB: `{ a: 1, b: 1 }` to return only the `a` -and `b` fields, `{ a: 0, b: 0 }` to omit these two fields. You cannot use both -modes at the time, except for `_id` which is by default always returned and -which you can choose to omit. You can project on nested documents. - -```javascript -// Same database as above - -// Keeping only the given fields -const docs = await db.findAsync({ planet: 'Mars' }, { planet: 1, system: 1 }) -// docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }] - -// Keeping only the given fields but removing _id -const docs = await db.findAsync({ planet: 'Mars' }, { - planet: 1, - system: 1, - _id: 0 -}) -// docs is [{ planet: 'Mars', system: 'solar' }] - -// Omitting only the given fields and removing _id -const docs = await db.findAsync({ planet: 'Mars' }, { - planet: 0, - system: 0, - _id: 0 -}) -// docs is [{ inhabited: false, satellites: ['Phobos', 'Deimos'] }] - -// Failure: using both modes at the same time -const docs = await db.findAsync({ planet: 'Mars' }, { planet: 0, system: 1 }) -// err is the error message, docs is undefined - -// You can also use it in a Cursor way but this syntax is not compatible with MongoDB -const docs = await db.findAsync({ planet: 'Mars' }).projection({ - planet: 1, - system: 1 -}) -// docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }] - -// Project on a nested document -const doc = await db.findOneAsync({ planet: 'Earth' }).projection({ - planet: 1, - 'humans.genders': 1 -}) -// doc is { planet: 'Earth', _id: 'id2', humans: { genders: 2 } } -``` - -### Counting documents - -You can use `countAsync` to count documents. It has the same syntax as `findAsync`. -For example: - -```javascript -// Count all planets in the solar system -const count = await db.countAsync({ system: 'solar' }) -// count equals to 3 - -// Count all documents in the datastore -const count = await db.countAsync({}) -// count equals to 4 -``` - -### Updating documents - -[`db.updateAsync(query, update, options)`](./API.md#Datastore+updateAsync) -will update all documents matching `query` according to the `update` rules. - -`update` specifies how the documents should be modified. It is either a new -document or a set of modifiers (you cannot use both together): -* A new document will replace the matched docs; -* Modifiers create the fields they need to modify if they don't exist, - and you can apply them to subdocs (see [the API reference]((./API.md#Datastore+updateAsync))) - -`options` is an object with three possible parameters: -* `multi` which allows the modification of several documents if set to true. -* `upsert` will insert a new document corresponding if it doesn't exist (either -the `update` is a simple object with no modifiers, or the `query` modified by -the modifiers in the `update`) if set to `true`. -* `returnUpdatedDocs` will return the array of documents matched by the find -query and updated (updated documents will be returned even if the update did not -actually modify them) if set to `true`. - -It resolves into an Object with the following properties: -- `numAffected`: how many documents were affected by the update; -- `upsert`: if a document was actually upserted (not always the same as `options.upsert`; -- `affectedDocuments`: - - if `upsert` is `true` the document upserted; - - if `options.returnUpdatedDocs` is `true` either the affected document or, if `options.multi` is `true` an Array of the affected documents, else `null`; - -**Note**: you can't change a document's _id. - -```javascript -// Let's use the same example collection as in the 'finding document' part -// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false } -// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true } -// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } -// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true } - -// Replace a document by another -const { numAffected } = await db.updateAsync({ planet: 'Jupiter' }, { planet: 'Pluton' }, {}) -// numAffected = 1 -// The doc #3 has been replaced by { _id: 'id3', planet: 'Pluton' } -// Note that the _id is kept unchanged, and the document has been replaced -// (the 'system' and inhabited fields are not here anymore) - - -// Set an existing field's value -const { numAffected } = await db.updateAsync({ system: 'solar' }, { $set: { system: 'solar system' } }, { multi: true }) -// numAffected = 3 -// Field 'system' on Mars, Earth, Jupiter now has value 'solar system' - - -// Setting the value of a non-existing field in a subdocument by using the dot-notation -await db.updateAsync({ planet: 'Mars' }, { - $set: { - 'data.satellites': 2, - 'data.red': true - } -}, {}) -// Mars document now is { _id: 'id1', system: 'solar', inhabited: false -// , data: { satellites: 2, red: true } -// } -// Not that to set fields in subdocuments, you HAVE to use dot-notation -// Using object-notation will just replace the top-level field -await db.updateAsync({ planet: 'Mars' }, { $set: { data: { satellites: 3 } } }, {}) -// Mars document now is { _id: 'id1', system: 'solar', inhabited: false -// , data: { satellites: 3 } -// } -// You lost the 'data.red' field which is probably not the intended behavior - - -// Deleting a field -await db.updateAsync({ planet: 'Mars' }, { $unset: { planet: true } }, {}) -// Now the document for Mars doesn't contain the planet field -// You can unset nested fields with the dot notation of course - - -// Upserting a document -const { numAffected, affectedDocuments, upsert } = await db.updateAsync({ planet: 'Pluton' }, { - planet: 'Pluton', - inhabited: false -}, { upsert: true }) -// numAffected = 1, affectedDocuments = { _id: 'id5', planet: 'Pluton', inhabited: false }, upsert = true -// A new document { _id: 'id5', planet: 'Pluton', inhabited: false } has been added to the collection - - -// If you upsert with a modifier, the upserted doc is the query modified by the modifier -// This is simpler than it sounds :) -await db.updateAsync({ planet: 'Pluton' }, { $inc: { distance: 38 } }, { upsert: true }) -// A new document { _id: 'id5', planet: 'Pluton', distance: 38 } has been added to the collection - - -// If we insert a new document { _id: 'id6', fruits: ['apple', 'orange', 'pear'] } in the collection, -// let's see how we can modify the array field atomically - -// $push inserts new elements at the end of the array -await db.updateAsync({ _id: 'id6' }, { $push: { fruits: 'banana' } }, {}) -// Now the fruits array is ['apple', 'orange', 'pear', 'banana'] - - -// $pop removes an element from the end (if used with 1) or the front (if used with -1) of the array -await db.updateAsync({ _id: 'id6' }, { $pop: { fruits: 1 } }, {}) -// Now the fruits array is ['apple', 'orange'] -// With { $pop: { fruits: -1 } }, it would have been ['orange', 'pear'] - - -// $addToSet adds an element to an array only if it isn't already in it -// Equality is deep-checked (i.e. $addToSet will not insert an object in an array already containing the same object) -// Note that it doesn't check whether the array contained duplicates before or not -await db.updateAsync({ _id: 'id6' }, { $addToSet: { fruits: 'apple' } }, {}) -// The fruits array didn't change -// If we had used a fruit not in the array, e.g. 'banana', it would have been added to the array - -// $pull removes all values matching a value or even any NeDB query from the array -await db.updateAsync({ _id: 'id6' }, { $pull: { fruits: 'apple' } }, {}) -// Now the fruits array is ['orange', 'pear'] - -await db.updateAsync({ _id: 'id6' }, { $pull: { fruits: { $in: ['apple', 'pear'] } } }, {}) -// Now the fruits array is ['orange'] - - -// $each can be used to $push or $addToSet multiple values at once -// This example works the same way with $addToSet -await db.updateAsync({ _id: 'id6' }, { $push: { fruits: { $each: ['banana', 'orange'] } } }, {}) -// Now the fruits array is ['apple', 'orange', 'pear', 'banana', 'orange'] - - -// $slice can be used in cunjunction with $push and $each to limit the size of the resulting array. -// A value of 0 will update the array to an empty array. A positive value n will keep only the n first elements -// A negative value -n will keep only the last n elements. -// If $slice is specified but not $each, $each is set to [] -await db.updateAsync({ _id: 'id6' }, { - $push: { - fruits: { - $each: ['banana'], - $slice: 2 - } - } -}) -// Now the fruits array is ['apple', 'orange'] - - -// $min/$max to update only if provided value is less/greater than current value -// Let's say the database contains this document -// doc = { _id: 'id', name: 'Name', value: 5 } -await db.updateAsync({ _id: 'id1' }, { $min: { value: 2 } }, {}) -// The document will be updated to { _id: 'id', name: 'Name', value: 2 } - - -await db.updateAsync({ _id: 'id1' }, { $min: { value: 8 } }, {}) -// The document will not be modified -``` - -### Removing documents - -[`db.removeAsync(query, options)`](./API.md#Datastore#removeAsync) -will remove documents matching `query`. Can remove multiple documents if -`options.multi` is set. Returns the `Promise`. - -```javascript -// Let's use the same example collection as in the "finding document" part -// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false } -// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true } -// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } -// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true } - -// Remove one document from the collection -// options set to {} since the default for multi is false -const { numRemoved } = await db.removeAsync({ _id: 'id2' }, {}) -// numRemoved = 1 - - -// Remove multiple documents -const { numRemoved } = await db.removeAsync({ system: 'solar' }, { multi: true }) -// numRemoved = 3 -// All planets from the solar system were removed - - -// Removing all documents with the 'match-all' query -const { numRemoved } = await db.removeAsync({}, { multi: true }) -``` - -### Indexing - -NeDB supports indexing. It gives a very nice speed boost and can be used to -enforce a unique constraint on a field. You can index any field, including -fields in nested documents using the dot notation. For now, indexes are only -used to speed up basic queries and queries using `$in`, `$lt`, `$lte`, `$gt` -and `$gte`. The indexed values cannot be of type array of object. - -**Breaking change**: [since v4.0.0](./CHANGELOG.md#400---2023-01-20), commas (`,`) can no longer be used in indexed field names. - -The following is illegal: -```javascript -db.ensureIndexAsync({ fieldName: 'some,field' }) -db.ensureIndexAsync({ fieldName: ['some,field', 'other,field'] }) -``` -This is a side effect of the compound index implementation. - -To create an index, use [`datastore#ensureIndexAsync(options)`](./API.md#Datastore+ensureIndexAsync). -It resolves when the index is persisted on disk (if the database is persistent) -and may throw an Error (usually a unique constraint that was violated). It can -be called when you want, even after some data was inserted, though it's best to -call it at application startup. The options are: - -* **fieldName** (required): name of the field to index. Use the dot notation to - index a field in a nested document. For a compound index, use an array of field names. -* **unique** (optional, defaults to `false`): enforce field uniqueness. -* **sparse** (optional, defaults to `false`): don't index documents for which - the field is not defined. -* **expireAfterSeconds** (number of seconds, optional): if set, the created - index is a TTL (time to live) index, that will automatically remove documents - when the indexed field value is older than `expireAfterSeconds`. - -Note: the `_id` is automatically indexed with a unique constraint. - -You can remove a previously created index with -[`datastore#removeIndexAsync(fieldName)`](./API.md#Datastore+removeIndexAsync). - -```javascript -try { - await db.ensureIndexAsync({ fieldName: 'somefield' }) -} catch (error) { - // If there was an error, error is not null -} - -// Using a unique constraint with the index -await db.ensureIndexAsync({ fieldName: 'somefield', unique: true }) - -// Using a sparse unique index -await db.ensureIndexAsync({ - fieldName: 'somefield', - unique: true, - sparse: true -}) - -// Using a compound index -await db.ensureIndexAsync({ fieldName: ["field1", "field2"] }); - -try { - // Format of the error message when the unique constraint is not met - await db.insertAsync({ somefield: '@seald-io/nedb' }) - // works - await db.insertAsync({ somefield: '@seald-io/nedb' }) - //rejects -} catch (error) { - // error is { errorType: 'uniqueViolated', - // key: 'name', - // message: 'Unique constraint violated for key name' } -} - - -// Remove index on field somefield -await db.removeIndexAsync('somefield') - -// Example of using expireAfterSeconds to remove documents 1 hour -// after their creation (db's timestampData option is true here) -await db.ensureIndex({ - fieldName: 'createdAt', - expireAfterSeconds: 3600 -}) - -// You can also use the option to set an expiration date like so -await db.ensureIndex({ - fieldName: 'expirationDate', - expireAfterSeconds: 0 -}) -// Now all documents will expire when system time reaches the date in their -// expirationDate field -``` - -## Other environments -NeDB runs on Node.js (it is tested on Node 12, 14 and 16), the browser (it is -tested on the latest version of Chrome) and React-Native using -[@react-native-async-storage/async-storage](https://github.com/react-native-async-storage/async-storage). - -### Browser bundle -The npm package contains a bundle and its minified counterpart for the browser. -They are located in the `browser-version/out` directory. You only need to require `nedb.js` -or `nedb.min.js` in your HTML file and the global object `Nedb` can be used -right away, with the same API as the server version: - -``` - - -``` - -If you specify a `filename`, the database will be persistent, and automatically -select the best storage method available using [localforage](https://github.com/localForage/localForage) -(IndexedDB, WebSQL or localStorage) depending on the browser. In most cases that -means a lot of data can be stored, typically in hundreds of MB. - -**WARNING**: the storage system changed between -v1.3 and v1.4 and is NOT back-compatible! Your application needs to resync -client-side when you upgrade NeDB. - -NeDB uses modern Javascript features such as `async`, `Promise`, `class`, `const` -, `let`, `Set`, `Map`, ... The bundle does not polyfill these features. If you -need to target another environment, you will need to make your own bundle. - -### Using the `browser` and `react-native` fields -NeDB uses the `browser` and `react-native` fields to replace some modules by an -environment specific shim. - -The way this works is by counting on the bundler that will package NeDB to use -this fields. This is [done by default by Webpack](https://webpack.js.org/configuration/resolve/#resolvealiasfields) -for the `browser` field. And this is [done by default by Metro](https://github.com/facebook/metro/blob/c21daba415ea26511e157f794689caab9abe8236/packages/metro/src/ModuleGraph/node-haste/Package.js#L108) -for the `react-native` field. - -This is done for: -- the [storage module](./lib/storage.js) which uses Node.js `fs`. It is - [replaced in the browser](./browser-version/lib/storage.browser.js) by one that uses - [localforage](https://github.com/localForage/localForage), and - [in `react-native`](./browser-version/lib/storage.react-native.js) by one that uses - [@react-native-async-storage/async-storage](https://github.com/react-native-async-storage/async-storage) -- the [customUtils module](./browser-version/lib/customUtils.js) which uses Node.js - `crypto` module. It is replaced by a good enough shim to generate ids that uses `Math.random()`. -- the [byline module](./browser-version/lib/byline.js) which uses Node.js `stream` - (a fork of [`node-byline`](https://github.com/jahewson/node-byline) included in - the repo because it is unmaintained). It isn't used in the browser nor - react-native versions, therefore it is shimmed with an empty object. - -However, the `browser` and `react-native` versions rely on node native modules and therefore must be polyfilled: -- `util` with https://github.com/browserify/node-util. -- `events` with https://github.com/browserify/events. - -## Performance - -### Speed - -NeDB is not intended to be a replacement of large-scale databases such as -MongoDB, and as such was not designed for speed. That said, it is still pretty -fast on the expected datasets, especially if you use indexing. On a typical, -not-so-fast dev machine, for a collection containing 10,000 documents, with -indexing: - -* Insert: **10,680 ops/s** -* Find: **43,290 ops/s** -* Update: **8,000 ops/s** -* Remove: **11,750 ops/s** - -You can run these simple benchmarks by executing the scripts in the `benchmarks` -folder. Run them with the `--help` flag to see how they work. - -### Memory footprint - -A copy of the whole database is kept in memory. This is not much on the expected -kind of datasets (20MB for 10,000 2KB documents). - -## Use in other services - -* An ODM for NeDB: [follicle](https://github.com/seald/follicle) -* A layer to add a promise-only interface: [nedb-promises](https://www.npmjs.com/package/nedb-promises) - -## Modernization - -This fork of NeDB will be incrementally updated to: -* [ ] cleanup the benchmark and update the performance statistics; -* [ ] remove deprecated features; -* [ ] add a way to change the `Storage` module by dependency injection, which will - pave the way to cleaner browser react-native versions (cf https://github.com/seald/nedb/pull/19). -* [x] use `async` functions and `Promises` instead of callbacks with `async@0.2.6`; -* [x] expose a `Promise`-based interface; -* [x] remove the `underscore` dependency; - -## Pull requests guidelines -If you submit a pull request, thanks! There are a couple rules to follow though -to make it manageable: - -* The pull request should be atomic, i.e. contain only one feature. If it - contains more, please submit multiple pull requests. Reviewing massive, 1000 - loc+ pull requests is extremely hard. -* Likewise, if for one unique feature the pull request grows too large (more - than 200 loc tests not included), please get in touch first. -* Please stick to the current coding style. It's important that the code uses a - coherent style for readability (this package uses [`standard`](https://standardjs.com/)). -* Do not include stylistic improvements ('housekeeping'). If you think one part - deserves lots of housekeeping, use a separate pull request so as not to - pollute the code. -* Don't forget tests for your new feature. Also don't forget to run the whole - test suite before submitting to make sure you didn't introduce regressions. -* Update the JSDoc and regenerate [the markdown docs](./API.md). -* Update the readme accordingly. - -## License - -See [License](LICENSE.md) diff --git a/node_modules/@seald-io/nedb/browser-version/lib/byline.js b/node_modules/@seald-io/nedb/browser-version/lib/byline.js deleted file mode 100644 index 4ba52ba..0000000 --- a/node_modules/@seald-io/nedb/browser-version/lib/byline.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {} diff --git a/node_modules/@seald-io/nedb/browser-version/lib/customUtils.js b/node_modules/@seald-io/nedb/browser-version/lib/customUtils.js deleted file mode 100755 index cc05357..0000000 --- a/node_modules/@seald-io/nedb/browser-version/lib/customUtils.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Utility functions that need to be reimplemented for each environment. - * This is the version for the browser & React-Native - * @module customUtilsBrowser - * @private - */ - -/** - * Taken from the crypto-browserify module - * https://github.com/dominictarr/crypto-browserify - * NOTE: Math.random() does not guarantee "cryptographic quality" but we actually don't need it - * @param {number} size in bytes - * @return {Array} - */ -const randomBytes = size => { - const bytes = new Array(size) - - for (let i = 0, r; i < size; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000 - bytes[i] = r >>> ((i & 0x03) << 3) & 0xff - } - - return bytes -} - -/** - * Taken from the base64-js module - * https://github.com/beatgammit/base64-js/ - * @param {Array} uint8 - * @return {string} - */ -const byteArrayToBase64 = uint8 => { - const lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' - const extraBytes = uint8.length % 3 // if we have 1 byte left, pad 2 bytes - let output = '' - let temp - - const tripletToBase64 = num => lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] - - // go through the array every three bytes, we'll deal with trailing stuff later - for (let i = 0, length = uint8.length - extraBytes; i < length; i += 3) { - temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output += tripletToBase64(temp) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - temp = uint8[uint8.length - 1] - output += lookup[temp >> 2] - output += lookup[(temp << 4) & 0x3F] - output += '==' - } else if (extraBytes === 2) { - temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) - output += lookup[temp >> 10] - output += lookup[(temp >> 4) & 0x3F] - output += lookup[(temp << 2) & 0x3F] - output += '=' - } - - return output -} - -/** - * Return a random alphanumerical string of length len - * There is a very small probability (less than 1/1,000,000) for the length to be less than len - * (il the base64 conversion yields too many pluses and slashes) but - * that's not an issue here - * The probability of a collision is extremely small (need 3*10^12 documents to have one chance in a million of a collision) - * See http://en.wikipedia.org/wiki/Birthday_problem - * @param {number} len - * @return {string} - * @alias module:customUtilsNode.uid - */ -const uid = len => byteArrayToBase64(randomBytes(Math.ceil(Math.max(8, len * 2)))).replace(/[+/]/g, '').slice(0, len) - -module.exports.uid = uid diff --git a/node_modules/@seald-io/nedb/browser-version/lib/storage.browser.js b/node_modules/@seald-io/nedb/browser-version/lib/storage.browser.js deleted file mode 100755 index 9a7898f..0000000 --- a/node_modules/@seald-io/nedb/browser-version/lib/storage.browser.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * Way data is stored for this database - * - * This version is the browser version and uses [localforage]{@link https://github.com/localForage/localForage} which chooses the best option depending on user browser (IndexedDB then WebSQL then localStorage). - * @module storageBrowser - * @see module:storage - * @see module:storageReactNative - * @private - */ - -const localforage = require('localforage') - -// Configure localforage to display NeDB name for now. Would be a good idea to let user use his own app name -const store = localforage.createInstance({ - name: 'NeDB', - storeName: 'nedbdata' -}) - -/** - * Returns Promise if file exists. - * - * @param {string} file - * @return {Promise} - * @async - * @alias module:storageBrowser.existsAsync - */ -const existsAsync = async file => { - try { - const value = await store.getItem(file) - if (value !== null) return true // Even if value is undefined, localforage returns null - return false - } catch (error) { - return false - } -} - -/** - * Moves the item from one path to another. - * @param {string} oldPath - * @param {string} newPath - * @return {Promise} - * @alias module:storageBrowser.renameAsync - * @async - */ -const renameAsync = async (oldPath, newPath) => { - try { - const value = await store.getItem(oldPath) - if (value === null) await store.removeItem(newPath) - else { - await store.setItem(newPath, value) - await store.removeItem(oldPath) - } - } catch (err) { - console.warn('An error happened while renaming, skip') - } -} - -/** - * Saves the item at given path. - * @param {string} file - * @param {string} data - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.writeFileAsync - * @async - */ -const writeFileAsync = async (file, data, options) => { - // Options do not matter in browser setup - try { - await store.setItem(file, data) - } catch (error) { - console.warn('An error happened while writing, skip') - } -} - -/** - * Append to the item at given path. - * @function - * @param {string} filename - * @param {string} toAppend - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.appendFileAsync - * @async - */ -const appendFileAsync = async (filename, toAppend, options) => { - // Options do not matter in browser setup - try { - const contents = (await store.getItem(filename)) || '' - await store.setItem(filename, contents + toAppend) - } catch (error) { - console.warn('An error happened appending to file writing, skip') - } -} - -/** - * Read data at given path. - * @function - * @param {string} filename - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.readFileAsync - * @async - */ -const readFileAsync = async (filename, options) => { - try { - return (await store.getItem(filename)) || '' - } catch (error) { - console.warn('An error happened while reading, skip') - return '' - } -} - -/** - * Async version of {@link module:storageBrowser.unlink}. - * @function - * @param {string} filename - * @return {Promise} - * @async - * @alias module:storageBrowser.unlink - */ -const unlinkAsync = async filename => { - try { - await store.removeItem(filename) - } catch (error) { - console.warn('An error happened while unlinking, skip') - } -} - -/** - * Shim for {@link module:storage.mkdirAsync}, nothing to do, no directories will be used on the browser. - * @function - * @param {string} path - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.mkdirAsync - * @async - */ -const mkdirAsync = (path, options) => Promise.resolve() - -/** - * Shim for {@link module:storage.ensureParentDirectoryExistsAsync}, nothing to do, no directories will be used on the browser. - * @function - * @param {string} file - * @param {number} [mode] - * @return {Promise} - * @alias module:storageBrowser.ensureParentDirectoryExistsAsync - * @async - */ -const ensureParentDirectoryExistsAsync = async (file, mode) => Promise.resolve() - -/** - * Shim for {@link module:storage.ensureDatafileIntegrityAsync}, nothing to do, no data corruption possible in the browser. - * @param {string} filename - * @return {Promise} - * @alias module:storageBrowser.ensureDatafileIntegrityAsync - */ -const ensureDatafileIntegrityAsync = (filename) => Promise.resolve() - -/** - * Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost) - * * @param {string} filename - * @param {string[]} lines - * @return {Promise} - * @alias module:storageBrowser.crashSafeWriteFileLinesAsync - */ -const crashSafeWriteFileLinesAsync = async (filename, lines) => { - lines.push('') // Add final new line - await writeFileAsync(filename, lines.join('\n')) -} - -// Interface -module.exports.existsAsync = existsAsync - -module.exports.renameAsync = renameAsync - -module.exports.writeFileAsync = writeFileAsync - -module.exports.crashSafeWriteFileLinesAsync = crashSafeWriteFileLinesAsync - -module.exports.appendFileAsync = appendFileAsync - -module.exports.readFileAsync = readFileAsync - -module.exports.unlinkAsync = unlinkAsync - -module.exports.mkdirAsync = mkdirAsync - -module.exports.ensureDatafileIntegrityAsync = ensureDatafileIntegrityAsync - -module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync diff --git a/node_modules/@seald-io/nedb/browser-version/lib/storage.react-native.js b/node_modules/@seald-io/nedb/browser-version/lib/storage.react-native.js deleted file mode 100755 index 528af37..0000000 --- a/node_modules/@seald-io/nedb/browser-version/lib/storage.react-native.js +++ /dev/null @@ -1,295 +0,0 @@ -/** - * Way data is stored for this database - * - * This version is the React-Native version and uses [@react-native-async-storage/async-storage]{@link https://github.com/react-native-async-storage/async-storage}. - * @module storageReactNative - * @see module:storageBrowser - * @see module:storage - * @private - */ - -const AsyncStorage = require('@react-native-async-storage/async-storage').default -const { callbackify } = require('util') - -/** - * Async version of {@link module:storageReactNative.exists}. - * @param {string} file - * @return {Promise} - * @async - * @alias module:storageReactNative.existsAsync - * @see module:storageReactNative.exists - */ -const existsAsync = async file => { - try { - const value = await AsyncStorage.getItem(file) - if (value !== null) return true // Even if value is undefined, AsyncStorage returns null - return false - } catch (error) { - return false - } -} -/** - * @callback module:storageReactNative~existsCallback - * @param {boolean} exists - */ - -/** - * Callback returns true if file exists - * @function - * @param {string} file - * @param {module:storageReactNative~existsCallback} cb - * @alias module:storageReactNative.exists - */ -const exists = callbackify(existsAsync) - -/** - * Async version of {@link module:storageReactNative.rename}. - * @param {string} oldPath - * @param {string} newPath - * @return {Promise} - * @alias module:storageReactNative.renameAsync - * @async - * @see module:storageReactNative.rename - */ -const renameAsync = async (oldPath, newPath) => { - try { - const value = await AsyncStorage.getItem(oldPath) - if (value === null) await AsyncStorage.removeItem(newPath) - else { - await AsyncStorage.setItem(newPath, value) - await AsyncStorage.removeItem(oldPath) - } - } catch (err) { - console.warn('An error happened while renaming, skip') - } -} - -/** - * Moves the item from one path to another - * @function - * @param {string} oldPath - * @param {string} newPath - * @param {NoParamCallback} c - * @return {void} - * @alias module:storageReactNative.rename - */ -const rename = callbackify(renameAsync) - -/** - * Async version of {@link module:storageReactNative.writeFile}. - * @param {string} file - * @param {string} data - * @param {object} [options] - * @return {Promise} - * @alias module:storageReactNative.writeFileAsync - * @async - * @see module:storageReactNative.writeFile - */ -const writeFileAsync = async (file, data, options) => { - // Options do not matter in react-native setup - try { - await AsyncStorage.setItem(file, data) - } catch (error) { - console.warn('An error happened while writing, skip') - } -} - -/** - * Saves the item at given path - * @function - * @param {string} path - * @param {string} data - * @param {object} options - * @param {function} callback - * @alias module:storageReactNative.writeFile - */ -const writeFile = callbackify(writeFileAsync) - -/** - * Async version of {@link module:storageReactNative.appendFile}. - * @function - * @param {string} filename - * @param {string} toAppend - * @param {object} [options] - * @return {Promise} - * @alias module:storageReactNative.appendFileAsync - * @async - * @see module:storageReactNative.appendFile - */ -const appendFileAsync = async (filename, toAppend, options) => { - // Options do not matter in react-native setup - try { - const contents = (await AsyncStorage.getItem(filename)) || '' - await AsyncStorage.setItem(filename, contents + toAppend) - } catch (error) { - console.warn('An error happened appending to file writing, skip') - } -} - -/** - * Append to the item at given path - * @function - * @param {string} filename - * @param {string} toAppend - * @param {object} [options] - * @param {function} callback - * @alias module:storageReactNative.appendFile - */ -const appendFile = callbackify(appendFileAsync) - -/** - * Async version of {@link module:storageReactNative.readFile}. - * @function - * @param {string} filename - * @param {object} [options] - * @return {Promise} - * @alias module:storageReactNative.readFileAsync - * @async - * @see module:storageReactNative.readFile - */ -const readFileAsync = async (filename, options) => { - try { - return (await AsyncStorage.getItem(filename)) || '' - } catch (error) { - console.warn('An error happened while reading, skip') - return '' - } -} - -/** - * Read data at given path - * @function - * @param {string} filename - * @param {object} options - * @param {function} callback - * @alias module:storageReactNative.readFile - */ -const readFile = callbackify(readFileAsync) - -/** - * Async version of {@link module:storageReactNative.unlink}. - * @function - * @param {string} filename - * @return {Promise} - * @async - * @alias module:storageReactNative.unlinkAsync - * @see module:storageReactNative.unlink - */ -const unlinkAsync = async filename => { - try { - await AsyncStorage.removeItem(filename) - } catch (error) { - console.warn('An error happened while unlinking, skip') - } -} - -/** - * Remove the data at given path - * @function - * @param {string} path - * @param {function} callback - * @alias module:storageReactNative.unlink - */ -const unlink = callbackify(unlinkAsync) - -/** - * Shim for {@link module:storage.mkdirAsync}, nothing to do, no directories will be used on the react-native. - * @function - * @param {string} dir - * @param {object} [options] - * @return {Promise} - * @alias module:storageReactNative.mkdirAsync - * @async - */ -const mkdirAsync = (dir, options) => Promise.resolve() - -/** - * Shim for {@link module:storage.mkdir}, nothing to do, no directories will be used on the react-native. - * @function - * @param {string} path - * @param {object} options - * @param {function} callback - * @alias module:storageReactNative.mkdir - */ -const mkdir = callbackify(mkdirAsync) - -/** - * Shim for {@link module:storage.ensureDatafileIntegrityAsync}, nothing to do, no data corruption possible in the react-native. - * @param {string} filename - * @return {Promise} - * @alias module:storageReactNative.ensureDatafileIntegrityAsync - */ -const ensureDatafileIntegrityAsync = (filename) => Promise.resolve() - -/** - * Shim for {@link module:storage.ensureDatafileIntegrity}, nothing to do, no data corruption possible in the react-native. - * @function - * @param {string} filename - * @param {NoParamCallback} callback signature: err - * @alias module:storageReactNative.ensureDatafileIntegrity - */ -const ensureDatafileIntegrity = callbackify(ensureDatafileIntegrityAsync) - -/** - * Async version of {@link module:storageReactNative.crashSafeWriteFileLines}. - * @param {string} filename - * @param {string[]} lines - * @return {Promise} - * @alias module:storageReactNative.crashSafeWriteFileLinesAsync - * @see module:storageReactNative.crashSafeWriteFileLines - */ -const crashSafeWriteFileLinesAsync = async (filename, lines) => { - lines.push('') // Add final new line - await writeFileAsync(filename, lines.join('\n')) -} - -/** - * Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost) - * @function - * @param {string} filename - * @param {string[]} lines - * @param {NoParamCallback} [callback] Optional callback, signature: err - * @alias module:storageReactNative.crashSafeWriteFileLines - */ -const crashSafeWriteFileLines = callbackify(crashSafeWriteFileLinesAsync) - -/** - * Shim for {@link module:storage.ensureParentDirectoryExistsAsync}, nothing to do, no directories will be used on the browser. - * @function - * @param {string} file - * @param {number} [mode] - * @return {Promise} - * @alias module:storageBrowser.ensureParentDirectoryExistsAsync - * @async - */ -const ensureParentDirectoryExistsAsync = async (file, mode) => Promise.resolve() - -// Interface -module.exports.exists = exists -module.exports.existsAsync = existsAsync - -module.exports.rename = rename -module.exports.renameAsync = renameAsync - -module.exports.writeFile = writeFile -module.exports.writeFileAsync = writeFileAsync - -module.exports.crashSafeWriteFileLines = crashSafeWriteFileLines -module.exports.crashSafeWriteFileLinesAsync = crashSafeWriteFileLinesAsync - -module.exports.appendFile = appendFile -module.exports.appendFileAsync = appendFileAsync - -module.exports.readFile = readFile -module.exports.readFileAsync = readFileAsync - -module.exports.unlink = unlink -module.exports.unlinkAsync = unlinkAsync - -module.exports.mkdir = mkdir -module.exports.mkdirAsync = mkdirAsync - -module.exports.ensureDatafileIntegrity = ensureDatafileIntegrity -module.exports.ensureDatafileIntegrityAsync = ensureDatafileIntegrityAsync - -module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync diff --git a/node_modules/@seald-io/nedb/browser-version/out/nedb.js b/node_modules/@seald-io/nedb/browser-version/out/nedb.js deleted file mode 100644 index c9177fe..0000000 --- a/node_modules/@seald-io/nedb/browser-version/out/nedb.js +++ /dev/null @@ -1,10155 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 100: -/***/ ((module) => { - -module.exports = {} - - -/***/ }), - -/***/ 159: -/***/ ((module) => { - -/** - * Utility functions that need to be reimplemented for each environment. - * This is the version for the browser & React-Native - * @module customUtilsBrowser - * @private - */ - -/** - * Taken from the crypto-browserify module - * https://github.com/dominictarr/crypto-browserify - * NOTE: Math.random() does not guarantee "cryptographic quality" but we actually don't need it - * @param {number} size in bytes - * @return {Array} - */ -const randomBytes = size => { - const bytes = new Array(size) - - for (let i = 0, r; i < size; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000 - bytes[i] = r >>> ((i & 0x03) << 3) & 0xff - } - - return bytes -} - -/** - * Taken from the base64-js module - * https://github.com/beatgammit/base64-js/ - * @param {Array} uint8 - * @return {string} - */ -const byteArrayToBase64 = uint8 => { - const lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' - const extraBytes = uint8.length % 3 // if we have 1 byte left, pad 2 bytes - let output = '' - let temp - - const tripletToBase64 = num => lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] - - // go through the array every three bytes, we'll deal with trailing stuff later - for (let i = 0, length = uint8.length - extraBytes; i < length; i += 3) { - temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output += tripletToBase64(temp) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - temp = uint8[uint8.length - 1] - output += lookup[temp >> 2] - output += lookup[(temp << 4) & 0x3F] - output += '==' - } else if (extraBytes === 2) { - temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]) - output += lookup[temp >> 10] - output += lookup[(temp >> 4) & 0x3F] - output += lookup[(temp << 2) & 0x3F] - output += '=' - } - - return output -} - -/** - * Return a random alphanumerical string of length len - * There is a very small probability (less than 1/1,000,000) for the length to be less than len - * (il the base64 conversion yields too many pluses and slashes) but - * that's not an issue here - * The probability of a collision is extremely small (need 3*10^12 documents to have one chance in a million of a collision) - * See http://en.wikipedia.org/wiki/Birthday_problem - * @param {number} len - * @return {string} - * @alias module:customUtilsNode.uid - */ -const uid = len => byteArrayToBase64(randomBytes(Math.ceil(Math.max(8, len * 2)))).replace(/[+/]/g, '').slice(0, len) - -module.exports.uid = uid - - -/***/ }), - -/***/ 909: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/** - * Way data is stored for this database - * - * This version is the browser version and uses [localforage]{@link https://github.com/localForage/localForage} which chooses the best option depending on user browser (IndexedDB then WebSQL then localStorage). - * @module storageBrowser - * @see module:storage - * @see module:storageReactNative - * @private - */ - -const localforage = __webpack_require__(483) - -// Configure localforage to display NeDB name for now. Would be a good idea to let user use his own app name -const store = localforage.createInstance({ - name: 'NeDB', - storeName: 'nedbdata' -}) - -/** - * Returns Promise if file exists. - * - * @param {string} file - * @return {Promise} - * @async - * @alias module:storageBrowser.existsAsync - */ -const existsAsync = async file => { - try { - const value = await store.getItem(file) - if (value !== null) return true // Even if value is undefined, localforage returns null - return false - } catch (error) { - return false - } -} - -/** - * Moves the item from one path to another. - * @param {string} oldPath - * @param {string} newPath - * @return {Promise} - * @alias module:storageBrowser.renameAsync - * @async - */ -const renameAsync = async (oldPath, newPath) => { - try { - const value = await store.getItem(oldPath) - if (value === null) await store.removeItem(newPath) - else { - await store.setItem(newPath, value) - await store.removeItem(oldPath) - } - } catch (err) { - console.warn('An error happened while renaming, skip') - } -} - -/** - * Saves the item at given path. - * @param {string} file - * @param {string} data - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.writeFileAsync - * @async - */ -const writeFileAsync = async (file, data, options) => { - // Options do not matter in browser setup - try { - await store.setItem(file, data) - } catch (error) { - console.warn('An error happened while writing, skip') - } -} - -/** - * Append to the item at given path. - * @function - * @param {string} filename - * @param {string} toAppend - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.appendFileAsync - * @async - */ -const appendFileAsync = async (filename, toAppend, options) => { - // Options do not matter in browser setup - try { - const contents = (await store.getItem(filename)) || '' - await store.setItem(filename, contents + toAppend) - } catch (error) { - console.warn('An error happened appending to file writing, skip') - } -} - -/** - * Read data at given path. - * @function - * @param {string} filename - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.readFileAsync - * @async - */ -const readFileAsync = async (filename, options) => { - try { - return (await store.getItem(filename)) || '' - } catch (error) { - console.warn('An error happened while reading, skip') - return '' - } -} - -/** - * Async version of {@link module:storageBrowser.unlink}. - * @function - * @param {string} filename - * @return {Promise} - * @async - * @alias module:storageBrowser.unlink - */ -const unlinkAsync = async filename => { - try { - await store.removeItem(filename) - } catch (error) { - console.warn('An error happened while unlinking, skip') - } -} - -/** - * Shim for {@link module:storage.mkdirAsync}, nothing to do, no directories will be used on the browser. - * @function - * @param {string} path - * @param {object} [options] - * @return {Promise} - * @alias module:storageBrowser.mkdirAsync - * @async - */ -const mkdirAsync = (path, options) => Promise.resolve() - -/** - * Shim for {@link module:storage.ensureParentDirectoryExistsAsync}, nothing to do, no directories will be used on the browser. - * @function - * @param {string} file - * @param {number} [mode] - * @return {Promise} - * @alias module:storageBrowser.ensureParentDirectoryExistsAsync - * @async - */ -const ensureParentDirectoryExistsAsync = async (file, mode) => Promise.resolve() - -/** - * Shim for {@link module:storage.ensureDatafileIntegrityAsync}, nothing to do, no data corruption possible in the browser. - * @param {string} filename - * @return {Promise} - * @alias module:storageBrowser.ensureDatafileIntegrityAsync - */ -const ensureDatafileIntegrityAsync = (filename) => Promise.resolve() - -/** - * Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost) - * * @param {string} filename - * @param {string[]} lines - * @return {Promise} - * @alias module:storageBrowser.crashSafeWriteFileLinesAsync - */ -const crashSafeWriteFileLinesAsync = async (filename, lines) => { - lines.push('') // Add final new line - await writeFileAsync(filename, lines.join('\n')) -} - -// Interface -module.exports.existsAsync = existsAsync - -module.exports.renameAsync = renameAsync - -module.exports.writeFileAsync = writeFileAsync - -module.exports.crashSafeWriteFileLinesAsync = crashSafeWriteFileLinesAsync - -module.exports.appendFileAsync = appendFileAsync - -module.exports.readFileAsync = readFileAsync - -module.exports.unlinkAsync = unlinkAsync - -module.exports.mkdirAsync = mkdirAsync - -module.exports.ensureDatafileIntegrityAsync = ensureDatafileIntegrityAsync - -module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync - - -/***/ }), - -/***/ 578: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const model = __webpack_require__(118) -const { callbackify } = __webpack_require__(539) - -/** - * Has a callback - * @callback Cursor~mapFn - * @param {document[]} res - * @return {*|Promise<*>} - */ - -/** - * Manage access to data, be it to find, update or remove it. - * - * It extends `Promise` so that its methods (which return `this`) are chainable & awaitable. - * @extends Promise - */ -class Cursor { - /** - * Create a new cursor for this collection. - * @param {Datastore} db - The datastore this cursor is bound to - * @param {query} query - The query this cursor will operate on - * @param {Cursor~mapFn} [mapFn] - Handler to be executed after cursor has found the results and before the callback passed to find/findOne/update/remove - */ - constructor (db, query, mapFn) { - /** - * @protected - * @type {Datastore} - */ - this.db = db - /** - * @protected - * @type {query} - */ - this.query = query || {} - /** - * The handler to be executed after cursor has found the results. - * @type {Cursor~mapFn} - * @protected - */ - if (mapFn) this.mapFn = mapFn - /** - * @see Cursor#limit - * @type {undefined|number} - * @private - */ - this._limit = undefined - /** - * @see Cursor#skip - * @type {undefined|number} - * @private - */ - this._skip = undefined - /** - * @see Cursor#sort - * @type {undefined|Object.} - * @private - */ - this._sort = undefined - /** - * @see Cursor#projection - * @type {undefined|Object.} - * @private - */ - this._projection = undefined - } - - /** - * Set a limit to the number of results for the given Cursor. - * @param {Number} limit - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - limit (limit) { - this._limit = limit - return this - } - - /** - * Skip a number of results for the given Cursor. - * @param {Number} skip - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - skip (skip) { - this._skip = skip - return this - } - - /** - * Sort results of the query for the given Cursor. - * @param {Object.} sortQuery - sortQuery is { field: order }, field can use the dot-notation, order is 1 for ascending and -1 for descending - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - sort (sortQuery) { - this._sort = sortQuery - return this - } - - /** - * Add the use of a projection to the given Cursor. - * @param {Object.} projection - MongoDB-style projection. {} means take all fields. Then it's { key1: 1, key2: 1 } to take only key1 and key2 - * { key1: 0, key2: 0 } to omit only key1 and key2. Except _id, you can't mix takes and omits. - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - projection (projection) { - this._projection = projection - return this - } - - /** - * Apply the projection. - * - * This is an internal function. You should use {@link Cursor#execAsync} or {@link Cursor#exec}. - * @param {document[]} candidates - * @return {document[]} - * @private - */ - _project (candidates) { - const res = [] - let action - - if (this._projection === undefined || Object.keys(this._projection).length === 0) { - return candidates - } - - const keepId = this._projection._id !== 0 - const { _id, ...rest } = this._projection - this._projection = rest - - // Check for consistency - const keys = Object.keys(this._projection) - keys.forEach(k => { - if (action !== undefined && this._projection[k] !== action) throw new Error('Can\'t both keep and omit fields except for _id') - action = this._projection[k] - }) - - // Do the actual projection - candidates.forEach(candidate => { - let toPush - if (action === 1) { // pick-type projection - toPush = { $set: {} } - keys.forEach(k => { - toPush.$set[k] = model.getDotValue(candidate, k) - if (toPush.$set[k] === undefined) delete toPush.$set[k] - }) - toPush = model.modify({}, toPush) - } else { // omit-type projection - toPush = { $unset: {} } - keys.forEach(k => { toPush.$unset[k] = true }) - toPush = model.modify(candidate, toPush) - } - if (keepId) toPush._id = candidate._id - else delete toPush._id - res.push(toPush) - }) - - return res - } - - /** - * Get all matching elements - * Will return pointers to matched elements (shallow copies), returning full copies is the role of find or findOne - * This is an internal function, use execAsync which uses the executor - * @return {document[]|Promise<*>} - * @private - */ - async _execAsync () { - let res = [] - let added = 0 - let skipped = 0 - - const candidates = await this.db._getCandidatesAsync(this.query) - - for (const candidate of candidates) { - if (model.match(candidate, this.query)) { - // If a sort is defined, wait for the results to be sorted before applying limit and skip - if (!this._sort) { - if (this._skip && this._skip > skipped) skipped += 1 - else { - res.push(candidate) - added += 1 - if (this._limit && this._limit <= added) break - } - } else res.push(candidate) - } - } - - // Apply all sorts - if (this._sort) { - // Sorting - const criteria = Object.entries(this._sort).map(([key, direction]) => ({ key, direction })) - res.sort((a, b) => { - for (const criterion of criteria) { - const compare = criterion.direction * model.compareThings(model.getDotValue(a, criterion.key), model.getDotValue(b, criterion.key), this.db.compareStrings) - if (compare !== 0) return compare - } - return 0 - }) - - // Applying limit and skip - const limit = this._limit || res.length - const skip = this._skip || 0 - - res = res.slice(skip, skip + limit) - } - - // Apply projection - res = this._project(res) - if (this.mapFn) return this.mapFn(res) - return res - } - - /** - * @callback Cursor~execCallback - * @param {Error} err - * @param {document[]|*} res If a mapFn was given to the Cursor, then the type of this parameter is the one returned by the mapFn. - */ - - /** - * Callback version of {@link Cursor#exec}. - * @param {Cursor~execCallback} _callback - * @see Cursor#execAsync - */ - exec (_callback) { - callbackify(() => this.execAsync())(_callback) - } - - /** - * Get all matching elements. - * Will return pointers to matched elements (shallow copies), returning full copies is the role of {@link Datastore#findAsync} or {@link Datastore#findOneAsync}. - * @return {Promise} - * @async - */ - execAsync () { - return this.db.executor.pushAsync(() => this._execAsync()) - } - - then (onFulfilled, onRejected) { - return this.execAsync().then(onFulfilled, onRejected) - } - - catch (onRejected) { - return this.execAsync().catch(onRejected) - } - - finally (onFinally) { - return this.execAsync().finally(onFinally) - } -} - -// Interface -module.exports = Cursor - - -/***/ }), - -/***/ 797: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const { EventEmitter } = __webpack_require__(187) -const { callbackify, deprecate } = __webpack_require__(539) -const Cursor = __webpack_require__(578) -const customUtils = __webpack_require__(159) -const Executor = __webpack_require__(196) -const Index = __webpack_require__(98) -const model = __webpack_require__(118) -const Persistence = __webpack_require__(328) -const { isDate, pick, filterIndexNames } = __webpack_require__(988) - -/** - * Callback with no parameter - * @callback NoParamCallback - * @param {?Error} err - */ - -/** - * String comparison function. - * ``` - * if (a < b) return -1 - * if (a > b) return 1 - * return 0 - * ``` - * @callback compareStrings - * @param {string} a - * @param {string} b - * @return {number} - */ - -/** - * Callback that returns an Array of documents. - * @callback MultipleDocumentsCallback - * @param {?Error} err - * @param {?document[]} docs - */ - -/** - * Callback that returns a single document. - * @callback SingleDocumentCallback - * @param {?Error} err - * @param {?document} docs - */ - -/** - * Generic async function. - * @callback AsyncFunction - * @param {...*} args - * @return {Promise<*>} - */ - -/** - * Callback with generic parameters. - * @callback GenericCallback - * @param {?Error} err - * @param {...*} args - */ - -/** - * Compaction event. Happens when the Datastore's Persistence has been compacted. - * It happens when calling {@link Datastore#compactDatafileAsync}, which is called periodically if you have called - * {@link Datastore#setAutocompactionInterval}. - * - * @event Datastore#event:"compaction.done" - * @type {undefined} - */ - -/** - * Generic document in NeDB. - * It consists of an Object with anything you want inside. - * @typedef document - * @property {?string} [_id] Internal `_id` of the document, which can be `null` or undefined at some points (when not - * inserted yet for example). - * @type {object} - */ - -/** - * Nedb query. - * - * Each key of a query references a field name, which can use the dot-notation to reference subfields inside nested - * documents, arrays, arrays of subdocuments and to match a specific element of an array. - * - * Each value of a query can be one of the following: - * - `string`: matches all documents which have this string as value for the referenced field name - * - `number`: matches all documents which have this number as value for the referenced field name - * - `Regexp`: matches all documents which have a value that matches the given `Regexp` for the referenced field name - * - `object`: matches all documents which have this object as deep-value for the referenced field name - * - Comparison operators: the syntax is `{ field: { $op: value } }` where `$op` is any comparison operator: - * - `$lt`, `$lte`: less than, less than or equal - * - `$gt`, `$gte`: greater than, greater than or equal - * - `$in`: member of. `value` must be an array of values - * - `$ne`, `$nin`: not equal, not a member of - * - `$exists`: checks whether the document posses the property `field`. `value` should be true or false - * - `$regex`: checks whether a string is matched by the regular expression. Contrary to MongoDB, the use of - * `$options` with `$regex` is not supported, because it doesn't give you more power than regex flags. Basic - * queries are more readable so only use the `$regex` operator when you need to use another operator with it - * - `$size`: if the referenced filed is an Array, matches on the size of the array - * - `$elemMatch`: matches if at least one array element matches the sub-query entirely - * - Logical operators: You can combine queries using logical operators: - * - For `$or` and `$and`, the syntax is `{ $op: [query1, query2, ...] }`. - * - For `$not`, the syntax is `{ $not: query }` - * - For `$where`, the syntax is: - * ``` - * { $where: function () { - * // object is 'this' - * // return a boolean - * } } - * ``` - * @typedef query - * @type {Object.} - */ - -/** - * Nedb projection. - * - * You can give `find` and `findOne` an optional second argument, `projections`. - * The syntax is the same as MongoDB: `{ a: 1, b: 1 }` to return only the `a` - * and `b` fields, `{ a: 0, b: 0 }` to omit these two fields. You cannot use both - * modes at the time, except for `_id` which is by default always returned and - * which you can choose to omit. You can project on nested documents. - * - * To reference subfields, you can use the dot-notation. - * - * @typedef projection - * @type {Object.} - */ - -/** - * The `beforeDeserialization` and `afterDeserialization` callbacks are hooks which are executed respectively before - * parsing each document and after stringifying them. They can be used for example to encrypt the Datastore. - * The `beforeDeserialization` should revert what `afterDeserialization` has done. - * @callback serializationHook - * @param {string} x - * @return {string} - */ - -/** - * @external EventEmitter - * @see http://nodejs.org/api/events.html - */ - -/** - * @class - * @classdesc The `Datastore` class is the main class of NeDB. - * @extends external:EventEmitter - * @emits Datastore#event:"compaction.done" - * @typicalname NeDB - */ -class Datastore extends EventEmitter { - /** - * Create a new collection, either persistent or in-memory. - * - * If you use a persistent datastore without the `autoload` option, you need to call {@link Datastore#loadDatabase} or - * {@link Datastore#loadDatabaseAsync} manually. This function fetches the data from datafile and prepares the database. - * **Don't forget it!** If you use a persistent datastore, no command (insert, find, update, remove) will be executed - * before it is called, so make sure to call it yourself or use the `autoload` option. - * - * Also, if loading fails, all commands registered to the {@link Datastore#executor} afterwards will not be executed. - * They will be registered and executed, in sequence, only after a successful loading. - * - * @param {object|string} options Can be an object or a string. If options is a string, the behavior is the same as in - * v0.6: it will be interpreted as `options.filename`. **Giving a string is deprecated, and will be removed in the - * next major version.** - * @param {string} [options.filename = null] Path to the file where the data is persisted. If left blank, the datastore is - * automatically considered in-memory only. It cannot end with a `~` which is used in the temporary files NeDB uses to - * perform crash-safe writes. Not used if `options.inMemoryOnly` is `true`. - * @param {boolean} [options.inMemoryOnly = false] If set to true, no data will be written in storage. This option has - * priority over `options.filename`. - * @param {object} [options.modes] Permissions to use for FS. Only used for Node.js storage module. Will not work on Windows. - * @param {number} [options.modes.fileMode = 0o644] Permissions to use for database files - * @param {number} [options.modes.dirMode = 0o755] Permissions to use for database directories - * @param {boolean} [options.timestampData = false] If set to true, createdAt and updatedAt will be created and - * populated automatically (if not specified by user) - * @param {boolean} [options.autoload = false] If used, the database will automatically be loaded from the datafile - * upon creation (you don't need to call `loadDatabase`). Any command issued before load is finished is buffered and - * will be executed when load is done. When autoloading is done, you can either use the `onload` callback, or you can - * use `this.autoloadPromise` which resolves (or rejects) when autloading is done. - * @param {NoParamCallback} [options.onload] If you use autoloading, this is the handler called after the `loadDatabase`. It - * takes one `error` argument. If you use autoloading without specifying this handler, and an error happens during - * load, an error will be thrown. - * @param {serializationHook} [options.beforeDeserialization] Hook you can use to transform data after it was serialized and - * before it is written to disk. Can be used for example to encrypt data before writing database to disk. This - * function takes a string as parameter (one line of an NeDB data file) and outputs the transformed string, **which - * must absolutely not contain a `\n` character** (or data will be lost). - * @param {serializationHook} [options.afterSerialization] Inverse of `afterSerialization`. Make sure to include both and not - * just one, or you risk data loss. For the same reason, make sure both functions are inverses of one another. Some - * failsafe mechanisms are in place to prevent data loss if you misuse the serialization hooks: NeDB checks that never - * one is declared without the other, and checks that they are reverse of one another by testing on random strings of - * various lengths. In addition, if too much data is detected as corrupt, NeDB will refuse to start as it could mean - * you're not using the deserialization hook corresponding to the serialization hook used before. - * @param {number} [options.corruptAlertThreshold = 0.1] Between 0 and 1, defaults to 10%. NeDB will refuse to start - * if more than this percentage of the datafile is corrupt. 0 means you don't tolerate any corruption, 1 means you - * don't care. - * @param {compareStrings} [options.compareStrings] If specified, it overrides default string comparison which is not - * well adapted to non-US characters in particular accented letters. Native `localCompare` will most of the time be - * the right choice. - * @param {boolean} [options.testSerializationHooks=true] Whether to test the serialization hooks or not, - * might be CPU-intensive - */ - constructor (options) { - super() - let filename - - // Retrocompatibility with v0.6 and before - if (typeof options === 'string') { - deprecate(() => { - filename = options - this.inMemoryOnly = false // Default - }, '@seald-io/nedb: Giving a string to the Datastore constructor is deprecated and will be removed in the next major version. Please use an options object with an argument \'filename\'.')() - } else { - options = options || {} - filename = options.filename - /** - * Determines if the `Datastore` keeps data in-memory, or if it saves it in storage. Is not read after - * instanciation. - * @type {boolean} - * @protected - */ - this.inMemoryOnly = options.inMemoryOnly || false - /** - * Determines if the `Datastore` should autoload the database upon instantiation. Is not read after instanciation. - * @type {boolean} - * @protected - */ - this.autoload = options.autoload || false - /** - * Determines if the `Datastore` should add `createdAt` and `updatedAt` fields automatically if not set by the user. - * @type {boolean} - * @protected - */ - this.timestampData = options.timestampData || false - } - - // Determine whether in memory or persistent - if (!filename || typeof filename !== 'string' || filename.length === 0) { - /** - * If null, it means `inMemoryOnly` is `true`. The `filename` is the name given to the storage module. Is not read - * after instanciation. - * @type {?string} - * @protected - */ - this.filename = null - this.inMemoryOnly = true - } else { - this.filename = filename - } - - // String comparison function - /** - * Overrides default string comparison which is not well adapted to non-US characters in particular accented - * letters. Native `localCompare` will most of the time be the right choice - * @type {compareStrings} - * @function - * @protected - */ - this.compareStrings = options.compareStrings - - // Persistence handling - /** - * The `Persistence` instance for this `Datastore`. - * @type {Persistence} - */ - this.persistence = new Persistence({ - db: this, - afterSerialization: options.afterSerialization, - beforeDeserialization: options.beforeDeserialization, - corruptAlertThreshold: options.corruptAlertThreshold, - modes: options.modes, - testSerializationHooks: options.testSerializationHooks - }) - - // This new executor is ready if we don't use persistence - // If we do, it will only be ready once loadDatabase is called - /** - * The `Executor` instance for this `Datastore`. It is used in all methods exposed by the {@link Datastore}, - * any {@link Cursor} produced by the `Datastore` and by {@link Datastore#compactDatafileAsync} to ensure operations - * are performed sequentially in the database. - * @type {Executor} - * @protected - */ - this.executor = new Executor() - if (this.inMemoryOnly) this.executor.ready = true - - /** - * Indexed by field name, dot notation can be used. - * _id is always indexed and since _ids are generated randomly the underlying binary search tree is always well-balanced - * @type {Object.} - * @protected - */ - this.indexes = {} - this.indexes._id = new Index({ fieldName: '_id', unique: true }) - /** - * Stores the time to live (TTL) of the indexes created. The key represents the field name, the value the number of - * seconds after which data with this index field should be removed. - * @type {Object.} - * @protected - */ - this.ttlIndexes = {} - - // Queue a load of the database right away and call the onload handler - // By default (no onload handler), if there is an error there, no operation will be possible so warn the user by throwing an exception - if (this.autoload) { - /** - * A Promise that resolves when the autoload has finished. - * - * The onload callback is not awaited by this Promise, it is started immediately after that. - * @type {?Promise} - */ - this.autoloadPromise = this.loadDatabaseAsync() - this.autoloadPromise - .then(() => { - if (options.onload) options.onload() - }, err => { - if (options.onload) options.onload(err) - else throw err - }) - } else this.autoloadPromise = null - /** - * Interval if {@link Datastore#setAutocompactionInterval} was called. - * @private - * @type {null|number} - */ - this._autocompactionIntervalId = null - } - - /** - * Queue a compaction/rewrite of the datafile. - * It works by rewriting the database file, and compacts it since the cache always contains only the number of - * documents in the collection while the data file is append-only so it may grow larger. - * - * @async - */ - compactDatafileAsync () { - return this.executor.pushAsync(() => this.persistence.persistCachedDatabaseAsync()) - } - - /** - * Callback version of {@link Datastore#compactDatafileAsync}. - * @param {NoParamCallback} [callback = () => {}] - * @see Datastore#compactDatafileAsync - */ - compactDatafile (callback) { - const promise = this.compactDatafileAsync() - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Set automatic compaction every `interval` ms - * @param {Number} interval in milliseconds, with an enforced minimum of 5000 milliseconds - */ - setAutocompactionInterval (interval) { - const minInterval = 5000 - if (Number.isNaN(Number(interval))) throw new Error('Interval must be a non-NaN number') - const realInterval = Math.max(Number(interval), minInterval) - - this.stopAutocompaction() - - this._autocompactionIntervalId = setInterval(() => { - this.compactDatafile() - }, realInterval) - } - - /** - * Stop autocompaction (do nothing if automatic compaction was not running) - */ - stopAutocompaction () { - if (this._autocompactionIntervalId) { - clearInterval(this._autocompactionIntervalId) - this._autocompactionIntervalId = null - } - } - - /** - * Callback version of {@link Datastore#loadDatabaseAsync}. - * @param {NoParamCallback} [callback] - * @see Datastore#loadDatabaseAsync - */ - loadDatabase (callback) { - const promise = this.loadDatabaseAsync() - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Stops auto-compaction, finishes all queued operations, drops the database both in memory and in storage. - * **WARNING**: it is not recommended re-using an instance of NeDB if its database has been dropped, it is - * preferable to instantiate a new one. - * @async - * @return {Promise} - */ - dropDatabaseAsync () { - return this.persistence.dropDatabaseAsync() // the executor is exceptionally used by Persistence - } - - /** - * Callback version of {@link Datastore#dropDatabaseAsync}. - * @param {NoParamCallback} [callback] - * @see Datastore#dropDatabaseAsync - */ - dropDatabase (callback) { - const promise = this.dropDatabaseAsync() - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Load the database from the datafile, and trigger the execution of buffered commands if any. - * @async - * @return {Promise} - */ - loadDatabaseAsync () { - return this.executor.pushAsync(() => this.persistence.loadDatabaseAsync(), true) - } - - /** - * Get an array of all the data in the database. - * @return {document[]} - */ - getAllData () { - return this.indexes._id.getAll() - } - - /** - * Reset all currently defined indexes. - * @param {?document|?document[]} [newData] - * @private - */ - _resetIndexes (newData) { - for (const index of Object.values(this.indexes)) { - index.reset(newData) - } - } - - /** - * Callback version of {@link Datastore#ensureIndex}. - * @param {object} options - * @param {string|string[]} options.fieldName - * @param {boolean} [options.unique = false] - * @param {boolean} [options.sparse = false] - * @param {number} [options.expireAfterSeconds] - * @param {NoParamCallback} [callback] - * @see Datastore#ensureIndex - */ - ensureIndex (options = {}, callback) { - const promise = this.ensureIndexAsync(options) // to make sure the synchronous part of ensureIndexAsync is executed synchronously - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Ensure an index is kept for this field. Same parameters as lib/indexes - * This function acts synchronously on the indexes, however the persistence of the indexes is deferred with the - * executor. - * @param {object} options - * @param {string|string[]} options.fieldName Name of the field to index. Use the dot notation to index a field in a nested - * document. For a compound index, use an array of field names. Using a comma in a field name is not permitted. - * @param {boolean} [options.unique = false] Enforce field uniqueness. Note that a unique index will raise an error - * if you try to index two documents for which the field is not defined. - * @param {boolean} [options.sparse = false] Don't index documents for which the field is not defined. Use this option - * along with "unique" if you want to accept multiple documents for which it is not defined. - * @param {number} [options.expireAfterSeconds] - If set, the created index is a TTL (time to live) index, that will - * automatically remove documents when the system date becomes larger than the date on the indexed field plus - * `expireAfterSeconds`. Documents where the indexed field is not specified or not a `Date` object are ignored. - * @return {Promise} - */ - async ensureIndexAsync (options = {}) { - if (!options.fieldName) { - const err = new Error('Cannot create an index without a fieldName') - err.missingFieldName = true - throw err - } - - const _fields = [].concat(options.fieldName).sort() - - if (_fields.some(field => field.includes(','))) { - throw new Error('Cannot use comma in index fieldName') - } - - const _options = { - ...options, - fieldName: _fields.join(',') - } - - if (this.indexes[_options.fieldName]) return - - this.indexes[_options.fieldName] = new Index(_options) - if (options.expireAfterSeconds !== undefined) this.ttlIndexes[_options.fieldName] = _options.expireAfterSeconds // With this implementation index creation is not necessary to ensure TTL but we stick with MongoDB's API here - - try { - this.indexes[_options.fieldName].insert(this.getAllData()) - } catch (e) { - delete this.indexes[_options.fieldName] - throw e - } - - // We may want to force all options to be persisted including defaults, not just the ones passed the index creation function - await this.executor.pushAsync(() => this.persistence.persistNewStateAsync([{ $$indexCreated: _options }]), true) - } - - /** - * Callback version of {@link Datastore#removeIndexAsync}. - * @param {string} fieldName - * @param {NoParamCallback} [callback] - * @see Datastore#removeIndexAsync - */ - removeIndex (fieldName, callback = () => {}) { - const promise = this.removeIndexAsync(fieldName) - callbackify(() => promise)(callback) - } - - /** - * Remove an index. - * @param {string} fieldName Field name of the index to remove. Use the dot notation to remove an index referring to a - * field in a nested document. - * @return {Promise} - * @see Datastore#removeIndex - */ - async removeIndexAsync (fieldName) { - delete this.indexes[fieldName] - - await this.executor.pushAsync(() => this.persistence.persistNewStateAsync([{ $$indexRemoved: fieldName }]), true) - } - - /** - * Add one or several document(s) to all indexes. - * - * This is an internal function. - * @param {document} doc - * @private - */ - _addToIndexes (doc) { - let failingIndex - let error - const keys = Object.keys(this.indexes) - - for (let i = 0; i < keys.length; i += 1) { - try { - this.indexes[keys[i]].insert(doc) - } catch (e) { - failingIndex = i - error = e - break - } - } - - // If an error happened, we need to rollback the insert on all other indexes - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.indexes[keys[i]].remove(doc) - } - - throw error - } - } - - /** - * Remove one or several document(s) from all indexes. - * - * This is an internal function. - * @param {document} doc - * @private - */ - _removeFromIndexes (doc) { - for (const index of Object.values(this.indexes)) { - index.remove(doc) - } - } - - /** - * Update one or several documents in all indexes. - * - * To update multiple documents, oldDoc must be an array of { oldDoc, newDoc } pairs. - * - * If one update violates a constraint, all changes are rolled back. - * - * This is an internal function. - * @param {document|Array.<{oldDoc: document, newDoc: document}>} oldDoc Document to update, or an `Array` of - * `{oldDoc, newDoc}` pairs. - * @param {document} [newDoc] Document to replace the oldDoc with. If the first argument is an `Array` of - * `{oldDoc, newDoc}` pairs, this second argument is ignored. - * @private - */ - _updateIndexes (oldDoc, newDoc) { - let failingIndex - let error - const keys = Object.keys(this.indexes) - - for (let i = 0; i < keys.length; i += 1) { - try { - this.indexes[keys[i]].update(oldDoc, newDoc) - } catch (e) { - failingIndex = i - error = e - break - } - } - - // If an error happened, we need to rollback the update on all other indexes - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.indexes[keys[i]].revertUpdate(oldDoc, newDoc) - } - - throw error - } - } - - /** - * Get all candidate documents matching the query, regardless of their expiry status. - * @param {query} query - * @return {document[]} - * - * @private - */ - _getRawCandidates (query) { - const indexNames = Object.keys(this.indexes) - - // STEP 1: get candidates list by checking indexes from most to least frequent usecase - // For a basic match - - let usableQuery - usableQuery = Object.entries(query) - .filter(filterIndexNames(indexNames)) - .pop() - if (usableQuery) return this.indexes[usableQuery[0]].getMatching(usableQuery[1]) - - // For a compound match - const compoundQueryKeys = indexNames - .filter(indexName => indexName.indexOf(',') !== -1) - .map(indexName => indexName.split(',')) - .filter(subIndexNames => - Object.entries(query) - .filter(filterIndexNames(subIndexNames)).length === subIndexNames.length - ) - - if (compoundQueryKeys.length > 0) return this.indexes[compoundQueryKeys[0]].getMatching(pick(query, compoundQueryKeys[0])) - - // For a $in match - usableQuery = Object.entries(query) - .filter(([k, v]) => - !!(query[k] && Object.prototype.hasOwnProperty.call(query[k], '$in')) && - indexNames.includes(k) - ) - .pop() - if (usableQuery) return this.indexes[usableQuery[0]].getMatching(usableQuery[1].$in) - // For a comparison match - usableQuery = Object.entries(query) - .filter(([k, v]) => - !!(query[k] && (Object.prototype.hasOwnProperty.call(query[k], '$lt') || Object.prototype.hasOwnProperty.call(query[k], '$lte') || Object.prototype.hasOwnProperty.call(query[k], '$gt') || Object.prototype.hasOwnProperty.call(query[k], '$gte'))) && - indexNames.includes(k) - ) - .pop() - if (usableQuery) return this.indexes[usableQuery[0]].getBetweenBounds(usableQuery[1]) - // By default, return all the DB data - return this.getAllData() - } - - /** - * Return the list of candidates for a given query - * Crude implementation for now, we return the candidates given by the first usable index if any - * We try the following query types, in this order: basic match, $in match, comparison match - * One way to make it better would be to enable the use of multiple indexes if the first usable index - * returns too much data. I may do it in the future. - * - * Returned candidates will be scanned to find and remove all expired documents - * - * This is an internal function. - * @param {query} query - * @param {boolean} [dontExpireStaleDocs = false] If true don't remove stale docs. Useful for the remove function - * which shouldn't be impacted by expirations. - * @return {Promise} candidates - * @private - */ - async _getCandidatesAsync (query, dontExpireStaleDocs = false) { - const validDocs = [] - - // STEP 1: get candidates list by checking indexes from most to least frequent usecase - const docs = this._getRawCandidates(query) - // STEP 2: remove all expired documents - if (!dontExpireStaleDocs) { - const expiredDocsIds = [] - const ttlIndexesFieldNames = Object.keys(this.ttlIndexes) - - docs.forEach(doc => { - if (ttlIndexesFieldNames.every(i => !(doc[i] !== undefined && isDate(doc[i]) && Date.now() > doc[i].getTime() + this.ttlIndexes[i] * 1000))) validDocs.push(doc) - else expiredDocsIds.push(doc._id) - }) - for (const _id of expiredDocsIds) { - await this._removeAsync({ _id }, {}) - } - } else validDocs.push(...docs) - return validDocs - } - - /** - * Insert a new document - * This is an internal function, use {@link Datastore#insertAsync} which has the same signature. - * @param {document|document[]} newDoc - * @return {Promise} - * @private - */ - async _insertAsync (newDoc) { - const preparedDoc = this._prepareDocumentForInsertion(newDoc) - this._insertInCache(preparedDoc) - - await this.persistence.persistNewStateAsync(Array.isArray(preparedDoc) ? preparedDoc : [preparedDoc]) - return model.deepCopy(preparedDoc) - } - - /** - * Create a new _id that's not already in use - * @return {string} id - * @private - */ - _createNewId () { - let attemptId = customUtils.uid(16) - // Try as many times as needed to get an unused _id. As explained in customUtils, the probability of this ever happening is extremely small, so this is O(1) - if (this.indexes._id.getMatching(attemptId).length > 0) attemptId = this._createNewId() - return attemptId - } - - /** - * Prepare a document (or array of documents) to be inserted in a database - * Meaning adds _id and timestamps if necessary on a copy of newDoc to avoid any side effect on user input - * @param {document|document[]} newDoc document, or Array of documents, to prepare - * @return {document|document[]} prepared document, or Array of prepared documents - * @private - */ - _prepareDocumentForInsertion (newDoc) { - let preparedDoc - - if (Array.isArray(newDoc)) { - preparedDoc = [] - newDoc.forEach(doc => { preparedDoc.push(this._prepareDocumentForInsertion(doc)) }) - } else { - preparedDoc = model.deepCopy(newDoc) - if (preparedDoc._id === undefined) preparedDoc._id = this._createNewId() - const now = new Date() - if (this.timestampData && preparedDoc.createdAt === undefined) preparedDoc.createdAt = now - if (this.timestampData && preparedDoc.updatedAt === undefined) preparedDoc.updatedAt = now - model.checkObject(preparedDoc) - } - - return preparedDoc - } - - /** - * If newDoc is an array of documents, this will insert all documents in the cache - * @param {document|document[]} preparedDoc - * @private - */ - _insertInCache (preparedDoc) { - if (Array.isArray(preparedDoc)) this._insertMultipleDocsInCache(preparedDoc) - else this._addToIndexes(preparedDoc) - } - - /** - * If one insertion fails (e.g. because of a unique constraint), roll back all previous - * inserts and throws the error - * @param {document[]} preparedDocs - * @private - */ - _insertMultipleDocsInCache (preparedDocs) { - let failingIndex - let error - - for (let i = 0; i < preparedDocs.length; i += 1) { - try { - this._addToIndexes(preparedDocs[i]) - } catch (e) { - error = e - failingIndex = i - break - } - } - - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this._removeFromIndexes(preparedDocs[i]) - } - - throw error - } - } - - /** - * Callback version of {@link Datastore#insertAsync}. - * @param {document|document[]} newDoc - * @param {SingleDocumentCallback|MultipleDocumentsCallback} [callback] - * @see Datastore#insertAsync - */ - insert (newDoc, callback) { - const promise = this.insertAsync(newDoc) - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Insert a new document, or new documents. - * @param {document|document[]} newDoc Document or array of documents to insert. - * @return {Promise} The document(s) inserted. - * @async - */ - insertAsync (newDoc) { - return this.executor.pushAsync(() => this._insertAsync(newDoc)) - } - - /** - * Callback for {@link Datastore#countCallback}. - * @callback Datastore~countCallback - * @param {?Error} err - * @param {?number} count - */ - - /** - * Callback-version of {@link Datastore#countAsync}. - * @param {query} query - * @param {Datastore~countCallback} [callback] - * @return {Cursor|undefined} - * @see Datastore#countAsync - */ - count (query, callback) { - const cursor = this.countAsync(query) - - if (typeof callback === 'function') callbackify(cursor.execAsync.bind(cursor))(callback) - else return cursor - } - - /** - * Count all documents matching the query. - * @param {query} query MongoDB-style query - * @return {Cursor} count - * @async - */ - countAsync (query) { - return new Cursor(this, query, docs => docs.length) - } - - /** - * Callback version of {@link Datastore#findAsync}. - * @param {query} query - * @param {projection|MultipleDocumentsCallback} [projection = {}] - * @param {MultipleDocumentsCallback} [callback] - * @return {Cursor|undefined} - * @see Datastore#findAsync - */ - find (query, projection, callback) { - if (arguments.length === 1) { - projection = {} - // callback is undefined, will return a cursor - } else if (arguments.length === 2) { - if (typeof projection === 'function') { - callback = projection - projection = {} - } // If not assume projection is an object and callback undefined - } - - const cursor = this.findAsync(query, projection) - - if (typeof callback === 'function') callbackify(cursor.execAsync.bind(cursor))(callback) - else return cursor - } - - /** - * Find all documents matching the query. - * We return the {@link Cursor} that the user can either `await` directly or use to can {@link Cursor#limit} or - * {@link Cursor#skip} before. - * @param {query} query MongoDB-style query - * @param {projection} [projection = {}] MongoDB-style projection - * @return {Cursor} - * @async - */ - findAsync (query, projection = {}) { - const cursor = new Cursor(this, query, docs => docs.map(doc => model.deepCopy(doc))) - - cursor.projection(projection) - return cursor - } - - /** - * @callback Datastore~findOneCallback - * @param {?Error} err - * @param {document} doc - */ - - /** - * Callback version of {@link Datastore#findOneAsync}. - * @param {query} query - * @param {projection|SingleDocumentCallback} [projection = {}] - * @param {SingleDocumentCallback} [callback] - * @return {Cursor|undefined} - * @see Datastore#findOneAsync - */ - findOne (query, projection, callback) { - if (arguments.length === 1) { - projection = {} - // callback is undefined, will return a cursor - } else if (arguments.length === 2) { - if (typeof projection === 'function') { - callback = projection - projection = {} - } // If not assume projection is an object and callback undefined - } - - const cursor = this.findOneAsync(query, projection) - - if (typeof callback === 'function') callbackify(cursor.execAsync.bind(cursor))(callback) - else return cursor - } - - /** - * Find one document matching the query. - * We return the {@link Cursor} that the user can either `await` directly or use to can {@link Cursor#skip} before. - * @param {query} query MongoDB-style query - * @param {projection} projection MongoDB-style projection - * @return {Cursor} - */ - findOneAsync (query, projection = {}) { - const cursor = new Cursor(this, query, docs => docs.length === 1 ? model.deepCopy(docs[0]) : null) - - cursor.projection(projection).limit(1) - return cursor - } - - /** - * See {@link Datastore#updateAsync} return type for the definition of the callback parameters. - * - * **WARNING:** Prior to 3.0.0, `upsert` was either `true` of falsy (but not `false`), it is now always a boolean. - * `affectedDocuments` could be `undefined` when `returnUpdatedDocs` was `false`, it is now `null` in these cases. - * - * **WARNING:** Prior to 1.8.0, the `upsert` argument was not given, it was impossible for the developer to determine - * during a `{ multi: false, returnUpdatedDocs: true, upsert: true }` update if it inserted a document or just updated - * it. - * - * @callback Datastore~updateCallback - * @param {?Error} err - * @param {number} numAffected - * @param {?document[]|?document} affectedDocuments - * @param {boolean} upsert - * @see {Datastore#updateAsync} - */ - - /** - * Version without the using {@link Datastore~executor} of {@link Datastore#updateAsync}, use it instead. - * - * @param {query} query - * @param {document|update} update - * @param {Object} options - * @param {boolean} [options.multi = false] - * @param {boolean} [options.upsert = false] - * @param {boolean} [options.returnUpdatedDocs = false] - * @return {Promise<{numAffected: number, affectedDocuments: document[]|document|null, upsert: boolean}>} - * @private - * @see Datastore#updateAsync - */ - async _updateAsync (query, update, options) { - const multi = options.multi !== undefined ? options.multi : false - const upsert = options.upsert !== undefined ? options.upsert : false - - // If upsert option is set, check whether we need to insert the doc - if (upsert) { - const cursor = new Cursor(this, query) - - // Need to use an internal function not tied to the executor to avoid deadlock - const docs = await cursor.limit(1)._execAsync() - - if (docs.length !== 1) { - let toBeInserted - - try { - model.checkObject(update) - // updateQuery is a simple object with no modifier, use it as the document to insert - toBeInserted = update - } catch (e) { - // updateQuery contains modifiers, use the find query as the base, - // strip it from all operators and update it according to updateQuery - toBeInserted = model.modify(model.deepCopy(query, true), update) - } - const newDoc = await this._insertAsync(toBeInserted) - return { numAffected: 1, affectedDocuments: newDoc, upsert: true } - } - } - // Perform the update - let numReplaced = 0 - let modifiedDoc - const modifications = [] - let createdAt - - const candidates = await this._getCandidatesAsync(query) - // Preparing update (if an error is thrown here neither the datafile nor - // the in-memory indexes are affected) - for (const candidate of candidates) { - if (model.match(candidate, query) && (multi || numReplaced === 0)) { - numReplaced += 1 - if (this.timestampData) { createdAt = candidate.createdAt } - modifiedDoc = model.modify(candidate, update) - if (this.timestampData) { - modifiedDoc.createdAt = createdAt - modifiedDoc.updatedAt = new Date() - } - modifications.push({ oldDoc: candidate, newDoc: modifiedDoc }) - } - } - - // Change the docs in memory - this._updateIndexes(modifications) - - // Update the datafile - const updatedDocs = modifications.map(x => x.newDoc) - await this.persistence.persistNewStateAsync(updatedDocs) - if (!options.returnUpdatedDocs) return { numAffected: numReplaced, upsert: false, affectedDocuments: null } - else { - let updatedDocsDC = [] - updatedDocs.forEach(doc => { updatedDocsDC.push(model.deepCopy(doc)) }) - if (!multi) updatedDocsDC = updatedDocsDC[0] - return { numAffected: numReplaced, affectedDocuments: updatedDocsDC, upsert: false } - } - } - - /** - * Callback version of {@link Datastore#updateAsync}. - * @param {query} query - * @param {document|*} update - * @param {Object|Datastore~updateCallback} [options|] - * @param {boolean} [options.multi = false] - * @param {boolean} [options.upsert = false] - * @param {boolean} [options.returnUpdatedDocs = false] - * @param {Datastore~updateCallback} [callback] - * @see Datastore#updateAsync - * - */ - update (query, update, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } - const _callback = (err, res = {}) => { - if (callback) callback(err, res.numAffected, res.affectedDocuments, res.upsert) - } - callbackify((query, update, options) => this.updateAsync(query, update, options))(query, update, options, _callback) - } - - /** - * Update all docs matching query. - * @param {query} query is the same kind of finding query you use with `find` and `findOne`. - * @param {document|*} update specifies how the documents should be modified. It is either a new document or a - * set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the - * matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can - * apply them to subdocs. Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, - * `$inc` to increment a field's value and `$min`/`$max` to change field's value, only if provided value is - * less/greater than current value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special - * `$each` and `$slice`. - * @param {Object} [options = {}] Optional options - * @param {boolean} [options.multi = false] If true, can update multiple documents - * @param {boolean} [options.upsert = false] If true, can insert a new document corresponding to the `update` rules if - * your `query` doesn't match anything. If your `update` is a simple object with no modifiers, it is the inserted - * document. In the other case, the `query` is stripped from all operator recursively, and the `update` is applied to - * it. - * @param {boolean} [options.returnUpdatedDocs = false] (not Mongo-DB compatible) If true and update is not an upsert, - * will return the array of documents matched by the find query and updated. Updated documents will be returned even - * if the update did not actually modify them. - * @return {Promise<{numAffected: number, affectedDocuments: document[]|document|null, upsert: boolean}>} - * - `upsert` is `true` if and only if the update did insert a document, **cannot be true if `options.upsert !== true`**. - * - `numAffected` is the number of documents affected by the update or insertion (if `options.multi` is `false` or `options.upsert` is `true`, cannot exceed `1`); - * - `affectedDocuments` can be one of the following: - * - If `upsert` is `true`, the inserted document; - * - If `options.returnUpdatedDocs` is `false`, `null`; - * - If `options.returnUpdatedDocs` is `true`: - * - If `options.multi` is `false`, the updated document; - * - If `options.multi` is `true`, the array of updated documents. - * @async - */ - updateAsync (query, update, options = {}) { - return this.executor.pushAsync(() => this._updateAsync(query, update, options)) - } - - /** - * @callback Datastore~removeCallback - * @param {?Error} err - * @param {?number} numRemoved - */ - - /** - * Internal version without using the {@link Datastore#executor} of {@link Datastore#removeAsync}, use it instead. - * - * @param {query} query - * @param {object} [options] - * @param {boolean} [options.multi = false] - * @return {Promise} - * @private - * @see Datastore#removeAsync - */ - async _removeAsync (query, options = {}) { - const multi = options.multi !== undefined ? options.multi : false - - const candidates = await this._getCandidatesAsync(query, true) - const removedDocs = [] - let numRemoved = 0 - - candidates.forEach(d => { - if (model.match(d, query) && (multi || numRemoved === 0)) { - numRemoved += 1 - removedDocs.push({ $$deleted: true, _id: d._id }) - this._removeFromIndexes(d) - } - }) - - await this.persistence.persistNewStateAsync(removedDocs) - return numRemoved - } - - /** - * Callback version of {@link Datastore#removeAsync}. - * @param {query} query - * @param {object|Datastore~removeCallback} [options={}] - * @param {boolean} [options.multi = false] - * @param {Datastore~removeCallback} [cb = () => {}] - * @see Datastore#removeAsync - */ - remove (query, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - const callback = cb || (() => {}) - callbackify((query, options) => this.removeAsync(query, options))(query, options, callback) - } - - /** - * Remove all docs matching the query. - * @param {query} query MongoDB-style query - * @param {object} [options={}] Optional options - * @param {boolean} [options.multi = false] If true, can update multiple documents - * @return {Promise} How many documents were removed - * @async - */ - removeAsync (query, options = {}) { - return this.executor.pushAsync(() => this._removeAsync(query, options)) - } -} - -module.exports = Datastore - - -/***/ }), - -/***/ 196: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const Waterfall = __webpack_require__(496) - -/** - * Executes operations sequentially. - * Has an option for a buffer that can be triggered afterwards. - * @private - */ -class Executor { - /** - * Instantiates a new Executor. - */ - constructor () { - /** - * If this.ready is `false`, then every task pushed will be buffered until this.processBuffer is called. - * @type {boolean} - * @private - */ - this.ready = false - /** - * The main queue - * @type {Waterfall} - * @private - */ - this.queue = new Waterfall() - /** - * The buffer queue - * @type {Waterfall} - * @private - */ - this.buffer = null - /** - * Method to trigger the buffer processing. - * - * Do not be use directly, use `this.processBuffer` instead. - * @function - * @private - */ - this._triggerBuffer = null - this.resetBuffer() - } - - /** - * If executor is ready, queue task (and process it immediately if executor was idle) - * If not, buffer task for later processing - * @param {AsyncFunction} task Function to execute - * @param {boolean} [forceQueuing = false] Optional (defaults to false) force executor to queue task even if it is not ready - * @return {Promise<*>} - * @async - * @see Executor#push - */ - pushAsync (task, forceQueuing = false) { - if (this.ready || forceQueuing) return this.queue.waterfall(task)() - else return this.buffer.waterfall(task)() - } - - /** - * Queue all tasks in buffer (in the same order they came in) - * Automatically sets executor as ready - */ - processBuffer () { - this.ready = true - this._triggerBuffer() - this.queue.waterfall(() => this.buffer.guardian) - } - - /** - * Removes all tasks queued up in the buffer - */ - resetBuffer () { - this.buffer = new Waterfall() - this.buffer.chain(new Promise(resolve => { - this._triggerBuffer = resolve - })) - if (this.ready) this._triggerBuffer() - } -} - -// Interface -module.exports = Executor - - -/***/ }), - -/***/ 98: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const BinarySearchTree = (__webpack_require__(908).AVLTree) -const model = __webpack_require__(118) -const { uniq, isDate } = __webpack_require__(988) - -/** - * Two indexed pointers are equal if they point to the same place - * @param {*} a - * @param {*} b - * @return {boolean} - * @private - */ -const checkValueEquality = (a, b) => a === b - -/** - * Type-aware projection - * @param {*} elt - * @return {string|*} - * @private - */ -const projectForUnique = elt => { - if (elt === null) return '$null' - if (typeof elt === 'string') return '$string' + elt - if (typeof elt === 'boolean') return '$boolean' + elt - if (typeof elt === 'number') return '$number' + elt - if (isDate(elt)) return '$date' + elt.getTime() - - return elt // Arrays and objects, will check for pointer equality -} - -/** - * Indexes on field names, with atomic operations and which can optionally enforce a unique constraint or allow indexed - * fields to be undefined - * @private - */ -class Index { - /** - * Create a new index - * All methods on an index guarantee that either the whole operation was successful and the index changed - * or the operation was unsuccessful and an error is thrown while the index is unchanged - * @param {object} options - * @param {string} options.fieldName On which field should the index apply, can use dot notation to index on sub fields, can use comma-separated notation to use compound indexes - * @param {boolean} [options.unique = false] Enforces a unique constraint - * @param {boolean} [options.sparse = false] Allows a sparse index (we can have documents for which fieldName is `undefined`) - */ - constructor (options) { - /** - * On which field the index applies to, can use dot notation to index on sub fields, can use comma-separated notation to use compound indexes. - * @type {string} - */ - this.fieldName = options.fieldName - - if (typeof this.fieldName !== 'string') throw new Error('fieldName must be a string') - - /** - * Internal property which is an Array representing the fieldName split with `,`, useful only for compound indexes. - * @type {string[]} - * @private - */ - this._fields = this.fieldName.split(',') - - /** - * Defines if the index enforces a unique constraint for this index. - * @type {boolean} - */ - this.unique = options.unique || false - /** - * Defines if we can have documents for which fieldName is `undefined` - * @type {boolean} - */ - this.sparse = options.sparse || false - - /** - * Options object given to the underlying BinarySearchTree. - * @type {{unique: boolean, checkValueEquality: (function(*, *): boolean), compareKeys: ((function(*, *, compareStrings): (number|number))|*)}} - */ - this.treeOptions = { unique: this.unique, compareKeys: model.compareThings, checkValueEquality } - - /** - * Underlying BinarySearchTree for this index. Uses an AVLTree for optimization. - * @type {AVLTree} - */ - this.tree = new BinarySearchTree(this.treeOptions) - } - - /** - * Reset an index - * @param {?document|?document[]} [newData] Data to initialize the index with. If an error is thrown during - * insertion, the index is not modified. - */ - reset (newData) { - this.tree = new BinarySearchTree(this.treeOptions) - - if (newData) this.insert(newData) - } - - /** - * Insert a new document in the index - * If an array is passed, we insert all its elements (if one insertion fails the index is not modified) - * O(log(n)) - * @param {document|document[]} doc The document, or array of documents, to insert. - */ - insert (doc) { - let keys - let failingIndex - let error - - if (Array.isArray(doc)) { - this.insertMultipleDocs(doc) - return - } - - const key = model.getDotValues(doc, this._fields) - - // We don't index documents that don't contain the field if the index is sparse - if ((key === undefined || (typeof key === 'object' && key !== null && Object.values(key).every(el => el === undefined))) && this.sparse) return - - if (!Array.isArray(key)) this.tree.insert(key, doc) - else { - // If an insert fails due to a unique constraint, roll back all inserts before it - keys = uniq(key, projectForUnique) - - for (let i = 0; i < keys.length; i += 1) { - try { - this.tree.insert(keys[i], doc) - } catch (e) { - error = e - failingIndex = i - break - } - } - - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.tree.delete(keys[i], doc) - } - - throw error - } - } - } - - /** - * Insert an array of documents in the index - * If a constraint is violated, the changes should be rolled back and an error thrown - * @param {document[]} docs Array of documents to insert. - * @private - */ - insertMultipleDocs (docs) { - let error - let failingIndex - - for (let i = 0; i < docs.length; i += 1) { - try { - this.insert(docs[i]) - } catch (e) { - error = e - failingIndex = i - break - } - } - - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.remove(docs[i]) - } - - throw error - } - } - - /** - * Removes a document from the index. - * If an array is passed, we remove all its elements - * The remove operation is safe with regards to the 'unique' constraint - * O(log(n)) - * @param {document[]|document} doc The document, or Array of documents, to remove. - */ - remove (doc) { - if (Array.isArray(doc)) { - doc.forEach(d => { this.remove(d) }) - return - } - - const key = model.getDotValues(doc, this._fields) - if (key === undefined && this.sparse) return - - if (!Array.isArray(key)) { - this.tree.delete(key, doc) - } else { - uniq(key, projectForUnique).forEach(_key => { - this.tree.delete(_key, doc) - }) - } - } - - /** - * Update a document in the index - * If a constraint is violated, changes are rolled back and an error thrown - * Naive implementation, still in O(log(n)) - * @param {document|Array.<{oldDoc: document, newDoc: document}>} oldDoc Document to update, or an `Array` of - * `{oldDoc, newDoc}` pairs. - * @param {document} [newDoc] Document to replace the oldDoc with. If the first argument is an `Array` of - * `{oldDoc, newDoc}` pairs, this second argument is ignored. - */ - update (oldDoc, newDoc) { - if (Array.isArray(oldDoc)) { - this.updateMultipleDocs(oldDoc) - return - } - - this.remove(oldDoc) - - try { - this.insert(newDoc) - } catch (e) { - this.insert(oldDoc) - throw e - } - } - - /** - * Update multiple documents in the index - * If a constraint is violated, the changes need to be rolled back - * and an error thrown - * @param {Array.<{oldDoc: document, newDoc: document}>} pairs - * - * @private - */ - updateMultipleDocs (pairs) { - let failingIndex - let error - - for (let i = 0; i < pairs.length; i += 1) { - this.remove(pairs[i].oldDoc) - } - - for (let i = 0; i < pairs.length; i += 1) { - try { - this.insert(pairs[i].newDoc) - } catch (e) { - error = e - failingIndex = i - break - } - } - - // If an error was raised, roll back changes in the inverse order - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.remove(pairs[i].newDoc) - } - - for (let i = 0; i < pairs.length; i += 1) { - this.insert(pairs[i].oldDoc) - } - - throw error - } - } - - /** - * Revert an update - * @param {document|Array.<{oldDoc: document, newDoc: document}>} oldDoc Document to revert to, or an `Array` of `{oldDoc, newDoc}` pairs. - * @param {document} [newDoc] Document to revert from. If the first argument is an Array of {oldDoc, newDoc}, this second argument is ignored. - */ - revertUpdate (oldDoc, newDoc) { - const revert = [] - - if (!Array.isArray(oldDoc)) this.update(newDoc, oldDoc) - else { - oldDoc.forEach(pair => { - revert.push({ oldDoc: pair.newDoc, newDoc: pair.oldDoc }) - }) - this.update(revert) - } - } - - /** - * Get all documents in index whose key match value (if it is a Thing) or one of the elements of value (if it is an array of Things) - * @param {Array.<*>|*} value Value to match the key against - * @return {document[]} - */ - getMatching (value) { - if (!Array.isArray(value)) return this.tree.search(value) - else { - const _res = {} - const res = [] - - value.forEach(v => { - this.getMatching(v).forEach(doc => { - _res[doc._id] = doc - }) - }) - - Object.keys(_res).forEach(_id => { - res.push(_res[_id]) - }) - - return res - } - } - - /** - * Get all documents in index whose key is between bounds are they are defined by query - * Documents are sorted by key - * @param {object} query An object with at least one matcher among $gt, $gte, $lt, $lte. - * @param {*} [query.$gt] Greater than matcher. - * @param {*} [query.$gte] Greater than or equal matcher. - * @param {*} [query.$lt] Lower than matcher. - * @param {*} [query.$lte] Lower than or equal matcher. - * @return {document[]} - */ - getBetweenBounds (query) { - return this.tree.betweenBounds(query) - } - - /** - * Get all elements in the index - * @return {document[]} - */ - getAll () { - const res = [] - - this.tree.executeOnEveryNode(node => { - res.push(...node.data) - }) - - return res - } -} - -// Interface -module.exports = Index - - -/***/ }), - -/***/ 118: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/** - * Handle models (i.e. docs) - * Serialization/deserialization - * Copying - * Querying, update - * @module model - * @private - */ -const { uniq, isDate, isRegExp } = __webpack_require__(988) - -/** - * Check a key, throw an error if the key is non valid - * @param {string} k key - * @param {document} v value, needed to treat the Date edge case - * Non-treatable edge cases here: if part of the object if of the form { $$date: number } or { $$deleted: true } - * Its serialized-then-deserialized version it will transformed into a Date object - * But you really need to want it to trigger such behaviour, even when warned not to use '$' at the beginning of the field names... - * @private - */ -const checkKey = (k, v) => { - if (typeof k === 'number') k = k.toString() - - if ( - k[0] === '$' && - !(k === '$$date' && typeof v === 'number') && - !(k === '$$deleted' && v === true) && - !(k === '$$indexCreated') && - !(k === '$$indexRemoved') - ) throw new Error('Field names cannot begin with the $ character') - - if (k.indexOf('.') !== -1) throw new Error('Field names cannot contain a .') -} - -/** - * Check a DB object and throw an error if it's not valid - * Works by applying the above checkKey function to all fields recursively - * @param {document|document[]} obj - * @alias module:model.checkObject - */ -const checkObject = obj => { - if (Array.isArray(obj)) { - obj.forEach(o => { - checkObject(o) - }) - } - - if (typeof obj === 'object' && obj !== null) { - for (const k in obj) { - if (Object.prototype.hasOwnProperty.call(obj, k)) { - checkKey(k, obj[k]) - checkObject(obj[k]) - } - } - } -} - -/** - * Serialize an object to be persisted to a one-line string - * For serialization/deserialization, we use the native JSON parser and not eval or Function - * That gives us less freedom but data entered in the database may come from users - * so eval and the like are not safe - * Accepted primitive types: Number, String, Boolean, Date, null - * Accepted secondary types: Objects, Arrays - * @param {document} obj - * @return {string} - * @alias module:model.serialize - */ -const serialize = obj => { - return JSON.stringify(obj, function (k, v) { - checkKey(k, v) - - if (v === undefined) return undefined - if (v === null) return null - - // Hackish way of checking if object is Date (this way it works between execution contexts in node-webkit). - // We can't use value directly because for dates it is already string in this function (date.toJSON was already called), so we use this - if (typeof this[k].getTime === 'function') return { $$date: this[k].getTime() } - - return v - }) -} - -/** - * From a one-line representation of an object generate by the serialize function - * Return the object itself - * @param {string} rawData - * @return {document} - * @alias module:model.deserialize - */ -const deserialize = rawData => JSON.parse(rawData, function (k, v) { - if (k === '$$date') return new Date(v) - if ( - typeof v === 'string' || - typeof v === 'number' || - typeof v === 'boolean' || - v === null - ) return v - if (v && v.$$date) return v.$$date - - return v -}) - -/** - * Deep copy a DB object - * The optional strictKeys flag (defaulting to false) indicates whether to copy everything or only fields - * where the keys are valid, i.e. don't begin with $ and don't contain a . - * @param {?document} obj - * @param {boolean} [strictKeys=false] - * @return {?document} - * @alias module:modelel:(.*) - */ -function deepCopy (obj, strictKeys) { - if ( - typeof obj === 'boolean' || - typeof obj === 'number' || - typeof obj === 'string' || - obj === null || - (isDate(obj)) - ) return obj - - if (Array.isArray(obj)) return obj.map(o => deepCopy(o, strictKeys)) - - if (typeof obj === 'object') { - const res = {} - for (const k in obj) { - if ( - Object.prototype.hasOwnProperty.call(obj, k) && - (!strictKeys || (k[0] !== '$' && k.indexOf('.') === -1)) - ) { - res[k] = deepCopy(obj[k], strictKeys) - } - } - return res - } - - return undefined // For now everything else is undefined. We should probably throw an error instead -} - -/** - * Tells if an object is a primitive type or a "real" object - * Arrays are considered primitive - * @param {*} obj - * @return {boolean} - * @alias module:modelel:(.*) - */ -const isPrimitiveType = obj => ( - typeof obj === 'boolean' || - typeof obj === 'number' || - typeof obj === 'string' || - obj === null || - isDate(obj) || - Array.isArray(obj) -) - -/** - * Utility functions for comparing things - * Assumes type checking was already done (a and b already have the same type) - * compareNSB works for numbers, strings and booleans - * @param {number|string|boolean} a - * @param {number|string|boolean} b - * @return {number} 0 if a == b, 1 i a > b, -1 if a < b - * @private - */ -const compareNSB = (a, b) => { - if (a < b) return -1 - if (a > b) return 1 - return 0 -} - -/** - * Utility function for comparing array - * Assumes type checking was already done (a and b already have the same type) - * compareNSB works for numbers, strings and booleans - * @param {Array} a - * @param {Array} b - * @return {number} 0 if arrays have the same length and all elements equal one another. Else either 1 or -1. - * @private - */ -const compareArrays = (a, b) => { - const minLength = Math.min(a.length, b.length) - for (let i = 0; i < minLength; i += 1) { - const comp = compareThings(a[i], b[i]) - - if (comp !== 0) return comp - } - - // Common section was identical, longest one wins - return compareNSB(a.length, b.length) -} - -/** - * Compare { things U undefined } - * Things are defined as any native types (string, number, boolean, null, date) and objects - * We need to compare with undefined as it will be used in indexes - * In the case of objects and arrays, we deep-compare - * If two objects dont have the same type, the (arbitrary) type hierarchy is: undefined, null, number, strings, boolean, dates, arrays, objects - * Return -1 if a < b, 1 if a > b and 0 if a = b (note that equality here is NOT the same as defined in areThingsEqual!) - * @param {*} a - * @param {*} b - * @param {compareStrings} [_compareStrings] String comparing function, returning -1, 0 or 1, overriding default string comparison (useful for languages with accented letters) - * @return {number} - * @alias module:model.compareThings - */ -const compareThings = (a, b, _compareStrings) => { - const compareStrings = _compareStrings || compareNSB - - // undefined - if (a === undefined) return b === undefined ? 0 : -1 - if (b === undefined) return 1 // no need to test if a === undefined - - // null - if (a === null) return b === null ? 0 : -1 - if (b === null) return 1 // no need to test if a === null - - // Numbers - if (typeof a === 'number') return typeof b === 'number' ? compareNSB(a, b) : -1 - if (typeof b === 'number') return typeof a === 'number' ? compareNSB(a, b) : 1 - - // Strings - if (typeof a === 'string') return typeof b === 'string' ? compareStrings(a, b) : -1 - if (typeof b === 'string') return typeof a === 'string' ? compareStrings(a, b) : 1 - - // Booleans - if (typeof a === 'boolean') return typeof b === 'boolean' ? compareNSB(a, b) : -1 - if (typeof b === 'boolean') return typeof a === 'boolean' ? compareNSB(a, b) : 1 - - // Dates - if (isDate(a)) return isDate(b) ? compareNSB(a.getTime(), b.getTime()) : -1 - if (isDate(b)) return isDate(a) ? compareNSB(a.getTime(), b.getTime()) : 1 - - // Arrays (first element is most significant and so on) - if (Array.isArray(a)) return Array.isArray(b) ? compareArrays(a, b) : -1 - if (Array.isArray(b)) return Array.isArray(a) ? compareArrays(a, b) : 1 - - // Objects - const aKeys = Object.keys(a).sort() - const bKeys = Object.keys(b).sort() - - for (let i = 0; i < Math.min(aKeys.length, bKeys.length); i += 1) { - const comp = compareThings(a[aKeys[i]], b[bKeys[i]]) - - if (comp !== 0) return comp - } - - return compareNSB(aKeys.length, bKeys.length) -} - -// ============================================================== -// Updating documents -// ============================================================== - -/** - * @callback modifierFunction - * The signature of modifier functions is as follows - * Their structure is always the same: recursively follow the dot notation while creating - * the nested documents if needed, then apply the "last step modifier" - * @param {Object} obj The model to modify - * @param {String} field Can contain dots, in that case that means we will set a subfield recursively - * @param {document} value - */ - -/** - * Create the complete modifier function - * @param {modifierFunction} lastStepModifierFunction a lastStepModifierFunction - * @param {boolean} [unset = false] Bad looking specific fix, needs to be generalized modifiers that behave like $unset are implemented - * @return {modifierFunction} - * @private - */ -const createModifierFunction = (lastStepModifierFunction, unset = false) => (obj, field, value) => { - const func = (obj, field, value) => { - const fieldParts = typeof field === 'string' ? field.split('.') : field - - if (fieldParts.length === 1) lastStepModifierFunction(obj, field, value) - else { - if (obj[fieldParts[0]] === undefined) { - if (unset) return - obj[fieldParts[0]] = {} - } - func(obj[fieldParts[0]], fieldParts.slice(1), value) - } - } - return func(obj, field, value) -} - -const $addToSetPartial = (obj, field, value) => { - // Create the array if it doesn't exist - if (!Object.prototype.hasOwnProperty.call(obj, field)) { obj[field] = [] } - - if (!Array.isArray(obj[field])) throw new Error('Can\'t $addToSet an element on non-array values') - - if (value !== null && typeof value === 'object' && value.$each) { - if (Object.keys(value).length > 1) throw new Error('Can\'t use another field in conjunction with $each') - if (!Array.isArray(value.$each)) throw new Error('$each requires an array value') - - value.$each.forEach(v => { - $addToSetPartial(obj, field, v) - }) - } else { - let addToSet = true - obj[field].forEach(v => { - if (compareThings(v, value) === 0) addToSet = false - }) - if (addToSet) obj[field].push(value) - } -} - -/** - * @enum {modifierFunction} - */ -const modifierFunctions = { - /** - * Set a field to a new value - */ - $set: createModifierFunction((obj, field, value) => { - obj[field] = value - }), - /** - * Unset a field - */ - $unset: createModifierFunction((obj, field, value) => { - delete obj[field] - }, true), - /** - * Updates the value of the field, only if specified field is smaller than the current value of the field - */ - $min: createModifierFunction((obj, field, value) => { - if (typeof obj[field] === 'undefined') obj[field] = value - else if (value < obj[field]) obj[field] = value - }), - /** - * Updates the value of the field, only if specified field is greater than the current value of the field - */ - $max: createModifierFunction((obj, field, value) => { - if (typeof obj[field] === 'undefined') obj[field] = value - else if (value > obj[field]) obj[field] = value - }), - /** - * Increment a numeric field's value - */ - $inc: createModifierFunction((obj, field, value) => { - if (typeof value !== 'number') throw new Error(`${value} must be a number`) - - if (typeof obj[field] !== 'number') { - if (!Object.prototype.hasOwnProperty.call(obj, field)) obj[field] = value - else throw new Error('Don\'t use the $inc modifier on non-number fields') - } else obj[field] += value - }), - /** - * Removes all instances of a value from an existing array - */ - $pull: createModifierFunction((obj, field, value) => { - if (!Array.isArray(obj[field])) throw new Error('Can\'t $pull an element from non-array values') - - const arr = obj[field] - for (let i = arr.length - 1; i >= 0; i -= 1) { - if (match(arr[i], value)) arr.splice(i, 1) - } - }), - /** - * Remove the first or last element of an array - */ - $pop: createModifierFunction((obj, field, value) => { - if (!Array.isArray(obj[field])) throw new Error('Can\'t $pop an element from non-array values') - if (typeof value !== 'number') throw new Error(`${value} isn't an integer, can't use it with $pop`) - if (value === 0) return - - if (value > 0) obj[field] = obj[field].slice(0, obj[field].length - 1) - else obj[field] = obj[field].slice(1) - }), - /** - * Add an element to an array field only if it is not already in it - * No modification if the element is already in the array - * Note that it doesn't check whether the original array contains duplicates - */ - $addToSet: createModifierFunction($addToSetPartial), - /** - * Push an element to the end of an array field - * Optional modifier $each instead of value to push several values - * Optional modifier $slice to slice the resulting array, see https://docs.mongodb.org/manual/reference/operator/update/slice/ - * Difference with MongoDB: if $slice is specified and not $each, we act as if value is an empty array - */ - $push: createModifierFunction((obj, field, value) => { - // Create the array if it doesn't exist - if (!Object.prototype.hasOwnProperty.call(obj, field)) obj[field] = [] - - if (!Array.isArray(obj[field])) throw new Error('Can\'t $push an element on non-array values') - - if ( - value !== null && - typeof value === 'object' && - value.$slice && - value.$each === undefined - ) value.$each = [] - - if (value !== null && typeof value === 'object' && value.$each) { - if ( - Object.keys(value).length >= 3 || - (Object.keys(value).length === 2 && value.$slice === undefined) - ) throw new Error('Can only use $slice in cunjunction with $each when $push to array') - if (!Array.isArray(value.$each)) throw new Error('$each requires an array value') - - value.$each.forEach(v => { - obj[field].push(v) - }) - - if (value.$slice === undefined || typeof value.$slice !== 'number') return - - if (value.$slice === 0) obj[field] = [] - else { - let start - let end - const n = obj[field].length - if (value.$slice < 0) { - start = Math.max(0, n + value.$slice) - end = n - } else if (value.$slice > 0) { - start = 0 - end = Math.min(n, value.$slice) - } - obj[field] = obj[field].slice(start, end) - } - } else { - obj[field].push(value) - } - }) - -} - -/** - * Modify a DB object according to an update query - * @param {document} obj - * @param {query} updateQuery - * @return {document} - * @alias module:model.modify - */ -const modify = (obj, updateQuery) => { - const keys = Object.keys(updateQuery) - const firstChars = keys.map(item => item[0]) - const dollarFirstChars = firstChars.filter(c => c === '$') - let newDoc - let modifiers - - if (keys.indexOf('_id') !== -1 && updateQuery._id !== obj._id) throw new Error('You cannot change a document\'s _id') - - if (dollarFirstChars.length !== 0 && dollarFirstChars.length !== firstChars.length) throw new Error('You cannot mix modifiers and normal fields') - - if (dollarFirstChars.length === 0) { - // Simply replace the object with the update query contents - newDoc = deepCopy(updateQuery) - newDoc._id = obj._id - } else { - // Apply modifiers - modifiers = uniq(keys) - newDoc = deepCopy(obj) - modifiers.forEach(m => { - if (!modifierFunctions[m]) throw new Error(`Unknown modifier ${m}`) - - // Can't rely on Object.keys throwing on non objects since ES6 - // Not 100% satisfying as non objects can be interpreted as objects but no false negatives so we can live with it - if (typeof updateQuery[m] !== 'object') throw new Error(`Modifier ${m}'s argument must be an object`) - - const keys = Object.keys(updateQuery[m]) - keys.forEach(k => { - modifierFunctions[m](newDoc, k, updateQuery[m][k]) - }) - }) - } - - // Check result is valid and return it - checkObject(newDoc) - - if (obj._id !== newDoc._id) throw new Error('You can\'t change a document\'s _id') - return newDoc -} - -// ============================================================== -// Finding documents -// ============================================================== - -/** - * Get a value from object with dot notation - * @param {object} obj - * @param {string} field - * @return {*} - * @alias module:model.getDotValue - */ -const getDotValue = (obj, field) => { - const fieldParts = typeof field === 'string' ? field.split('.') : field - - if (!obj) return undefined // field cannot be empty so that means we should return undefined so that nothing can match - - if (fieldParts.length === 0) return obj - - if (fieldParts.length === 1) return obj[fieldParts[0]] - - if (Array.isArray(obj[fieldParts[0]])) { - // If the next field is an integer, return only this item of the array - const i = parseInt(fieldParts[1], 10) - if (typeof i === 'number' && !isNaN(i)) return getDotValue(obj[fieldParts[0]][i], fieldParts.slice(2)) - - // Return the array of values - return obj[fieldParts[0]].map(el => getDotValue(el, fieldParts.slice(1))) - } else return getDotValue(obj[fieldParts[0]], fieldParts.slice(1)) -} - -/** - * Get dot values for either a bunch of fields or just one. - */ -const getDotValues = (obj, fields) => { - if (!Array.isArray(fields)) throw new Error('fields must be an Array') - if (fields.length > 1) { - const key = {} - for (const field of fields) { - key[field] = getDotValue(obj, field) - } - return key - } else return getDotValue(obj, fields[0]) -} - -/** - * Check whether 'things' are equal - * Things are defined as any native types (string, number, boolean, null, date) and objects - * In the case of object, we check deep equality - * Returns true if they are, false otherwise - * @param {*} a - * @param {*} a - * @return {boolean} - * @alias module:model.areThingsEqual - */ -const areThingsEqual = (a, b) => { - // Strings, booleans, numbers, null - if ( - a === null || - typeof a === 'string' || - typeof a === 'boolean' || - typeof a === 'number' || - b === null || - typeof b === 'string' || - typeof b === 'boolean' || - typeof b === 'number' - ) return a === b - - // Dates - if (isDate(a) || isDate(b)) return isDate(a) && isDate(b) && a.getTime() === b.getTime() - - // Arrays (no match since arrays are used as a $in) - // undefined (no match since they mean field doesn't exist and can't be serialized) - if ( - (!(Array.isArray(a) && Array.isArray(b)) && (Array.isArray(a) || Array.isArray(b))) || - a === undefined || b === undefined - ) return false - - // General objects (check for deep equality) - // a and b should be objects at this point - let aKeys - let bKeys - try { - aKeys = Object.keys(a) - bKeys = Object.keys(b) - } catch (e) { - return false - } - - if (aKeys.length !== bKeys.length) return false - for (const el of aKeys) { - if (bKeys.indexOf(el) === -1) return false - if (!areThingsEqual(a[el], b[el])) return false - } - return true -} - -/** - * Check that two values are comparable - * @param {*} a - * @param {*} a - * @return {boolean} - * @private - */ -const areComparable = (a, b) => { - if ( - typeof a !== 'string' && - typeof a !== 'number' && - !isDate(a) && - typeof b !== 'string' && - typeof b !== 'number' && - !isDate(b) - ) return false - - if (typeof a !== typeof b) return false - - return true -} - -/** - * @callback comparisonOperator - * Arithmetic and comparison operators - * @param {*} a Value in the object - * @param {*} b Value in the query - * @return {boolean} - */ - -/** - * @enum {comparisonOperator} - */ -const comparisonFunctions = { - /** Lower than */ - $lt: (a, b) => areComparable(a, b) && a < b, - /** Lower than or equals */ - $lte: (a, b) => areComparable(a, b) && a <= b, - /** Greater than */ - $gt: (a, b) => areComparable(a, b) && a > b, - /** Greater than or equals */ - $gte: (a, b) => areComparable(a, b) && a >= b, - /** Does not equal */ - $ne: (a, b) => a === undefined || !areThingsEqual(a, b), - /** Is in Array */ - $in: (a, b) => { - if (!Array.isArray(b)) throw new Error('$in operator called with a non-array') - - for (const el of b) { - if (areThingsEqual(a, el)) return true - } - - return false - }, - /** Is not in Array */ - $nin: (a, b) => { - if (!Array.isArray(b)) throw new Error('$nin operator called with a non-array') - - return !comparisonFunctions.$in(a, b) - }, - /** Matches Regexp */ - $regex: (a, b) => { - if (!isRegExp(b)) throw new Error('$regex operator called with non regular expression') - - if (typeof a !== 'string') return false - else return b.test(a) - }, - /** Returns true if field exists */ - $exists: (a, b) => { - // This will be true for all values of stat except false, null, undefined and 0 - // That's strange behaviour (we should only use true/false) but that's the way Mongo does it... - if (b || b === '') b = true - else b = false - - if (a === undefined) return !b - else return b - }, - /** Specific to Arrays, returns true if a length equals b */ - $size: (a, b) => { - if (!Array.isArray(a)) return false - if (b % 1 !== 0) throw new Error('$size operator called without an integer') - - return a.length === b - }, - /** Specific to Arrays, returns true if some elements of a match the query b */ - $elemMatch: (a, b) => { - if (!Array.isArray(a)) return false - return a.some(el => match(el, b)) - } -} - -const arrayComparisonFunctions = { $size: true, $elemMatch: true } - -/** - * @enum - */ -const logicalOperators = { - /** - * Match any of the subqueries - * @param {document} obj - * @param {query[]} query - * @return {boolean} - */ - $or: (obj, query) => { - if (!Array.isArray(query)) throw new Error('$or operator used without an array') - - for (let i = 0; i < query.length; i += 1) { - if (match(obj, query[i])) return true - } - - return false - }, - /** - * Match all of the subqueries - * @param {document} obj - * @param {query[]} query - * @return {boolean} - */ - $and: (obj, query) => { - if (!Array.isArray(query)) throw new Error('$and operator used without an array') - - for (let i = 0; i < query.length; i += 1) { - if (!match(obj, query[i])) return false - } - - return true - }, - /** - * Inverted match of the query - * @param {document} obj - * @param {query} query - * @return {boolean} - */ - $not: (obj, query) => !match(obj, query), - - /** - * @callback whereCallback - * @param {document} obj - * @return {boolean} - */ - - /** - * Use a function to match - * @param {document} obj - * @param {whereCallback} fn - * @return {boolean} - */ - $where: (obj, fn) => { - if (typeof fn !== 'function') throw new Error('$where operator used without a function') - - const result = fn.call(obj) - if (typeof result !== 'boolean') throw new Error('$where function must return boolean') - - return result - } -} - -/** - * Tell if a given document matches a query - * @param {document} obj Document to check - * @param {query} query - * @return {boolean} - * @alias module:model.match - */ -const match = (obj, query) => { - // Primitive query against a primitive type - // This is a bit of a hack since we construct an object with an arbitrary key only to dereference it later - // But I don't have time for a cleaner implementation now - if (isPrimitiveType(obj) || isPrimitiveType(query)) return matchQueryPart({ needAKey: obj }, 'needAKey', query) - - // Normal query - for (const queryKey in query) { - if (Object.prototype.hasOwnProperty.call(query, queryKey)) { - const queryValue = query[queryKey] - if (queryKey[0] === '$') { - if (!logicalOperators[queryKey]) throw new Error(`Unknown logical operator ${queryKey}`) - if (!logicalOperators[queryKey](obj, queryValue)) return false - } else if (!matchQueryPart(obj, queryKey, queryValue)) return false - } - } - - return true -} - -/** - * Match an object against a specific { key: value } part of a query - * if the treatObjAsValue flag is set, don't try to match every part separately, but the array as a whole - * @param {object} obj - * @param {string} queryKey - * @param {*} queryValue - * @param {boolean} [treatObjAsValue=false] - * @return {boolean} - * @private - */ -function matchQueryPart (obj, queryKey, queryValue, treatObjAsValue) { - const objValue = getDotValue(obj, queryKey) - - // Check if the value is an array if we don't force a treatment as value - if (Array.isArray(objValue) && !treatObjAsValue) { - // If the queryValue is an array, try to perform an exact match - if (Array.isArray(queryValue)) return matchQueryPart(obj, queryKey, queryValue, true) - - // Check if we are using an array-specific comparison function - if (queryValue !== null && typeof queryValue === 'object' && !isRegExp(queryValue)) { - for (const key in queryValue) { - if (Object.prototype.hasOwnProperty.call(queryValue, key) && arrayComparisonFunctions[key]) { return matchQueryPart(obj, queryKey, queryValue, true) } - } - } - - // If not, treat it as an array of { obj, query } where there needs to be at least one match - for (const el of objValue) { - if (matchQueryPart({ k: el }, 'k', queryValue)) return true // k here could be any string - } - return false - } - - // queryValue is an actual object. Determine whether it contains comparison operators - // or only normal fields. Mixed objects are not allowed - if (queryValue !== null && typeof queryValue === 'object' && !isRegExp(queryValue) && !Array.isArray(queryValue)) { - const keys = Object.keys(queryValue) - const firstChars = keys.map(item => item[0]) - const dollarFirstChars = firstChars.filter(c => c === '$') - - if (dollarFirstChars.length !== 0 && dollarFirstChars.length !== firstChars.length) throw new Error('You cannot mix operators and normal fields') - - // queryValue is an object of this form: { $comparisonOperator1: value1, ... } - if (dollarFirstChars.length > 0) { - for (const key of keys) { - if (!comparisonFunctions[key]) throw new Error(`Unknown comparison function ${key}`) - - if (!comparisonFunctions[key](objValue, queryValue[key])) return false - } - return true - } - } - - // Using regular expressions with basic querying - if (isRegExp(queryValue)) return comparisonFunctions.$regex(objValue, queryValue) - - // queryValue is either a native value or a normal object - // Basic matching is possible - return areThingsEqual(objValue, queryValue) -} - -// Interface -module.exports.serialize = serialize -module.exports.deserialize = deserialize -module.exports.deepCopy = deepCopy -module.exports.checkObject = checkObject -module.exports.isPrimitiveType = isPrimitiveType -module.exports.modify = modify -module.exports.getDotValue = getDotValue -module.exports.getDotValues = getDotValues -module.exports.match = match -module.exports.areThingsEqual = areThingsEqual -module.exports.compareThings = compareThings - - -/***/ }), - -/***/ 328: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const { deprecate } = __webpack_require__(539) -const byline = __webpack_require__(100) -const customUtils = __webpack_require__(159) -const Index = __webpack_require__(98) -const model = __webpack_require__(118) -const storage = __webpack_require__(909) - -const DEFAULT_DIR_MODE = 0o755 -const DEFAULT_FILE_MODE = 0o644 - -/** - * Under the hood, NeDB's persistence uses an append-only format, meaning that all - * updates and deletes actually result in lines added at the end of the datafile, - * for performance reasons. The database is automatically compacted (i.e. put back - * in the one-line-per-document format) every time you load each database within - * your application. - * - * Persistence handles the compaction exposed in the Datastore {@link Datastore#compactDatafileAsync}, - * {@link Datastore#setAutocompactionInterval}. - * - * Since version 3.0.0, using {@link Datastore.persistence} methods manually is deprecated. - * - * Compaction takes a bit of time (not too much: 130ms for 50k - * records on a typical development machine) and no other operation can happen when - * it does, so most projects actually don't need to use it. - * - * Compaction will also immediately remove any documents whose data line has become - * corrupted, assuming that the total percentage of all corrupted documents in that - * database still falls below the specified `corruptAlertThreshold` option's value. - * - * Durability works similarly to major databases: compaction forces the OS to - * physically flush data to disk, while appends to the data file do not (the OS is - * responsible for flushing the data). That guarantees that a server crash can - * never cause complete data loss, while preserving performance. The worst that can - * happen is a crash between two syncs, causing a loss of all data between the two - * syncs. Usually syncs are 30 seconds appart so that's at most 30 seconds of - * data. [This post by Antirez on Redis persistence](http://oldblog.antirez.com/post/redis-persistence-demystified.html) - * explains this in more details, NeDB being very close to Redis AOF persistence - * with `appendfsync` option set to `no`. - */ -class Persistence { - /** - * Create a new Persistence object for database options.db - * @param {Datastore} options.db - * @param {Number} [options.corruptAlertThreshold] Optional, threshold after which an alert is thrown if too much data is corrupt - * @param {serializationHook} [options.beforeDeserialization] Hook you can use to transform data after it was serialized and before it is written to disk. - * @param {serializationHook} [options.afterSerialization] Inverse of `afterSerialization`. - * @param {object} [options.modes] Modes to use for FS permissions. Will not work on Windows. - * @param {number} [options.modes.fileMode=0o644] Mode to use for files. - * @param {number} [options.modes.dirMode=0o755] Mode to use for directories. - * @param {boolean} [options.testSerializationHooks=true] Whether to test the serialization hooks or not, might be CPU-intensive - */ - constructor (options) { - this.db = options.db - this.inMemoryOnly = this.db.inMemoryOnly - this.filename = this.db.filename - this.corruptAlertThreshold = options.corruptAlertThreshold !== undefined ? options.corruptAlertThreshold : 0.1 - this.modes = options.modes !== undefined ? options.modes : { fileMode: DEFAULT_FILE_MODE, dirMode: DEFAULT_DIR_MODE } - if (this.modes.fileMode === undefined) this.modes.fileMode = DEFAULT_FILE_MODE - if (this.modes.dirMode === undefined) this.modes.dirMode = DEFAULT_DIR_MODE - if ( - !this.inMemoryOnly && - this.filename && - this.filename.charAt(this.filename.length - 1) === '~' - ) throw new Error('The datafile name can\'t end with a ~, which is reserved for crash safe backup files') - - // After serialization and before deserialization hooks with some basic sanity checks - if ( - options.afterSerialization && - !options.beforeDeserialization - ) throw new Error('Serialization hook defined but deserialization hook undefined, cautiously refusing to start NeDB to prevent dataloss') - if ( - !options.afterSerialization && - options.beforeDeserialization - ) throw new Error('Serialization hook undefined but deserialization hook defined, cautiously refusing to start NeDB to prevent dataloss') - - this.afterSerialization = options.afterSerialization || (s => s) - this.beforeDeserialization = options.beforeDeserialization || (s => s) - - if (options.testSerializationHooks === undefined || options.testSerializationHooks) { - for (let i = 1; i < 30; i += 1) { - for (let j = 0; j < 10; j += 1) { - const randomString = customUtils.uid(i) - if (this.beforeDeserialization(this.afterSerialization(randomString)) !== randomString) { - throw new Error('beforeDeserialization is not the reverse of afterSerialization, cautiously refusing to start NeDB to prevent dataloss') - } - } - } - } - } - - /** - * Internal version without using the {@link Datastore#executor} of {@link Datastore#compactDatafileAsync}, use it instead. - * @return {Promise} - * @private - */ - async persistCachedDatabaseAsync () { - const lines = [] - - if (this.inMemoryOnly) return - - this.db.getAllData().forEach(doc => { - lines.push(this.afterSerialization(model.serialize(doc))) - }) - Object.keys(this.db.indexes).forEach(fieldName => { - if (fieldName !== '_id') { // The special _id index is managed by datastore.js, the others need to be persisted - lines.push(this.afterSerialization(model.serialize({ - $$indexCreated: { - fieldName: this.db.indexes[fieldName].fieldName, - unique: this.db.indexes[fieldName].unique, - sparse: this.db.indexes[fieldName].sparse - } - }))) - } - }) - - await storage.crashSafeWriteFileLinesAsync(this.filename, lines, this.modes) - this.db.emit('compaction.done') - } - - /** - * @see Datastore#compactDatafile - * @deprecated - * @param {NoParamCallback} [callback = () => {}] - * @see Persistence#compactDatafileAsync - */ - compactDatafile (callback) { - deprecate(_callback => this.db.compactDatafile(_callback), '@seald-io/nedb: calling Datastore#persistence#compactDatafile is deprecated, please use Datastore#compactDatafile, it will be removed in the next major version.')(callback) - } - - /** - * @see Datastore#setAutocompactionInterval - * @deprecated - */ - setAutocompactionInterval (interval) { - deprecate(_interval => this.db.setAutocompactionInterval(_interval), '@seald-io/nedb: calling Datastore#persistence#setAutocompactionInterval is deprecated, please use Datastore#setAutocompactionInterval, it will be removed in the next major version.')(interval) - } - - /** - * @see Datastore#stopAutocompaction - * @deprecated - */ - stopAutocompaction () { - deprecate(() => this.db.stopAutocompaction(), '@seald-io/nedb: calling Datastore#persistence#stopAutocompaction is deprecated, please use Datastore#stopAutocompaction, it will be removed in the next major version.')() - } - - /** - * Persist new state for the given newDocs (can be insertion, update or removal) - * Use an append-only format - * - * Do not use directly, it should only used by a {@link Datastore} instance. - * @param {document[]} newDocs Can be empty if no doc was updated/removed - * @return {Promise} - * @private - */ - async persistNewStateAsync (newDocs) { - let toPersist = '' - - // In-memory only datastore - if (this.inMemoryOnly) return - - newDocs.forEach(doc => { - toPersist += this.afterSerialization(model.serialize(doc)) + '\n' - }) - - if (toPersist.length === 0) return - - await storage.appendFileAsync(this.filename, toPersist, { encoding: 'utf8', mode: this.modes.fileMode }) - } - - /** - * @typedef rawIndex - * @property {string} fieldName - * @property {boolean} [unique] - * @property {boolean} [sparse] - */ - - /** - * From a database's raw data, return the corresponding machine understandable collection. - * - * Do not use directly, it should only used by a {@link Datastore} instance. - * @param {string} rawData database file - * @return {{data: document[], indexes: Object.}} - * @private - */ - treatRawData (rawData) { - const data = rawData.split('\n') - const dataById = {} - const indexes = {} - let dataLength = data.length - - // Last line of every data file is usually blank so not really corrupt - let corruptItems = 0 - - for (const datum of data) { - if (datum === '') { dataLength--; continue } - try { - const doc = model.deserialize(this.beforeDeserialization(datum)) - if (doc._id) { - if (doc.$$deleted === true) delete dataById[doc._id] - else dataById[doc._id] = doc - } else if (doc.$$indexCreated && doc.$$indexCreated.fieldName != null) indexes[doc.$$indexCreated.fieldName] = doc.$$indexCreated - else if (typeof doc.$$indexRemoved === 'string') delete indexes[doc.$$indexRemoved] - } catch (e) { - corruptItems += 1 - } - } - - // A bit lenient on corruption - if (dataLength > 0) { - const corruptionRate = corruptItems / dataLength - if (corruptionRate > this.corruptAlertThreshold) { - const error = new Error(`${Math.floor(100 * corruptionRate)}% of the data file is corrupt, more than given corruptAlertThreshold (${Math.floor(100 * this.corruptAlertThreshold)}%). Cautiously refusing to start NeDB to prevent dataloss.`) - error.corruptionRate = corruptionRate - error.corruptItems = corruptItems - error.dataLength = dataLength - throw error - } - } - - const tdata = Object.values(dataById) - - return { data: tdata, indexes } - } - - /** - * From a database's raw data stream, return the corresponding machine understandable collection - * Is only used by a {@link Datastore} instance. - * - * Is only used in the Node.js version, since [React-Native]{@link module:storageReactNative} & - * [browser]{@link module:storageBrowser} storage modules don't provide an equivalent of - * {@link module:storage.readFileStream}. - * - * Do not use directly, it should only used by a {@link Datastore} instance. - * @param {Readable} rawStream - * @return {Promise<{data: document[], indexes: Object.}>} - * @async - * @private - */ - treatRawStreamAsync (rawStream) { - return new Promise((resolve, reject) => { - const dataById = {} - - const indexes = {} - - let corruptItems = 0 - - const lineStream = byline(rawStream) - let dataLength = 0 - - lineStream.on('data', (line) => { - if (line === '') return - try { - const doc = model.deserialize(this.beforeDeserialization(line)) - if (doc._id) { - if (doc.$$deleted === true) delete dataById[doc._id] - else dataById[doc._id] = doc - } else if (doc.$$indexCreated && doc.$$indexCreated.fieldName != null) indexes[doc.$$indexCreated.fieldName] = doc.$$indexCreated - else if (typeof doc.$$indexRemoved === 'string') delete indexes[doc.$$indexRemoved] - } catch (e) { - corruptItems += 1 - } - - dataLength++ - }) - - lineStream.on('end', () => { - // A bit lenient on corruption - if (dataLength > 0) { - const corruptionRate = corruptItems / dataLength - if (corruptionRate > this.corruptAlertThreshold) { - const error = new Error(`${Math.floor(100 * corruptionRate)}% of the data file is corrupt, more than given corruptAlertThreshold (${Math.floor(100 * this.corruptAlertThreshold)}%). Cautiously refusing to start NeDB to prevent dataloss.`) - error.corruptionRate = corruptionRate - error.corruptItems = corruptItems - error.dataLength = dataLength - reject(error, null) - return - } - } - const data = Object.values(dataById) - - resolve({ data, indexes }) - }) - - lineStream.on('error', function (err) { - reject(err, null) - }) - }) - } - - /** - * Load the database - * 1) Create all indexes - * 2) Insert all data - * 3) Compact the database - * - * This means pulling data out of the data file or creating it if it doesn't exist - * Also, all data is persisted right away, which has the effect of compacting the database file - * This operation is very quick at startup for a big collection (60ms for ~10k docs) - * - * Do not use directly as it does not use the [Executor]{@link Datastore.executor}, use {@link Datastore#loadDatabaseAsync} instead. - * @return {Promise} - * @private - */ - async loadDatabaseAsync () { - this.db._resetIndexes() - - // In-memory only datastore - if (this.inMemoryOnly) return - await Persistence.ensureParentDirectoryExistsAsync(this.filename, this.modes.dirMode) - await storage.ensureDatafileIntegrityAsync(this.filename, this.modes.fileMode) - - let treatedData - if (storage.readFileStream) { - // Server side - const fileStream = storage.readFileStream(this.filename, { encoding: 'utf8', mode: this.modes.fileMode }) - treatedData = await this.treatRawStreamAsync(fileStream) - } else { - // Browser - const rawData = await storage.readFileAsync(this.filename, { encoding: 'utf8', mode: this.modes.fileMode }) - treatedData = this.treatRawData(rawData) - } - // Recreate all indexes in the datafile - Object.keys(treatedData.indexes).forEach(key => { - this.db.indexes[key] = new Index(treatedData.indexes[key]) - }) - - // Fill cached database (i.e. all indexes) with data - try { - this.db._resetIndexes(treatedData.data) - } catch (e) { - this.db._resetIndexes() // Rollback any index which didn't fail - throw e - } - - await this.db.persistence.persistCachedDatabaseAsync() - this.db.executor.processBuffer() - } - - /** - * See {@link Datastore#dropDatabaseAsync}. This function uses {@link Datastore#executor} internally. Decorating this - * function with an {@link Executor#pushAsync} will result in a deadlock. - * @return {Promise} - * @private - * @see Datastore#dropDatabaseAsync - */ - async dropDatabaseAsync () { - this.db.stopAutocompaction() // stop autocompaction - this.db.executor.ready = false // prevent queuing new tasks - this.db.executor.resetBuffer() // remove pending buffered tasks - await this.db.executor.queue.guardian // wait for the ongoing tasks to end - // remove indexes (which means remove data from memory) - this.db.indexes = {} - // add back _id index, otherwise it will fail - this.db.indexes._id = new Index({ fieldName: '_id', unique: true }) - // reset TTL on indexes - this.db.ttlIndexes = {} - - // remove datastore file - if (!this.db.inMemoryOnly) { - await this.db.executor.pushAsync(async () => { - if (await storage.existsAsync(this.filename)) await storage.unlinkAsync(this.filename) - }, true) - } - } - - /** - * Check if a directory stat and create it on the fly if it is not the case. - * @param {string} dir - * @param {number} [mode=0o777] - * @return {Promise} - * @private - */ - static async ensureParentDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) { - return storage.ensureParentDirectoryExistsAsync(dir, mode) - } -} - -// Interface -module.exports = Persistence - - -/***/ }), - -/***/ 988: -/***/ ((module) => { - -/** - * Utility functions for all environments. - * This replaces the underscore dependency. - * - * @module utils - * @private - */ - -/** - * @callback IterateeFunction - * @param {*} arg - * @return {*} - */ - -/** - * Produces a duplicate-free version of the array, using === to test object equality. In particular only the first - * occurrence of each value is kept. If you want to compute unique items based on a transformation, pass an iteratee - * function. - * - * Heavily inspired by {@link https://underscorejs.org/#uniq}. - * @param {Array} array - * @param {IterateeFunction} [iteratee] transformation applied to every element before checking for duplicates. This will not - * transform the items in the result. - * @return {Array} - * @alias module:utils.uniq - */ -const uniq = (array, iteratee) => { - if (iteratee) return [...(new Map(array.map(x => [iteratee(x), x]))).values()] - else return [...new Set(array)] -} -/** - * Returns true if arg is an Object. Note that JavaScript arrays and functions are objects, while (normal) strings - * and numbers are not. - * - * Heavily inspired by {@link https://underscorejs.org/#isObject}. - * @param {*} arg - * @return {boolean} - */ -const isObject = arg => typeof arg === 'object' && arg !== null - -/** - * Returns true if d is a Date. - * - * Heavily inspired by {@link https://underscorejs.org/#isDate}. - * @param {*} d - * @return {boolean} - * @alias module:utils.isDate - */ -const isDate = d => isObject(d) && Object.prototype.toString.call(d) === '[object Date]' - -/** - * Returns true if re is a RegExp. - * - * Heavily inspired by {@link https://underscorejs.org/#isRegExp}. - * @param {*} re - * @return {boolean} - * @alias module:utils.isRegExp - */ -const isRegExp = re => isObject(re) && Object.prototype.toString.call(re) === '[object RegExp]' - -/** - * Return a copy of the object filtered using the given keys. - * - * @param {object} object - * @param {string[]} keys - * @return {object} - */ -const pick = (object, keys) => { - return keys.reduce((obj, key) => { - if (object && Object.prototype.hasOwnProperty.call(object, key)) { - obj[key] = object[key] - } - return obj - }, {}) -} - -const filterIndexNames = (indexNames) => ([k, v]) => !!(typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || isDate(v) || v === null) && -indexNames.includes(k) - -module.exports.uniq = uniq -module.exports.isDate = isDate -module.exports.isRegExp = isRegExp -module.exports.pick = pick -module.exports.filterIndexNames = filterIndexNames - - -/***/ }), - -/***/ 496: -/***/ ((module) => { - -/** - * Responsible for sequentially executing actions on the database - * @private - */ -class Waterfall { - /** - * Instantiate a new Waterfall. - */ - constructor () { - /** - * This is the internal Promise object which resolves when all the tasks of the `Waterfall` are done. - * - * It will change any time `this.waterfall` is called. - * - * @type {Promise} - */ - this.guardian = Promise.resolve() - } - - /** - * - * @param {AsyncFunction} func - * @return {AsyncFunction} - */ - waterfall (func) { - return (...args) => { - this.guardian = this.guardian.then(() => { - return func(...args) - .then(result => ({ error: false, result }), result => ({ error: true, result })) - }) - return this.guardian.then(({ error, result }) => { - if (error) return Promise.reject(result) - else return Promise.resolve(result) - }) - } - } - - /** - * Shorthand for chaining a promise to the Waterfall - * @param {Promise} promise - * @return {Promise} - */ - chain (promise) { - return this.waterfall(() => promise)() - } -} - -module.exports = Waterfall - - -/***/ }), - -/***/ 908: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* unused reexport */ __webpack_require__(902) -module.exports.AVLTree = __webpack_require__(522) - - -/***/ }), - -/***/ 522: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/** - * Self-balancing binary search tree using the AVL implementation - */ -const BinarySearchTree = __webpack_require__(902) -const customUtils = __webpack_require__(639) - -class AVLTree { - /** - * Constructor - * We can't use a direct pointer to the root node (as in the simple binary search tree) - * as the root will change during tree rotations - * @param {Boolean} options.unique Whether to enforce a 'unique' constraint on the key or not - * @param {Function} options.compareKeys Initialize this BST's compareKeys - */ - constructor (options) { - this.tree = new _AVLTree(options) - } - - checkIsAVLT () { this.tree.checkIsAVLT() } - - // Insert in the internal tree, update the pointer to the root if needed - insert (key, value) { - const newTree = this.tree.insert(key, value) - - // If newTree is undefined, that means its structure was not modified - if (newTree) { this.tree = newTree } - } - - // Delete a value - delete (key, value) { - const newTree = this.tree.delete(key, value) - - // If newTree is undefined, that means its structure was not modified - if (newTree) { this.tree = newTree } - } -} - -class _AVLTree extends BinarySearchTree { - /** - * Constructor of the internal AVLTree - * @param {Object} options Optional - * @param {Boolean} options.unique Whether to enforce a 'unique' constraint on the key or not - * @param {Key} options.key Initialize this BST's key with key - * @param {Value} options.value Initialize this BST's data with [value] - * @param {Function} options.compareKeys Initialize this BST's compareKeys - */ - constructor (options) { - super() - options = options || {} - - this.left = null - this.right = null - this.parent = options.parent !== undefined ? options.parent : null - if (Object.prototype.hasOwnProperty.call(options, 'key')) this.key = options.key - this.data = Object.prototype.hasOwnProperty.call(options, 'value') ? [options.value] : [] - this.unique = options.unique || false - - this.compareKeys = options.compareKeys || customUtils.defaultCompareKeysFunction - this.checkValueEquality = options.checkValueEquality || customUtils.defaultCheckValueEquality - } - - /** - * Check the recorded height is correct for every node - * Throws if one height doesn't match - */ - checkHeightCorrect () { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { return } // Empty tree - - if (this.left && this.left.height === undefined) { throw new Error('Undefined height for node ' + this.left.key) } - if (this.right && this.right.height === undefined) { throw new Error('Undefined height for node ' + this.right.key) } - if (this.height === undefined) { throw new Error('Undefined height for node ' + this.key) } - - const leftH = this.left ? this.left.height : 0 - const rightH = this.right ? this.right.height : 0 - - if (this.height !== 1 + Math.max(leftH, rightH)) { throw new Error('Height constraint failed for node ' + this.key) } - if (this.left) { this.left.checkHeightCorrect() } - if (this.right) { this.right.checkHeightCorrect() } - } - - /** - * Return the balance factor - */ - balanceFactor () { - const leftH = this.left ? this.left.height : 0 - const rightH = this.right ? this.right.height : 0 - return leftH - rightH - } - - /** - * Check that the balance factors are all between -1 and 1 - */ - checkBalanceFactors () { - if (Math.abs(this.balanceFactor()) > 1) { throw new Error('Tree is unbalanced at node ' + this.key) } - - if (this.left) { this.left.checkBalanceFactors() } - if (this.right) { this.right.checkBalanceFactors() } - } - - /** - * When checking if the BST conditions are met, also check that the heights are correct - * and the tree is balanced - */ - checkIsAVLT () { - super.checkIsBST() - this.checkHeightCorrect() - this.checkBalanceFactors() - } - - /** - * Perform a right rotation of the tree if possible - * and return the root of the resulting tree - * The resulting tree's nodes' heights are also updated - */ - rightRotation () { - const q = this - const p = this.left - - if (!p) return q // No change - - const b = p.right - - // Alter tree structure - if (q.parent) { - p.parent = q.parent - if (q.parent.left === q) q.parent.left = p - else q.parent.right = p - } else { - p.parent = null - } - p.right = q - q.parent = p - q.left = b - if (b) { b.parent = q } - - // Update heights - const ah = p.left ? p.left.height : 0 - const bh = b ? b.height : 0 - const ch = q.right ? q.right.height : 0 - q.height = Math.max(bh, ch) + 1 - p.height = Math.max(ah, q.height) + 1 - - return p - } - - /** - * Perform a left rotation of the tree if possible - * and return the root of the resulting tree - * The resulting tree's nodes' heights are also updated - */ - leftRotation () { - const p = this - const q = this.right - - if (!q) { return this } // No change - - const b = q.left - - // Alter tree structure - if (p.parent) { - q.parent = p.parent - if (p.parent.left === p) p.parent.left = q - else p.parent.right = q - } else { - q.parent = null - } - q.left = p - p.parent = q - p.right = b - if (b) { b.parent = p } - - // Update heights - const ah = p.left ? p.left.height : 0 - const bh = b ? b.height : 0 - const ch = q.right ? q.right.height : 0 - p.height = Math.max(ah, bh) + 1 - q.height = Math.max(ch, p.height) + 1 - - return q - } - - /** - * Modify the tree if its right subtree is too small compared to the left - * Return the new root if any - */ - rightTooSmall () { - if (this.balanceFactor() <= 1) return this // Right is not too small, don't change - - if (this.left.balanceFactor() < 0) this.left.leftRotation() - - return this.rightRotation() - } - - /** - * Modify the tree if its left subtree is too small compared to the right - * Return the new root if any - */ - leftTooSmall () { - if (this.balanceFactor() >= -1) { return this } // Left is not too small, don't change - - if (this.right.balanceFactor() > 0) this.right.rightRotation() - - return this.leftRotation() - } - - /** - * Rebalance the tree along the given path. The path is given reversed (as he was calculated - * in the insert and delete functions). - * Returns the new root of the tree - * Of course, the first element of the path must be the root of the tree - */ - rebalanceAlongPath (path) { - let newRoot = this - let rotated - let i - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { - delete this.height - return this - } // Empty tree - - // Rebalance the tree and update all heights - for (i = path.length - 1; i >= 0; i -= 1) { - path[i].height = 1 + Math.max(path[i].left ? path[i].left.height : 0, path[i].right ? path[i].right.height : 0) - - if (path[i].balanceFactor() > 1) { - rotated = path[i].rightTooSmall() - if (i === 0) newRoot = rotated - } - - if (path[i].balanceFactor() < -1) { - rotated = path[i].leftTooSmall() - if (i === 0) newRoot = rotated - } - } - - return newRoot - } - - /** - * Insert a key, value pair in the tree while maintaining the AVL tree height constraint - * Return a pointer to the root node, which may have changed - */ - insert (key, value) { - const insertPath = [] - let currentNode = this - - // Empty tree, insert as root - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { - this.key = key - this.data.push(value) - this.height = 1 - return this - } - - // Insert new leaf at the right place - while (true) { - // Same key: no change in the tree structure - if (currentNode.compareKeys(currentNode.key, key) === 0) { - if (currentNode.unique) { - const err = new Error(`Can't insert key ${JSON.stringify(key)}, it violates the unique constraint`) - err.key = key - err.errorType = 'uniqueViolated' - throw err - } else currentNode.data.push(value) - return this - } - - insertPath.push(currentNode) - - if (currentNode.compareKeys(key, currentNode.key) < 0) { - if (!currentNode.left) { - insertPath.push(currentNode.createLeftChild({ key: key, value: value })) - break - } else currentNode = currentNode.left - } else { - if (!currentNode.right) { - insertPath.push(currentNode.createRightChild({ key: key, value: value })) - break - } else currentNode = currentNode.right - } - } - - return this.rebalanceAlongPath(insertPath) - } - - /** - * Delete a key or just a value and return the new root of the tree - * @param {Key} key - * @param {Value} value Optional. If not set, the whole key is deleted. If set, only this value is deleted - */ - delete (key, value) { - const newData = [] - let replaceWith - let currentNode = this - const deletePath = [] - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return this // Empty tree - - // Either no match is found and the function will return from within the loop - // Or a match is found and deletePath will contain the path from the root to the node to delete after the loop - while (true) { - if (currentNode.compareKeys(key, currentNode.key) === 0) { break } - - deletePath.push(currentNode) - - if (currentNode.compareKeys(key, currentNode.key) < 0) { - if (currentNode.left) { - currentNode = currentNode.left - } else return this // Key not found, no modification - } else { - // currentNode.compareKeys(key, currentNode.key) is > 0 - if (currentNode.right) { - currentNode = currentNode.right - } else return this // Key not found, no modification - } - } - - // Delete only a value (no tree modification) - if (currentNode.data.length > 1 && value !== undefined) { - currentNode.data.forEach(function (d) { - if (!currentNode.checkValueEquality(d, value)) newData.push(d) - }) - currentNode.data = newData - return this - } - - // Delete a whole node - - // Leaf - if (!currentNode.left && !currentNode.right) { - if (currentNode === this) { // This leaf is also the root - delete currentNode.key - currentNode.data = [] - delete currentNode.height - return this - } else { - if (currentNode.parent.left === currentNode) currentNode.parent.left = null - else currentNode.parent.right = null - return this.rebalanceAlongPath(deletePath) - } - } - - // Node with only one child - if (!currentNode.left || !currentNode.right) { - replaceWith = currentNode.left ? currentNode.left : currentNode.right - - if (currentNode === this) { // This node is also the root - replaceWith.parent = null - return replaceWith // height of replaceWith is necessarily 1 because the tree was balanced before deletion - } else { - if (currentNode.parent.left === currentNode) { - currentNode.parent.left = replaceWith - replaceWith.parent = currentNode.parent - } else { - currentNode.parent.right = replaceWith - replaceWith.parent = currentNode.parent - } - - return this.rebalanceAlongPath(deletePath) - } - } - - // Node with two children - // Use the in-order predecessor (no need to randomize since we actively rebalance) - deletePath.push(currentNode) - replaceWith = currentNode.left - - // Special case: the in-order predecessor is right below the node to delete - if (!replaceWith.right) { - currentNode.key = replaceWith.key - currentNode.data = replaceWith.data - currentNode.left = replaceWith.left - if (replaceWith.left) { replaceWith.left.parent = currentNode } - return this.rebalanceAlongPath(deletePath) - } - - // After this loop, replaceWith is the right-most leaf in the left subtree - // and deletePath the path from the root (inclusive) to replaceWith (exclusive) - while (true) { - if (replaceWith.right) { - deletePath.push(replaceWith) - replaceWith = replaceWith.right - } else break - } - - currentNode.key = replaceWith.key - currentNode.data = replaceWith.data - - replaceWith.parent.right = replaceWith.left - if (replaceWith.left) replaceWith.left.parent = replaceWith.parent - - return this.rebalanceAlongPath(deletePath) - } -} - -/** - * Keep a pointer to the internal tree constructor for testing purposes - */ -AVLTree._AVLTree = _AVLTree; - -/** - * Other functions we want to use on an AVLTree as if it were the internal _AVLTree - */ -['getNumberOfKeys', 'search', 'betweenBounds', 'prettyPrint', 'executeOnEveryNode'].forEach(function (fn) { - AVLTree.prototype[fn] = function () { - return this.tree[fn].apply(this.tree, arguments) - } -}) - -// Interface -module.exports = AVLTree - - -/***/ }), - -/***/ 902: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/** - * Simple binary search tree - */ -const customUtils = __webpack_require__(639) - -class BinarySearchTree { - /** - * Constructor - * @param {Object} options Optional - * @param {Boolean} options.unique Whether to enforce a 'unique' constraint on the key or not - * @param {Key} options.key Initialize this BST's key with key - * @param {Value} options.value Initialize this BST's data with [value] - * @param {Function} options.compareKeys Initialize this BST's compareKeys - */ - constructor (options) { - options = options || {} - - this.left = null - this.right = null - this.parent = options.parent !== undefined ? options.parent : null - if (Object.prototype.hasOwnProperty.call(options, 'key')) { this.key = options.key } - this.data = Object.prototype.hasOwnProperty.call(options, 'value') ? [options.value] : [] - this.unique = options.unique || false - - this.compareKeys = options.compareKeys || customUtils.defaultCompareKeysFunction - this.checkValueEquality = options.checkValueEquality || customUtils.defaultCheckValueEquality - } - - /** - * Get the descendant with max key - */ - getMaxKeyDescendant () { - if (this.right) return this.right.getMaxKeyDescendant() - else return this - } - - /** - * Get the maximum key - */ - getMaxKey () { - return this.getMaxKeyDescendant().key - } - - /** - * Get the descendant with min key - */ - getMinKeyDescendant () { - if (this.left) return this.left.getMinKeyDescendant() - else return this - } - - /** - * Get the minimum key - */ - getMinKey () { - return this.getMinKeyDescendant().key - } - - /** - * Check that all nodes (incl. leaves) fullfil condition given by fn - * test is a function passed every (key, data) and which throws if the condition is not met - */ - checkAllNodesFullfillCondition (test) { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return - - test(this.key, this.data) - if (this.left) this.left.checkAllNodesFullfillCondition(test) - if (this.right) this.right.checkAllNodesFullfillCondition(test) - } - - /** - * Check that the core BST properties on node ordering are verified - * Throw if they aren't - */ - checkNodeOrdering () { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return - - if (this.left) { - this.left.checkAllNodesFullfillCondition(k => { - if (this.compareKeys(k, this.key) >= 0) throw new Error(`Tree with root ${this.key} is not a binary search tree`) - }) - this.left.checkNodeOrdering() - } - - if (this.right) { - this.right.checkAllNodesFullfillCondition(k => { - if (this.compareKeys(k, this.key) <= 0) throw new Error(`Tree with root ${this.key} is not a binary search tree`) - }) - this.right.checkNodeOrdering() - } - } - - /** - * Check that all pointers are coherent in this tree - */ - checkInternalPointers () { - if (this.left) { - if (this.left.parent !== this) throw new Error(`Parent pointer broken for key ${this.key}`) - this.left.checkInternalPointers() - } - - if (this.right) { - if (this.right.parent !== this) throw new Error(`Parent pointer broken for key ${this.key}`) - this.right.checkInternalPointers() - } - } - - /** - * Check that a tree is a BST as defined here (node ordering and pointer references) - */ - checkIsBST () { - this.checkNodeOrdering() - this.checkInternalPointers() - if (this.parent) throw new Error("The root shouldn't have a parent") - } - - /** - * Get number of keys inserted - */ - getNumberOfKeys () { - let res - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return 0 - - res = 1 - if (this.left) res += this.left.getNumberOfKeys() - if (this.right) res += this.right.getNumberOfKeys() - - return res - } - - /** - * Create a BST similar (i.e. same options except for key and value) to the current one - * Use the same constructor (i.e. BinarySearchTree, AVLTree etc) - * @param {Object} options see constructor - */ - createSimilar (options) { - options = options || {} - options.unique = this.unique - options.compareKeys = this.compareKeys - options.checkValueEquality = this.checkValueEquality - - return new this.constructor(options) - } - - /** - * Create the left child of this BST and return it - */ - createLeftChild (options) { - const leftChild = this.createSimilar(options) - leftChild.parent = this - this.left = leftChild - - return leftChild - } - - /** - * Create the right child of this BST and return it - */ - createRightChild (options) { - const rightChild = this.createSimilar(options) - rightChild.parent = this - this.right = rightChild - - return rightChild - } - - /** - * Insert a new element - */ - insert (key, value) { - // Empty tree, insert as root - if (!Object.prototype.hasOwnProperty.call(this, 'key')) { - this.key = key - this.data.push(value) - return - } - - // Same key as root - if (this.compareKeys(this.key, key) === 0) { - if (this.unique) { - const err = new Error(`Can't insert key ${JSON.stringify(key)}, it violates the unique constraint`) - err.key = key - err.errorType = 'uniqueViolated' - throw err - } else this.data.push(value) - return - } - - if (this.compareKeys(key, this.key) < 0) { - // Insert in left subtree - if (this.left) this.left.insert(key, value) - else this.createLeftChild({ key: key, value: value }) - } else { - // Insert in right subtree - if (this.right) this.right.insert(key, value) - else this.createRightChild({ key: key, value: value }) - } - } - - /** - * Search for all data corresponding to a key - */ - search (key) { - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return [] - - if (this.compareKeys(this.key, key) === 0) return this.data - - if (this.compareKeys(key, this.key) < 0) { - if (this.left) return this.left.search(key) - else return [] - } else { - if (this.right) return this.right.search(key) - else return [] - } - } - - /** - * Return a function that tells whether a given key matches a lower bound - */ - getLowerBoundMatcher (query) { - // No lower bound - if (!Object.prototype.hasOwnProperty.call(query, '$gt') && !Object.prototype.hasOwnProperty.call(query, '$gte')) return () => true - - if (Object.prototype.hasOwnProperty.call(query, '$gt') && Object.prototype.hasOwnProperty.call(query, '$gte')) { - if (this.compareKeys(query.$gte, query.$gt) === 0) return key => this.compareKeys(key, query.$gt) > 0 - - if (this.compareKeys(query.$gte, query.$gt) > 0) return key => this.compareKeys(key, query.$gte) >= 0 - else return key => this.compareKeys(key, query.$gt) > 0 - } - - if (Object.prototype.hasOwnProperty.call(query, '$gt')) return key => this.compareKeys(key, query.$gt) > 0 - else return key => this.compareKeys(key, query.$gte) >= 0 - } - - /** - * Return a function that tells whether a given key matches an upper bound - */ - getUpperBoundMatcher (query) { - // No lower bound - if (!Object.prototype.hasOwnProperty.call(query, '$lt') && !Object.prototype.hasOwnProperty.call(query, '$lte')) return () => true - - if (Object.prototype.hasOwnProperty.call(query, '$lt') && Object.prototype.hasOwnProperty.call(query, '$lte')) { - if (this.compareKeys(query.$lte, query.$lt) === 0) return key => this.compareKeys(key, query.$lt) < 0 - - if (this.compareKeys(query.$lte, query.$lt) < 0) return key => this.compareKeys(key, query.$lte) <= 0 - else return key => this.compareKeys(key, query.$lt) < 0 - } - - if (Object.prototype.hasOwnProperty.call(query, '$lt')) return key => this.compareKeys(key, query.$lt) < 0 - else return key => this.compareKeys(key, query.$lte) <= 0 - } - - /** - * Get all data for a key between bounds - * Return it in key order - * @param {Object} query Mongo-style query where keys are $lt, $lte, $gt or $gte (other keys are not considered) - * @param {Functions} lbm/ubm matching functions calculated at the first recursive step - */ - betweenBounds (query, lbm, ubm) { - const res = [] - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return [] // Empty tree - - lbm = lbm || this.getLowerBoundMatcher(query) - ubm = ubm || this.getUpperBoundMatcher(query) - - if (lbm(this.key) && this.left) append(res, this.left.betweenBounds(query, lbm, ubm)) - if (lbm(this.key) && ubm(this.key)) append(res, this.data) - if (ubm(this.key) && this.right) append(res, this.right.betweenBounds(query, lbm, ubm)) - - return res - } - - /** - * Delete the current node if it is a leaf - * Return true if it was deleted - */ - deleteIfLeaf () { - if (this.left || this.right) return false - - // The leaf is itself a root - if (!this.parent) { - delete this.key - this.data = [] - return true - } - - if (this.parent.left === this) this.parent.left = null - else this.parent.right = null - - return true - } - - /** - * Delete the current node if it has only one child - * Return true if it was deleted - */ - deleteIfOnlyOneChild () { - let child - - if (this.left && !this.right) child = this.left - if (!this.left && this.right) child = this.right - if (!child) return false - - // Root - if (!this.parent) { - this.key = child.key - this.data = child.data - - this.left = null - if (child.left) { - this.left = child.left - child.left.parent = this - } - - this.right = null - if (child.right) { - this.right = child.right - child.right.parent = this - } - - return true - } - - if (this.parent.left === this) { - this.parent.left = child - child.parent = this.parent - } else { - this.parent.right = child - child.parent = this.parent - } - - return true - } - - /** - * Delete a key or just a value - * @param {Key} key - * @param {Value} value Optional. If not set, the whole key is deleted. If set, only this value is deleted - */ - delete (key, value) { - const newData = [] - let replaceWith - - if (!Object.prototype.hasOwnProperty.call(this, 'key')) return - - if (this.compareKeys(key, this.key) < 0) { - if (this.left) this.left.delete(key, value) - return - } - - if (this.compareKeys(key, this.key) > 0) { - if (this.right) this.right.delete(key, value) - return - } - - if (!this.compareKeys(key, this.key) === 0) return - - // Delete only a value - if (this.data.length > 1 && value !== undefined) { - this.data.forEach(d => { - if (!this.checkValueEquality(d, value)) newData.push(d) - }) - this.data = newData - return - } - - // Delete the whole node - if (this.deleteIfLeaf()) return - - if (this.deleteIfOnlyOneChild()) return - - // We are in the case where the node to delete has two children - if (Math.random() >= 0.5) { // Randomize replacement to avoid unbalancing the tree too much - // Use the in-order predecessor - replaceWith = this.left.getMaxKeyDescendant() - - this.key = replaceWith.key - this.data = replaceWith.data - - if (this === replaceWith.parent) { // Special case - this.left = replaceWith.left - if (replaceWith.left) replaceWith.left.parent = replaceWith.parent - } else { - replaceWith.parent.right = replaceWith.left - if (replaceWith.left) replaceWith.left.parent = replaceWith.parent - } - } else { - // Use the in-order successor - replaceWith = this.right.getMinKeyDescendant() - - this.key = replaceWith.key - this.data = replaceWith.data - - if (this === replaceWith.parent) { // Special case - this.right = replaceWith.right - if (replaceWith.right) replaceWith.right.parent = replaceWith.parent - } else { - replaceWith.parent.left = replaceWith.right - if (replaceWith.right) replaceWith.right.parent = replaceWith.parent - } - } - } - - /** - * Execute a function on every node of the tree, in key order - * @param {Function} fn Signature: node. Most useful will probably be node.key and node.data - */ - executeOnEveryNode (fn) { - if (this.left) this.left.executeOnEveryNode(fn) - fn(this) - if (this.right) this.right.executeOnEveryNode(fn) - } - - /** - * Pretty print a tree - * @param {Boolean} printData To print the nodes' data along with the key - */ - prettyPrint (printData, spacing) { - spacing = spacing || '' - - console.log(`${spacing}* ${this.key}`) - if (printData) console.log(`${spacing}* ${this.data}`) - - if (!this.left && !this.right) return - - if (this.left) this.left.prettyPrint(printData, `${spacing} `) - else console.log(`${spacing} *`) - - if (this.right) this.right.prettyPrint(printData, `${spacing} `) - else console.log(`${spacing} *`) - } -} - -// ================================ -// Methods used to test the tree -// ================================ - -// ============================================ -// Methods used to actually work on the tree -// ============================================ - -// Append all elements in toAppend to array -function append (array, toAppend) { - for (let i = 0; i < toAppend.length; i += 1) { - array.push(toAppend[i]) - } -} - -// Interface -module.exports = BinarySearchTree - - -/***/ }), - -/***/ 639: -/***/ ((module) => { - -/** - * Return an array with the numbers from 0 to n-1, in a random order - */ -const getRandomArray = n => { - if (n === 0) return [] - if (n === 1) return [0] - - const res = getRandomArray(n - 1) - const next = Math.floor(Math.random() * n) - res.splice(next, 0, n - 1) // Add n-1 at a random position in the array - - return res -} - -module.exports.getRandomArray = getRandomArray - -/* - * Default compareKeys function will work for numbers, strings and dates - */ -const defaultCompareKeysFunction = (a, b) => { - if (a < b) return -1 - if (a > b) return 1 - if (a === b) return 0 - - const err = new Error("Couldn't compare elements") - err.a = a - err.b = b - throw err -} - -module.exports.defaultCompareKeysFunction = defaultCompareKeysFunction - -/** - * Check whether two values are equal (used in non-unique deletion) - */ -const defaultCheckValueEquality = (a, b) => a === b - -module.exports.defaultCheckValueEquality = defaultCheckValueEquality - - -/***/ }), - -/***/ 924: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(210); - -var callBind = __webpack_require__(559); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; - - -/***/ }), - -/***/ 559: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(612); -var GetIntrinsic = __webpack_require__(210); - -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty( - func, - 'length', - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } - } - return func; -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} - - -/***/ }), - -/***/ 187: -/***/ ((module) => { - -"use strict"; -// 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 R = typeof Reflect === 'object' ? Reflect : null -var ReflectApply = R && typeof R.apply === 'function' - ? R.apply - : function ReflectApply(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); - } - -var ReflectOwnKeys -if (R && typeof R.ownKeys === 'function') { - ReflectOwnKeys = R.ownKeys -} else if (Object.getOwnPropertySymbols) { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target) - .concat(Object.getOwnPropertySymbols(target)); - }; -} else { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target); - }; -} - -function ProcessEmitWarning(warning) { - if (console && console.warn) console.warn(warning); -} - -var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { - return value !== value; -} - -function EventEmitter() { - EventEmitter.init.call(this); -} -module.exports = EventEmitter; -module.exports.once = once; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._eventsCount = 0; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -function checkListener(listener) { - if (typeof listener !== 'function') { - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } -} - -Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); - } - defaultMaxListeners = arg; - } -}); - -EventEmitter.init = function() { - - if (this._events === undefined || - this._events === Object.getPrototypeOf(this)._events) { - this._events = Object.create(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -}; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); - } - this._maxListeners = n; - return this; -}; - -function _getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return _getMaxListeners(this); -}; - -EventEmitter.prototype.emit = function emit(type) { - var args = []; - for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); - var doError = (type === 'error'); - - var events = this._events; - if (events !== undefined) - doError = (doError && events.error === undefined); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - var er; - if (args.length > 0) - er = args[0]; - if (er instanceof Error) { - // Note: The comments on the `throw` lines are intentional, they show - // up in Node's output if this results in an unhandled exception. - throw er; // Unhandled 'error' event - } - // At least give some kind of context to the user - var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); - err.context = er; - throw err; // Unhandled 'error' event - } - - var handler = events[type]; - - if (handler === undefined) - return false; - - if (typeof handler === 'function') { - ReflectApply(handler, this, args); - } else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - ReflectApply(listeners[i], this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - checkListener(listener); - - events = target._events; - if (events === undefined) { - events = target._events = Object.create(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener !== undefined) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (existing === undefined) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - // If we've already got an array, just append. - } else if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - - // Check for listener leak - m = _getMaxListeners(target); - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; - // No error code for this since it is a Warning - // eslint-disable-next-line no-restricted-syntax - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' ' + String(type) + ' listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (arguments.length === 0) - return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - checkListener(listener); - - events = this._events; - if (events === undefined) - return this; - - list = events[type]; - if (list === undefined) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = Object.create(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else { - spliceOne(list, position); - } - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener !== undefined) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (events === undefined) - return this; - - // not listening for removeListener, no need to emit - if (events.removeListener === undefined) { - if (arguments.length === 0) { - this._events = Object.create(null); - this._eventsCount = 0; - } else if (events[type] !== undefined) { - if (--this._eventsCount === 0) - this._events = Object.create(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = Object.keys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = Object.create(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners !== undefined) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (events === undefined) - return []; - - var evlistener = events[type]; - if (evlistener === undefined) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? - unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events !== undefined) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener !== undefined) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; -}; - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function spliceOne(list, index) { - for (; index + 1 < list.length; index++) - list[index] = list[index + 1]; - list.pop(); -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function once(emitter, name) { - return new Promise(function (resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } - - function resolver() { - if (typeof emitter.removeListener === 'function') { - emitter.removeListener('error', errorListener); - } - resolve([].slice.call(arguments)); - }; - - eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); - if (name !== 'error') { - addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); - } - }); -} - -function addErrorHandlerIfEventEmitter(emitter, handler, flags) { - if (typeof emitter.on === 'function') { - eventTargetAgnosticAddListener(emitter, 'error', handler, flags); - } -} - -function eventTargetAgnosticAddListener(emitter, name, listener, flags) { - if (typeof emitter.on === 'function') { - if (flags.once) { - emitter.once(name, listener); - } else { - emitter.on(name, listener); - } - } else if (typeof emitter.addEventListener === 'function') { - // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen for `error` events here. - emitter.addEventListener(name, function wrapListener(arg) { - // IE does not have builtin `{ once: true }` support so we - // have to do it manually. - if (flags.once) { - emitter.removeEventListener(name, wrapListener); - } - listener(arg); - }); - } else { - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } -} - - -/***/ }), - -/***/ 29: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var isCallable = __webpack_require__(320); - -var toStr = Object.prototype.toString; -var hasOwnProperty = Object.prototype.hasOwnProperty; - -var forEachArray = function forEachArray(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } -}; - -var forEachString = function forEachString(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - // no such thing as a sparse string. - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } -}; - -var forEachObject = function forEachObject(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } -}; - -var forEach = function forEach(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError('iterator must be a function'); - } - - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - - if (toStr.call(list) === '[object Array]') { - forEachArray(list, iterator, receiver); - } else if (typeof list === 'string') { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } -}; - -module.exports = forEach; - - -/***/ }), - -/***/ 648: -/***/ ((module) => { - -"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; -}; - - -/***/ }), - -/***/ 612: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var implementation = __webpack_require__(648); - -module.exports = Function.prototype.bind || implementation; - - -/***/ }), - -/***/ 210: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var undefined; - -var $SyntaxError = SyntaxError; -var $Function = Function; -var $TypeError = TypeError; - -// eslint-disable-next-line consistent-return -var getEvalledConstructor = function (expressionSyntax) { - try { - 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 = __webpack_require__(405)(); - -var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto - -var needsEval = {}; - -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%': needsEval, - '%AsyncGenerator%': needsEval, - '%AsyncGeneratorFunction%': needsEval, - '%AsyncIteratorPrototype%': needsEval, - '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, - '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, - '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, - '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, - '%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%': needsEval, - '%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 -}; - -try { - null.error; // eslint-disable-line no-unused-expressions -} catch (e) { - // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 - var errorProto = getProto(getProto(e)); - INTRINSICS['%Error.prototype%'] = errorProto; -} - -var doEval = function doEval(name) { - var value; - if (name === '%AsyncFunction%') { - value = getEvalledConstructor('async function () {}'); - } else if (name === '%GeneratorFunction%') { - value = getEvalledConstructor('function* () {}'); - } else if (name === '%AsyncGeneratorFunction%') { - value = getEvalledConstructor('async function* () {}'); - } else if (name === '%AsyncGenerator%') { - var fn = doEval('%AsyncGeneratorFunction%'); - if (fn) { - value = fn.prototype; - } - } else if (name === '%AsyncIteratorPrototype%') { - var gen = doEval('%AsyncGenerator%'); - if (gen) { - value = getProto(gen.prototype); - } - } - - INTRINSICS[name] = value; - - return value; -}; - -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 = __webpack_require__(612); -var hasOwn = __webpack_require__(642); -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); -var $strSlice = bind.call(Function.call, String.prototype.slice); -var $exec = bind.call(Function.call, RegExp.prototype.exec); - -/* 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 first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === '%' && last !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); - } else if (last === '%' && first !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); - } - 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 (value === needsEval) { - value = doEval(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'); - } - - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); - } - 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]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ( - ( - (first === '"' || first === "'" || first === '`') - || (last === '"' || last === "'" || last === '`') - ) - && first !== last - ) { - throw new $SyntaxError('property names with quotes must have matching quotes'); - } - if (part === 'constructor' || !isOwn) { - skipFurtherCaching = true; - } - - intrinsicBaseName += '.' + part; - intrinsicRealName = '%' + intrinsicBaseName + '%'; - - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); - } - return void undefined; - } - if ($gOPD && (i + 1) >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - - // 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; -}; - - -/***/ }), - -/***/ 296: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(210); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); - -if ($gOPD) { - try { - $gOPD([], 'length'); - } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; - } -} - -module.exports = $gOPD; - - -/***/ }), - -/***/ 405: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var origSymbol = typeof Symbol !== 'undefined' && Symbol; -var hasSymbolSham = __webpack_require__(419); - -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(); -}; - - -/***/ }), - -/***/ 419: -/***/ ((module) => { - -"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, no-unreachable-loop - 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; -}; - - -/***/ }), - -/***/ 410: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var hasSymbols = __webpack_require__(419); - -module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; -}; - - -/***/ }), - -/***/ 642: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(612); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - - -/***/ }), - -/***/ 717: -/***/ ((module) => { - -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} - - -/***/ }), - -/***/ 584: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var hasToStringTag = __webpack_require__(410)(); -var callBound = __webpack_require__(924); - -var $toString = callBound('Object.prototype.toString'); - -var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === '[object Arguments]'; -}; - -var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && - typeof value === 'object' && - typeof value.length === 'number' && - value.length >= 0 && - $toString(value) !== '[object Array]' && - $toString(value.callee) === '[object Function]'; -}; - -var supportsStandardArguments = (function () { - return isStandardArguments(arguments); -}()); - -isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests - -module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - - -/***/ }), - -/***/ 320: -/***/ ((module) => { - -"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 objectClass = '[object Object]'; -var fnClass = '[object Function]'; -var genClass = '[object GeneratorFunction]'; -var ddaClass = '[object HTMLAllCollection]'; // IE 11 -var ddaClass2 = '[object HTML document.all class]'; -var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` - -var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing - -var isDDA = function isDocumentDotAll() { return false; }; -if (typeof document === 'object') { - // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly - var all = document.all; - if (toStr.call(all) === toStr.call(document.all)) { - isDDA = function isDocumentDotAll(value) { - /* globals document: false */ - // in IE 6-8, typeof document.all is "object" and it's truthy - if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { - try { - var str = toStr.call(value); - return ( - str === ddaClass - || str === ddaClass2 - || str === ddaClass3 // opera 12.16 - || str === objectClass // IE 6-8 - ) && value('') == null; // eslint-disable-line eqeqeq - } catch (e) { /**/ } - } - return false; - }; - } -} - -module.exports = reflectApply - ? function isCallable(value) { - if (isDDA(value)) { return true; } - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { return false; } - } - return !isES6ClassFn(value) && tryFunctionObject(value); - } - : function isCallable(value) { - if (isDDA(value)) { return true; } - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - if (hasToStringTag) { return tryFunctionObject(value); } - if (isES6ClassFn(value)) { return false; } - var strClass = toStr.call(value); - if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } - return tryFunctionObject(value); - }; - - -/***/ }), - -/***/ 662: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var toStr = Object.prototype.toString; -var fnToStr = Function.prototype.toString; -var isFnRegex = /^\s*(?:function)?\*/; -var hasToStringTag = __webpack_require__(410)(); -var getProto = Object.getPrototypeOf; -var getGeneratorFunc = function () { // eslint-disable-line consistent-return - if (!hasToStringTag) { - return false; - } - try { - return Function('return function*() {}')(); - } catch (e) { - } -}; -var GeneratorFunction; - -module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== 'function') { - return false; - } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; - } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === '[object GeneratorFunction]'; - } - if (!getProto) { - return false; - } - if (typeof GeneratorFunction === 'undefined') { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; - } - return getProto(fn) === GeneratorFunction; -}; - - -/***/ }), - -/***/ 692: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var forEach = __webpack_require__(29); -var availableTypedArrays = __webpack_require__(83); -var callBound = __webpack_require__(924); - -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = __webpack_require__(410)(); -var gOPD = __webpack_require__(296); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; -var typedArrays = availableTypedArrays(); - -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; -}; -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function (getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { /**/ } - } - }); - return anyTrue; -}; - -module.exports = function isTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { return false; } - return tryTypedArrays(value); -}; - - -/***/ }), - -/***/ 483: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/*! - localForage -- Offline Storage, Improved - Version 1.10.0 - https://localforage.github.io/localForage - (c) 2013-2017 Mozilla, Apache License 2.0 -*/ -(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=undefined;if(!u&&a)return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw (f.code="MODULE_NOT_FOUND", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=undefined;for(var o=0;o element; its readystatechange event will be fired asynchronously once it is inserted - // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. - var scriptEl = global.document.createElement('script'); - scriptEl.onreadystatechange = function () { - nextTick(); - - scriptEl.onreadystatechange = null; - scriptEl.parentNode.removeChild(scriptEl); - scriptEl = null; - }; - global.document.documentElement.appendChild(scriptEl); - }; - } else { - scheduleDrain = function () { - setTimeout(nextTick, 0); - }; - } -} - -var draining; -var queue = []; -//named nextTick for less confusing stack traces -function nextTick() { - draining = true; - var i, oldQueue; - var len = queue.length; - while (len) { - oldQueue = queue; - queue = []; - i = -1; - while (++i < len) { - oldQueue[i](); - } - len = queue.length; - } - draining = false; -} - -module.exports = immediate; -function immediate(task) { - if (queue.push(task) === 1 && !draining) { - scheduleDrain(); - } -} - -}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],2:[function(_dereq_,module,exports){ -'use strict'; -var immediate = _dereq_(1); - -/* istanbul ignore next */ -function INTERNAL() {} - -var handlers = {}; - -var REJECTED = ['REJECTED']; -var FULFILLED = ['FULFILLED']; -var PENDING = ['PENDING']; - -module.exports = Promise; - -function Promise(resolver) { - if (typeof resolver !== 'function') { - throw new TypeError('resolver must be a function'); - } - this.state = PENDING; - this.queue = []; - this.outcome = void 0; - if (resolver !== INTERNAL) { - safelyResolveThenable(this, resolver); - } -} - -Promise.prototype["catch"] = function (onRejected) { - return this.then(null, onRejected); -}; -Promise.prototype.then = function (onFulfilled, onRejected) { - if (typeof onFulfilled !== 'function' && this.state === FULFILLED || - typeof onRejected !== 'function' && this.state === REJECTED) { - return this; - } - var promise = new this.constructor(INTERNAL); - if (this.state !== PENDING) { - var resolver = this.state === FULFILLED ? onFulfilled : onRejected; - unwrap(promise, resolver, this.outcome); - } else { - this.queue.push(new QueueItem(promise, onFulfilled, onRejected)); - } - - return promise; -}; -function QueueItem(promise, onFulfilled, onRejected) { - this.promise = promise; - if (typeof onFulfilled === 'function') { - this.onFulfilled = onFulfilled; - this.callFulfilled = this.otherCallFulfilled; - } - if (typeof onRejected === 'function') { - this.onRejected = onRejected; - this.callRejected = this.otherCallRejected; - } -} -QueueItem.prototype.callFulfilled = function (value) { - handlers.resolve(this.promise, value); -}; -QueueItem.prototype.otherCallFulfilled = function (value) { - unwrap(this.promise, this.onFulfilled, value); -}; -QueueItem.prototype.callRejected = function (value) { - handlers.reject(this.promise, value); -}; -QueueItem.prototype.otherCallRejected = function (value) { - unwrap(this.promise, this.onRejected, value); -}; - -function unwrap(promise, func, value) { - immediate(function () { - var returnValue; - try { - returnValue = func(value); - } catch (e) { - return handlers.reject(promise, e); - } - if (returnValue === promise) { - handlers.reject(promise, new TypeError('Cannot resolve promise with itself')); - } else { - handlers.resolve(promise, returnValue); - } - }); -} - -handlers.resolve = function (self, value) { - var result = tryCatch(getThen, value); - if (result.status === 'error') { - return handlers.reject(self, result.value); - } - var thenable = result.value; - - if (thenable) { - safelyResolveThenable(self, thenable); - } else { - self.state = FULFILLED; - self.outcome = value; - var i = -1; - var len = self.queue.length; - while (++i < len) { - self.queue[i].callFulfilled(value); - } - } - return self; -}; -handlers.reject = function (self, error) { - self.state = REJECTED; - self.outcome = error; - var i = -1; - var len = self.queue.length; - while (++i < len) { - self.queue[i].callRejected(error); - } - return self; -}; - -function getThen(obj) { - // Make sure we only access the accessor once as required by the spec - var then = obj && obj.then; - if (obj && (typeof obj === 'object' || typeof obj === 'function') && typeof then === 'function') { - return function appyThen() { - then.apply(obj, arguments); - }; - } -} - -function safelyResolveThenable(self, thenable) { - // Either fulfill, reject or reject with error - var called = false; - function onError(value) { - if (called) { - return; - } - called = true; - handlers.reject(self, value); - } - - function onSuccess(value) { - if (called) { - return; - } - called = true; - handlers.resolve(self, value); - } - - function tryToUnwrap() { - thenable(onSuccess, onError); - } - - var result = tryCatch(tryToUnwrap); - if (result.status === 'error') { - onError(result.value); - } -} - -function tryCatch(func, value) { - var out = {}; - try { - out.value = func(value); - out.status = 'success'; - } catch (e) { - out.status = 'error'; - out.value = e; - } - return out; -} - -Promise.resolve = resolve; -function resolve(value) { - if (value instanceof this) { - return value; - } - return handlers.resolve(new this(INTERNAL), value); -} - -Promise.reject = reject; -function reject(reason) { - var promise = new this(INTERNAL); - return handlers.reject(promise, reason); -} - -Promise.all = all; -function all(iterable) { - var self = this; - if (Object.prototype.toString.call(iterable) !== '[object Array]') { - return this.reject(new TypeError('must be an array')); - } - - var len = iterable.length; - var called = false; - if (!len) { - return this.resolve([]); - } - - var values = new Array(len); - var resolved = 0; - var i = -1; - var promise = new this(INTERNAL); - - while (++i < len) { - allResolver(iterable[i], i); - } - return promise; - function allResolver(value, i) { - self.resolve(value).then(resolveFromAll, function (error) { - if (!called) { - called = true; - handlers.reject(promise, error); - } - }); - function resolveFromAll(outValue) { - values[i] = outValue; - if (++resolved === len && !called) { - called = true; - handlers.resolve(promise, values); - } - } - } -} - -Promise.race = race; -function race(iterable) { - var self = this; - if (Object.prototype.toString.call(iterable) !== '[object Array]') { - return this.reject(new TypeError('must be an array')); - } - - var len = iterable.length; - var called = false; - if (!len) { - return this.resolve([]); - } - - var i = -1; - var promise = new this(INTERNAL); - - while (++i < len) { - resolver(iterable[i]); - } - return promise; - function resolver(value) { - self.resolve(value).then(function (response) { - if (!called) { - called = true; - handlers.resolve(promise, response); - } - }, function (error) { - if (!called) { - called = true; - handlers.reject(promise, error); - } - }); - } -} - -},{"1":1}],3:[function(_dereq_,module,exports){ -(function (global){ -'use strict'; -if (typeof global.Promise !== 'function') { - global.Promise = _dereq_(2); -} - -}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"2":2}],4:[function(_dereq_,module,exports){ -'use strict'; - -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; }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function getIDB() { - /* global indexedDB,webkitIndexedDB,mozIndexedDB,OIndexedDB,msIndexedDB */ - try { - if (typeof indexedDB !== 'undefined') { - return indexedDB; - } - if (typeof webkitIndexedDB !== 'undefined') { - return webkitIndexedDB; - } - if (typeof mozIndexedDB !== 'undefined') { - return mozIndexedDB; - } - if (typeof OIndexedDB !== 'undefined') { - return OIndexedDB; - } - if (typeof msIndexedDB !== 'undefined') { - return msIndexedDB; - } - } catch (e) { - return; - } -} - -var idb = getIDB(); - -function isIndexedDBValid() { - try { - // Initialize IndexedDB; fall back to vendor-prefixed versions - // if needed. - if (!idb || !idb.open) { - return false; - } - // We mimic PouchDB here; - // - // We test for openDatabase because IE Mobile identifies itself - // as Safari. Oh the lulz... - var isSafari = typeof openDatabase !== 'undefined' && /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform); - - var hasFetch = typeof fetch === 'function' && fetch.toString().indexOf('[native code') !== -1; - - // Safari <10.1 does not meet our requirements for IDB support - // (see: https://github.com/pouchdb/pouchdb/issues/5572). - // Safari 10.1 shipped with fetch, we can use that to detect it. - // Note: this creates issues with `window.fetch` polyfills and - // overrides; see: - // https://github.com/localForage/localForage/issues/856 - return (!isSafari || hasFetch) && typeof indexedDB !== 'undefined' && - // some outdated implementations of IDB that appear on Samsung - // and HTC Android devices <4.4 are missing IDBKeyRange - // See: https://github.com/mozilla/localForage/issues/128 - // See: https://github.com/mozilla/localForage/issues/272 - typeof IDBKeyRange !== 'undefined'; - } catch (e) { - return false; - } -} - -// Abstracts constructing a Blob object, so it also works in older -// browsers that don't support the native Blob constructor. (i.e. -// old QtWebKit versions, at least). -// Abstracts constructing a Blob object, so it also works in older -// browsers that don't support the native Blob constructor. (i.e. -// old QtWebKit versions, at least). -function createBlob(parts, properties) { - /* global BlobBuilder,MSBlobBuilder,MozBlobBuilder,WebKitBlobBuilder */ - parts = parts || []; - properties = properties || {}; - try { - return new Blob(parts, properties); - } catch (e) { - if (e.name !== 'TypeError') { - throw e; - } - var Builder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : WebKitBlobBuilder; - var builder = new Builder(); - for (var i = 0; i < parts.length; i += 1) { - builder.append(parts[i]); - } - return builder.getBlob(properties.type); - } -} - -// This is CommonJS because lie is an external dependency, so Rollup -// can just ignore it. -if (typeof Promise === 'undefined') { - // In the "nopromises" build this will just throw if you don't have - // a global promise object, but it would throw anyway later. - _dereq_(3); -} -var Promise$1 = Promise; - -function executeCallback(promise, callback) { - if (callback) { - promise.then(function (result) { - callback(null, result); - }, function (error) { - callback(error); - }); - } -} - -function executeTwoCallbacks(promise, callback, errorCallback) { - if (typeof callback === 'function') { - promise.then(callback); - } - - if (typeof errorCallback === 'function') { - promise["catch"](errorCallback); - } -} - -function normalizeKey(key) { - // Cast the key to a string, as that's all we can set as a key. - if (typeof key !== 'string') { - console.warn(key + ' used as a key, but it is not a string.'); - key = String(key); - } - - return key; -} - -function getCallback() { - if (arguments.length && typeof arguments[arguments.length - 1] === 'function') { - return arguments[arguments.length - 1]; - } -} - -// Some code originally from async_storage.js in -// [Gaia](https://github.com/mozilla-b2g/gaia). - -var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support'; -var supportsBlobs = void 0; -var dbContexts = {}; -var toString = Object.prototype.toString; - -// Transaction Modes -var READ_ONLY = 'readonly'; -var READ_WRITE = 'readwrite'; - -// Transform a binary string to an array buffer, because otherwise -// weird stuff happens when you try to work with the binary string directly. -// It is known. -// From http://stackoverflow.com/questions/14967647/ (continues on next line) -// encode-decode-image-with-base64-breaks-image (2013-04-21) -function _binStringToArrayBuffer(bin) { - var length = bin.length; - var buf = new ArrayBuffer(length); - var arr = new Uint8Array(buf); - for (var i = 0; i < length; i++) { - arr[i] = bin.charCodeAt(i); - } - return buf; -} - -// -// Blobs are not supported in all versions of IndexedDB, notably -// Chrome <37 and Android <5. In those versions, storing a blob will throw. -// -// Various other blob bugs exist in Chrome v37-42 (inclusive). -// Detecting them is expensive and confusing to users, and Chrome 37-42 -// is at very low usage worldwide, so we do a hacky userAgent check instead. -// -// content-type bug: https://code.google.com/p/chromium/issues/detail?id=408120 -// 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916 -// FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836 -// -// Code borrowed from PouchDB. See: -// https://github.com/pouchdb/pouchdb/blob/master/packages/node_modules/pouchdb-adapter-idb/src/blobSupport.js -// -function _checkBlobSupportWithoutCaching(idb) { - return new Promise$1(function (resolve) { - var txn = idb.transaction(DETECT_BLOB_SUPPORT_STORE, READ_WRITE); - var blob = createBlob(['']); - txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key'); - - txn.onabort = function (e) { - // If the transaction aborts now its due to not being able to - // write to the database, likely due to the disk being full - e.preventDefault(); - e.stopPropagation(); - resolve(false); - }; - - txn.oncomplete = function () { - var matchedChrome = navigator.userAgent.match(/Chrome\/(\d+)/); - var matchedEdge = navigator.userAgent.match(/Edge\//); - // MS Edge pretends to be Chrome 42: - // https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx - resolve(matchedEdge || !matchedChrome || parseInt(matchedChrome[1], 10) >= 43); - }; - })["catch"](function () { - return false; // error, so assume unsupported - }); -} - -function _checkBlobSupport(idb) { - if (typeof supportsBlobs === 'boolean') { - return Promise$1.resolve(supportsBlobs); - } - return _checkBlobSupportWithoutCaching(idb).then(function (value) { - supportsBlobs = value; - return supportsBlobs; - }); -} - -function _deferReadiness(dbInfo) { - var dbContext = dbContexts[dbInfo.name]; - - // Create a deferred object representing the current database operation. - var deferredOperation = {}; - - deferredOperation.promise = new Promise$1(function (resolve, reject) { - deferredOperation.resolve = resolve; - deferredOperation.reject = reject; - }); - - // Enqueue the deferred operation. - dbContext.deferredOperations.push(deferredOperation); - - // Chain its promise to the database readiness. - if (!dbContext.dbReady) { - dbContext.dbReady = deferredOperation.promise; - } else { - dbContext.dbReady = dbContext.dbReady.then(function () { - return deferredOperation.promise; - }); - } -} - -function _advanceReadiness(dbInfo) { - var dbContext = dbContexts[dbInfo.name]; - - // Dequeue a deferred operation. - var deferredOperation = dbContext.deferredOperations.pop(); - - // Resolve its promise (which is part of the database readiness - // chain of promises). - if (deferredOperation) { - deferredOperation.resolve(); - return deferredOperation.promise; - } -} - -function _rejectReadiness(dbInfo, err) { - var dbContext = dbContexts[dbInfo.name]; - - // Dequeue a deferred operation. - var deferredOperation = dbContext.deferredOperations.pop(); - - // Reject its promise (which is part of the database readiness - // chain of promises). - if (deferredOperation) { - deferredOperation.reject(err); - return deferredOperation.promise; - } -} - -function _getConnection(dbInfo, upgradeNeeded) { - return new Promise$1(function (resolve, reject) { - dbContexts[dbInfo.name] = dbContexts[dbInfo.name] || createDbContext(); - - if (dbInfo.db) { - if (upgradeNeeded) { - _deferReadiness(dbInfo); - dbInfo.db.close(); - } else { - return resolve(dbInfo.db); - } - } - - var dbArgs = [dbInfo.name]; - - if (upgradeNeeded) { - dbArgs.push(dbInfo.version); - } - - var openreq = idb.open.apply(idb, dbArgs); - - if (upgradeNeeded) { - openreq.onupgradeneeded = function (e) { - var db = openreq.result; - try { - db.createObjectStore(dbInfo.storeName); - if (e.oldVersion <= 1) { - // Added when support for blob shims was added - db.createObjectStore(DETECT_BLOB_SUPPORT_STORE); - } - } catch (ex) { - if (ex.name === 'ConstraintError') { - console.warn('The database "' + dbInfo.name + '"' + ' has been upgraded from version ' + e.oldVersion + ' to version ' + e.newVersion + ', but the storage "' + dbInfo.storeName + '" already exists.'); - } else { - throw ex; - } - } - }; - } - - openreq.onerror = function (e) { - e.preventDefault(); - reject(openreq.error); - }; - - openreq.onsuccess = function () { - var db = openreq.result; - db.onversionchange = function (e) { - // Triggered when the database is modified (e.g. adding an objectStore) or - // deleted (even when initiated by other sessions in different tabs). - // Closing the connection here prevents those operations from being blocked. - // If the database is accessed again later by this instance, the connection - // will be reopened or the database recreated as needed. - e.target.close(); - }; - resolve(db); - _advanceReadiness(dbInfo); - }; - }); -} - -function _getOriginalConnection(dbInfo) { - return _getConnection(dbInfo, false); -} - -function _getUpgradedConnection(dbInfo) { - return _getConnection(dbInfo, true); -} - -function _isUpgradeNeeded(dbInfo, defaultVersion) { - if (!dbInfo.db) { - return true; - } - - var isNewStore = !dbInfo.db.objectStoreNames.contains(dbInfo.storeName); - var isDowngrade = dbInfo.version < dbInfo.db.version; - var isUpgrade = dbInfo.version > dbInfo.db.version; - - if (isDowngrade) { - // If the version is not the default one - // then warn for impossible downgrade. - if (dbInfo.version !== defaultVersion) { - console.warn('The database "' + dbInfo.name + '"' + " can't be downgraded from version " + dbInfo.db.version + ' to version ' + dbInfo.version + '.'); - } - // Align the versions to prevent errors. - dbInfo.version = dbInfo.db.version; - } - - if (isUpgrade || isNewStore) { - // If the store is new then increment the version (if needed). - // This will trigger an "upgradeneeded" event which is required - // for creating a store. - if (isNewStore) { - var incVersion = dbInfo.db.version + 1; - if (incVersion > dbInfo.version) { - dbInfo.version = incVersion; - } - } - - return true; - } - - return false; -} - -// encode a blob for indexeddb engines that don't support blobs -function _encodeBlob(blob) { - return new Promise$1(function (resolve, reject) { - var reader = new FileReader(); - reader.onerror = reject; - reader.onloadend = function (e) { - var base64 = btoa(e.target.result || ''); - resolve({ - __local_forage_encoded_blob: true, - data: base64, - type: blob.type - }); - }; - reader.readAsBinaryString(blob); - }); -} - -// decode an encoded blob -function _decodeBlob(encodedBlob) { - var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data)); - return createBlob([arrayBuff], { type: encodedBlob.type }); -} - -// is this one of our fancy encoded blobs? -function _isEncodedBlob(value) { - return value && value.__local_forage_encoded_blob; -} - -// Specialize the default `ready()` function by making it dependent -// on the current database operations. Thus, the driver will be actually -// ready when it's been initialized (default) *and* there are no pending -// operations on the database (initiated by some other instances). -function _fullyReady(callback) { - var self = this; - - var promise = self._initReady().then(function () { - var dbContext = dbContexts[self._dbInfo.name]; - - if (dbContext && dbContext.dbReady) { - return dbContext.dbReady; - } - }); - - executeTwoCallbacks(promise, callback, callback); - return promise; -} - -// Try to establish a new db connection to replace the -// current one which is broken (i.e. experiencing -// InvalidStateError while creating a transaction). -function _tryReconnect(dbInfo) { - _deferReadiness(dbInfo); - - var dbContext = dbContexts[dbInfo.name]; - var forages = dbContext.forages; - - for (var i = 0; i < forages.length; i++) { - var forage = forages[i]; - if (forage._dbInfo.db) { - forage._dbInfo.db.close(); - forage._dbInfo.db = null; - } - } - dbInfo.db = null; - - return _getOriginalConnection(dbInfo).then(function (db) { - dbInfo.db = db; - if (_isUpgradeNeeded(dbInfo)) { - // Reopen the database for upgrading. - return _getUpgradedConnection(dbInfo); - } - return db; - }).then(function (db) { - // store the latest db reference - // in case the db was upgraded - dbInfo.db = dbContext.db = db; - for (var i = 0; i < forages.length; i++) { - forages[i]._dbInfo.db = db; - } - })["catch"](function (err) { - _rejectReadiness(dbInfo, err); - throw err; - }); -} - -// FF doesn't like Promises (micro-tasks) and IDDB store operations, -// so we have to do it with callbacks -function createTransaction(dbInfo, mode, callback, retries) { - if (retries === undefined) { - retries = 1; - } - - try { - var tx = dbInfo.db.transaction(dbInfo.storeName, mode); - callback(null, tx); - } catch (err) { - if (retries > 0 && (!dbInfo.db || err.name === 'InvalidStateError' || err.name === 'NotFoundError')) { - return Promise$1.resolve().then(function () { - if (!dbInfo.db || err.name === 'NotFoundError' && !dbInfo.db.objectStoreNames.contains(dbInfo.storeName) && dbInfo.version <= dbInfo.db.version) { - // increase the db version, to create the new ObjectStore - if (dbInfo.db) { - dbInfo.version = dbInfo.db.version + 1; - } - // Reopen the database for upgrading. - return _getUpgradedConnection(dbInfo); - } - }).then(function () { - return _tryReconnect(dbInfo).then(function () { - createTransaction(dbInfo, mode, callback, retries - 1); - }); - })["catch"](callback); - } - - callback(err); - } -} - -function createDbContext() { - return { - // Running localForages sharing a database. - forages: [], - // Shared database. - db: null, - // Database readiness (promise). - dbReady: null, - // Deferred operations on the database. - deferredOperations: [] - }; -} - -// Open the IndexedDB database (automatically creates one if one didn't -// previously exist), using any options set in the config. -function _initStorage(options) { - var self = this; - var dbInfo = { - db: null - }; - - if (options) { - for (var i in options) { - dbInfo[i] = options[i]; - } - } - - // Get the current context of the database; - var dbContext = dbContexts[dbInfo.name]; - - // ...or create a new context. - if (!dbContext) { - dbContext = createDbContext(); - // Register the new context in the global container. - dbContexts[dbInfo.name] = dbContext; - } - - // Register itself as a running localForage in the current context. - dbContext.forages.push(self); - - // Replace the default `ready()` function with the specialized one. - if (!self._initReady) { - self._initReady = self.ready; - self.ready = _fullyReady; - } - - // Create an array of initialization states of the related localForages. - var initPromises = []; - - function ignoreErrors() { - // Don't handle errors here, - // just makes sure related localForages aren't pending. - return Promise$1.resolve(); - } - - for (var j = 0; j < dbContext.forages.length; j++) { - var forage = dbContext.forages[j]; - if (forage !== self) { - // Don't wait for itself... - initPromises.push(forage._initReady()["catch"](ignoreErrors)); - } - } - - // Take a snapshot of the related localForages. - var forages = dbContext.forages.slice(0); - - // Initialize the connection process only when - // all the related localForages aren't pending. - return Promise$1.all(initPromises).then(function () { - dbInfo.db = dbContext.db; - // Get the connection or open a new one without upgrade. - return _getOriginalConnection(dbInfo); - }).then(function (db) { - dbInfo.db = db; - if (_isUpgradeNeeded(dbInfo, self._defaultConfig.version)) { - // Reopen the database for upgrading. - return _getUpgradedConnection(dbInfo); - } - return db; - }).then(function (db) { - dbInfo.db = dbContext.db = db; - self._dbInfo = dbInfo; - // Share the final connection amongst related localForages. - for (var k = 0; k < forages.length; k++) { - var forage = forages[k]; - if (forage !== self) { - // Self is already up-to-date. - forage._dbInfo.db = dbInfo.db; - forage._dbInfo.version = dbInfo.version; - } - } - }); -} - -function getItem(key, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - var req = store.get(key); - - req.onsuccess = function () { - var value = req.result; - if (value === undefined) { - value = null; - } - if (_isEncodedBlob(value)) { - value = _decodeBlob(value); - } - resolve(value); - }; - - req.onerror = function () { - reject(req.error); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -// Iterate over all items stored in database. -function iterate(iterator, callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - var req = store.openCursor(); - var iterationNumber = 1; - - req.onsuccess = function () { - var cursor = req.result; - - if (cursor) { - var value = cursor.value; - if (_isEncodedBlob(value)) { - value = _decodeBlob(value); - } - var result = iterator(value, cursor.key, iterationNumber++); - - // when the iterator callback returns any - // (non-`undefined`) value, then we stop - // the iteration immediately - if (result !== void 0) { - resolve(result); - } else { - cursor["continue"](); - } - } else { - resolve(); - } - }; - - req.onerror = function () { - reject(req.error); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - - return promise; -} - -function setItem(key, value, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = new Promise$1(function (resolve, reject) { - var dbInfo; - self.ready().then(function () { - dbInfo = self._dbInfo; - if (toString.call(value) === '[object Blob]') { - return _checkBlobSupport(dbInfo.db).then(function (blobSupport) { - if (blobSupport) { - return value; - } - return _encodeBlob(value); - }); - } - return value; - }).then(function (value) { - createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - - // The reason we don't _save_ null is because IE 10 does - // not support saving the `null` type in IndexedDB. How - // ironic, given the bug below! - // See: https://github.com/mozilla/localForage/issues/161 - if (value === null) { - value = undefined; - } - - var req = store.put(value, key); - - transaction.oncomplete = function () { - // Cast to undefined so the value passed to - // callback/promise is the same as what one would get out - // of `getItem()` later. This leads to some weirdness - // (setItem('foo', undefined) will return `null`), but - // it's not my fault localStorage is our baseline and that - // it's weird. - if (value === undefined) { - value = null; - } - - resolve(value); - }; - transaction.onabort = transaction.onerror = function () { - var err = req.error ? req.error : req.transaction.error; - reject(err); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function removeItem(key, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - // We use a Grunt task to make this safe for IE and some - // versions of Android (including those used by Cordova). - // Normally IE won't like `.delete()` and will insist on - // using `['delete']()`, but we have a build step that - // fixes this for us now. - var req = store["delete"](key); - transaction.oncomplete = function () { - resolve(); - }; - - transaction.onerror = function () { - reject(req.error); - }; - - // The request will be also be aborted if we've exceeded our storage - // space. - transaction.onabort = function () { - var err = req.error ? req.error : req.transaction.error; - reject(err); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function clear(callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - createTransaction(self._dbInfo, READ_WRITE, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - var req = store.clear(); - - transaction.oncomplete = function () { - resolve(); - }; - - transaction.onabort = transaction.onerror = function () { - var err = req.error ? req.error : req.transaction.error; - reject(err); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function length(callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - var req = store.count(); - - req.onsuccess = function () { - resolve(req.result); - }; - - req.onerror = function () { - reject(req.error); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function key(n, callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - if (n < 0) { - resolve(null); - - return; - } - - self.ready().then(function () { - createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - var advanced = false; - var req = store.openKeyCursor(); - - req.onsuccess = function () { - var cursor = req.result; - if (!cursor) { - // this means there weren't enough keys - resolve(null); - - return; - } - - if (n === 0) { - // We have the first key, return it if that's what they - // wanted. - resolve(cursor.key); - } else { - if (!advanced) { - // Otherwise, ask the cursor to skip ahead n - // records. - advanced = true; - cursor.advance(n); - } else { - // When we get here, we've got the nth key. - resolve(cursor.key); - } - } - }; - - req.onerror = function () { - reject(req.error); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function keys(callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - createTransaction(self._dbInfo, READ_ONLY, function (err, transaction) { - if (err) { - return reject(err); - } - - try { - var store = transaction.objectStore(self._dbInfo.storeName); - var req = store.openKeyCursor(); - var keys = []; - - req.onsuccess = function () { - var cursor = req.result; - - if (!cursor) { - resolve(keys); - return; - } - - keys.push(cursor.key); - cursor["continue"](); - }; - - req.onerror = function () { - reject(req.error); - }; - } catch (e) { - reject(e); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function dropInstance(options, callback) { - callback = getCallback.apply(this, arguments); - - var currentConfig = this.config(); - options = typeof options !== 'function' && options || {}; - if (!options.name) { - options.name = options.name || currentConfig.name; - options.storeName = options.storeName || currentConfig.storeName; - } - - var self = this; - var promise; - if (!options.name) { - promise = Promise$1.reject('Invalid arguments'); - } else { - var isCurrentDb = options.name === currentConfig.name && self._dbInfo.db; - - var dbPromise = isCurrentDb ? Promise$1.resolve(self._dbInfo.db) : _getOriginalConnection(options).then(function (db) { - var dbContext = dbContexts[options.name]; - var forages = dbContext.forages; - dbContext.db = db; - for (var i = 0; i < forages.length; i++) { - forages[i]._dbInfo.db = db; - } - return db; - }); - - if (!options.storeName) { - promise = dbPromise.then(function (db) { - _deferReadiness(options); - - var dbContext = dbContexts[options.name]; - var forages = dbContext.forages; - - db.close(); - for (var i = 0; i < forages.length; i++) { - var forage = forages[i]; - forage._dbInfo.db = null; - } - - var dropDBPromise = new Promise$1(function (resolve, reject) { - var req = idb.deleteDatabase(options.name); - - req.onerror = function () { - var db = req.result; - if (db) { - db.close(); - } - reject(req.error); - }; - - req.onblocked = function () { - // Closing all open connections in onversionchange handler should prevent this situation, but if - // we do get here, it just means the request remains pending - eventually it will succeed or error - console.warn('dropInstance blocked for database "' + options.name + '" until all open connections are closed'); - }; - - req.onsuccess = function () { - var db = req.result; - if (db) { - db.close(); - } - resolve(db); - }; - }); - - return dropDBPromise.then(function (db) { - dbContext.db = db; - for (var i = 0; i < forages.length; i++) { - var _forage = forages[i]; - _advanceReadiness(_forage._dbInfo); - } - })["catch"](function (err) { - (_rejectReadiness(options, err) || Promise$1.resolve())["catch"](function () {}); - throw err; - }); - }); - } else { - promise = dbPromise.then(function (db) { - if (!db.objectStoreNames.contains(options.storeName)) { - return; - } - - var newVersion = db.version + 1; - - _deferReadiness(options); - - var dbContext = dbContexts[options.name]; - var forages = dbContext.forages; - - db.close(); - for (var i = 0; i < forages.length; i++) { - var forage = forages[i]; - forage._dbInfo.db = null; - forage._dbInfo.version = newVersion; - } - - var dropObjectPromise = new Promise$1(function (resolve, reject) { - var req = idb.open(options.name, newVersion); - - req.onerror = function (err) { - var db = req.result; - db.close(); - reject(err); - }; - - req.onupgradeneeded = function () { - var db = req.result; - db.deleteObjectStore(options.storeName); - }; - - req.onsuccess = function () { - var db = req.result; - db.close(); - resolve(db); - }; - }); - - return dropObjectPromise.then(function (db) { - dbContext.db = db; - for (var j = 0; j < forages.length; j++) { - var _forage2 = forages[j]; - _forage2._dbInfo.db = db; - _advanceReadiness(_forage2._dbInfo); - } - })["catch"](function (err) { - (_rejectReadiness(options, err) || Promise$1.resolve())["catch"](function () {}); - throw err; - }); - }); - } - } - - executeCallback(promise, callback); - return promise; -} - -var asyncStorage = { - _driver: 'asyncStorage', - _initStorage: _initStorage, - _support: isIndexedDBValid(), - iterate: iterate, - getItem: getItem, - setItem: setItem, - removeItem: removeItem, - clear: clear, - length: length, - key: key, - keys: keys, - dropInstance: dropInstance -}; - -function isWebSQLValid() { - return typeof openDatabase === 'function'; -} - -// Sadly, the best way to save binary data in WebSQL/localStorage is serializing -// it to Base64, so this is how we store it to prevent very strange errors with less -// verbose ways of binary <-> string data storage. -var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - -var BLOB_TYPE_PREFIX = '~~local_forage_type~'; -var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/; - -var SERIALIZED_MARKER = '__lfsc__:'; -var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length; - -// OMG the serializations! -var TYPE_ARRAYBUFFER = 'arbf'; -var TYPE_BLOB = 'blob'; -var TYPE_INT8ARRAY = 'si08'; -var TYPE_UINT8ARRAY = 'ui08'; -var TYPE_UINT8CLAMPEDARRAY = 'uic8'; -var TYPE_INT16ARRAY = 'si16'; -var TYPE_INT32ARRAY = 'si32'; -var TYPE_UINT16ARRAY = 'ur16'; -var TYPE_UINT32ARRAY = 'ui32'; -var TYPE_FLOAT32ARRAY = 'fl32'; -var TYPE_FLOAT64ARRAY = 'fl64'; -var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length; - -var toString$1 = Object.prototype.toString; - -function stringToBuffer(serializedString) { - // Fill the string into a ArrayBuffer. - var bufferLength = serializedString.length * 0.75; - var len = serializedString.length; - var i; - var p = 0; - var encoded1, encoded2, encoded3, encoded4; - - if (serializedString[serializedString.length - 1] === '=') { - bufferLength--; - if (serializedString[serializedString.length - 2] === '=') { - bufferLength--; - } - } - - var buffer = new ArrayBuffer(bufferLength); - var bytes = new Uint8Array(buffer); - - for (i = 0; i < len; i += 4) { - encoded1 = BASE_CHARS.indexOf(serializedString[i]); - encoded2 = BASE_CHARS.indexOf(serializedString[i + 1]); - encoded3 = BASE_CHARS.indexOf(serializedString[i + 2]); - encoded4 = BASE_CHARS.indexOf(serializedString[i + 3]); - - /*jslint bitwise: true */ - bytes[p++] = encoded1 << 2 | encoded2 >> 4; - bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2; - bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63; - } - return buffer; -} - -// Converts a buffer to a string to store, serialized, in the backend -// storage library. -function bufferToString(buffer) { - // base64-arraybuffer - var bytes = new Uint8Array(buffer); - var base64String = ''; - var i; - - for (i = 0; i < bytes.length; i += 3) { - /*jslint bitwise: true */ - base64String += BASE_CHARS[bytes[i] >> 2]; - base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4]; - base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6]; - base64String += BASE_CHARS[bytes[i + 2] & 63]; - } - - if (bytes.length % 3 === 2) { - base64String = base64String.substring(0, base64String.length - 1) + '='; - } else if (bytes.length % 3 === 1) { - base64String = base64String.substring(0, base64String.length - 2) + '=='; - } - - return base64String; -} - -// Serialize a value, afterwards executing a callback (which usually -// instructs the `setItem()` callback/promise to be executed). This is how -// we store binary data with localStorage. -function serialize(value, callback) { - var valueType = ''; - if (value) { - valueType = toString$1.call(value); - } - - // Cannot use `value instanceof ArrayBuffer` or such here, as these - // checks fail when running the tests using casper.js... - // - // TODO: See why those tests fail and use a better solution. - if (value && (valueType === '[object ArrayBuffer]' || value.buffer && toString$1.call(value.buffer) === '[object ArrayBuffer]')) { - // Convert binary arrays to a string and prefix the string with - // a special marker. - var buffer; - var marker = SERIALIZED_MARKER; - - if (value instanceof ArrayBuffer) { - buffer = value; - marker += TYPE_ARRAYBUFFER; - } else { - buffer = value.buffer; - - if (valueType === '[object Int8Array]') { - marker += TYPE_INT8ARRAY; - } else if (valueType === '[object Uint8Array]') { - marker += TYPE_UINT8ARRAY; - } else if (valueType === '[object Uint8ClampedArray]') { - marker += TYPE_UINT8CLAMPEDARRAY; - } else if (valueType === '[object Int16Array]') { - marker += TYPE_INT16ARRAY; - } else if (valueType === '[object Uint16Array]') { - marker += TYPE_UINT16ARRAY; - } else if (valueType === '[object Int32Array]') { - marker += TYPE_INT32ARRAY; - } else if (valueType === '[object Uint32Array]') { - marker += TYPE_UINT32ARRAY; - } else if (valueType === '[object Float32Array]') { - marker += TYPE_FLOAT32ARRAY; - } else if (valueType === '[object Float64Array]') { - marker += TYPE_FLOAT64ARRAY; - } else { - callback(new Error('Failed to get type for BinaryArray')); - } - } - - callback(marker + bufferToString(buffer)); - } else if (valueType === '[object Blob]') { - // Conver the blob to a binaryArray and then to a string. - var fileReader = new FileReader(); - - fileReader.onload = function () { - // Backwards-compatible prefix for the blob type. - var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result); - - callback(SERIALIZED_MARKER + TYPE_BLOB + str); - }; - - fileReader.readAsArrayBuffer(value); - } else { - try { - callback(JSON.stringify(value)); - } catch (e) { - console.error("Couldn't convert value into a JSON string: ", value); - - callback(null, e); - } - } -} - -// Deserialize data we've inserted into a value column/field. We place -// special markers into our strings to mark them as encoded; this isn't -// as nice as a meta field, but it's the only sane thing we can do whilst -// keeping localStorage support intact. -// -// Oftentimes this will just deserialize JSON content, but if we have a -// special marker (SERIALIZED_MARKER, defined above), we will extract -// some kind of arraybuffer/binary data/typed array out of the string. -function deserialize(value) { - // If we haven't marked this string as being specially serialized (i.e. - // something other than serialized JSON), we can just return it and be - // done with it. - if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) { - return JSON.parse(value); - } - - // The following code deals with deserializing some kind of Blob or - // TypedArray. First we separate out the type of data we're dealing - // with from the data itself. - var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH); - var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH); - - var blobType; - // Backwards-compatible blob type serialization strategy. - // DBs created with older versions of localForage will simply not have the blob type. - if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) { - var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX); - blobType = matcher[1]; - serializedString = serializedString.substring(matcher[0].length); - } - var buffer = stringToBuffer(serializedString); - - // Return the right type based on the code/type set during - // serialization. - switch (type) { - case TYPE_ARRAYBUFFER: - return buffer; - case TYPE_BLOB: - return createBlob([buffer], { type: blobType }); - case TYPE_INT8ARRAY: - return new Int8Array(buffer); - case TYPE_UINT8ARRAY: - return new Uint8Array(buffer); - case TYPE_UINT8CLAMPEDARRAY: - return new Uint8ClampedArray(buffer); - case TYPE_INT16ARRAY: - return new Int16Array(buffer); - case TYPE_UINT16ARRAY: - return new Uint16Array(buffer); - case TYPE_INT32ARRAY: - return new Int32Array(buffer); - case TYPE_UINT32ARRAY: - return new Uint32Array(buffer); - case TYPE_FLOAT32ARRAY: - return new Float32Array(buffer); - case TYPE_FLOAT64ARRAY: - return new Float64Array(buffer); - default: - throw new Error('Unkown type: ' + type); - } -} - -var localforageSerializer = { - serialize: serialize, - deserialize: deserialize, - stringToBuffer: stringToBuffer, - bufferToString: bufferToString -}; - -/* - * Includes code from: - * - * base64-arraybuffer - * https://github.com/niklasvh/base64-arraybuffer - * - * Copyright (c) 2012 Niklas von Hertzen - * Licensed under the MIT license. - */ - -function createDbTable(t, dbInfo, callback, errorCallback) { - t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' ' + '(id INTEGER PRIMARY KEY, key unique, value)', [], callback, errorCallback); -} - -// Open the WebSQL database (automatically creates one if one didn't -// previously exist), using any options set in the config. -function _initStorage$1(options) { - var self = this; - var dbInfo = { - db: null - }; - - if (options) { - for (var i in options) { - dbInfo[i] = typeof options[i] !== 'string' ? options[i].toString() : options[i]; - } - } - - var dbInfoPromise = new Promise$1(function (resolve, reject) { - // Open the database; the openDatabase API will automatically - // create it for us if it doesn't exist. - try { - dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size); - } catch (e) { - return reject(e); - } - - // Create our key/value table if it doesn't exist. - dbInfo.db.transaction(function (t) { - createDbTable(t, dbInfo, function () { - self._dbInfo = dbInfo; - resolve(); - }, function (t, error) { - reject(error); - }); - }, reject); - }); - - dbInfo.serializer = localforageSerializer; - return dbInfoPromise; -} - -function tryExecuteSql(t, dbInfo, sqlStatement, args, callback, errorCallback) { - t.executeSql(sqlStatement, args, callback, function (t, error) { - if (error.code === error.SYNTAX_ERR) { - t.executeSql('SELECT name FROM sqlite_master ' + "WHERE type='table' AND name = ?", [dbInfo.storeName], function (t, results) { - if (!results.rows.length) { - // if the table is missing (was deleted) - // re-create it table and retry - createDbTable(t, dbInfo, function () { - t.executeSql(sqlStatement, args, callback, errorCallback); - }, errorCallback); - } else { - errorCallback(t, error); - } - }, errorCallback); - } else { - errorCallback(t, error); - } - }, errorCallback); -} - -function getItem$1(key, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function (t, results) { - var result = results.rows.length ? results.rows.item(0).value : null; - - // Check to see if this is serialized content we need to - // unpack. - if (result) { - result = dbInfo.serializer.deserialize(result); - } - - resolve(result); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function iterate$1(iterator, callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'SELECT * FROM ' + dbInfo.storeName, [], function (t, results) { - var rows = results.rows; - var length = rows.length; - - for (var i = 0; i < length; i++) { - var item = rows.item(i); - var result = item.value; - - // Check to see if this is serialized content - // we need to unpack. - if (result) { - result = dbInfo.serializer.deserialize(result); - } - - result = iterator(result, item.key, i + 1); - - // void(0) prevents problems with redefinition - // of `undefined`. - if (result !== void 0) { - resolve(result); - return; - } - } - - resolve(); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function _setItem(key, value, callback, retriesLeft) { - var self = this; - - key = normalizeKey(key); - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - // The localStorage API doesn't return undefined values in an - // "expected" way, so undefined is always cast to null in all - // drivers. See: https://github.com/mozilla/localForage/pull/42 - if (value === undefined) { - value = null; - } - - // Save the original value to pass to the callback. - var originalValue = value; - - var dbInfo = self._dbInfo; - dbInfo.serializer.serialize(value, function (value, error) { - if (error) { - reject(error); - } else { - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'INSERT OR REPLACE INTO ' + dbInfo.storeName + ' ' + '(key, value) VALUES (?, ?)', [key, value], function () { - resolve(originalValue); - }, function (t, error) { - reject(error); - }); - }, function (sqlError) { - // The transaction failed; check - // to see if it's a quota error. - if (sqlError.code === sqlError.QUOTA_ERR) { - // We reject the callback outright for now, but - // it's worth trying to re-run the transaction. - // Even if the user accepts the prompt to use - // more storage on Safari, this error will - // be called. - // - // Try to re-run the transaction. - if (retriesLeft > 0) { - resolve(_setItem.apply(self, [key, originalValue, callback, retriesLeft - 1])); - return; - } - reject(sqlError); - } - }); - } - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function setItem$1(key, value, callback) { - return _setItem.apply(this, [key, value, callback, 1]); -} - -function removeItem$1(key, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function () { - resolve(); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -// Deletes every item in the table. -// TODO: Find out if this resets the AUTO_INCREMENT number. -function clear$1(callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'DELETE FROM ' + dbInfo.storeName, [], function () { - resolve(); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -// Does a simple `COUNT(key)` to get the number of items stored in -// localForage. -function length$1(callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - dbInfo.db.transaction(function (t) { - // Ahhh, SQL makes this one soooooo easy. - tryExecuteSql(t, dbInfo, 'SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function (t, results) { - var result = results.rows.item(0).c; - resolve(result); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -// Return the key located at key index X; essentially gets the key from a -// `WHERE id = ?`. This is the most efficient way I can think to implement -// this rarely-used (in my experience) part of the API, but it can seem -// inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so -// the ID of each key will change every time it's updated. Perhaps a stored -// procedure for the `setItem()` SQL would solve this problem? -// TODO: Don't change ID on `setItem()`. -function key$1(n, callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function (t, results) { - var result = results.rows.length ? results.rows.item(0).key : null; - resolve(result); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -function keys$1(callback) { - var self = this; - - var promise = new Promise$1(function (resolve, reject) { - self.ready().then(function () { - var dbInfo = self._dbInfo; - dbInfo.db.transaction(function (t) { - tryExecuteSql(t, dbInfo, 'SELECT key FROM ' + dbInfo.storeName, [], function (t, results) { - var keys = []; - - for (var i = 0; i < results.rows.length; i++) { - keys.push(results.rows.item(i).key); - } - - resolve(keys); - }, function (t, error) { - reject(error); - }); - }); - })["catch"](reject); - }); - - executeCallback(promise, callback); - return promise; -} - -// https://www.w3.org/TR/webdatabase/#databases -// > There is no way to enumerate or delete the databases available for an origin from this API. -function getAllStoreNames(db) { - return new Promise$1(function (resolve, reject) { - db.transaction(function (t) { - t.executeSql('SELECT name FROM sqlite_master ' + "WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'", [], function (t, results) { - var storeNames = []; - - for (var i = 0; i < results.rows.length; i++) { - storeNames.push(results.rows.item(i).name); - } - - resolve({ - db: db, - storeNames: storeNames - }); - }, function (t, error) { - reject(error); - }); - }, function (sqlError) { - reject(sqlError); - }); - }); -} - -function dropInstance$1(options, callback) { - callback = getCallback.apply(this, arguments); - - var currentConfig = this.config(); - options = typeof options !== 'function' && options || {}; - if (!options.name) { - options.name = options.name || currentConfig.name; - options.storeName = options.storeName || currentConfig.storeName; - } - - var self = this; - var promise; - if (!options.name) { - promise = Promise$1.reject('Invalid arguments'); - } else { - promise = new Promise$1(function (resolve) { - var db; - if (options.name === currentConfig.name) { - // use the db reference of the current instance - db = self._dbInfo.db; - } else { - db = openDatabase(options.name, '', '', 0); - } - - if (!options.storeName) { - // drop all database tables - resolve(getAllStoreNames(db)); - } else { - resolve({ - db: db, - storeNames: [options.storeName] - }); - } - }).then(function (operationInfo) { - return new Promise$1(function (resolve, reject) { - operationInfo.db.transaction(function (t) { - function dropTable(storeName) { - return new Promise$1(function (resolve, reject) { - t.executeSql('DROP TABLE IF EXISTS ' + storeName, [], function () { - resolve(); - }, function (t, error) { - reject(error); - }); - }); - } - - var operations = []; - for (var i = 0, len = operationInfo.storeNames.length; i < len; i++) { - operations.push(dropTable(operationInfo.storeNames[i])); - } - - Promise$1.all(operations).then(function () { - resolve(); - })["catch"](function (e) { - reject(e); - }); - }, function (sqlError) { - reject(sqlError); - }); - }); - }); - } - - executeCallback(promise, callback); - return promise; -} - -var webSQLStorage = { - _driver: 'webSQLStorage', - _initStorage: _initStorage$1, - _support: isWebSQLValid(), - iterate: iterate$1, - getItem: getItem$1, - setItem: setItem$1, - removeItem: removeItem$1, - clear: clear$1, - length: length$1, - key: key$1, - keys: keys$1, - dropInstance: dropInstance$1 -}; - -function isLocalStorageValid() { - try { - return typeof localStorage !== 'undefined' && 'setItem' in localStorage && - // in IE8 typeof localStorage.setItem === 'object' - !!localStorage.setItem; - } catch (e) { - return false; - } -} - -function _getKeyPrefix(options, defaultConfig) { - var keyPrefix = options.name + '/'; - - if (options.storeName !== defaultConfig.storeName) { - keyPrefix += options.storeName + '/'; - } - return keyPrefix; -} - -// Check if localStorage throws when saving an item -function checkIfLocalStorageThrows() { - var localStorageTestKey = '_localforage_support_test'; - - try { - localStorage.setItem(localStorageTestKey, true); - localStorage.removeItem(localStorageTestKey); - - return false; - } catch (e) { - return true; - } -} - -// Check if localStorage is usable and allows to save an item -// This method checks if localStorage is usable in Safari Private Browsing -// mode, or in any other case where the available quota for localStorage -// is 0 and there wasn't any saved items yet. -function _isLocalStorageUsable() { - return !checkIfLocalStorageThrows() || localStorage.length > 0; -} - -// Config the localStorage backend, using options set in the config. -function _initStorage$2(options) { - var self = this; - var dbInfo = {}; - if (options) { - for (var i in options) { - dbInfo[i] = options[i]; - } - } - - dbInfo.keyPrefix = _getKeyPrefix(options, self._defaultConfig); - - if (!_isLocalStorageUsable()) { - return Promise$1.reject(); - } - - self._dbInfo = dbInfo; - dbInfo.serializer = localforageSerializer; - - return Promise$1.resolve(); -} - -// Remove all keys from the datastore, effectively destroying all data in -// the app's key/value store! -function clear$2(callback) { - var self = this; - var promise = self.ready().then(function () { - var keyPrefix = self._dbInfo.keyPrefix; - - for (var i = localStorage.length - 1; i >= 0; i--) { - var key = localStorage.key(i); - - if (key.indexOf(keyPrefix) === 0) { - localStorage.removeItem(key); - } - } - }); - - executeCallback(promise, callback); - return promise; -} - -// Retrieve an item from the store. Unlike the original async_storage -// library in Gaia, we don't modify return values at all. If a key's value -// is `undefined`, we pass that value to the callback function. -function getItem$2(key, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = self.ready().then(function () { - var dbInfo = self._dbInfo; - var result = localStorage.getItem(dbInfo.keyPrefix + key); - - // If a result was found, parse it from the serialized - // string into a JS object. If result isn't truthy, the key - // is likely undefined and we'll pass it straight to the - // callback. - if (result) { - result = dbInfo.serializer.deserialize(result); - } - - return result; - }); - - executeCallback(promise, callback); - return promise; -} - -// Iterate over all items in the store. -function iterate$2(iterator, callback) { - var self = this; - - var promise = self.ready().then(function () { - var dbInfo = self._dbInfo; - var keyPrefix = dbInfo.keyPrefix; - var keyPrefixLength = keyPrefix.length; - var length = localStorage.length; - - // We use a dedicated iterator instead of the `i` variable below - // so other keys we fetch in localStorage aren't counted in - // the `iterationNumber` argument passed to the `iterate()` - // callback. - // - // See: github.com/mozilla/localForage/pull/435#discussion_r38061530 - var iterationNumber = 1; - - for (var i = 0; i < length; i++) { - var key = localStorage.key(i); - if (key.indexOf(keyPrefix) !== 0) { - continue; - } - var value = localStorage.getItem(key); - - // If a result was found, parse it from the serialized - // string into a JS object. If result isn't truthy, the - // key is likely undefined and we'll pass it straight - // to the iterator. - if (value) { - value = dbInfo.serializer.deserialize(value); - } - - value = iterator(value, key.substring(keyPrefixLength), iterationNumber++); - - if (value !== void 0) { - return value; - } - } - }); - - executeCallback(promise, callback); - return promise; -} - -// Same as localStorage's key() method, except takes a callback. -function key$2(n, callback) { - var self = this; - var promise = self.ready().then(function () { - var dbInfo = self._dbInfo; - var result; - try { - result = localStorage.key(n); - } catch (error) { - result = null; - } - - // Remove the prefix from the key, if a key is found. - if (result) { - result = result.substring(dbInfo.keyPrefix.length); - } - - return result; - }); - - executeCallback(promise, callback); - return promise; -} - -function keys$2(callback) { - var self = this; - var promise = self.ready().then(function () { - var dbInfo = self._dbInfo; - var length = localStorage.length; - var keys = []; - - for (var i = 0; i < length; i++) { - var itemKey = localStorage.key(i); - if (itemKey.indexOf(dbInfo.keyPrefix) === 0) { - keys.push(itemKey.substring(dbInfo.keyPrefix.length)); - } - } - - return keys; - }); - - executeCallback(promise, callback); - return promise; -} - -// Supply the number of keys in the datastore to the callback function. -function length$2(callback) { - var self = this; - var promise = self.keys().then(function (keys) { - return keys.length; - }); - - executeCallback(promise, callback); - return promise; -} - -// Remove an item from the store, nice and simple. -function removeItem$2(key, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = self.ready().then(function () { - var dbInfo = self._dbInfo; - localStorage.removeItem(dbInfo.keyPrefix + key); - }); - - executeCallback(promise, callback); - return promise; -} - -// Set a key's value and run an optional callback once the value is set. -// Unlike Gaia's implementation, the callback function is passed the value, -// in case you want to operate on that value only after you're sure it -// saved, or something like that. -function setItem$2(key, value, callback) { - var self = this; - - key = normalizeKey(key); - - var promise = self.ready().then(function () { - // Convert undefined values to null. - // https://github.com/mozilla/localForage/pull/42 - if (value === undefined) { - value = null; - } - - // Save the original value to pass to the callback. - var originalValue = value; - - return new Promise$1(function (resolve, reject) { - var dbInfo = self._dbInfo; - dbInfo.serializer.serialize(value, function (value, error) { - if (error) { - reject(error); - } else { - try { - localStorage.setItem(dbInfo.keyPrefix + key, value); - resolve(originalValue); - } catch (e) { - // localStorage capacity exceeded. - // TODO: Make this a specific error/event. - if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') { - reject(e); - } - reject(e); - } - } - }); - }); - }); - - executeCallback(promise, callback); - return promise; -} - -function dropInstance$2(options, callback) { - callback = getCallback.apply(this, arguments); - - options = typeof options !== 'function' && options || {}; - if (!options.name) { - var currentConfig = this.config(); - options.name = options.name || currentConfig.name; - options.storeName = options.storeName || currentConfig.storeName; - } - - var self = this; - var promise; - if (!options.name) { - promise = Promise$1.reject('Invalid arguments'); - } else { - promise = new Promise$1(function (resolve) { - if (!options.storeName) { - resolve(options.name + '/'); - } else { - resolve(_getKeyPrefix(options, self._defaultConfig)); - } - }).then(function (keyPrefix) { - for (var i = localStorage.length - 1; i >= 0; i--) { - var key = localStorage.key(i); - - if (key.indexOf(keyPrefix) === 0) { - localStorage.removeItem(key); - } - } - }); - } - - executeCallback(promise, callback); - return promise; -} - -var localStorageWrapper = { - _driver: 'localStorageWrapper', - _initStorage: _initStorage$2, - _support: isLocalStorageValid(), - iterate: iterate$2, - getItem: getItem$2, - setItem: setItem$2, - removeItem: removeItem$2, - clear: clear$2, - length: length$2, - key: key$2, - keys: keys$2, - dropInstance: dropInstance$2 -}; - -var sameValue = function sameValue(x, y) { - return x === y || typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); -}; - -var includes = function includes(array, searchElement) { - var len = array.length; - var i = 0; - while (i < len) { - if (sameValue(array[i], searchElement)) { - return true; - } - i++; - } - - return false; -}; - -var isArray = Array.isArray || function (arg) { - return Object.prototype.toString.call(arg) === '[object Array]'; -}; - -// Drivers are stored here when `defineDriver()` is called. -// They are shared across all instances of localForage. -var DefinedDrivers = {}; - -var DriverSupport = {}; - -var DefaultDrivers = { - INDEXEDDB: asyncStorage, - WEBSQL: webSQLStorage, - LOCALSTORAGE: localStorageWrapper -}; - -var DefaultDriverOrder = [DefaultDrivers.INDEXEDDB._driver, DefaultDrivers.WEBSQL._driver, DefaultDrivers.LOCALSTORAGE._driver]; - -var OptionalDriverMethods = ['dropInstance']; - -var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'].concat(OptionalDriverMethods); - -var DefaultConfig = { - description: '', - driver: DefaultDriverOrder.slice(), - name: 'localforage', - // Default DB size is _JUST UNDER_ 5MB, as it's the highest size - // we can use without a prompt. - size: 4980736, - storeName: 'keyvaluepairs', - version: 1.0 -}; - -function callWhenReady(localForageInstance, libraryMethod) { - localForageInstance[libraryMethod] = function () { - var _args = arguments; - return localForageInstance.ready().then(function () { - return localForageInstance[libraryMethod].apply(localForageInstance, _args); - }); - }; -} - -function extend() { - for (var i = 1; i < arguments.length; i++) { - var arg = arguments[i]; - - if (arg) { - for (var _key in arg) { - if (arg.hasOwnProperty(_key)) { - if (isArray(arg[_key])) { - arguments[0][_key] = arg[_key].slice(); - } else { - arguments[0][_key] = arg[_key]; - } - } - } - } - } - - return arguments[0]; -} - -var LocalForage = function () { - function LocalForage(options) { - _classCallCheck(this, LocalForage); - - for (var driverTypeKey in DefaultDrivers) { - if (DefaultDrivers.hasOwnProperty(driverTypeKey)) { - var driver = DefaultDrivers[driverTypeKey]; - var driverName = driver._driver; - this[driverTypeKey] = driverName; - - if (!DefinedDrivers[driverName]) { - // we don't need to wait for the promise, - // since the default drivers can be defined - // in a blocking manner - this.defineDriver(driver); - } - } - } - - this._defaultConfig = extend({}, DefaultConfig); - this._config = extend({}, this._defaultConfig, options); - this._driverSet = null; - this._initDriver = null; - this._ready = false; - this._dbInfo = null; - - this._wrapLibraryMethodsWithReady(); - this.setDriver(this._config.driver)["catch"](function () {}); - } - - // Set any config values for localForage; can be called anytime before - // the first API call (e.g. `getItem`, `setItem`). - // We loop through options so we don't overwrite existing config - // values. - - - LocalForage.prototype.config = function config(options) { - // If the options argument is an object, we use it to set values. - // Otherwise, we return either a specified config value or all - // config values. - if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') { - // If localforage is ready and fully initialized, we can't set - // any new configuration values. Instead, we return an error. - if (this._ready) { - return new Error("Can't call config() after localforage " + 'has been used.'); - } - - for (var i in options) { - if (i === 'storeName') { - options[i] = options[i].replace(/\W/g, '_'); - } - - if (i === 'version' && typeof options[i] !== 'number') { - return new Error('Database version must be a number.'); - } - - this._config[i] = options[i]; - } - - // after all config options are set and - // the driver option is used, try setting it - if ('driver' in options && options.driver) { - return this.setDriver(this._config.driver); - } - - return true; - } else if (typeof options === 'string') { - return this._config[options]; - } else { - return this._config; - } - }; - - // Used to define a custom driver, shared across all instances of - // localForage. - - - LocalForage.prototype.defineDriver = function defineDriver(driverObject, callback, errorCallback) { - var promise = new Promise$1(function (resolve, reject) { - try { - var driverName = driverObject._driver; - var complianceError = new Error('Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver'); - - // A driver name should be defined and not overlap with the - // library-defined, default drivers. - if (!driverObject._driver) { - reject(complianceError); - return; - } - - var driverMethods = LibraryMethods.concat('_initStorage'); - for (var i = 0, len = driverMethods.length; i < len; i++) { - var driverMethodName = driverMethods[i]; - - // when the property is there, - // it should be a method even when optional - var isRequired = !includes(OptionalDriverMethods, driverMethodName); - if ((isRequired || driverObject[driverMethodName]) && typeof driverObject[driverMethodName] !== 'function') { - reject(complianceError); - return; - } - } - - var configureMissingMethods = function configureMissingMethods() { - var methodNotImplementedFactory = function methodNotImplementedFactory(methodName) { - return function () { - var error = new Error('Method ' + methodName + ' is not implemented by the current driver'); - var promise = Promise$1.reject(error); - executeCallback(promise, arguments[arguments.length - 1]); - return promise; - }; - }; - - for (var _i = 0, _len = OptionalDriverMethods.length; _i < _len; _i++) { - var optionalDriverMethod = OptionalDriverMethods[_i]; - if (!driverObject[optionalDriverMethod]) { - driverObject[optionalDriverMethod] = methodNotImplementedFactory(optionalDriverMethod); - } - } - }; - - configureMissingMethods(); - - var setDriverSupport = function setDriverSupport(support) { - if (DefinedDrivers[driverName]) { - console.info('Redefining LocalForage driver: ' + driverName); - } - DefinedDrivers[driverName] = driverObject; - DriverSupport[driverName] = support; - // don't use a then, so that we can define - // drivers that have simple _support methods - // in a blocking manner - resolve(); - }; - - if ('_support' in driverObject) { - if (driverObject._support && typeof driverObject._support === 'function') { - driverObject._support().then(setDriverSupport, reject); - } else { - setDriverSupport(!!driverObject._support); - } - } else { - setDriverSupport(true); - } - } catch (e) { - reject(e); - } - }); - - executeTwoCallbacks(promise, callback, errorCallback); - return promise; - }; - - LocalForage.prototype.driver = function driver() { - return this._driver || null; - }; - - LocalForage.prototype.getDriver = function getDriver(driverName, callback, errorCallback) { - var getDriverPromise = DefinedDrivers[driverName] ? Promise$1.resolve(DefinedDrivers[driverName]) : Promise$1.reject(new Error('Driver not found.')); - - executeTwoCallbacks(getDriverPromise, callback, errorCallback); - return getDriverPromise; - }; - - LocalForage.prototype.getSerializer = function getSerializer(callback) { - var serializerPromise = Promise$1.resolve(localforageSerializer); - executeTwoCallbacks(serializerPromise, callback); - return serializerPromise; - }; - - LocalForage.prototype.ready = function ready(callback) { - var self = this; - - var promise = self._driverSet.then(function () { - if (self._ready === null) { - self._ready = self._initDriver(); - } - - return self._ready; - }); - - executeTwoCallbacks(promise, callback, callback); - return promise; - }; - - LocalForage.prototype.setDriver = function setDriver(drivers, callback, errorCallback) { - var self = this; - - if (!isArray(drivers)) { - drivers = [drivers]; - } - - var supportedDrivers = this._getSupportedDrivers(drivers); - - function setDriverToConfig() { - self._config.driver = self.driver(); - } - - function extendSelfWithDriver(driver) { - self._extend(driver); - setDriverToConfig(); - - self._ready = self._initStorage(self._config); - return self._ready; - } - - function initDriver(supportedDrivers) { - return function () { - var currentDriverIndex = 0; - - function driverPromiseLoop() { - while (currentDriverIndex < supportedDrivers.length) { - var driverName = supportedDrivers[currentDriverIndex]; - currentDriverIndex++; - - self._dbInfo = null; - self._ready = null; - - return self.getDriver(driverName).then(extendSelfWithDriver)["catch"](driverPromiseLoop); - } - - setDriverToConfig(); - var error = new Error('No available storage method found.'); - self._driverSet = Promise$1.reject(error); - return self._driverSet; - } - - return driverPromiseLoop(); - }; - } - - // There might be a driver initialization in progress - // so wait for it to finish in order to avoid a possible - // race condition to set _dbInfo - var oldDriverSetDone = this._driverSet !== null ? this._driverSet["catch"](function () { - return Promise$1.resolve(); - }) : Promise$1.resolve(); - - this._driverSet = oldDriverSetDone.then(function () { - var driverName = supportedDrivers[0]; - self._dbInfo = null; - self._ready = null; - - return self.getDriver(driverName).then(function (driver) { - self._driver = driver._driver; - setDriverToConfig(); - self._wrapLibraryMethodsWithReady(); - self._initDriver = initDriver(supportedDrivers); - }); - })["catch"](function () { - setDriverToConfig(); - var error = new Error('No available storage method found.'); - self._driverSet = Promise$1.reject(error); - return self._driverSet; - }); - - executeTwoCallbacks(this._driverSet, callback, errorCallback); - return this._driverSet; - }; - - LocalForage.prototype.supports = function supports(driverName) { - return !!DriverSupport[driverName]; - }; - - LocalForage.prototype._extend = function _extend(libraryMethodsAndProperties) { - extend(this, libraryMethodsAndProperties); - }; - - LocalForage.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) { - var supportedDrivers = []; - for (var i = 0, len = drivers.length; i < len; i++) { - var driverName = drivers[i]; - if (this.supports(driverName)) { - supportedDrivers.push(driverName); - } - } - return supportedDrivers; - }; - - LocalForage.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() { - // Add a stub for each driver API method that delays the call to the - // corresponding driver method until localForage is ready. These stubs - // will be replaced by the driver methods as soon as the driver is - // loaded, so there is no performance impact. - for (var i = 0, len = LibraryMethods.length; i < len; i++) { - callWhenReady(this, LibraryMethods[i]); - } - }; - - LocalForage.prototype.createInstance = function createInstance(options) { - return new LocalForage(options); - }; - - return LocalForage; -}(); - -// The actual localForage object that we expose as a module or via a -// global. It's extended by pulling in one of our other libraries. - - -var localforage_js = new LocalForage(); - -module.exports = localforage_js; - -},{"3":3}]},{},[4])(4) -}); - - -/***/ }), - -/***/ 155: -/***/ ((module) => { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - -/***/ }), - -/***/ 384: -/***/ ((module) => { - -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} - -/***/ }), - -/***/ 955: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -// Currently in sync with Node.js lib/internal/util/types.js -// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 - - - -var isArgumentsObject = __webpack_require__(584); -var isGeneratorFunction = __webpack_require__(662); -var whichTypedArray = __webpack_require__(430); -var isTypedArray = __webpack_require__(692); - -function uncurryThis(f) { - return f.call.bind(f); -} - -var BigIntSupported = typeof BigInt !== 'undefined'; -var SymbolSupported = typeof Symbol !== 'undefined'; - -var ObjectToString = uncurryThis(Object.prototype.toString); - -var numberValue = uncurryThis(Number.prototype.valueOf); -var stringValue = uncurryThis(String.prototype.valueOf); -var booleanValue = uncurryThis(Boolean.prototype.valueOf); - -if (BigIntSupported) { - var bigIntValue = uncurryThis(BigInt.prototype.valueOf); -} - -if (SymbolSupported) { - var symbolValue = uncurryThis(Symbol.prototype.valueOf); -} - -function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== 'object') { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch(e) { - return false; - } -} - -exports.isArgumentsObject = isArgumentsObject; -exports.isGeneratorFunction = isGeneratorFunction; -exports.isTypedArray = isTypedArray; - -// Taken from here and modified for better browser support -// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js -function isPromise(input) { - return ( - ( - typeof Promise !== 'undefined' && - input instanceof Promise - ) || - ( - input !== null && - typeof input === 'object' && - typeof input.then === 'function' && - typeof input.catch === 'function' - ) - ); -} -exports.isPromise = isPromise; - -function isArrayBufferView(value) { - if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - - return ( - isTypedArray(value) || - isDataView(value) - ); -} -exports.isArrayBufferView = isArrayBufferView; - - -function isUint8Array(value) { - return whichTypedArray(value) === 'Uint8Array'; -} -exports.isUint8Array = isUint8Array; - -function isUint8ClampedArray(value) { - return whichTypedArray(value) === 'Uint8ClampedArray'; -} -exports.isUint8ClampedArray = isUint8ClampedArray; - -function isUint16Array(value) { - return whichTypedArray(value) === 'Uint16Array'; -} -exports.isUint16Array = isUint16Array; - -function isUint32Array(value) { - return whichTypedArray(value) === 'Uint32Array'; -} -exports.isUint32Array = isUint32Array; - -function isInt8Array(value) { - return whichTypedArray(value) === 'Int8Array'; -} -exports.isInt8Array = isInt8Array; - -function isInt16Array(value) { - return whichTypedArray(value) === 'Int16Array'; -} -exports.isInt16Array = isInt16Array; - -function isInt32Array(value) { - return whichTypedArray(value) === 'Int32Array'; -} -exports.isInt32Array = isInt32Array; - -function isFloat32Array(value) { - return whichTypedArray(value) === 'Float32Array'; -} -exports.isFloat32Array = isFloat32Array; - -function isFloat64Array(value) { - return whichTypedArray(value) === 'Float64Array'; -} -exports.isFloat64Array = isFloat64Array; - -function isBigInt64Array(value) { - return whichTypedArray(value) === 'BigInt64Array'; -} -exports.isBigInt64Array = isBigInt64Array; - -function isBigUint64Array(value) { - return whichTypedArray(value) === 'BigUint64Array'; -} -exports.isBigUint64Array = isBigUint64Array; - -function isMapToString(value) { - return ObjectToString(value) === '[object Map]'; -} -isMapToString.working = ( - typeof Map !== 'undefined' && - isMapToString(new Map()) -); - -function isMap(value) { - if (typeof Map === 'undefined') { - return false; - } - - return isMapToString.working - ? isMapToString(value) - : value instanceof Map; -} -exports.isMap = isMap; - -function isSetToString(value) { - return ObjectToString(value) === '[object Set]'; -} -isSetToString.working = ( - typeof Set !== 'undefined' && - isSetToString(new Set()) -); -function isSet(value) { - if (typeof Set === 'undefined') { - return false; - } - - return isSetToString.working - ? isSetToString(value) - : value instanceof Set; -} -exports.isSet = isSet; - -function isWeakMapToString(value) { - return ObjectToString(value) === '[object WeakMap]'; -} -isWeakMapToString.working = ( - typeof WeakMap !== 'undefined' && - isWeakMapToString(new WeakMap()) -); -function isWeakMap(value) { - if (typeof WeakMap === 'undefined') { - return false; - } - - return isWeakMapToString.working - ? isWeakMapToString(value) - : value instanceof WeakMap; -} -exports.isWeakMap = isWeakMap; - -function isWeakSetToString(value) { - return ObjectToString(value) === '[object WeakSet]'; -} -isWeakSetToString.working = ( - typeof WeakSet !== 'undefined' && - isWeakSetToString(new WeakSet()) -); -function isWeakSet(value) { - return isWeakSetToString(value); -} -exports.isWeakSet = isWeakSet; - -function isArrayBufferToString(value) { - return ObjectToString(value) === '[object ArrayBuffer]'; -} -isArrayBufferToString.working = ( - typeof ArrayBuffer !== 'undefined' && - isArrayBufferToString(new ArrayBuffer()) -); -function isArrayBuffer(value) { - if (typeof ArrayBuffer === 'undefined') { - return false; - } - - return isArrayBufferToString.working - ? isArrayBufferToString(value) - : value instanceof ArrayBuffer; -} -exports.isArrayBuffer = isArrayBuffer; - -function isDataViewToString(value) { - return ObjectToString(value) === '[object DataView]'; -} -isDataViewToString.working = ( - typeof ArrayBuffer !== 'undefined' && - typeof DataView !== 'undefined' && - isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) -); -function isDataView(value) { - if (typeof DataView === 'undefined') { - return false; - } - - return isDataViewToString.working - ? isDataViewToString(value) - : value instanceof DataView; -} -exports.isDataView = isDataView; - -// Store a copy of SharedArrayBuffer in case it's deleted elsewhere -var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined; -function isSharedArrayBufferToString(value) { - return ObjectToString(value) === '[object SharedArrayBuffer]'; -} -function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === 'undefined') { - return false; - } - - if (typeof isSharedArrayBufferToString.working === 'undefined') { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); - } - - return isSharedArrayBufferToString.working - ? isSharedArrayBufferToString(value) - : value instanceof SharedArrayBufferCopy; -} -exports.isSharedArrayBuffer = isSharedArrayBuffer; - -function isAsyncFunction(value) { - return ObjectToString(value) === '[object AsyncFunction]'; -} -exports.isAsyncFunction = isAsyncFunction; - -function isMapIterator(value) { - return ObjectToString(value) === '[object Map Iterator]'; -} -exports.isMapIterator = isMapIterator; - -function isSetIterator(value) { - return ObjectToString(value) === '[object Set Iterator]'; -} -exports.isSetIterator = isSetIterator; - -function isGeneratorObject(value) { - return ObjectToString(value) === '[object Generator]'; -} -exports.isGeneratorObject = isGeneratorObject; - -function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === '[object WebAssembly.Module]'; -} -exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - -function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); -} -exports.isNumberObject = isNumberObject; - -function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); -} -exports.isStringObject = isStringObject; - -function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); -} -exports.isBooleanObject = isBooleanObject; - -function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); -} -exports.isBigIntObject = isBigIntObject; - -function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); -} -exports.isSymbolObject = isSymbolObject; - -function isBoxedPrimitive(value) { - return ( - isNumberObject(value) || - isStringObject(value) || - isBooleanObject(value) || - isBigIntObject(value) || - isSymbolObject(value) - ); -} -exports.isBoxedPrimitive = isBoxedPrimitive; - -function isAnyArrayBuffer(value) { - return typeof Uint8Array !== 'undefined' && ( - isArrayBuffer(value) || - isSharedArrayBuffer(value) - ); -} -exports.isAnyArrayBuffer = isAnyArrayBuffer; - -['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + ' is not supported in userland'); - } - }); -}); - - -/***/ }), - -/***/ 539: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -/* provided dependency */ var process = __webpack_require__(155); -// 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 getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || - function getOwnPropertyDescriptors(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - if (typeof process !== 'undefined' && process.noDeprecation === true) { - return fn; - } - - // Allow for deprecating things in the process of starting up. - if (typeof process === 'undefined') { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnvRegex = /^$/; - -if (process.env.NODE_DEBUG) { - var debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') - .replace(/\*/g, '.*') - .replace(/,/g, '$|^') - .toUpperCase(); - debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); -} -exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').slice(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.slice(1, -1); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -exports.types = __webpack_require__(955); - -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; -exports.types.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; -exports.types.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; -exports.types.isNativeError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = __webpack_require__(384); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = __webpack_require__(717); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; - -exports.promisify = function promisify(original) { - if (typeof original !== 'function') - throw new TypeError('The "original" argument must be of type Function'); - - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== 'function') { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, enumerable: false, writable: false, configurable: true - }); - return fn; - } - - function fn() { - var promiseResolve, promiseReject; - var promise = new Promise(function (resolve, reject) { - promiseResolve = resolve; - promiseReject = reject; - }); - - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - args.push(function (err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); - } - }); - - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - - return promise; - } - - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - - if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, enumerable: false, writable: false, configurable: true - }); - return Object.defineProperties( - fn, - getOwnPropertyDescriptors(original) - ); -} - -exports.promisify.custom = kCustomPromisifiedSymbol - -function callbackifyOnRejected(reason, cb) { - // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). - // Because `null` is a special error value in callbacks which means "no error - // occurred", we error-wrap so the callback consumer can distinguish between - // "the promise rejected with null" or "the promise fulfilled with undefined". - if (!reason) { - var newReason = new Error('Promise was rejected with a falsy value'); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); -} - -function callbackify(original) { - if (typeof original !== 'function') { - throw new TypeError('The "original" argument must be of type Function'); - } - - // We DO NOT return the promise as it gives the user a false sense that - // the promise is actually somehow related to the callback's execution - // and that the callback throwing will reject the promise. - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - - var maybeCb = args.pop(); - if (typeof maybeCb !== 'function') { - throw new TypeError('The last argument must be of type Function'); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - // In true node style we process the callback on `nextTick` with all the - // implications (stack, `uncaughtException`, `async_hooks`) - original.apply(this, args) - .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) }, - function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); - } - - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, - getOwnPropertyDescriptors(original)); - return callbackified; -} -exports.callbackify = callbackify; - - -/***/ }), - -/***/ 430: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var forEach = __webpack_require__(29); -var availableTypedArrays = __webpack_require__(83); -var callBound = __webpack_require__(924); -var gOPD = __webpack_require__(296); - -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = __webpack_require__(410)(); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; -var typedArrays = availableTypedArrays(); - -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - if (typeof g[typedArray] === 'function') { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function (getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) {} - } - }); - return foundName; -}; - -var isTypedArray = __webpack_require__(692); - -module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } - return tryTypedArrays(value); -}; - - -/***/ }), - -/***/ 83: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var possibleNames = [ - 'BigInt64Array', - 'BigUint64Array', - 'Float32Array', - 'Float64Array', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray' -]; - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; - -module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - out[out.length] = possibleNames[i]; - } - } - return out; -}; - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/global */ -/******/ (() => { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ })(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __webpack_require__(797); -/******/ window.Nedb = __webpack_exports__; -/******/ -/******/ })() -; \ No newline at end of file diff --git a/node_modules/@seald-io/nedb/browser-version/out/nedb.min.js b/node_modules/@seald-io/nedb/browser-version/out/nedb.min.js deleted file mode 100644 index 4d77a27..0000000 --- a/node_modules/@seald-io/nedb/browser-version/out/nedb.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see nedb.min.js.LICENSE.txt */ -(()=>{var e={100:e=>{e.exports={}},159:e=>{e.exports.uid=e=>(e=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=e.length%3;let n,o="";for(let a=0,s=e.length-r;a>18&63]+t[i>>12&63]+t[i>>6&63]+t[63&i];var i;return 1===r?(n=e[e.length-1],o+=t[n>>2],o+=t[n<<4&63],o+="=="):2===r&&(n=(e[e.length-2]<<8)+e[e.length-1],o+=t[n>>10],o+=t[n>>4&63],o+=t[n<<2&63],o+="="),o})((e=>{const t=new Array(e);for(let r,n=0;n>>((3&n)<<3)&255;return t})(Math.ceil(Math.max(8,2*e)))).replace(/[+/]/g,"").slice(0,e)},909:(e,t,r)=>{const n=r(483).createInstance({name:"NeDB",storeName:"nedbdata"}),o=async(e,t,r)=>{try{await n.setItem(e,t)}catch(e){console.warn("An error happened while writing, skip")}};e.exports.existsAsync=async e=>{try{return null!==await n.getItem(e)}catch(e){return!1}},e.exports.renameAsync=async(e,t)=>{try{const r=await n.getItem(e);null===r?await n.removeItem(t):(await n.setItem(t,r),await n.removeItem(e))}catch(e){console.warn("An error happened while renaming, skip")}},e.exports.writeFileAsync=o,e.exports.crashSafeWriteFileLinesAsync=async(e,t)=>{t.push(""),await o(e,t.join("\n"))},e.exports.appendFileAsync=async(e,t,r)=>{try{const r=await n.getItem(e)||"";await n.setItem(e,r+t)}catch(e){console.warn("An error happened appending to file writing, skip")}},e.exports.readFileAsync=async(e,t)=>{try{return await n.getItem(e)||""}catch(e){return console.warn("An error happened while reading, skip"),""}},e.exports.unlinkAsync=async e=>{try{await n.removeItem(e)}catch(e){console.warn("An error happened while unlinking, skip")}},e.exports.mkdirAsync=(e,t)=>Promise.resolve(),e.exports.ensureDatafileIntegrityAsync=e=>Promise.resolve(),e.exports.ensureParentDirectoryExistsAsync=async(e,t)=>Promise.resolve()},578:(e,t,r)=>{const n=r(118),{callbackify:o}=r(539);e.exports=class{constructor(e,t,r){this.db=e,this.query=t||{},r&&(this.mapFn=r),this._limit=void 0,this._skip=void 0,this._sort=void 0,this._projection=void 0}limit(e){return this._limit=e,this}skip(e){return this._skip=e,this}sort(e){return this._sort=e,this}projection(e){return this._projection=e,this}_project(e){const t=[];let r;if(void 0===this._projection||0===Object.keys(this._projection).length)return e;const o=0!==this._projection._id,{_id:i,...a}=this._projection;this._projection=a;const s=Object.keys(this._projection);return s.forEach((e=>{if(void 0!==r&&this._projection[e]!==r)throw new Error("Can't both keep and omit fields except for _id");r=this._projection[e]})),e.forEach((e=>{let i;1===r?(i={$set:{}},s.forEach((t=>{i.$set[t]=n.getDotValue(e,t),void 0===i.$set[t]&&delete i.$set[t]})),i=n.modify({},i)):(i={$unset:{}},s.forEach((e=>{i.$unset[e]=!0})),i=n.modify(e,i)),o?i._id=e._id:delete i._id,t.push(i)})),t}async _execAsync(){let e=[],t=0,r=0;const o=await this.db._getCandidatesAsync(this.query);for(const i of o)if(n.match(i,this.query))if(this._sort)e.push(i);else if(this._skip&&this._skip>r)r+=1;else if(e.push(i),t+=1,this._limit&&this._limit<=t)break;if(this._sort){const t=Object.entries(this._sort).map((([e,t])=>({key:e,direction:t})));e.sort(((e,r)=>{for(const o of t){const t=o.direction*n.compareThings(n.getDotValue(e,o.key),n.getDotValue(r,o.key),this.db.compareStrings);if(0!==t)return t}return 0}));const r=this._limit||e.length,o=this._skip||0;e=e.slice(o,o+r)}return e=this._project(e),this.mapFn?this.mapFn(e):e}exec(e){o((()=>this.execAsync()))(e)}execAsync(){return this.db.executor.pushAsync((()=>this._execAsync()))}then(e,t){return this.execAsync().then(e,t)}catch(e){return this.execAsync().catch(e)}finally(e){return this.execAsync().finally(e)}}},797:(e,t,r)=>{const{EventEmitter:n}=r(187),{callbackify:o,deprecate:i}=r(539),a=r(578),s=r(159),c=r(196),u=r(98),f=r(118),l=r(328),{isDate:h,pick:p,filterIndexNames:y}=r(988);e.exports=class extends n{constructor(e){let t;super(),"string"==typeof e?i((()=>{t=e,this.inMemoryOnly=!1}),"@seald-io/nedb: Giving a string to the Datastore constructor is deprecated and will be removed in the next major version. Please use an options object with an argument 'filename'.")():(t=(e=e||{}).filename,this.inMemoryOnly=e.inMemoryOnly||!1,this.autoload=e.autoload||!1,this.timestampData=e.timestampData||!1),t&&"string"==typeof t&&0!==t.length?this.filename=t:(this.filename=null,this.inMemoryOnly=!0),this.compareStrings=e.compareStrings,this.persistence=new l({db:this,afterSerialization:e.afterSerialization,beforeDeserialization:e.beforeDeserialization,corruptAlertThreshold:e.corruptAlertThreshold,modes:e.modes,testSerializationHooks:e.testSerializationHooks}),this.executor=new c,this.inMemoryOnly&&(this.executor.ready=!0),this.indexes={},this.indexes._id=new u({fieldName:"_id",unique:!0}),this.ttlIndexes={},this.autoload?(this.autoloadPromise=this.loadDatabaseAsync(),this.autoloadPromise.then((()=>{e.onload&&e.onload()}),(t=>{if(!e.onload)throw t;e.onload(t)}))):this.autoloadPromise=null,this._autocompactionIntervalId=null}compactDatafileAsync(){return this.executor.pushAsync((()=>this.persistence.persistCachedDatabaseAsync()))}compactDatafile(e){const t=this.compactDatafileAsync();"function"==typeof e&&o((()=>t))(e)}setAutocompactionInterval(e){if(Number.isNaN(Number(e)))throw new Error("Interval must be a non-NaN number");const t=Math.max(Number(e),5e3);this.stopAutocompaction(),this._autocompactionIntervalId=setInterval((()=>{this.compactDatafile()}),t)}stopAutocompaction(){this._autocompactionIntervalId&&(clearInterval(this._autocompactionIntervalId),this._autocompactionIntervalId=null)}loadDatabase(e){const t=this.loadDatabaseAsync();"function"==typeof e&&o((()=>t))(e)}dropDatabaseAsync(){return this.persistence.dropDatabaseAsync()}dropDatabase(e){const t=this.dropDatabaseAsync();"function"==typeof e&&o((()=>t))(e)}loadDatabaseAsync(){return this.executor.pushAsync((()=>this.persistence.loadDatabaseAsync()),!0)}getAllData(){return this.indexes._id.getAll()}_resetIndexes(e){for(const t of Object.values(this.indexes))t.reset(e)}ensureIndex(e={},t){const r=this.ensureIndexAsync(e);"function"==typeof t&&o((()=>r))(t)}async ensureIndexAsync(e={}){if(!e.fieldName){const e=new Error("Cannot create an index without a fieldName");throw e.missingFieldName=!0,e}const t=[].concat(e.fieldName).sort();if(t.some((e=>e.includes(","))))throw new Error("Cannot use comma in index fieldName");const r={...e,fieldName:t.join(",")};if(!this.indexes[r.fieldName]){this.indexes[r.fieldName]=new u(r),void 0!==e.expireAfterSeconds&&(this.ttlIndexes[r.fieldName]=r.expireAfterSeconds);try{this.indexes[r.fieldName].insert(this.getAllData())}catch(e){throw delete this.indexes[r.fieldName],e}await this.executor.pushAsync((()=>this.persistence.persistNewStateAsync([{$$indexCreated:r}])),!0)}}removeIndex(e,t=(()=>{})){const r=this.removeIndexAsync(e);o((()=>r))(t)}async removeIndexAsync(e){delete this.indexes[e],await this.executor.pushAsync((()=>this.persistence.persistNewStateAsync([{$$indexRemoved:e}])),!0)}_addToIndexes(e){let t,r;const n=Object.keys(this.indexes);for(let o=0;o-1!==e.indexOf(","))).map((e=>e.split(","))).filter((t=>Object.entries(e).filter(y(t)).length===t.length));return n.length>0?this.indexes[n[0]].getMatching(p(e,n[0])):(r=Object.entries(e).filter((([r,n])=>!(!e[r]||!Object.prototype.hasOwnProperty.call(e[r],"$in"))&&t.includes(r))).pop(),r?this.indexes[r[0]].getMatching(r[1].$in):(r=Object.entries(e).filter((([r,n])=>!(!e[r]||!(Object.prototype.hasOwnProperty.call(e[r],"$lt")||Object.prototype.hasOwnProperty.call(e[r],"$lte")||Object.prototype.hasOwnProperty.call(e[r],"$gt")||Object.prototype.hasOwnProperty.call(e[r],"$gte")))&&t.includes(r))).pop(),r?this.indexes[r[0]].getBetweenBounds(r[1]):this.getAllData()))}async _getCandidatesAsync(e,t=!1){const r=[],n=this._getRawCandidates(e);if(t)r.push(...n);else{const e=[],t=Object.keys(this.ttlIndexes);n.forEach((n=>{t.every((e=>!(void 0!==n[e]&&h(n[e])&&Date.now()>n[e].getTime()+1e3*this.ttlIndexes[e])))?r.push(n):e.push(n._id)}));for(const t of e)await this._removeAsync({_id:t},{})}return r}async _insertAsync(e){const t=this._prepareDocumentForInsertion(e);return this._insertInCache(t),await this.persistence.persistNewStateAsync(Array.isArray(t)?t:[t]),f.deepCopy(t)}_createNewId(){let e=s.uid(16);return this.indexes._id.getMatching(e).length>0&&(e=this._createNewId()),e}_prepareDocumentForInsertion(e){let t;if(Array.isArray(e))t=[],e.forEach((e=>{t.push(this._prepareDocumentForInsertion(e))}));else{t=f.deepCopy(e),void 0===t._id&&(t._id=this._createNewId());const r=new Date;this.timestampData&&void 0===t.createdAt&&(t.createdAt=r),this.timestampData&&void 0===t.updatedAt&&(t.updatedAt=r),f.checkObject(t)}return t}_insertInCache(e){Array.isArray(e)?this._insertMultipleDocsInCache(e):this._addToIndexes(e)}_insertMultipleDocsInCache(e){let t,r;for(let n=0;nr))(t)}insertAsync(e){return this.executor.pushAsync((()=>this._insertAsync(e)))}count(e,t){const r=this.countAsync(e);if("function"!=typeof t)return r;o(r.execAsync.bind(r))(t)}countAsync(e){return new a(this,e,(e=>e.length))}find(e,t,r){1===arguments.length?t={}:2===arguments.length&&"function"==typeof t&&(r=t,t={});const n=this.findAsync(e,t);if("function"!=typeof r)return n;o(n.execAsync.bind(n))(r)}findAsync(e,t={}){const r=new a(this,e,(e=>e.map((e=>f.deepCopy(e)))));return r.projection(t),r}findOne(e,t,r){1===arguments.length?t={}:2===arguments.length&&"function"==typeof t&&(r=t,t={});const n=this.findOneAsync(e,t);if("function"!=typeof r)return n;o(n.execAsync.bind(n))(r)}findOneAsync(e,t={}){const r=new a(this,e,(e=>1===e.length?f.deepCopy(e[0]):null));return r.projection(t).limit(1),r}async _updateAsync(e,t,r){const n=void 0!==r.multi&&r.multi;if(void 0!==r.upsert&&r.upsert){const r=new a(this,e);if(1!==(await r.limit(1)._execAsync()).length){let r;try{f.checkObject(t),r=t}catch(n){r=f.modify(f.deepCopy(e,!0),t)}return{numAffected:1,affectedDocuments:await this._insertAsync(r),upsert:!0}}}let o,i=0;const s=[];let c;const u=await this._getCandidatesAsync(e);for(const r of u)f.match(r,e)&&(n||0===i)&&(i+=1,this.timestampData&&(c=r.createdAt),o=f.modify(r,t),this.timestampData&&(o.createdAt=c,o.updatedAt=new Date),s.push({oldDoc:r,newDoc:o}));this._updateIndexes(s);const l=s.map((e=>e.newDoc));if(await this.persistence.persistNewStateAsync(l),r.returnUpdatedDocs){let e=[];return l.forEach((t=>{e.push(f.deepCopy(t))})),n||(e=e[0]),{numAffected:i,affectedDocuments:e,upsert:!1}}return{numAffected:i,upsert:!1,affectedDocuments:null}}update(e,t,r,n){"function"==typeof r&&(n=r,r={}),o(((e,t,r)=>this.updateAsync(e,t,r)))(e,t,r,((e,t={})=>{n&&n(e,t.numAffected,t.affectedDocuments,t.upsert)}))}updateAsync(e,t,r={}){return this.executor.pushAsync((()=>this._updateAsync(e,t,r)))}async _removeAsync(e,t={}){const r=void 0!==t.multi&&t.multi,n=await this._getCandidatesAsync(e,!0),o=[];let i=0;return n.forEach((t=>{f.match(t,e)&&(r||0===i)&&(i+=1,o.push({$$deleted:!0,_id:t._id}),this._removeFromIndexes(t))})),await this.persistence.persistNewStateAsync(o),i}remove(e,t,r){"function"==typeof t&&(r=t,t={});const n=r||(()=>{});o(((e,t)=>this.removeAsync(e,t)))(e,t,n)}removeAsync(e,t={}){return this.executor.pushAsync((()=>this._removeAsync(e,t)))}}},196:(e,t,r)=>{const n=r(496);e.exports=class{constructor(){this.ready=!1,this.queue=new n,this.buffer=null,this._triggerBuffer=null,this.resetBuffer()}pushAsync(e,t=!1){return this.ready||t?this.queue.waterfall(e)():this.buffer.waterfall(e)()}processBuffer(){this.ready=!0,this._triggerBuffer(),this.queue.waterfall((()=>this.buffer.guardian))}resetBuffer(){this.buffer=new n,this.buffer.chain(new Promise((e=>{this._triggerBuffer=e}))),this.ready&&this._triggerBuffer()}}},98:(e,t,r)=>{const n=r(908).AVLTree,o=r(118),{uniq:i,isDate:a}=r(988),s=(e,t)=>e===t,c=e=>null===e?"$null":"string"==typeof e?"$string"+e:"boolean"==typeof e?"$boolean"+e:"number"==typeof e?"$number"+e:a(e)?"$date"+e.getTime():e;e.exports=class{constructor(e){if(this.fieldName=e.fieldName,"string"!=typeof this.fieldName)throw new Error("fieldName must be a string");this._fields=this.fieldName.split(","),this.unique=e.unique||!1,this.sparse=e.sparse||!1,this.treeOptions={unique:this.unique,compareKeys:o.compareThings,checkValueEquality:s},this.tree=new n(this.treeOptions)}reset(e){this.tree=new n(this.treeOptions),e&&this.insert(e)}insert(e){let t,r,n;if(Array.isArray(e))return void this.insertMultipleDocs(e);const a=o.getDotValues(e,this._fields);if(!(void 0===a||"object"==typeof a&&null!==a&&Object.values(a).every((e=>void 0===e)))||!this.sparse)if(Array.isArray(a)){t=i(a,c);for(let o=0;o{this.remove(e)}));const t=o.getDotValues(e,this._fields);void 0===t&&this.sparse||(Array.isArray(t)?i(t,c).forEach((t=>{this.tree.delete(t,e)})):this.tree.delete(t,e))}update(e,t){if(Array.isArray(e))this.updateMultipleDocs(e);else{this.remove(e);try{this.insert(t)}catch(t){throw this.insert(e),t}}}updateMultipleDocs(e){let t,r;for(let t=0;t{r.push({oldDoc:e.newDoc,newDoc:e.oldDoc})})),this.update(r)):this.update(t,e)}getMatching(e){if(Array.isArray(e)){const t={},r=[];return e.forEach((e=>{this.getMatching(e).forEach((e=>{t[e._id]=e}))})),Object.keys(t).forEach((e=>{r.push(t[e])})),r}return this.tree.search(e)}getBetweenBounds(e){return this.tree.betweenBounds(e)}getAll(){const e=[];return this.tree.executeOnEveryNode((t=>{e.push(...t.data)})),e}}},118:(e,t,r)=>{const{uniq:n,isDate:o,isRegExp:i}=r(988),a=(e,t)=>{if("number"==typeof e&&(e=e.toString()),!("$"!==e[0]||"$$date"===e&&"number"==typeof t||"$$deleted"===e&&!0===t||"$$indexCreated"===e||"$$indexRemoved"===e))throw new Error("Field names cannot begin with the $ character");if(-1!==e.indexOf("."))throw new Error("Field names cannot contain a .")},s=e=>{if(Array.isArray(e)&&e.forEach((e=>{s(e)})),"object"==typeof e&&null!==e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a(t,e[t]),s(e[t]))};function c(e,t){if("boolean"==typeof e||"number"==typeof e||"string"==typeof e||null===e||o(e))return e;if(Array.isArray(e))return e.map((e=>c(e,t)));if("object"==typeof e){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(!t||"$"!==n[0]&&-1===n.indexOf("."))&&(r[n]=c(e[n],t));return r}}const u=e=>"boolean"==typeof e||"number"==typeof e||"string"==typeof e||null===e||o(e)||Array.isArray(e),f=(e,t)=>et?1:0,l=(e,t)=>{const r=Math.min(e.length,t.length);for(let n=0;n{const n=r||f;if(void 0===e)return void 0===t?0:-1;if(void 0===t)return 1;if(null===e)return null===t?0:-1;if(null===t)return 1;if("number"==typeof e)return"number"==typeof t?f(e,t):-1;if("number"==typeof t)return"number"==typeof e?f(e,t):1;if("string"==typeof e)return"string"==typeof t?n(e,t):-1;if("string"==typeof t)return"string"==typeof e?n(e,t):1;if("boolean"==typeof e)return"boolean"==typeof t?f(e,t):-1;if("boolean"==typeof t)return"boolean"==typeof e?f(e,t):1;if(o(e))return o(t)?f(e.getTime(),t.getTime()):-1;if(o(t))return o(e)?f(e.getTime(),t.getTime()):1;if(Array.isArray(e))return Array.isArray(t)?l(e,t):-1;if(Array.isArray(t))return Array.isArray(e)?l(e,t):1;const i=Object.keys(e).sort(),a=Object.keys(t).sort();for(let r=0;r(r,n,o)=>{const i=(r,n,o)=>{const a="string"==typeof n?n.split("."):n;if(1===a.length)e(r,n,o);else{if(void 0===r[a[0]]){if(t)return;r[a[0]]={}}i(r[a[0]],a.slice(1),o)}};return i(r,n,o)},y=(e,t,r)=>{if(Object.prototype.hasOwnProperty.call(e,t)||(e[t]=[]),!Array.isArray(e[t]))throw new Error("Can't $addToSet an element on non-array values");if(null!==r&&"object"==typeof r&&r.$each){if(Object.keys(r).length>1)throw new Error("Can't use another field in conjunction with $each");if(!Array.isArray(r.$each))throw new Error("$each requires an array value");r.$each.forEach((r=>{y(e,t,r)}))}else{let n=!0;e[t].forEach((e=>{0===h(e,r)&&(n=!1)})),n&&e[t].push(r)}},d={$set:p(((e,t,r)=>{e[t]=r})),$unset:p(((e,t,r)=>{delete e[t]}),!0),$min:p(((e,t,r)=>{(void 0===e[t]||r{(void 0===e[t]||r>e[t])&&(e[t]=r)})),$inc:p(((e,t,r)=>{if("number"!=typeof r)throw new Error(`${r} must be a number`);if("number"!=typeof e[t]){if(Object.prototype.hasOwnProperty.call(e,t))throw new Error("Don't use the $inc modifier on non-number fields");e[t]=r}else e[t]+=r})),$pull:p(((e,t,r)=>{if(!Array.isArray(e[t]))throw new Error("Can't $pull an element from non-array values");const n=e[t];for(let e=n.length-1;e>=0;e-=1)O(n[e],r)&&n.splice(e,1)})),$pop:p(((e,t,r)=>{if(!Array.isArray(e[t]))throw new Error("Can't $pop an element from non-array values");if("number"!=typeof r)throw new Error(`${r} isn't an integer, can't use it with $pop`);0!==r&&(e[t]=r>0?e[t].slice(0,e[t].length-1):e[t].slice(1))})),$addToSet:p(y),$push:p(((e,t,r)=>{if(Object.prototype.hasOwnProperty.call(e,t)||(e[t]=[]),!Array.isArray(e[t]))throw new Error("Can't $push an element on non-array values");if(null!==r&&"object"==typeof r&&r.$slice&&void 0===r.$each&&(r.$each=[]),null!==r&&"object"==typeof r&&r.$each){if(Object.keys(r).length>=3||2===Object.keys(r).length&&void 0===r.$slice)throw new Error("Can only use $slice in cunjunction with $each when $push to array");if(!Array.isArray(r.$each))throw new Error("$each requires an array value");if(r.$each.forEach((r=>{e[t].push(r)})),void 0===r.$slice||"number"!=typeof r.$slice)return;if(0===r.$slice)e[t]=[];else{let n,o;const i=e[t].length;r.$slice<0?(n=Math.max(0,i+r.$slice),o=i):r.$slice>0&&(n=0,o=Math.min(i,r.$slice)),e[t]=e[t].slice(n,o)}}else e[t].push(r)}))},g=(e,t)=>{const r="string"==typeof t?t.split("."):t;if(e){if(0===r.length)return e;if(1===r.length)return e[r[0]];if(Array.isArray(e[r[0]])){const t=parseInt(r[1],10);return"number"!=typeof t||isNaN(t)?e[r[0]].map((e=>g(e,r.slice(1)))):g(e[r[0]][t],r.slice(2))}return g(e[r[0]],r.slice(1))}},m=(e,t)=>{if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||null===t||"string"==typeof t||"boolean"==typeof t||"number"==typeof t)return e===t;if(o(e)||o(t))return o(e)&&o(t)&&e.getTime()===t.getTime();if((!Array.isArray(e)||!Array.isArray(t))&&(Array.isArray(e)||Array.isArray(t))||void 0===e||void 0===t)return!1;let r,n;try{r=Object.keys(e),n=Object.keys(t)}catch(e){return!1}if(r.length!==n.length)return!1;for(const o of r){if(-1===n.indexOf(o))return!1;if(!m(e[o],t[o]))return!1}return!0},v=(e,t)=>!("string"!=typeof e&&"number"!=typeof e&&!o(e)&&"string"!=typeof t&&"number"!=typeof t&&!o(t))&&typeof e==typeof t,b={$lt:(e,t)=>v(e,t)&&ev(e,t)&&e<=t,$gt:(e,t)=>v(e,t)&&e>t,$gte:(e,t)=>v(e,t)&&e>=t,$ne:(e,t)=>void 0===e||!m(e,t),$in:(e,t)=>{if(!Array.isArray(t))throw new Error("$in operator called with a non-array");for(const r of t)if(m(e,r))return!0;return!1},$nin:(e,t)=>{if(!Array.isArray(t))throw new Error("$nin operator called with a non-array");return!b.$in(e,t)},$regex:(e,t)=>{if(!i(t))throw new Error("$regex operator called with non regular expression");return"string"==typeof e&&t.test(e)},$exists:(e,t)=>(t=!(!t&&""!==t),void 0===e?!t:t),$size:(e,t)=>{if(!Array.isArray(e))return!1;if(t%1!=0)throw new Error("$size operator called without an integer");return e.length===t},$elemMatch:(e,t)=>!!Array.isArray(e)&&e.some((e=>O(e,t)))},w={$size:!0,$elemMatch:!0},A={$or:(e,t)=>{if(!Array.isArray(t))throw new Error("$or operator used without an array");for(let r=0;r{if(!Array.isArray(t))throw new Error("$and operator used without an array");for(let r=0;r!O(e,t),$where:(e,t)=>{if("function"!=typeof t)throw new Error("$where operator used without a function");const r=t.call(e);if("boolean"!=typeof r)throw new Error("$where function must return boolean");return r}},O=(e,t)=>{if(u(e)||u(t))return x({needAKey:e},"needAKey",t);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const n=t[r];if("$"===r[0]){if(!A[r])throw new Error(`Unknown logical operator ${r}`);if(!A[r](e,n))return!1}else if(!x(e,r,n))return!1}return!0};function x(e,t,r,n){const o=g(e,t);if(Array.isArray(o)&&!n){if(Array.isArray(r))return x(e,t,r,!0);if(null!==r&&"object"==typeof r&&!i(r))for(const n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&w[n])return x(e,t,r,!0);for(const e of o)if(x({k:e},"k",r))return!0;return!1}if(null!==r&&"object"==typeof r&&!i(r)&&!Array.isArray(r)){const e=Object.keys(r),t=e.map((e=>e[0])),n=t.filter((e=>"$"===e));if(0!==n.length&&n.length!==t.length)throw new Error("You cannot mix operators and normal fields");if(n.length>0){for(const t of e){if(!b[t])throw new Error(`Unknown comparison function ${t}`);if(!b[t](o,r[t]))return!1}return!0}}return i(r)?b.$regex(o,r):m(o,r)}e.exports.serialize=e=>JSON.stringify(e,(function(e,t){if(a(e,t),void 0!==t)return null===t?null:"function"==typeof this[e].getTime?{$$date:this[e].getTime()}:t})),e.exports.deserialize=e=>JSON.parse(e,(function(e,t){return"$$date"===e?new Date(t):"string"==typeof t||"number"==typeof t||"boolean"==typeof t||null===t?t:t&&t.$$date?t.$$date:t})),e.exports.deepCopy=c,e.exports.checkObject=s,e.exports.isPrimitiveType=u,e.exports.modify=(e,t)=>{const r=Object.keys(t),o=r.map((e=>e[0])),i=o.filter((e=>"$"===e));let a,u;if(-1!==r.indexOf("_id")&&t._id!==e._id)throw new Error("You cannot change a document's _id");if(0!==i.length&&i.length!==o.length)throw new Error("You cannot mix modifiers and normal fields");if(0===i.length?(a=c(t),a._id=e._id):(u=n(r),a=c(e),u.forEach((e=>{if(!d[e])throw new Error(`Unknown modifier ${e}`);if("object"!=typeof t[e])throw new Error(`Modifier ${e}'s argument must be an object`);Object.keys(t[e]).forEach((r=>{d[e](a,r,t[e][r])}))}))),s(a),e._id!==a._id)throw new Error("You can't change a document's _id");return a},e.exports.getDotValue=g,e.exports.getDotValues=(e,t)=>{if(!Array.isArray(t))throw new Error("fields must be an Array");if(t.length>1){const r={};for(const n of t)r[n]=g(e,n);return r}return g(e,t[0])},e.exports.match=O,e.exports.areThingsEqual=m,e.exports.compareThings=h},328:(e,t,r)=>{const{deprecate:n}=r(539),o=r(100),i=r(159),a=r(98),s=r(118),c=r(909);class u{constructor(e){if(this.db=e.db,this.inMemoryOnly=this.db.inMemoryOnly,this.filename=this.db.filename,this.corruptAlertThreshold=void 0!==e.corruptAlertThreshold?e.corruptAlertThreshold:.1,this.modes=void 0!==e.modes?e.modes:{fileMode:420,dirMode:493},void 0===this.modes.fileMode&&(this.modes.fileMode=420),void 0===this.modes.dirMode&&(this.modes.dirMode=493),!this.inMemoryOnly&&this.filename&&"~"===this.filename.charAt(this.filename.length-1))throw new Error("The datafile name can't end with a ~, which is reserved for crash safe backup files");if(e.afterSerialization&&!e.beforeDeserialization)throw new Error("Serialization hook defined but deserialization hook undefined, cautiously refusing to start NeDB to prevent dataloss");if(!e.afterSerialization&&e.beforeDeserialization)throw new Error("Serialization hook undefined but deserialization hook defined, cautiously refusing to start NeDB to prevent dataloss");if(this.afterSerialization=e.afterSerialization||(e=>e),this.beforeDeserialization=e.beforeDeserialization||(e=>e),void 0===e.testSerializationHooks||e.testSerializationHooks)for(let e=1;e<30;e+=1)for(let t=0;t<10;t+=1){const t=i.uid(e);if(this.beforeDeserialization(this.afterSerialization(t))!==t)throw new Error("beforeDeserialization is not the reverse of afterSerialization, cautiously refusing to start NeDB to prevent dataloss")}}async persistCachedDatabaseAsync(){const e=[];this.inMemoryOnly||(this.db.getAllData().forEach((t=>{e.push(this.afterSerialization(s.serialize(t)))})),Object.keys(this.db.indexes).forEach((t=>{"_id"!==t&&e.push(this.afterSerialization(s.serialize({$$indexCreated:{fieldName:this.db.indexes[t].fieldName,unique:this.db.indexes[t].unique,sparse:this.db.indexes[t].sparse}})))})),await c.crashSafeWriteFileLinesAsync(this.filename,e,this.modes),this.db.emit("compaction.done"))}compactDatafile(e){n((e=>this.db.compactDatafile(e)),"@seald-io/nedb: calling Datastore#persistence#compactDatafile is deprecated, please use Datastore#compactDatafile, it will be removed in the next major version.")(e)}setAutocompactionInterval(e){n((e=>this.db.setAutocompactionInterval(e)),"@seald-io/nedb: calling Datastore#persistence#setAutocompactionInterval is deprecated, please use Datastore#setAutocompactionInterval, it will be removed in the next major version.")(e)}stopAutocompaction(){n((()=>this.db.stopAutocompaction()),"@seald-io/nedb: calling Datastore#persistence#stopAutocompaction is deprecated, please use Datastore#stopAutocompaction, it will be removed in the next major version.")()}async persistNewStateAsync(e){let t="";this.inMemoryOnly||(e.forEach((e=>{t+=this.afterSerialization(s.serialize(e))+"\n"})),0!==t.length&&await c.appendFileAsync(this.filename,t,{encoding:"utf8",mode:this.modes.fileMode}))}treatRawData(e){const t=e.split("\n"),r={},n={};let o=t.length,i=0;for(const e of t)if(""!==e)try{const t=s.deserialize(this.beforeDeserialization(e));t._id?!0===t.$$deleted?delete r[t._id]:r[t._id]=t:t.$$indexCreated&&null!=t.$$indexCreated.fieldName?n[t.$$indexCreated.fieldName]=t.$$indexCreated:"string"==typeof t.$$indexRemoved&&delete n[t.$$indexRemoved]}catch(e){i+=1}else o--;if(o>0){const e=i/o;if(e>this.corruptAlertThreshold){const t=new Error(`${Math.floor(100*e)}% of the data file is corrupt, more than given corruptAlertThreshold (${Math.floor(100*this.corruptAlertThreshold)}%). Cautiously refusing to start NeDB to prevent dataloss.`);throw t.corruptionRate=e,t.corruptItems=i,t.dataLength=o,t}}return{data:Object.values(r),indexes:n}}treatRawStreamAsync(e){return new Promise(((t,r)=>{const n={},i={};let a=0;const c=o(e);let u=0;c.on("data",(e=>{if(""!==e){try{const t=s.deserialize(this.beforeDeserialization(e));t._id?!0===t.$$deleted?delete n[t._id]:n[t._id]=t:t.$$indexCreated&&null!=t.$$indexCreated.fieldName?i[t.$$indexCreated.fieldName]=t.$$indexCreated:"string"==typeof t.$$indexRemoved&&delete i[t.$$indexRemoved]}catch(e){a+=1}u++}})),c.on("end",(()=>{if(u>0){const e=a/u;if(e>this.corruptAlertThreshold){const t=new Error(`${Math.floor(100*e)}% of the data file is corrupt, more than given corruptAlertThreshold (${Math.floor(100*this.corruptAlertThreshold)}%). Cautiously refusing to start NeDB to prevent dataloss.`);return t.corruptionRate=e,t.corruptItems=a,t.dataLength=u,void r(t,null)}}const e=Object.values(n);t({data:e,indexes:i})})),c.on("error",(function(e){r(e,null)}))}))}async loadDatabaseAsync(){if(this.db._resetIndexes(),this.inMemoryOnly)return;let e;if(await u.ensureParentDirectoryExistsAsync(this.filename,this.modes.dirMode),await c.ensureDatafileIntegrityAsync(this.filename,this.modes.fileMode),c.readFileStream){const t=c.readFileStream(this.filename,{encoding:"utf8",mode:this.modes.fileMode});e=await this.treatRawStreamAsync(t)}else{const t=await c.readFileAsync(this.filename,{encoding:"utf8",mode:this.modes.fileMode});e=this.treatRawData(t)}Object.keys(e.indexes).forEach((t=>{this.db.indexes[t]=new a(e.indexes[t])}));try{this.db._resetIndexes(e.data)}catch(e){throw this.db._resetIndexes(),e}await this.db.persistence.persistCachedDatabaseAsync(),this.db.executor.processBuffer()}async dropDatabaseAsync(){this.db.stopAutocompaction(),this.db.executor.ready=!1,this.db.executor.resetBuffer(),await this.db.executor.queue.guardian,this.db.indexes={},this.db.indexes._id=new a({fieldName:"_id",unique:!0}),this.db.ttlIndexes={},this.db.inMemoryOnly||await this.db.executor.pushAsync((async()=>{await c.existsAsync(this.filename)&&await c.unlinkAsync(this.filename)}),!0)}static async ensureParentDirectoryExistsAsync(e,t=493){return c.ensureParentDirectoryExistsAsync(e,t)}}e.exports=u},988:e=>{const t=e=>"object"==typeof e&&null!==e,r=e=>t(e)&&"[object Date]"===Object.prototype.toString.call(e);e.exports.uniq=(e,t)=>t?[...new Map(e.map((e=>[t(e),e]))).values()]:[...new Set(e)],e.exports.isDate=r,e.exports.isRegExp=e=>t(e)&&"[object RegExp]"===Object.prototype.toString.call(e),e.exports.pick=(e,t)=>t.reduce(((t,r)=>(e&&Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]),t)),{}),e.exports.filterIndexNames=e=>([t,n])=>!("string"!=typeof n&&"number"!=typeof n&&"boolean"!=typeof n&&!r(n)&&null!==n)&&e.includes(t)},496:e=>{e.exports=class{constructor(){this.guardian=Promise.resolve()}waterfall(e){return(...t)=>(this.guardian=this.guardian.then((()=>e(...t).then((e=>({error:!1,result:e})),(e=>({error:!0,result:e}))))),this.guardian.then((({error:e,result:t})=>e?Promise.reject(t):Promise.resolve(t))))}chain(e){return this.waterfall((()=>e))()}}},908:(e,t,r)=>{r(902),e.exports.AVLTree=r(522)},522:(e,t,r)=>{const n=r(902),o=r(639);class i{constructor(e){this.tree=new a(e)}checkIsAVLT(){this.tree.checkIsAVLT()}insert(e,t){const r=this.tree.insert(e,t);r&&(this.tree=r)}delete(e,t){const r=this.tree.delete(e,t);r&&(this.tree=r)}}class a extends n{constructor(e){super(),e=e||{},this.left=null,this.right=null,this.parent=void 0!==e.parent?e.parent:null,Object.prototype.hasOwnProperty.call(e,"key")&&(this.key=e.key),this.data=Object.prototype.hasOwnProperty.call(e,"value")?[e.value]:[],this.unique=e.unique||!1,this.compareKeys=e.compareKeys||o.defaultCompareKeysFunction,this.checkValueEquality=e.checkValueEquality||o.defaultCheckValueEquality}checkHeightCorrect(){if(!Object.prototype.hasOwnProperty.call(this,"key"))return;if(this.left&&void 0===this.left.height)throw new Error("Undefined height for node "+this.left.key);if(this.right&&void 0===this.right.height)throw new Error("Undefined height for node "+this.right.key);if(void 0===this.height)throw new Error("Undefined height for node "+this.key);const e=this.left?this.left.height:0,t=this.right?this.right.height:0;if(this.height!==1+Math.max(e,t))throw new Error("Height constraint failed for node "+this.key);this.left&&this.left.checkHeightCorrect(),this.right&&this.right.checkHeightCorrect()}balanceFactor(){return(this.left?this.left.height:0)-(this.right?this.right.height:0)}checkBalanceFactors(){if(Math.abs(this.balanceFactor())>1)throw new Error("Tree is unbalanced at node "+this.key);this.left&&this.left.checkBalanceFactors(),this.right&&this.right.checkBalanceFactors()}checkIsAVLT(){super.checkIsBST(),this.checkHeightCorrect(),this.checkBalanceFactors()}rightRotation(){const e=this,t=this.left;if(!t)return e;const r=t.right;e.parent?(t.parent=e.parent,e.parent.left===e?e.parent.left=t:e.parent.right=t):t.parent=null,t.right=e,e.parent=t,e.left=r,r&&(r.parent=e);const n=t.left?t.left.height:0,o=r?r.height:0,i=e.right?e.right.height:0;return e.height=Math.max(o,i)+1,t.height=Math.max(n,e.height)+1,t}leftRotation(){const e=this,t=this.right;if(!t)return this;const r=t.left;e.parent?(t.parent=e.parent,e.parent.left===e?e.parent.left=t:e.parent.right=t):t.parent=null,t.left=e,e.parent=t,e.right=r,r&&(r.parent=e);const n=e.left?e.left.height:0,o=r?r.height:0,i=t.right?t.right.height:0;return e.height=Math.max(n,o)+1,t.height=Math.max(i,e.height)+1,t}rightTooSmall(){return this.balanceFactor()<=1?this:(this.left.balanceFactor()<0&&this.left.leftRotation(),this.rightRotation())}leftTooSmall(){return this.balanceFactor()>=-1?this:(this.right.balanceFactor()>0&&this.right.rightRotation(),this.leftRotation())}rebalanceAlongPath(e){let t,r,n=this;if(!Object.prototype.hasOwnProperty.call(this,"key"))return delete this.height,this;for(r=e.length-1;r>=0;r-=1)e[r].height=1+Math.max(e[r].left?e[r].left.height:0,e[r].right?e[r].right.height:0),e[r].balanceFactor()>1&&(t=e[r].rightTooSmall(),0===r&&(n=t)),e[r].balanceFactor()<-1&&(t=e[r].leftTooSmall(),0===r&&(n=t));return n}insert(e,t){const r=[];let n=this;if(!Object.prototype.hasOwnProperty.call(this,"key"))return this.key=e,this.data.push(t),this.height=1,this;for(;;){if(0===n.compareKeys(n.key,e)){if(n.unique){const t=new Error(`Can't insert key ${JSON.stringify(e)}, it violates the unique constraint`);throw t.key=e,t.errorType="uniqueViolated",t}return n.data.push(t),this}if(r.push(n),n.compareKeys(e,n.key)<0){if(!n.left){r.push(n.createLeftChild({key:e,value:t}));break}n=n.left}else{if(!n.right){r.push(n.createRightChild({key:e,value:t}));break}n=n.right}}return this.rebalanceAlongPath(r)}delete(e,t){const r=[];let n,o=this;const i=[];if(!Object.prototype.hasOwnProperty.call(this,"key"))return this;for(;0!==o.compareKeys(e,o.key);)if(i.push(o),o.compareKeys(e,o.key)<0){if(!o.left)return this;o=o.left}else{if(!o.right)return this;o=o.right}if(o.data.length>1&&void 0!==t)return o.data.forEach((function(e){o.checkValueEquality(e,t)||r.push(e)})),o.data=r,this;if(!o.left&&!o.right)return o===this?(delete o.key,o.data=[],delete o.height,this):(o.parent.left===o?o.parent.left=null:o.parent.right=null,this.rebalanceAlongPath(i));if(!o.left||!o.right)return n=o.left?o.left:o.right,o===this?(n.parent=null,n):(o.parent.left===o?(o.parent.left=n,n.parent=o.parent):(o.parent.right=n,n.parent=o.parent),this.rebalanceAlongPath(i));if(i.push(o),n=o.left,!n.right)return o.key=n.key,o.data=n.data,o.left=n.left,n.left&&(n.left.parent=o),this.rebalanceAlongPath(i);for(;n.right;)i.push(n),n=n.right;return o.key=n.key,o.data=n.data,n.parent.right=n.left,n.left&&(n.left.parent=n.parent),this.rebalanceAlongPath(i)}}i._AVLTree=a,["getNumberOfKeys","search","betweenBounds","prettyPrint","executeOnEveryNode"].forEach((function(e){i.prototype[e]=function(){return this.tree[e].apply(this.tree,arguments)}})),e.exports=i},902:(e,t,r)=>{const n=r(639);function o(e,t){for(let r=0;r{if(this.compareKeys(e,this.key)>=0)throw new Error(`Tree with root ${this.key} is not a binary search tree`)})),this.left.checkNodeOrdering()),this.right&&(this.right.checkAllNodesFullfillCondition((e=>{if(this.compareKeys(e,this.key)<=0)throw new Error(`Tree with root ${this.key} is not a binary search tree`)})),this.right.checkNodeOrdering()))}checkInternalPointers(){if(this.left){if(this.left.parent!==this)throw new Error(`Parent pointer broken for key ${this.key}`);this.left.checkInternalPointers()}if(this.right){if(this.right.parent!==this)throw new Error(`Parent pointer broken for key ${this.key}`);this.right.checkInternalPointers()}}checkIsBST(){if(this.checkNodeOrdering(),this.checkInternalPointers(),this.parent)throw new Error("The root shouldn't have a parent")}getNumberOfKeys(){let e;return Object.prototype.hasOwnProperty.call(this,"key")?(e=1,this.left&&(e+=this.left.getNumberOfKeys()),this.right&&(e+=this.right.getNumberOfKeys()),e):0}createSimilar(e){return(e=e||{}).unique=this.unique,e.compareKeys=this.compareKeys,e.checkValueEquality=this.checkValueEquality,new this.constructor(e)}createLeftChild(e){const t=this.createSimilar(e);return t.parent=this,this.left=t,t}createRightChild(e){const t=this.createSimilar(e);return t.parent=this,this.right=t,t}insert(e,t){if(!Object.prototype.hasOwnProperty.call(this,"key"))return this.key=e,void this.data.push(t);if(0!==this.compareKeys(this.key,e))this.compareKeys(e,this.key)<0?this.left?this.left.insert(e,t):this.createLeftChild({key:e,value:t}):this.right?this.right.insert(e,t):this.createRightChild({key:e,value:t});else{if(this.unique){const t=new Error(`Can't insert key ${JSON.stringify(e)}, it violates the unique constraint`);throw t.key=e,t.errorType="uniqueViolated",t}this.data.push(t)}}search(e){return Object.prototype.hasOwnProperty.call(this,"key")?0===this.compareKeys(this.key,e)?this.data:this.compareKeys(e,this.key)<0?this.left?this.left.search(e):[]:this.right?this.right.search(e):[]:[]}getLowerBoundMatcher(e){return Object.prototype.hasOwnProperty.call(e,"$gt")||Object.prototype.hasOwnProperty.call(e,"$gte")?Object.prototype.hasOwnProperty.call(e,"$gt")&&Object.prototype.hasOwnProperty.call(e,"$gte")?0===this.compareKeys(e.$gte,e.$gt)?t=>this.compareKeys(t,e.$gt)>0:this.compareKeys(e.$gte,e.$gt)>0?t=>this.compareKeys(t,e.$gte)>=0:t=>this.compareKeys(t,e.$gt)>0:Object.prototype.hasOwnProperty.call(e,"$gt")?t=>this.compareKeys(t,e.$gt)>0:t=>this.compareKeys(t,e.$gte)>=0:()=>!0}getUpperBoundMatcher(e){return Object.prototype.hasOwnProperty.call(e,"$lt")||Object.prototype.hasOwnProperty.call(e,"$lte")?Object.prototype.hasOwnProperty.call(e,"$lt")&&Object.prototype.hasOwnProperty.call(e,"$lte")?0===this.compareKeys(e.$lte,e.$lt)?t=>this.compareKeys(t,e.$lt)<0:this.compareKeys(e.$lte,e.$lt)<0?t=>this.compareKeys(t,e.$lte)<=0:t=>this.compareKeys(t,e.$lt)<0:Object.prototype.hasOwnProperty.call(e,"$lt")?t=>this.compareKeys(t,e.$lt)<0:t=>this.compareKeys(t,e.$lte)<=0:()=>!0}betweenBounds(e,t,r){const n=[];return Object.prototype.hasOwnProperty.call(this,"key")?(t=t||this.getLowerBoundMatcher(e),r=r||this.getUpperBoundMatcher(e),t(this.key)&&this.left&&o(n,this.left.betweenBounds(e,t,r)),t(this.key)&&r(this.key)&&o(n,this.data),r(this.key)&&this.right&&o(n,this.right.betweenBounds(e,t,r)),n):[]}deleteIfLeaf(){return!(this.left||this.right||(this.parent?(this.parent.left===this?this.parent.left=null:this.parent.right=null,0):(delete this.key,this.data=[],0)))}deleteIfOnlyOneChild(){let e;return this.left&&!this.right&&(e=this.left),!this.left&&this.right&&(e=this.right),!!e&&(this.parent?(this.parent.left===this?(this.parent.left=e,e.parent=this.parent):(this.parent.right=e,e.parent=this.parent),!0):(this.key=e.key,this.data=e.data,this.left=null,e.left&&(this.left=e.left,e.left.parent=this),this.right=null,e.right&&(this.right=e.right,e.right.parent=this),!0))}delete(e,t){const r=[];let n;if(Object.prototype.hasOwnProperty.call(this,"key"))if(this.compareKeys(e,this.key)<0)this.left&&this.left.delete(e,t);else if(this.compareKeys(e,this.key)>0)this.right&&this.right.delete(e,t);else if(0!==!this.compareKeys(e,this.key))return this.data.length>1&&void 0!==t?(this.data.forEach((e=>{this.checkValueEquality(e,t)||r.push(e)})),void(this.data=r)):void(this.deleteIfLeaf()||this.deleteIfOnlyOneChild()||(Math.random()>=.5?(n=this.left.getMaxKeyDescendant(),this.key=n.key,this.data=n.data,this===n.parent?(this.left=n.left,n.left&&(n.left.parent=n.parent)):(n.parent.right=n.left,n.left&&(n.left.parent=n.parent))):(n=this.right.getMinKeyDescendant(),this.key=n.key,this.data=n.data,this===n.parent?(this.right=n.right,n.right&&(n.right.parent=n.parent)):(n.parent.left=n.right,n.right&&(n.right.parent=n.parent)))))}executeOnEveryNode(e){this.left&&this.left.executeOnEveryNode(e),e(this),this.right&&this.right.executeOnEveryNode(e)}prettyPrint(e,t){t=t||"",console.log(`${t}* ${this.key}`),e&&console.log(`${t}* ${this.data}`),(this.left||this.right)&&(this.left?this.left.prettyPrint(e,`${t} `):console.log(`${t} *`),this.right?this.right.prettyPrint(e,`${t} `):console.log(`${t} *`))}}},639:e=>{const t=e=>{if(0===e)return[];if(1===e)return[0];const r=t(e-1),n=Math.floor(Math.random()*e);return r.splice(n,0,e-1),r};e.exports.getRandomArray=t,e.exports.defaultCompareKeysFunction=(e,t)=>{if(et)return 1;if(e===t)return 0;const r=new Error("Couldn't compare elements");throw r.a=e,r.b=t,r},e.exports.defaultCheckValueEquality=(e,t)=>e===t},924:(e,t,r)=>{"use strict";var n=r(210),o=r(559),i=o(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"==typeof r&&i(e,".prototype.")>-1?o(r):r}},559:(e,t,r)=>{"use strict";var n=r(612),o=r(210),i=o("%Function.prototype.apply%"),a=o("%Function.prototype.call%"),s=o("%Reflect.apply%",!0)||n.call(a,i),c=o("%Object.getOwnPropertyDescriptor%",!0),u=o("%Object.defineProperty%",!0),f=o("%Math.max%");if(u)try{u({},"a",{value:1})}catch(e){u=null}e.exports=function(e){var t=s(n,a,arguments);return c&&u&&c(t,"length").configurable&&u(t,"length",{value:1+f(0,e.length-(arguments.length-1))}),t};var l=function(){return s(n,i,arguments)};u?u(e.exports,"apply",{value:l}):e.exports.apply=l},187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(r,n){function o(r){e.removeListener(t,i),n(r)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),r([].slice.call(arguments))}d(e,t,i,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&d(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var o,i,a,u;if(s(r),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),i=e._events),a=i[t]),void 0===a)a=i[t]=r,++e._eventsCount;else if("function"==typeof a?a=i[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(o=c(e))>0&&a.length>o&&!a.warned){a.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=a.length,u=f,console&&console.warn&&console.warn(u)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=f.bind(n);return o.listener=r,n.wrapFn=o,o}function h(e,t,r){var n=e._events;if(void 0===n)return[];var o=n[t];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,f=y(c,u);for(r=0;r=0;i--)if(r[i]===t||r[i].listener===t){a=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return h(this,e,!0)},i.prototype.rawListeners=function(e){return h(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},29:(e,t,r)=>{"use strict";var n=r(320),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=function(e,t,r){for(var n=0,o=e.length;n=3&&(i=r),"[object Array]"===o.call(e)?a(e,t,i):"string"==typeof e?s(e,t,i):c(e,t,i)}},648:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";e.exports=function(e){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(t+i);for(var a,s=r.call(arguments,1),c=Math.max(0,i.length-s.length),u=[],f=0;f{"use strict";var n=r(648);e.exports=Function.prototype.bind||n},210:(e,t,r)=>{"use strict";var n,o=SyntaxError,i=Function,a=TypeError,s=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(e){c=null}var u=function(){throw new a},f=c?function(){try{return u}catch(e){try{return c(arguments,"callee").get}catch(e){return u}}}():u,l=r(405)(),h=Object.getPrototypeOf||function(e){return e.__proto__},p={},y="undefined"==typeof Uint8Array?n:h(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":l?h([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":p,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?h(h([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?h((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?h((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?h(""[Symbol.iterator]()):n,"%Symbol%":l?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":f,"%TypedArray%":y,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};try{null.error}catch(e){var g=h(h(e));d["%Error.prototype%"]=g}var m=function e(t){var r;if("%AsyncFunction%"===t)r=s("async function () {}");else if("%GeneratorFunction%"===t)r=s("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=s("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&(r=h(o.prototype))}return d[t]=r,r},v={"%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"]},b=r(612),w=r(642),A=b.call(Function.call,Array.prototype.concat),O=b.call(Function.apply,Array.prototype.splice),x=b.call(Function.call,String.prototype.replace),_=b.call(Function.call,String.prototype.slice),j=b.call(Function.call,RegExp.prototype.exec),S=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,k=function(e){var t=_(e,0,1),r=_(e,-1);if("%"===t&&"%"!==r)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return x(e,S,(function(e,t,r,o){n[n.length]=r?x(o,E,"$1"):t||e})),n},I=function(e,t){var r,n=e;if(w(v,n)&&(n="%"+(r=v[n])[0]+"%"),w(d,n)){var i=d[n];if(i===p&&(i=m(n)),void 0===i&&!t)throw new a("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:i}}throw new o("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new a('"allowMissing" argument must be a boolean');if(null===j(/^%?[^%]*%?$/,e))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=k(e),n=r.length>0?r[0]:"",i=I("%"+n+"%",t),s=i.name,u=i.value,f=!1,l=i.alias;l&&(n=l[0],O(r,A([0,1],l)));for(var h=1,p=!0;h=r.length){var v=c(u,y);u=(p=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:u[y]}else p=w(u,y),u=u[y];p&&!f&&(d[s]=u)}}return u}},296:(e,t,r)=>{"use strict";var n=r(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(e){n=null}e.exports=n},405:(e,t,r)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=r(419);e.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},410:(e,t,r)=>{"use strict";var n=r(419);e.exports=function(){return n()&&!!Symbol.toStringTag}},642:(e,t,r)=>{"use strict";var n=r(612);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},584:(e,t,r)=>{"use strict";var n=r(410)(),o=r(924)("Object.prototype.toString"),i=function(e){return!(n&&e&&"object"==typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===o(e)},a=function(e){return!!i(e)||null!==e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&"[object Array]"!==o(e)&&"[object Function]"===o(e.callee)},s=function(){return i(arguments)}();i.isLegacyArguments=a,e.exports=s?i:a},320:e=>{"use strict";var t,r,n=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},o((function(){throw 42}),null,t)}catch(e){e!==r&&(o=null)}else o=null;var i=/^\s*class\b/,a=function(e){try{var t=n.call(e);return i.test(t)}catch(e){return!1}},s=function(e){try{return!a(e)&&(n.call(e),!0)}catch(e){return!1}},c=Object.prototype.toString,u="function"==typeof Symbol&&!!Symbol.toStringTag,f=!(0 in[,]),l=function(){return!1};if("object"==typeof document){var h=document.all;c.call(h)===c.call(document.all)&&(l=function(e){if((f||!e)&&(void 0===e||"object"==typeof e))try{var t=c.call(e);return("[object HTMLAllCollection]"===t||"[object HTML document.all class]"===t||"[object HTMLCollection]"===t||"[object Object]"===t)&&null==e("")}catch(e){}return!1})}e.exports=o?function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;try{o(e,null,t)}catch(e){if(e!==r)return!1}return!a(e)&&s(e)}:function(e){if(l(e))return!0;if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(u)return s(e);if(a(e))return!1;var t=c.call(e);return!("[object Function]"!==t&&"[object GeneratorFunction]"!==t&&!/^\[object HTML/.test(t))&&s(e)}},662:(e,t,r)=>{"use strict";var n,o=Object.prototype.toString,i=Function.prototype.toString,a=/^\s*(?:function)?\*/,s=r(410)(),c=Object.getPrototypeOf;e.exports=function(e){if("function"!=typeof e)return!1;if(a.test(i.call(e)))return!0;if(!s)return"[object GeneratorFunction]"===o.call(e);if(!c)return!1;if(void 0===n){var t=function(){if(!s)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&c(t)}return c(e)===n}},692:(e,t,r)=>{"use strict";var n=r(29),o=r(83),i=r(924),a=i("Object.prototype.toString"),s=r(410)(),c=r(296),u="undefined"==typeof globalThis?r.g:globalThis,f=o(),l=i("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r-1}return!!c&&function(e){var t=!1;return n(p,(function(r,n){if(!t)try{t=r.call(e)===n}catch(e){}})),t}(e)}},483:(e,t,r)=>{e.exports=function e(t,r,n){function o(a,s){if(!r[a]){if(!t[a]){if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[a]={exports:{}};t[a][0].call(u.exports,(function(e){return o(t[a][1][e]||e)}),u,u.exports,e,t,r,n)}return r[a].exports}for(var i=void 0,a=0;a=43)}})).catch((function(){return!1}))}(e).then((function(e){return h=e}))}function b(e){var t=p[e.name],r={};r.promise=new a((function(e,t){r.resolve=e,r.reject=t})),t.deferredOperations.push(r),t.dbReady?t.dbReady=t.dbReady.then((function(){return r.promise})):t.dbReady=r.promise}function w(e){var t=p[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function A(e,t){var r=p[e.name].deferredOperations.pop();if(r)return r.reject(t),r.promise}function O(e,t){return new a((function(r,n){if(p[e.name]=p[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return r(e.db);b(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var r=a.result;try{r.createObjectStore(e.storeName),t.oldVersion<=1&&r.createObjectStore(l)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),n(a.error)},a.onsuccess=function(){var t=a.result;t.onversionchange=function(e){e.target.close()},r(t),w(e)}}))}function x(e){return O(e,!1)}function _(e){return O(e,!0)}function j(e,t){if(!e.db)return!0;var r=!e.db.objectStoreNames.contains(e.storeName),n=e.versione.db.version;if(n&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||r){if(r){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function S(e){return i([m(atob(e.data))],{type:e.type})}function E(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,r=t._initReady().then((function(){var e=p[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return c(r,e,e),r}function I(e,t,r,n){void 0===n&&(n=1);try{var o=e.db.transaction(e.storeName,t);r(null,o)}catch(o){if(n>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),_(e)})).then((function(){return function(e){b(e);for(var t=p[e.name],r=t.forages,n=0;n>4,f[c++]=(15&n)<<4|o>>2,f[c++]=(3&o)<<6|63&i;return u}function Y(e){var t,r=new Uint8Array(e),n="";for(t=0;t>2],n+=D[(3&r[t])<<4|r[t+1]>>4],n+=D[(15&r[t+1])<<2|r[t+2]>>6],n+=D[63&r[t+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}var Q={serialize:function(e,t){var r="";if(e&&(r=H.call(e)),e&&("[object ArrayBuffer]"===r||e.buffer&&"[object ArrayBuffer]"===H.call(e.buffer))){var n,o=T;e instanceof ArrayBuffer?(n=e,o+=F):(n=e.buffer,"[object Int8Array]"===r?o+=R:"[object Uint8Array]"===r?o+=B:"[object Uint8ClampedArray]"===r?o+=L:"[object Int16Array]"===r?o+=U:"[object Uint16Array]"===r?o+=q:"[object Int32Array]"===r?o+=z:"[object Uint32Array]"===r?o+=K:"[object Float32Array]"===r?o+=V:"[object Float64Array]"===r?o+=W:t(new Error("Failed to get type for BinaryArray"))),t(o+Y(n))}else if("[object Blob]"===r){var i=new FileReader;i.onload=function(){var r=$+e.type+"~"+Y(this.result);t(T+C+r)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(r){console.error("Couldn't convert value into a JSON string: ",e),t(null,r)}},deserialize:function(e){if(e.substring(0,M)!==T)return JSON.parse(e);var t,r=e.substring(G),n=e.substring(M,G);if(n===C&&N.test(r)){var o=r.match(N);t=o[1],r=r.substring(o[0].length)}var a=J(r);switch(n){case F:return a;case C:return i([a],{type:t});case R:return new Int8Array(a);case B:return new Uint8Array(a);case L:return new Uint8ClampedArray(a);case U:return new Int16Array(a);case q:return new Uint16Array(a);case z:return new Int32Array(a);case K:return new Uint32Array(a);case V:return new Float32Array(a);case W:return new Float64Array(a);default:throw new Error("Unkown type: "+n)}},stringToBuffer:J,bufferToString:Y};function X(e,t,r,n){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function Z(e,t,r,n,o,i){e.executeSql(r,n,o,(function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,s){s.rows.length?i(e,a):X(e,t,(function(){e.executeSql(r,n,o,i)}),i)}),i):i(e,a)}),i)}function ee(e,t,r,n){var o=this;e=u(e);var i=new a((function(i,a){o.ready().then((function(){void 0===t&&(t=null);var s=t,c=o._dbInfo;c.serializer.serialize(t,(function(t,u){u?a(u):c.db.transaction((function(r){Z(r,c,"INSERT OR REPLACE INTO "+c.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){i(s)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(n>0)return void i(ee.apply(o,[e,s,r,n-1]));a(t)}}))}))})).catch(a)}));return s(i,r),i}var te={_driver:"webSQLStorage",_initStorage:function(e){var t=this,r={db:null};if(e)for(var n in e)r[n]="string"!=typeof e[n]?e[n].toString():e[n];var o=new a((function(e,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(e){return n(e)}r.db.transaction((function(o){X(o,r,(function(){t._dbInfo=r,e()}),(function(e,t){n(t)}))}),n)}));return r.serializer=Q,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var r=this,n=new a((function(t,n){r.ready().then((function(){var o=r._dbInfo;o.db.transaction((function(r){Z(r,o,"SELECT * FROM "+o.storeName,[],(function(r,n){for(var i=n.rows,a=i.length,s=0;s '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var o=[],i=0;i0}var oe={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var r in e)t[r]=e[r];return t.keyPrefix=re(e,this._defaultConfig),ne()?(this._dbInfo=t,t.serializer=Q,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var r=this,n=r.ready().then((function(){for(var t=r._dbInfo,n=t.keyPrefix,o=n.length,i=localStorage.length,a=1,s=0;s=0;r--){var n=localStorage.key(r);0===n.indexOf(e)&&localStorage.removeItem(n)}}));return s(r,e),r},length:function(e){var t=this.keys().then((function(e){return e.length}));return s(t,e),t},key:function(e,t){var r=this,n=r.ready().then((function(){var t,n=r._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(n.keyPrefix.length)),t}));return s(n,t),n},keys:function(e){var t=this,r=t.ready().then((function(){for(var e=t._dbInfo,r=localStorage.length,n=[],o=0;o=0;t--){var r=localStorage.key(t);0===r.indexOf(e)&&localStorage.removeItem(r)}})):a.reject("Invalid arguments"),s(n,t),n}},ie=function(e,t){for(var r=e.length,n=0;n{var t,r,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var s,c=[],u=!1,f=-1;function l(){u&&s&&(u=!1,s.length?c=s.concat(c):f=-1,c.length&&h())}function h(){if(!u){var e=a(l);u=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var r=1;r{e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},955:(e,t,r)=>{"use strict";var n=r(584),o=r(662),i=r(430),a=r(692);function s(e){return e.call.bind(e)}var c="undefined"!=typeof BigInt,u="undefined"!=typeof Symbol,f=s(Object.prototype.toString),l=s(Number.prototype.valueOf),h=s(String.prototype.valueOf),p=s(Boolean.prototype.valueOf);if(c)var y=s(BigInt.prototype.valueOf);if(u)var d=s(Symbol.prototype.valueOf);function g(e,t){if("object"!=typeof e)return!1;try{return t(e),!0}catch(e){return!1}}function m(e){return"[object Map]"===f(e)}function v(e){return"[object Set]"===f(e)}function b(e){return"[object WeakMap]"===f(e)}function w(e){return"[object WeakSet]"===f(e)}function A(e){return"[object ArrayBuffer]"===f(e)}function O(e){return"undefined"!=typeof ArrayBuffer&&(A.working?A(e):e instanceof ArrayBuffer)}function x(e){return"[object DataView]"===f(e)}function _(e){return"undefined"!=typeof DataView&&(x.working?x(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=o,t.isTypedArray=a,t.isPromise=function(e){return"undefined"!=typeof Promise&&e instanceof Promise||null!==e&&"object"==typeof e&&"function"==typeof e.then&&"function"==typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):a(e)||_(e)},t.isUint8Array=function(e){return"Uint8Array"===i(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===i(e)},t.isUint16Array=function(e){return"Uint16Array"===i(e)},t.isUint32Array=function(e){return"Uint32Array"===i(e)},t.isInt8Array=function(e){return"Int8Array"===i(e)},t.isInt16Array=function(e){return"Int16Array"===i(e)},t.isInt32Array=function(e){return"Int32Array"===i(e)},t.isFloat32Array=function(e){return"Float32Array"===i(e)},t.isFloat64Array=function(e){return"Float64Array"===i(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===i(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===i(e)},m.working="undefined"!=typeof Map&&m(new Map),t.isMap=function(e){return"undefined"!=typeof Map&&(m.working?m(e):e instanceof Map)},v.working="undefined"!=typeof Set&&v(new Set),t.isSet=function(e){return"undefined"!=typeof Set&&(v.working?v(e):e instanceof Set)},b.working="undefined"!=typeof WeakMap&&b(new WeakMap),t.isWeakMap=function(e){return"undefined"!=typeof WeakMap&&(b.working?b(e):e instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},A.working="undefined"!=typeof ArrayBuffer&&A(new ArrayBuffer),t.isArrayBuffer=O,x.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&x(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=_;var j="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function S(e){return"[object SharedArrayBuffer]"===f(e)}function E(e){return void 0!==j&&(void 0===S.working&&(S.working=S(new j)),S.working?S(e):e instanceof j)}function k(e){return g(e,l)}function I(e){return g(e,h)}function P(e){return g(e,p)}function D(e){return c&&g(e,y)}function $(e){return u&&g(e,d)}t.isSharedArrayBuffer=E,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===f(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===f(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===f(e)},t.isGeneratorObject=function(e){return"[object Generator]"===f(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===f(e)},t.isNumberObject=k,t.isStringObject=I,t.isBooleanObject=P,t.isBigIntObject=D,t.isSymbolObject=$,t.isBoxedPrimitive=function(e){return k(e)||I(e)||P(e)||D(e)||$(e)},t.isAnyArrayBuffer=function(e){return"undefined"!=typeof Uint8Array&&(O(e)||E(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},539:(e,t,r)=>{var n=r(155),o=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=o)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=f),h(n,e,n.depth)}function f(e,t){var r=u.styles[t];return r?"["+u.colors[r][0]+"m"+e+"["+u.colors[r][1]+"m":e}function l(e,t){return e}function h(e,r,n){if(e.customInspect&&r&&j(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var o=r.inspect(n,e);return b(o)||(o=h(e,o,n)),o}var i=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return v(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}(e,r);if(i)return i;var a=Object.keys(r),s=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(r)),_(r)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return p(r);if(0===a.length){if(j(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(A(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(x(r))return e.stylize(Date.prototype.toString.call(r),"date");if(_(r))return p(r)}var u,f="",l=!1,O=["{","}"];return d(r)&&(l=!0,O=["[","]"]),j(r)&&(f=" [Function"+(r.name?": "+r.name:"")+"]"),A(r)&&(f=" "+RegExp.prototype.toString.call(r)),x(r)&&(f=" "+Date.prototype.toUTCString.call(r)),_(r)&&(f=" "+p(r)),0!==a.length||l&&0!=r.length?n<0?A(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=l?function(e,t,r,n,o){for(var i=[],a=0,s=t.length;a60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(u,f,O)):O[0]+f+O[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function y(e,t,r,n,o,i){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),I(n,o)||(a="["+o+"]"),s||(e.seen.indexOf(c.value)<0?(s=m(r)?h(e,c.value,null):h(e,c.value,r-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(e){return" "+e})).join("\n").slice(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),w(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function m(e){return null===e}function v(e){return"number"==typeof e}function b(e){return"string"==typeof e}function w(e){return void 0===e}function A(e){return O(e)&&"[object RegExp]"===S(e)}function O(e){return"object"==typeof e&&null!==e}function x(e){return O(e)&&"[object Date]"===S(e)}function _(e){return O(e)&&("[object Error]"===S(e)||e instanceof Error)}function j(e){return"function"==typeof e}function S(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!a[e])if(s.test(e)){var r=n.pid;a[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else a[e]=function(){};return a[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(955),t.isArray=d,t.isBoolean=g,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=v,t.isString=b,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=w,t.isRegExp=A,t.types.isRegExp=A,t.isObject=O,t.isDate=x,t.types.isDate=x,t.isError=_,t.types.isNativeError=_,t.isFunction=j,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=r(384);var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,r;console.log("%s - %s",(r=[E((e=new Date).getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":"),[e.getDate(),k[e.getMonth()],r].join(" ")),t.format.apply(t,arguments))},t.inherits=r(717),t._extend=function(e,t){if(!t||!O(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function D(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(P&&e[P]){var t;if("function"!=typeof(t=e[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),o=[],i=0;i{"use strict";var n=r(29),o=r(83),i=r(924),a=r(296),s=i("Object.prototype.toString"),c=r(410)(),u="undefined"==typeof globalThis?r.g:globalThis,f=o(),l=i("String.prototype.slice"),h={},p=Object.getPrototypeOf;c&&a&&p&&n(f,(function(e){if("function"==typeof u[e]){var t=new u[e];if(Symbol.toStringTag in t){var r=p(t),n=a(r,Symbol.toStringTag);if(!n){var o=p(r);n=a(o,Symbol.toStringTag)}h[e]=n.get}}}));var y=r(692);e.exports=function(e){return!!y(e)&&(c&&Symbol.toStringTag in e?function(e){var t=!1;return n(h,(function(r,n){if(!t)try{var o=r.call(e);o===n&&(t=o)}catch(e){}})),t}(e):l(s(e),8,-1))}},83:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],o="undefined"==typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 924: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(210); - -var callBind = __webpack_require__(559); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; - - -/***/ }), - -/***/ 559: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(612); -var GetIntrinsic = __webpack_require__(210); - -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); -var $max = GetIntrinsic('%Math.max%'); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty( - func, - 'length', - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } - } - return func; -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} - - -/***/ }), - -/***/ 29: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var isCallable = __webpack_require__(320); - -var toStr = Object.prototype.toString; -var hasOwnProperty = Object.prototype.hasOwnProperty; - -var forEachArray = function forEachArray(array, iterator, receiver) { - for (var i = 0, len = array.length; i < len; i++) { - if (hasOwnProperty.call(array, i)) { - if (receiver == null) { - iterator(array[i], i, array); - } else { - iterator.call(receiver, array[i], i, array); - } - } - } -}; - -var forEachString = function forEachString(string, iterator, receiver) { - for (var i = 0, len = string.length; i < len; i++) { - // no such thing as a sparse string. - if (receiver == null) { - iterator(string.charAt(i), i, string); - } else { - iterator.call(receiver, string.charAt(i), i, string); - } - } -}; - -var forEachObject = function forEachObject(object, iterator, receiver) { - for (var k in object) { - if (hasOwnProperty.call(object, k)) { - if (receiver == null) { - iterator(object[k], k, object); - } else { - iterator.call(receiver, object[k], k, object); - } - } - } -}; - -var forEach = function forEach(list, iterator, thisArg) { - if (!isCallable(iterator)) { - throw new TypeError('iterator must be a function'); - } - - var receiver; - if (arguments.length >= 3) { - receiver = thisArg; - } - - if (toStr.call(list) === '[object Array]') { - forEachArray(list, iterator, receiver); - } else if (typeof list === 'string') { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } -}; - -module.exports = forEach; - - -/***/ }), - -/***/ 648: -/***/ ((module) => { - -"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; -}; - - -/***/ }), - -/***/ 612: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var implementation = __webpack_require__(648); - -module.exports = Function.prototype.bind || implementation; - - -/***/ }), - -/***/ 210: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var undefined; - -var $SyntaxError = SyntaxError; -var $Function = Function; -var $TypeError = TypeError; - -// eslint-disable-next-line consistent-return -var getEvalledConstructor = function (expressionSyntax) { - try { - 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 = __webpack_require__(405)(); - -var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto - -var needsEval = {}; - -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%': needsEval, - '%AsyncGenerator%': needsEval, - '%AsyncGeneratorFunction%': needsEval, - '%AsyncIteratorPrototype%': needsEval, - '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, - '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, - '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, - '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, - '%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%': needsEval, - '%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 -}; - -try { - null.error; // eslint-disable-line no-unused-expressions -} catch (e) { - // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 - var errorProto = getProto(getProto(e)); - INTRINSICS['%Error.prototype%'] = errorProto; -} - -var doEval = function doEval(name) { - var value; - if (name === '%AsyncFunction%') { - value = getEvalledConstructor('async function () {}'); - } else if (name === '%GeneratorFunction%') { - value = getEvalledConstructor('function* () {}'); - } else if (name === '%AsyncGeneratorFunction%') { - value = getEvalledConstructor('async function* () {}'); - } else if (name === '%AsyncGenerator%') { - var fn = doEval('%AsyncGeneratorFunction%'); - if (fn) { - value = fn.prototype; - } - } else if (name === '%AsyncIteratorPrototype%') { - var gen = doEval('%AsyncGenerator%'); - if (gen) { - value = getProto(gen.prototype); - } - } - - INTRINSICS[name] = value; - - return value; -}; - -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 = __webpack_require__(612); -var hasOwn = __webpack_require__(642); -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); -var $strSlice = bind.call(Function.call, String.prototype.slice); -var $exec = bind.call(Function.call, RegExp.prototype.exec); - -/* 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 first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === '%' && last !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); - } else if (last === '%' && first !== '%') { - throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); - } - 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 (value === needsEval) { - value = doEval(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'); - } - - if ($exec(/^%?[^%]*%?$/, name) === null) { - throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); - } - 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]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ( - ( - (first === '"' || first === "'" || first === '`') - || (last === '"' || last === "'" || last === '`') - ) - && first !== last - ) { - throw new $SyntaxError('property names with quotes must have matching quotes'); - } - if (part === 'constructor' || !isOwn) { - skipFurtherCaching = true; - } - - intrinsicBaseName += '.' + part; - intrinsicRealName = '%' + intrinsicBaseName + '%'; - - if (hasOwn(INTRINSICS, intrinsicRealName)) { - value = INTRINSICS[intrinsicRealName]; - } else if (value != null) { - if (!(part in value)) { - if (!allowMissing) { - throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); - } - return void undefined; - } - if ($gOPD && (i + 1) >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - - // 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; -}; - - -/***/ }), - -/***/ 296: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var GetIntrinsic = __webpack_require__(210); - -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); - -if ($gOPD) { - try { - $gOPD([], 'length'); - } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; - } -} - -module.exports = $gOPD; - - -/***/ }), - -/***/ 405: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var origSymbol = typeof Symbol !== 'undefined' && Symbol; -var hasSymbolSham = __webpack_require__(419); - -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(); -}; - - -/***/ }), - -/***/ 419: -/***/ ((module) => { - -"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, no-unreachable-loop - 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; -}; - - -/***/ }), - -/***/ 410: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var hasSymbols = __webpack_require__(419); - -module.exports = function hasToStringTagShams() { - return hasSymbols() && !!Symbol.toStringTag; -}; - - -/***/ }), - -/***/ 642: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var bind = __webpack_require__(612); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); - - -/***/ }), - -/***/ 717: -/***/ ((module) => { - -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} - - -/***/ }), - -/***/ 584: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var hasToStringTag = __webpack_require__(410)(); -var callBound = __webpack_require__(924); - -var $toString = callBound('Object.prototype.toString'); - -var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { - return false; - } - return $toString(value) === '[object Arguments]'; -}; - -var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && - typeof value === 'object' && - typeof value.length === 'number' && - value.length >= 0 && - $toString(value) !== '[object Array]' && - $toString(value.callee) === '[object Function]'; -}; - -var supportsStandardArguments = (function () { - return isStandardArguments(arguments); -}()); - -isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests - -module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - - -/***/ }), - -/***/ 320: -/***/ ((module) => { - -"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 objectClass = '[object Object]'; -var fnClass = '[object Function]'; -var genClass = '[object GeneratorFunction]'; -var ddaClass = '[object HTMLAllCollection]'; // IE 11 -var ddaClass2 = '[object HTML document.all class]'; -var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` - -var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing - -var isDDA = function isDocumentDotAll() { return false; }; -if (typeof document === 'object') { - // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly - var all = document.all; - if (toStr.call(all) === toStr.call(document.all)) { - isDDA = function isDocumentDotAll(value) { - /* globals document: false */ - // in IE 6-8, typeof document.all is "object" and it's truthy - if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) { - try { - var str = toStr.call(value); - return ( - str === ddaClass - || str === ddaClass2 - || str === ddaClass3 // opera 12.16 - || str === objectClass // IE 6-8 - ) && value('') == null; // eslint-disable-line eqeqeq - } catch (e) { /**/ } - } - return false; - }; - } -} - -module.exports = reflectApply - ? function isCallable(value) { - if (isDDA(value)) { return true; } - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) { return false; } - } - return !isES6ClassFn(value) && tryFunctionObject(value); - } - : function isCallable(value) { - if (isDDA(value)) { return true; } - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - if (hasToStringTag) { return tryFunctionObject(value); } - if (isES6ClassFn(value)) { return false; } - var strClass = toStr.call(value); - if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; } - return tryFunctionObject(value); - }; - - -/***/ }), - -/***/ 662: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var toStr = Object.prototype.toString; -var fnToStr = Function.prototype.toString; -var isFnRegex = /^\s*(?:function)?\*/; -var hasToStringTag = __webpack_require__(410)(); -var getProto = Object.getPrototypeOf; -var getGeneratorFunc = function () { // eslint-disable-line consistent-return - if (!hasToStringTag) { - return false; - } - try { - return Function('return function*() {}')(); - } catch (e) { - } -}; -var GeneratorFunction; - -module.exports = function isGeneratorFunction(fn) { - if (typeof fn !== 'function') { - return false; - } - if (isFnRegex.test(fnToStr.call(fn))) { - return true; - } - if (!hasToStringTag) { - var str = toStr.call(fn); - return str === '[object GeneratorFunction]'; - } - if (!getProto) { - return false; - } - if (typeof GeneratorFunction === 'undefined') { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false; - } - return getProto(fn) === GeneratorFunction; -}; - - -/***/ }), - -/***/ 692: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var forEach = __webpack_require__(29); -var availableTypedArrays = __webpack_require__(83); -var callBound = __webpack_require__(924); - -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = __webpack_require__(410)(); -var gOPD = __webpack_require__(296); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; -var typedArrays = availableTypedArrays(); - -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; -}; -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var anyTrue = false; - forEach(toStrTags, function (getter, typedArray) { - if (!anyTrue) { - try { - anyTrue = getter.call(value) === typedArray; - } catch (e) { /**/ } - } - }); - return anyTrue; -}; - -module.exports = function isTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { - var tag = $slice($toString(value), 8, -1); - return $indexOf(typedArrays, tag) > -1; - } - if (!gOPD) { return false; } - return tryTypedArrays(value); -}; - - -/***/ }), - -/***/ 155: -/***/ ((module) => { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - -/***/ }), - -/***/ 384: -/***/ ((module) => { - -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} - -/***/ }), - -/***/ 955: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; -// Currently in sync with Node.js lib/internal/util/types.js -// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 - - - -var isArgumentsObject = __webpack_require__(584); -var isGeneratorFunction = __webpack_require__(662); -var whichTypedArray = __webpack_require__(430); -var isTypedArray = __webpack_require__(692); - -function uncurryThis(f) { - return f.call.bind(f); -} - -var BigIntSupported = typeof BigInt !== 'undefined'; -var SymbolSupported = typeof Symbol !== 'undefined'; - -var ObjectToString = uncurryThis(Object.prototype.toString); - -var numberValue = uncurryThis(Number.prototype.valueOf); -var stringValue = uncurryThis(String.prototype.valueOf); -var booleanValue = uncurryThis(Boolean.prototype.valueOf); - -if (BigIntSupported) { - var bigIntValue = uncurryThis(BigInt.prototype.valueOf); -} - -if (SymbolSupported) { - var symbolValue = uncurryThis(Symbol.prototype.valueOf); -} - -function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== 'object') { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch(e) { - return false; - } -} - -exports.isArgumentsObject = isArgumentsObject; -exports.isGeneratorFunction = isGeneratorFunction; -exports.isTypedArray = isTypedArray; - -// Taken from here and modified for better browser support -// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js -function isPromise(input) { - return ( - ( - typeof Promise !== 'undefined' && - input instanceof Promise - ) || - ( - input !== null && - typeof input === 'object' && - typeof input.then === 'function' && - typeof input.catch === 'function' - ) - ); -} -exports.isPromise = isPromise; - -function isArrayBufferView(value) { - if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - - return ( - isTypedArray(value) || - isDataView(value) - ); -} -exports.isArrayBufferView = isArrayBufferView; - - -function isUint8Array(value) { - return whichTypedArray(value) === 'Uint8Array'; -} -exports.isUint8Array = isUint8Array; - -function isUint8ClampedArray(value) { - return whichTypedArray(value) === 'Uint8ClampedArray'; -} -exports.isUint8ClampedArray = isUint8ClampedArray; - -function isUint16Array(value) { - return whichTypedArray(value) === 'Uint16Array'; -} -exports.isUint16Array = isUint16Array; - -function isUint32Array(value) { - return whichTypedArray(value) === 'Uint32Array'; -} -exports.isUint32Array = isUint32Array; - -function isInt8Array(value) { - return whichTypedArray(value) === 'Int8Array'; -} -exports.isInt8Array = isInt8Array; - -function isInt16Array(value) { - return whichTypedArray(value) === 'Int16Array'; -} -exports.isInt16Array = isInt16Array; - -function isInt32Array(value) { - return whichTypedArray(value) === 'Int32Array'; -} -exports.isInt32Array = isInt32Array; - -function isFloat32Array(value) { - return whichTypedArray(value) === 'Float32Array'; -} -exports.isFloat32Array = isFloat32Array; - -function isFloat64Array(value) { - return whichTypedArray(value) === 'Float64Array'; -} -exports.isFloat64Array = isFloat64Array; - -function isBigInt64Array(value) { - return whichTypedArray(value) === 'BigInt64Array'; -} -exports.isBigInt64Array = isBigInt64Array; - -function isBigUint64Array(value) { - return whichTypedArray(value) === 'BigUint64Array'; -} -exports.isBigUint64Array = isBigUint64Array; - -function isMapToString(value) { - return ObjectToString(value) === '[object Map]'; -} -isMapToString.working = ( - typeof Map !== 'undefined' && - isMapToString(new Map()) -); - -function isMap(value) { - if (typeof Map === 'undefined') { - return false; - } - - return isMapToString.working - ? isMapToString(value) - : value instanceof Map; -} -exports.isMap = isMap; - -function isSetToString(value) { - return ObjectToString(value) === '[object Set]'; -} -isSetToString.working = ( - typeof Set !== 'undefined' && - isSetToString(new Set()) -); -function isSet(value) { - if (typeof Set === 'undefined') { - return false; - } - - return isSetToString.working - ? isSetToString(value) - : value instanceof Set; -} -exports.isSet = isSet; - -function isWeakMapToString(value) { - return ObjectToString(value) === '[object WeakMap]'; -} -isWeakMapToString.working = ( - typeof WeakMap !== 'undefined' && - isWeakMapToString(new WeakMap()) -); -function isWeakMap(value) { - if (typeof WeakMap === 'undefined') { - return false; - } - - return isWeakMapToString.working - ? isWeakMapToString(value) - : value instanceof WeakMap; -} -exports.isWeakMap = isWeakMap; - -function isWeakSetToString(value) { - return ObjectToString(value) === '[object WeakSet]'; -} -isWeakSetToString.working = ( - typeof WeakSet !== 'undefined' && - isWeakSetToString(new WeakSet()) -); -function isWeakSet(value) { - return isWeakSetToString(value); -} -exports.isWeakSet = isWeakSet; - -function isArrayBufferToString(value) { - return ObjectToString(value) === '[object ArrayBuffer]'; -} -isArrayBufferToString.working = ( - typeof ArrayBuffer !== 'undefined' && - isArrayBufferToString(new ArrayBuffer()) -); -function isArrayBuffer(value) { - if (typeof ArrayBuffer === 'undefined') { - return false; - } - - return isArrayBufferToString.working - ? isArrayBufferToString(value) - : value instanceof ArrayBuffer; -} -exports.isArrayBuffer = isArrayBuffer; - -function isDataViewToString(value) { - return ObjectToString(value) === '[object DataView]'; -} -isDataViewToString.working = ( - typeof ArrayBuffer !== 'undefined' && - typeof DataView !== 'undefined' && - isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) -); -function isDataView(value) { - if (typeof DataView === 'undefined') { - return false; - } - - return isDataViewToString.working - ? isDataViewToString(value) - : value instanceof DataView; -} -exports.isDataView = isDataView; - -// Store a copy of SharedArrayBuffer in case it's deleted elsewhere -var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined; -function isSharedArrayBufferToString(value) { - return ObjectToString(value) === '[object SharedArrayBuffer]'; -} -function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === 'undefined') { - return false; - } - - if (typeof isSharedArrayBufferToString.working === 'undefined') { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); - } - - return isSharedArrayBufferToString.working - ? isSharedArrayBufferToString(value) - : value instanceof SharedArrayBufferCopy; -} -exports.isSharedArrayBuffer = isSharedArrayBuffer; - -function isAsyncFunction(value) { - return ObjectToString(value) === '[object AsyncFunction]'; -} -exports.isAsyncFunction = isAsyncFunction; - -function isMapIterator(value) { - return ObjectToString(value) === '[object Map Iterator]'; -} -exports.isMapIterator = isMapIterator; - -function isSetIterator(value) { - return ObjectToString(value) === '[object Set Iterator]'; -} -exports.isSetIterator = isSetIterator; - -function isGeneratorObject(value) { - return ObjectToString(value) === '[object Generator]'; -} -exports.isGeneratorObject = isGeneratorObject; - -function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === '[object WebAssembly.Module]'; -} -exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - -function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); -} -exports.isNumberObject = isNumberObject; - -function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); -} -exports.isStringObject = isStringObject; - -function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); -} -exports.isBooleanObject = isBooleanObject; - -function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); -} -exports.isBigIntObject = isBigIntObject; - -function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); -} -exports.isSymbolObject = isSymbolObject; - -function isBoxedPrimitive(value) { - return ( - isNumberObject(value) || - isStringObject(value) || - isBooleanObject(value) || - isBigIntObject(value) || - isSymbolObject(value) - ); -} -exports.isBoxedPrimitive = isBoxedPrimitive; - -function isAnyArrayBuffer(value) { - return typeof Uint8Array !== 'undefined' && ( - isArrayBuffer(value) || - isSharedArrayBuffer(value) - ); -} -exports.isAnyArrayBuffer = isAnyArrayBuffer; - -['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + ' is not supported in userland'); - } - }); -}); - - -/***/ }), - -/***/ 539: -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -/* provided dependency */ var process = __webpack_require__(155); -// 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 getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || - function getOwnPropertyDescriptors(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - if (typeof process !== 'undefined' && process.noDeprecation === true) { - return fn; - } - - // Allow for deprecating things in the process of starting up. - if (typeof process === 'undefined') { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnvRegex = /^$/; - -if (process.env.NODE_DEBUG) { - var debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') - .replace(/\*/g, '.*') - .replace(/,/g, '$|^') - .toUpperCase(); - debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); -} -exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').slice(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.slice(1, -1); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -exports.types = __webpack_require__(955); - -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; -exports.types.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; -exports.types.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; -exports.types.isNativeError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = __webpack_require__(384); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = __webpack_require__(717); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; - -exports.promisify = function promisify(original) { - if (typeof original !== 'function') - throw new TypeError('The "original" argument must be of type Function'); - - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== 'function') { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, enumerable: false, writable: false, configurable: true - }); - return fn; - } - - function fn() { - var promiseResolve, promiseReject; - var promise = new Promise(function (resolve, reject) { - promiseResolve = resolve; - promiseReject = reject; - }); - - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - args.push(function (err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); - } - }); - - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - - return promise; - } - - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - - if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, enumerable: false, writable: false, configurable: true - }); - return Object.defineProperties( - fn, - getOwnPropertyDescriptors(original) - ); -} - -exports.promisify.custom = kCustomPromisifiedSymbol - -function callbackifyOnRejected(reason, cb) { - // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). - // Because `null` is a special error value in callbacks which means "no error - // occurred", we error-wrap so the callback consumer can distinguish between - // "the promise rejected with null" or "the promise fulfilled with undefined". - if (!reason) { - var newReason = new Error('Promise was rejected with a falsy value'); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); -} - -function callbackify(original) { - if (typeof original !== 'function') { - throw new TypeError('The "original" argument must be of type Function'); - } - - // We DO NOT return the promise as it gives the user a false sense that - // the promise is actually somehow related to the callback's execution - // and that the callback throwing will reject the promise. - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - - var maybeCb = args.pop(); - if (typeof maybeCb !== 'function') { - throw new TypeError('The last argument must be of type Function'); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - // In true node style we process the callback on `nextTick` with all the - // implications (stack, `uncaughtException`, `async_hooks`) - original.apply(this, args) - .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) }, - function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); - } - - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, - getOwnPropertyDescriptors(original)); - return callbackified; -} -exports.callbackify = callbackify; - - -/***/ }), - -/***/ 430: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var forEach = __webpack_require__(29); -var availableTypedArrays = __webpack_require__(83); -var callBound = __webpack_require__(924); -var gOPD = __webpack_require__(296); - -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = __webpack_require__(410)(); - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; -var typedArrays = availableTypedArrays(); - -var $slice = callBound('String.prototype.slice'); -var toStrTags = {}; -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - if (typeof g[typedArray] === 'function') { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; - } - } - }); -} - -var tryTypedArrays = function tryAllTypedArrays(value) { - var foundName = false; - forEach(toStrTags, function (getter, typedArray) { - if (!foundName) { - try { - var name = getter.call(value); - if (name === typedArray) { - foundName = name; - } - } catch (e) {} - } - }); - return foundName; -}; - -var isTypedArray = __webpack_require__(692); - -module.exports = function whichTypedArray(value) { - if (!isTypedArray(value)) { return false; } - if (!hasToStringTag || !(Symbol.toStringTag in value)) { return $slice($toString(value), 8, -1); } - return tryTypedArrays(value); -}; - - -/***/ }), - -/***/ 533: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -const { callbackify, promisify } = __webpack_require__(539) -const { promises: fs, constants: fsConstants } = __webpack_require__(115) - -const waterfallAsync = async tasks => { - for (const task of tasks) { - await promisify(task)() - } -} - -const waterfall = callbackify(waterfallAsync) - -const eachAsync = async (arr, iterator) => Promise.all(arr.map(el => promisify(iterator)(el))) - -const each = callbackify(eachAsync) - -const apply = function (fn) { - const args = Array.prototype.slice.call(arguments, 1) - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ) - } -} - -const whilstAsync = async (test, fn) => { - while (test()) await promisify(fn)() -} - -const whilst = callbackify(whilstAsync) - -const wait = delay => new Promise(resolve => { - setTimeout(resolve, delay) -}) -const exists = path => fs.access(path, fsConstants.FS_OK).then(() => true, () => false) - -// eslint-disable-next-line n/no-callback-literal -const existsCallback = (path, callback) => fs.access(path, fsConstants.FS_OK).then(() => callback(true), () => callback(false)) - -module.exports.whilst = whilst -module.exports.apply = apply -module.exports.waterfall = waterfall -module.exports.each = each -module.exports.wait = wait -module.exports.exists = exists -module.exports.existsCallback = existsCallback -module.exports.callbackify = callbackify - - -/***/ }), - -/***/ 115: -/***/ (() => { - -/* (ignored) */ - -/***/ }), - -/***/ 83: -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var possibleNames = [ - 'BigInt64Array', - 'BigUint64Array', - 'Float32Array', - 'Float64Array', - 'Int16Array', - 'Int32Array', - 'Int8Array', - 'Uint16Array', - 'Uint32Array', - 'Uint8Array', - 'Uint8ClampedArray' -]; - -var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; - -module.exports = function availableTypedArrays() { - var out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - out[out.length] = possibleNames[i]; - } - } - return out; -}; - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/global */ -/******/ (() => { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ })(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module used 'module' so it can't be inlined -/******/ var __webpack_exports__ = __webpack_require__(533); -/******/ window.testUtils = __webpack_exports__; -/******/ -/******/ })() -; \ No newline at end of file diff --git a/node_modules/@seald-io/nedb/browser-version/out/testutils.min.js b/node_modules/@seald-io/nedb/browser-version/out/testutils.min.js deleted file mode 100644 index c4389f7..0000000 --- a/node_modules/@seald-io/nedb/browser-version/out/testutils.min.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var t={924:(t,r,e)=>{"use strict";var n=e(210),o=e(559),i=o(n("String.prototype.indexOf"));t.exports=function(t,r){var e=n(t,!!r);return"function"==typeof e&&i(t,".prototype.")>-1?o(e):e}},559:(t,r,e)=>{"use strict";var n=e(612),o=e(210),i=o("%Function.prototype.apply%"),a=o("%Function.prototype.call%"),u=o("%Reflect.apply%",!0)||n.call(a,i),c=o("%Object.getOwnPropertyDescriptor%",!0),p=o("%Object.defineProperty%",!0),f=o("%Math.max%");if(p)try{p({},"a",{value:1})}catch(t){p=null}t.exports=function(t){var r=u(n,a,arguments);return c&&p&&c(r,"length").configurable&&p(r,"length",{value:1+f(0,t.length-(arguments.length-1))}),r};var y=function(){return u(n,i,arguments)};p?p(t.exports,"apply",{value:y}):t.exports.apply=y},29:(t,r,e)=>{"use strict";var n=e(320),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=function(t,r,e){for(var n=0,o=t.length;n=3&&(i=e),"[object Array]"===o.call(t)?a(t,r,i):"string"==typeof t?u(t,r,i):c(t,r,i)}},648:t=>{"use strict";var r="Function.prototype.bind called on incompatible ",e=Array.prototype.slice,n=Object.prototype.toString,o="[object Function]";t.exports=function(t){var i=this;if("function"!=typeof i||n.call(i)!==o)throw new TypeError(r+i);for(var a,u=e.call(arguments,1),c=Math.max(0,i.length-u.length),p=[],f=0;f{"use strict";var n=e(648);t.exports=Function.prototype.bind||n},210:(t,r,e)=>{"use strict";var n,o=SyntaxError,i=Function,a=TypeError,u=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(t){c=null}var p=function(){throw new a},f=c?function(){try{return p}catch(t){try{return c(arguments,"callee").get}catch(t){return p}}}():p,y=e(405)(),l=Object.getPrototypeOf||function(t){return t.__proto__},s={},g="undefined"==typeof Uint8Array?n:l(Uint8Array),d={"%AggregateError%":"undefined"==typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":y?l([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":s,"%AsyncGenerator%":s,"%AsyncGeneratorFunction%":s,"%AsyncIteratorPrototype%":s,"%Atomics%":"undefined"==typeof Atomics?n:Atomics,"%BigInt%":"undefined"==typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":s,"%Int8Array%":"undefined"==typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":y?l(l([][Symbol.iterator]())):n,"%JSON%":"object"==typeof JSON?JSON:n,"%Map%":"undefined"==typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&y?l((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?n:Promise,"%Proxy%":"undefined"==typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&y?l((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":y?l(""[Symbol.iterator]()):n,"%Symbol%":y?Symbol:n,"%SyntaxError%":o,"%ThrowTypeError%":f,"%TypedArray%":g,"%TypeError%":a,"%Uint8Array%":"undefined"==typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?n:WeakSet};try{null.error}catch(t){var b=l(l(t));d["%Error.prototype%"]=b}var h=function t(r){var e;if("%AsyncFunction%"===r)e=u("async function () {}");else if("%GeneratorFunction%"===r)e=u("function* () {}");else if("%AsyncGeneratorFunction%"===r)e=u("async function* () {}");else if("%AsyncGenerator%"===r){var n=t("%AsyncGeneratorFunction%");n&&(e=n.prototype)}else if("%AsyncIteratorPrototype%"===r){var o=t("%AsyncGenerator%");o&&(e=l(o.prototype))}return d[r]=e,e},m={"%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"]},A=e(612),v=e(642),w=A.call(Function.call,Array.prototype.concat),S=A.call(Function.apply,Array.prototype.splice),j=A.call(Function.call,String.prototype.replace),O=A.call(Function.call,String.prototype.slice),P=A.call(Function.call,RegExp.prototype.exec),x=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,E=/\\(\\)?/g,F=function(t){var r=O(t,0,1),e=O(t,-1);if("%"===r&&"%"!==e)throw new o("invalid intrinsic syntax, expected closing `%`");if("%"===e&&"%"!==r)throw new o("invalid intrinsic syntax, expected opening `%`");var n=[];return j(t,x,(function(t,r,e,o){n[n.length]=e?j(o,E,"$1"):r||t})),n},I=function(t,r){var e,n=t;if(v(m,n)&&(n="%"+(e=m[n])[0]+"%"),v(d,n)){var i=d[n];if(i===s&&(i=h(n)),void 0===i&&!r)throw new a("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:e,name:n,value:i}}throw new o("intrinsic "+t+" does not exist!")};t.exports=function(t,r){if("string"!=typeof t||0===t.length)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof r)throw new a('"allowMissing" argument must be a boolean');if(null===P(/^%?[^%]*%?$/,t))throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var e=F(t),n=e.length>0?e[0]:"",i=I("%"+n+"%",r),u=i.name,p=i.value,f=!1,y=i.alias;y&&(n=y[0],S(e,w([0,1],y)));for(var l=1,s=!0;l=e.length){var m=c(p,g);p=(s=!!m)&&"get"in m&&!("originalValue"in m.get)?m.get:p[g]}else s=v(p,g),p=p[g];s&&!f&&(d[u]=p)}}return p}},296:(t,r,e)=>{"use strict";var n=e(210)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(t){n=null}t.exports=n},405:(t,r,e)=>{"use strict";var n="undefined"!=typeof Symbol&&Symbol,o=e(419);t.exports=function(){return"function"==typeof n&&"function"==typeof Symbol&&"symbol"==typeof n("foo")&&"symbol"==typeof Symbol("bar")&&o()}},419:t=>{"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},r=Symbol("test"),e=Object(r);if("string"==typeof r)return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;for(r in t[r]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var n=Object.getOwnPropertySymbols(t);if(1!==n.length||n[0]!==r)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,r);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},410:(t,r,e)=>{"use strict";var n=e(419);t.exports=function(){return n()&&!!Symbol.toStringTag}},642:(t,r,e)=>{"use strict";var n=e(612);t.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},717:t=>{"function"==typeof Object.create?t.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,r){if(r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}}},584:(t,r,e)=>{"use strict";var n=e(410)(),o=e(924)("Object.prototype.toString"),i=function(t){return!(n&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===o(t)},a=function(t){return!!i(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==o(t)&&"[object Function]"===o(t.callee)},u=function(){return i(arguments)}();i.isLegacyArguments=a,t.exports=u?i:a},320:t=>{"use strict";var r,e,n=Function.prototype.toString,o="object"==typeof Reflect&&null!==Reflect&&Reflect.apply;if("function"==typeof o&&"function"==typeof Object.defineProperty)try{r=Object.defineProperty({},"length",{get:function(){throw e}}),e={},o((function(){throw 42}),null,r)}catch(t){t!==e&&(o=null)}else o=null;var i=/^\s*class\b/,a=function(t){try{var r=n.call(t);return i.test(r)}catch(t){return!1}},u=function(t){try{return!a(t)&&(n.call(t),!0)}catch(t){return!1}},c=Object.prototype.toString,p="function"==typeof Symbol&&!!Symbol.toStringTag,f=!(0 in[,]),y=function(){return!1};if("object"==typeof document){var l=document.all;c.call(l)===c.call(document.all)&&(y=function(t){if((f||!t)&&(void 0===t||"object"==typeof t))try{var r=c.call(t);return("[object HTMLAllCollection]"===r||"[object HTML document.all class]"===r||"[object HTMLCollection]"===r||"[object Object]"===r)&&null==t("")}catch(t){}return!1})}t.exports=o?function(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;try{o(t,null,r)}catch(t){if(t!==e)return!1}return!a(t)&&u(t)}:function(t){if(y(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(p)return u(t);if(a(t))return!1;var r=c.call(t);return!("[object Function]"!==r&&"[object GeneratorFunction]"!==r&&!/^\[object HTML/.test(r))&&u(t)}},662:(t,r,e)=>{"use strict";var n,o=Object.prototype.toString,i=Function.prototype.toString,a=/^\s*(?:function)?\*/,u=e(410)(),c=Object.getPrototypeOf;t.exports=function(t){if("function"!=typeof t)return!1;if(a.test(i.call(t)))return!0;if(!u)return"[object GeneratorFunction]"===o.call(t);if(!c)return!1;if(void 0===n){var r=function(){if(!u)return!1;try{return Function("return function*() {}")()}catch(t){}}();n=!!r&&c(r)}return c(t)===n}},692:(t,r,e)=>{"use strict";var n=e(29),o=e(83),i=e(924),a=i("Object.prototype.toString"),u=e(410)(),c=e(296),p="undefined"==typeof globalThis?e.g:globalThis,f=o(),y=i("Array.prototype.indexOf",!0)||function(t,r){for(var e=0;e-1}return!!c&&function(t){var r=!1;return n(s,(function(e,n){if(!r)try{r=e.call(t)===n}catch(t){}})),r}(t)}},155:t=>{var r,e,n=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{e="function"==typeof clearTimeout?clearTimeout:i}catch(t){e=i}}();var u,c=[],p=!1,f=-1;function y(){p&&u&&(p=!1,u.length?c=u.concat(c):f=-1,c.length&&l())}function l(){if(!p){var t=a(y);p=!0;for(var r=c.length;r;){for(u=c,c=[];++f1)for(var e=1;e{t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},955:(t,r,e)=>{"use strict";var n=e(584),o=e(662),i=e(430),a=e(692);function u(t){return t.call.bind(t)}var c="undefined"!=typeof BigInt,p="undefined"!=typeof Symbol,f=u(Object.prototype.toString),y=u(Number.prototype.valueOf),l=u(String.prototype.valueOf),s=u(Boolean.prototype.valueOf);if(c)var g=u(BigInt.prototype.valueOf);if(p)var d=u(Symbol.prototype.valueOf);function b(t,r){if("object"!=typeof t)return!1;try{return r(t),!0}catch(t){return!1}}function h(t){return"[object Map]"===f(t)}function m(t){return"[object Set]"===f(t)}function A(t){return"[object WeakMap]"===f(t)}function v(t){return"[object WeakSet]"===f(t)}function w(t){return"[object ArrayBuffer]"===f(t)}function S(t){return"undefined"!=typeof ArrayBuffer&&(w.working?w(t):t instanceof ArrayBuffer)}function j(t){return"[object DataView]"===f(t)}function O(t){return"undefined"!=typeof DataView&&(j.working?j(t):t instanceof DataView)}r.isArgumentsObject=n,r.isGeneratorFunction=o,r.isTypedArray=a,r.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},r.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):a(t)||O(t)},r.isUint8Array=function(t){return"Uint8Array"===i(t)},r.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===i(t)},r.isUint16Array=function(t){return"Uint16Array"===i(t)},r.isUint32Array=function(t){return"Uint32Array"===i(t)},r.isInt8Array=function(t){return"Int8Array"===i(t)},r.isInt16Array=function(t){return"Int16Array"===i(t)},r.isInt32Array=function(t){return"Int32Array"===i(t)},r.isFloat32Array=function(t){return"Float32Array"===i(t)},r.isFloat64Array=function(t){return"Float64Array"===i(t)},r.isBigInt64Array=function(t){return"BigInt64Array"===i(t)},r.isBigUint64Array=function(t){return"BigUint64Array"===i(t)},h.working="undefined"!=typeof Map&&h(new Map),r.isMap=function(t){return"undefined"!=typeof Map&&(h.working?h(t):t instanceof Map)},m.working="undefined"!=typeof Set&&m(new Set),r.isSet=function(t){return"undefined"!=typeof Set&&(m.working?m(t):t instanceof Set)},A.working="undefined"!=typeof WeakMap&&A(new WeakMap),r.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(A.working?A(t):t instanceof WeakMap)},v.working="undefined"!=typeof WeakSet&&v(new WeakSet),r.isWeakSet=function(t){return v(t)},w.working="undefined"!=typeof ArrayBuffer&&w(new ArrayBuffer),r.isArrayBuffer=S,j.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&j(new DataView(new ArrayBuffer(1),0,1)),r.isDataView=O;var P="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function x(t){return"[object SharedArrayBuffer]"===f(t)}function E(t){return void 0!==P&&(void 0===x.working&&(x.working=x(new P)),x.working?x(t):t instanceof P)}function F(t){return b(t,y)}function I(t){return b(t,l)}function T(t){return b(t,s)}function U(t){return c&&b(t,g)}function B(t){return p&&b(t,d)}r.isSharedArrayBuffer=E,r.isAsyncFunction=function(t){return"[object AsyncFunction]"===f(t)},r.isMapIterator=function(t){return"[object Map Iterator]"===f(t)},r.isSetIterator=function(t){return"[object Set Iterator]"===f(t)},r.isGeneratorObject=function(t){return"[object Generator]"===f(t)},r.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===f(t)},r.isNumberObject=F,r.isStringObject=I,r.isBooleanObject=T,r.isBigIntObject=U,r.isSymbolObject=B,r.isBoxedPrimitive=function(t){return F(t)||I(t)||T(t)||U(t)||B(t)},r.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(S(t)||E(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(r,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},539:(t,r,e)=>{var n=e(155),o=Object.getOwnPropertyDescriptors||function(t){for(var r=Object.keys(t),e={},n=0;n=o)return t;switch(t){case"%s":return String(n[e++]);case"%d":return Number(n[e++]);case"%j":try{return JSON.stringify(n[e++])}catch(t){return"[Circular]"}default:return t}})),u=n[e];e=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(e)?n.showHidden=e:e&&r._extend(n,e),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=f),l(n,t,n.depth)}function f(t,r){var e=p.styles[r];return e?"["+p.colors[e][0]+"m"+t+"["+p.colors[e][1]+"m":t}function y(t,r){return t}function l(t,e,n){if(t.customInspect&&e&&P(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var o=e.inspect(n,t);return A(o)||(o=l(t,o,n)),o}var i=function(t,r){if(v(r))return t.stylize("undefined","undefined");if(A(r)){var e="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(e,"string")}return m(r)?t.stylize(""+r,"number"):b(r)?t.stylize(""+r,"boolean"):h(r)?t.stylize("null","null"):void 0}(t,e);if(i)return i;var a=Object.keys(e),u=function(t){var r={};return t.forEach((function(t,e){r[t]=!0})),r}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),O(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return s(e);if(0===a.length){if(P(e)){var c=e.name?": "+e.name:"";return t.stylize("[Function"+c+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(j(e))return t.stylize(Date.prototype.toString.call(e),"date");if(O(e))return s(e)}var p,f="",y=!1,S=["{","}"];return d(e)&&(y=!0,S=["[","]"]),P(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),w(e)&&(f=" "+RegExp.prototype.toString.call(e)),j(e)&&(f=" "+Date.prototype.toUTCString.call(e)),O(e)&&(f=" "+s(e)),0!==a.length||y&&0!=e.length?n<0?w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),p=y?function(t,r,e,n,o){for(var i=[],a=0,u=r.length;a60?e[0]+(""===r?"":r+"\n ")+" "+t.join(",\n ")+" "+e[1]:e[0]+r+" "+t.join(", ")+" "+e[1]}(p,f,S)):S[0]+f+S[1]}function s(t){return"["+Error.prototype.toString.call(t)+"]"}function g(t,r,e,n,o,i){var a,u,c;if((c=Object.getOwnPropertyDescriptor(r,o)||{value:r[o]}).get?u=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(u=t.stylize("[Setter]","special")),I(n,o)||(a="["+o+"]"),u||(t.seen.indexOf(c.value)<0?(u=h(e)?l(t,c.value,null):l(t,c.value,e-1)).indexOf("\n")>-1&&(u=i?u.split("\n").map((function(t){return" "+t})).join("\n").slice(2):"\n"+u.split("\n").map((function(t){return" "+t})).join("\n")):u=t.stylize("[Circular]","special")),v(a)){if(i&&o.match(/^\d+$/))return u;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.slice(1,-1),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+u}function d(t){return Array.isArray(t)}function b(t){return"boolean"==typeof t}function h(t){return null===t}function m(t){return"number"==typeof t}function A(t){return"string"==typeof t}function v(t){return void 0===t}function w(t){return S(t)&&"[object RegExp]"===x(t)}function S(t){return"object"==typeof t&&null!==t}function j(t){return S(t)&&"[object Date]"===x(t)}function O(t){return S(t)&&("[object Error]"===x(t)||t instanceof Error)}function P(t){return"function"==typeof t}function x(t){return Object.prototype.toString.call(t)}function E(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(t=t.toUpperCase(),!a[t])if(u.test(t)){var e=n.pid;a[t]=function(){var n=r.format.apply(r,arguments);console.error("%s %d: %s",t,e,n)}}else a[t]=function(){};return a[t]},r.inspect=p,p.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},p.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.types=e(955),r.isArray=d,r.isBoolean=b,r.isNull=h,r.isNullOrUndefined=function(t){return null==t},r.isNumber=m,r.isString=A,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=v,r.isRegExp=w,r.types.isRegExp=w,r.isObject=S,r.isDate=j,r.types.isDate=j,r.isError=O,r.types.isNativeError=O,r.isFunction=P,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=e(384);var F=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(t,r){return Object.prototype.hasOwnProperty.call(t,r)}r.log=function(){var t,e;console.log("%s - %s",(e=[E((t=new Date).getHours()),E(t.getMinutes()),E(t.getSeconds())].join(":"),[t.getDate(),F[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=e(717),r._extend=function(t,r){if(!r||!S(r))return t;for(var e=Object.keys(r),n=e.length;n--;)t[e[n]]=r[e[n]];return t};var T="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function U(t,r){if(!t){var e=new Error("Promise was rejected with a falsy value");e.reason=t,t=e}return r(t)}r.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(T&&t[T]){var r;if("function"!=typeof(r=t[T]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,T,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var r,e,n=new Promise((function(t,n){r=t,e=n})),o=[],i=0;i{"use strict";var n=e(29),o=e(83),i=e(924),a=e(296),u=i("Object.prototype.toString"),c=e(410)(),p="undefined"==typeof globalThis?e.g:globalThis,f=o(),y=i("String.prototype.slice"),l={},s=Object.getPrototypeOf;c&&a&&s&&n(f,(function(t){if("function"==typeof p[t]){var r=new p[t];if(Symbol.toStringTag in r){var e=s(r),n=a(e,Symbol.toStringTag);if(!n){var o=s(e);n=a(o,Symbol.toStringTag)}l[t]=n.get}}}));var g=e(692);t.exports=function(t){return!!g(t)&&(c&&Symbol.toStringTag in t?function(t){var r=!1;return n(l,(function(e,n){if(!r)try{var o=e.call(t);o===n&&(r=o)}catch(t){}})),r}(t):y(u(t),8,-1))}},533:(t,r,e)=>{const{callbackify:n,promisify:o}=e(539),{promises:i,constants:a}=e(115),u=n((async t=>{for(const r of t)await o(r)()})),c=n((async(t,r)=>Promise.all(t.map((t=>o(r)(t)))))),p=n((async(t,r)=>{for(;t();)await o(r)()}));t.exports.whilst=p,t.exports.apply=function(t){const r=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,r.concat(Array.prototype.slice.call(arguments)))}},t.exports.waterfall=u,t.exports.each=c,t.exports.wait=t=>new Promise((r=>{setTimeout(r,t)})),t.exports.exists=t=>i.access(t,a.FS_OK).then((()=>!0),(()=>!1)),t.exports.existsCallback=(t,r)=>i.access(t,a.FS_OK).then((()=>r(!0)),(()=>r(!1))),t.exports.callbackify=n},115:()=>{},83:(t,r,e)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],o="undefined"==typeof globalThis?e.g:globalThis;t.exports=function(){for(var t=[],r=0;r -// Mehdi Kouhen -// Stefan Steinhart -// Anthony Nichols -// Alejandro Fernandez Haro -// Pierre de la Martinière -// TypeScript Version: 4.9 - -/// - -import { EventEmitter } from "events"; - -export default Nedb; - -export type Document = Schema & { - _id: string; -}; - -declare class Nedb> extends EventEmitter { - constructor(pathOrOptions?: string | Nedb.DataStoreOptions); - - persistence: Nedb.Persistence; - - autoloadPromise: Promise | null; - - loadDatabase(callback?: (err: Error | null) => void): void; - - loadDatabaseAsync(): Promise; - - dropDatabase(callback?: (err: Error | null) => void): void; - - dropDatabaseAsync(): Promise; - - compactDatafile(callback?: (err: Error | null) => void): void; - - compactDatafileAsync(): Promise; - - setAutocompactionInterval(interval: number): void; - - stopAutocompaction(): void; - - getAllData(): Document[]; - - ensureIndex( - options: Nedb.EnsureIndexOptions, - callback?: (err: Error | null) => void - ): void; - - ensureIndexAsync(options: Nedb.EnsureIndexOptions): Promise; - - removeIndex(fieldName: string | string[], callback?: (err: Error | null) => void): void; - - removeIndexAsync(fieldName: string | string[]): Promise; - - insert( - newDoc: T, - callback?: (err: Error | null, document: Document) => void - ): void; - insert( - newDocs: T[], - callback?: (err: Error | null, documents: Document[]) => void - ): void; - - insertAsync(newDoc: T): Promise>; - insertAsync(newDocs: T[]): Promise[]>; - - count(query: any, callback: (err: Error | null, n: number) => void): void; - count(query: any): Nedb.CursorCount; - - countAsync(query: any): Nedb.Cursor; - - find( - query: any, - projection: any, - callback?: (err: Error | null, documents: Document[]) => void - ): void; - find( - query: any, - projection?: any - ): Nedb.Cursor; - find( - query: any, - callback: (err: Error | null, documents: Document[]) => void - ): void; - - findAsync( - query: any, - projection?: any - ): Nedb.Cursor; - - findOne( - query: any, - projection: any, - callback: (err: Error | null, document: Document) => void - ): void; - findOne( - query: any, - callback: (err: Error | null, document: Document) => void - ): void; - - findOneAsync( - query: any, - projection?: any - ): Nedb.Cursor; - - update( - query: any, - updateQuery: any, - options?: O, - callback?: ( - err: Error | null, - numberOfUpdated: number, - affectedDocuments: O['returnUpdatedDocs'] extends true ? O['multi'] extends true ? Document[] | null : Document | null : null, - upsert: boolean | null - ) => void - ): void; - - updateAsync( - query: any, - updateQuery: any, - options?: O - ): Promise<{ - numAffected: number; - affectedDocuments: O['returnUpdatedDocs'] extends true ? O['multi'] extends true ? Document[] | null : Document | null : null; - upsert: boolean; - }>; - - remove( - query: any, - options: Nedb.RemoveOptions, - callback?: (err: Error | null, n: number) => void - ): void; - remove(query: any, callback?: (err: Error | null, n: number) => void): void; - - removeAsync(query: any, options: Nedb.RemoveOptions): Promise; - - addListener(event: "compaction.done", listener: () => void): this; - on(event: "compaction.done", listener: () => void): this; - once(event: "compaction.done", listener: () => void): this; - prependListener(event: "compaction.done", listener: () => void): this; - prependOnceListener(event: "compaction.done", listener: () => void): this; - removeListener(event: "compaction.done", listener: () => void): this; - off(event: "compaction.done", listener: () => void): this; - listeners(event: "compaction.done"): Array<() => void>; - rawListeners(event: "compaction.done"): Array<() => void>; - listenerCount(type: "compaction.done"): number; -} - -declare namespace Nedb { - interface Cursor extends Promise> { - sort(query: any): Cursor; - skip(n: number): Cursor; - limit(n: number): Cursor; - projection(query: any): Cursor; - exec(callback: (err: Error | null, documents: Document[]) => void): void; - execAsync(): Promise>; - } - - interface CursorCount { - exec(callback: (err: Error | null, count: number) => void): void; - } - - interface DataStoreOptions { - filename?: string; - timestampData?: boolean; - inMemoryOnly?: boolean; - autoload?: boolean; - onload?(error: Error | null): any; - beforeDeserialization?(line: string): string; - afterSerialization?(line: string): string; - corruptAlertThreshold?: number; - compareStrings?(a: string, b: string): number; - modes?: { fileMode: number; dirMode: number }; - testSerializationHooks?: boolean; - } - - interface UpdateOptions { - multi?: boolean; - upsert?: boolean; - returnUpdatedDocs?: boolean; - } - - interface RemoveOptions { - multi?: boolean; - } - - interface EnsureIndexOptions { - fieldName: string | string[]; - unique?: boolean; - sparse?: boolean; - expireAfterSeconds?: number; - } - - interface Persistence { - /** @deprecated */ - compactDatafile(): void; - /** @deprecated */ - compactDatafileAsync(): Promise; - /** @deprecated */ - setAutocompactionInterval(interval: number): void; - /** @deprecated */ - stopAutocompaction(): void; - } -} diff --git a/node_modules/@seald-io/nedb/index.js b/node_modules/@seald-io/nedb/index.js deleted file mode 100755 index e6b9e6c..0000000 --- a/node_modules/@seald-io/nedb/index.js +++ /dev/null @@ -1,3 +0,0 @@ -const Datastore = require('./lib/datastore') - -module.exports = Datastore diff --git a/node_modules/@seald-io/nedb/lib/byline.js b/node_modules/@seald-io/nedb/lib/byline.js deleted file mode 100644 index c366751..0000000 --- a/node_modules/@seald-io/nedb/lib/byline.js +++ /dev/null @@ -1,118 +0,0 @@ -// Forked from https://github.com/jahewson/node-byline - -// Copyright (C) 2011-2015 John Hewson -// -// 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. -/** - * @module byline - * @private - */ -const stream = require('stream') -const timers = require('timers') -const { Buffer } = require('buffer') - -const createLineStream = (readStream, options) => { - if (!readStream) throw new Error('expected readStream') - if (!readStream.readable) throw new Error('readStream must be readable') - const ls = new LineStream(options) - readStream.pipe(ls) - return ls -} - -/** - * Fork from {@link https://github.com/jahewson/node-byline}. - * @see https://github.com/jahewson/node-byline - * @alias module:byline.LineStream - * @private - */ -class LineStream extends stream.Transform { - constructor (options) { - super(options) - options = options || {} - - // use objectMode to stop the output from being buffered - // which re-concatanates the lines, just without newlines. - this._readableState.objectMode = true - this._lineBuffer = [] - this._keepEmptyLines = options.keepEmptyLines || false - this._lastChunkEndedWithCR = false - - // take the source's encoding if we don't have one - this.once('pipe', src => { - if (!this.encoding && src instanceof stream.Readable) this.encoding = src._readableState.encoding // but we can't do this for old-style streams - }) - } - - _transform (chunk, encoding, done) { - // decode binary chunks as UTF-8 - encoding = encoding || 'utf8' - - if (Buffer.isBuffer(chunk)) { - if (encoding === 'buffer') { - chunk = chunk.toString() // utf8 - encoding = 'utf8' - } else chunk = chunk.toString(encoding) - } - this._chunkEncoding = encoding - - // see: http://www.unicode.org/reports/tr18/#Line_Boundaries - const lines = chunk.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g) - - // don't split CRLF which spans chunks - if (this._lastChunkEndedWithCR && chunk[0] === '\n') lines.shift() - - if (this._lineBuffer.length > 0) { - this._lineBuffer[this._lineBuffer.length - 1] += lines[0] - lines.shift() - } - - this._lastChunkEndedWithCR = chunk[chunk.length - 1] === '\r' - this._lineBuffer = this._lineBuffer.concat(lines) - this._pushBuffer(encoding, 1, done) - } - - _pushBuffer (encoding, keep, done) { - // always buffer the last (possibly partial) line - while (this._lineBuffer.length > keep) { - const line = this._lineBuffer.shift() - // skip empty lines - if (this._keepEmptyLines || line.length > 0) { - if (!this.push(this._reencode(line, encoding))) { - // when the high-water mark is reached, defer pushes until the next tick - timers.setImmediate(() => { this._pushBuffer(encoding, keep, done) }) - return - } - } - } - done() - } - - _flush (done) { - this._pushBuffer(this._chunkEncoding, 0, done) - } - - // see Readable::push - _reencode (line, chunkEncoding) { - if (this.encoding && this.encoding !== chunkEncoding) return Buffer.from(line, chunkEncoding).toString(this.encoding) - else if (this.encoding) return line // this should be the most common case, i.e. we're using an encoded source stream - else return Buffer.from(line, chunkEncoding) - } -} - -module.exports = createLineStream diff --git a/node_modules/@seald-io/nedb/lib/cursor.js b/node_modules/@seald-io/nedb/lib/cursor.js deleted file mode 100755 index f7cb083..0000000 --- a/node_modules/@seald-io/nedb/lib/cursor.js +++ /dev/null @@ -1,250 +0,0 @@ -const model = require('./model.js') -const { callbackify } = require('util') - -/** - * Has a callback - * @callback Cursor~mapFn - * @param {document[]} res - * @return {*|Promise<*>} - */ - -/** - * Manage access to data, be it to find, update or remove it. - * - * It extends `Promise` so that its methods (which return `this`) are chainable & awaitable. - * @extends Promise - */ -class Cursor { - /** - * Create a new cursor for this collection. - * @param {Datastore} db - The datastore this cursor is bound to - * @param {query} query - The query this cursor will operate on - * @param {Cursor~mapFn} [mapFn] - Handler to be executed after cursor has found the results and before the callback passed to find/findOne/update/remove - */ - constructor (db, query, mapFn) { - /** - * @protected - * @type {Datastore} - */ - this.db = db - /** - * @protected - * @type {query} - */ - this.query = query || {} - /** - * The handler to be executed after cursor has found the results. - * @type {Cursor~mapFn} - * @protected - */ - if (mapFn) this.mapFn = mapFn - /** - * @see Cursor#limit - * @type {undefined|number} - * @private - */ - this._limit = undefined - /** - * @see Cursor#skip - * @type {undefined|number} - * @private - */ - this._skip = undefined - /** - * @see Cursor#sort - * @type {undefined|Object.} - * @private - */ - this._sort = undefined - /** - * @see Cursor#projection - * @type {undefined|Object.} - * @private - */ - this._projection = undefined - } - - /** - * Set a limit to the number of results for the given Cursor. - * @param {Number} limit - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - limit (limit) { - this._limit = limit - return this - } - - /** - * Skip a number of results for the given Cursor. - * @param {Number} skip - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - skip (skip) { - this._skip = skip - return this - } - - /** - * Sort results of the query for the given Cursor. - * @param {Object.} sortQuery - sortQuery is { field: order }, field can use the dot-notation, order is 1 for ascending and -1 for descending - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - sort (sortQuery) { - this._sort = sortQuery - return this - } - - /** - * Add the use of a projection to the given Cursor. - * @param {Object.} projection - MongoDB-style projection. {} means take all fields. Then it's { key1: 1, key2: 1 } to take only key1 and key2 - * { key1: 0, key2: 0 } to omit only key1 and key2. Except _id, you can't mix takes and omits. - * @return {Cursor} the same instance of Cursor, (useful for chaining). - */ - projection (projection) { - this._projection = projection - return this - } - - /** - * Apply the projection. - * - * This is an internal function. You should use {@link Cursor#execAsync} or {@link Cursor#exec}. - * @param {document[]} candidates - * @return {document[]} - * @private - */ - _project (candidates) { - const res = [] - let action - - if (this._projection === undefined || Object.keys(this._projection).length === 0) { - return candidates - } - - const keepId = this._projection._id !== 0 - const { _id, ...rest } = this._projection - this._projection = rest - - // Check for consistency - const keys = Object.keys(this._projection) - keys.forEach(k => { - if (action !== undefined && this._projection[k] !== action) throw new Error('Can\'t both keep and omit fields except for _id') - action = this._projection[k] - }) - - // Do the actual projection - candidates.forEach(candidate => { - let toPush - if (action === 1) { // pick-type projection - toPush = { $set: {} } - keys.forEach(k => { - toPush.$set[k] = model.getDotValue(candidate, k) - if (toPush.$set[k] === undefined) delete toPush.$set[k] - }) - toPush = model.modify({}, toPush) - } else { // omit-type projection - toPush = { $unset: {} } - keys.forEach(k => { toPush.$unset[k] = true }) - toPush = model.modify(candidate, toPush) - } - if (keepId) toPush._id = candidate._id - else delete toPush._id - res.push(toPush) - }) - - return res - } - - /** - * Get all matching elements - * Will return pointers to matched elements (shallow copies), returning full copies is the role of find or findOne - * This is an internal function, use execAsync which uses the executor - * @return {document[]|Promise<*>} - * @private - */ - async _execAsync () { - let res = [] - let added = 0 - let skipped = 0 - - const candidates = await this.db._getCandidatesAsync(this.query) - - for (const candidate of candidates) { - if (model.match(candidate, this.query)) { - // If a sort is defined, wait for the results to be sorted before applying limit and skip - if (!this._sort) { - if (this._skip && this._skip > skipped) skipped += 1 - else { - res.push(candidate) - added += 1 - if (this._limit && this._limit <= added) break - } - } else res.push(candidate) - } - } - - // Apply all sorts - if (this._sort) { - // Sorting - const criteria = Object.entries(this._sort).map(([key, direction]) => ({ key, direction })) - res.sort((a, b) => { - for (const criterion of criteria) { - const compare = criterion.direction * model.compareThings(model.getDotValue(a, criterion.key), model.getDotValue(b, criterion.key), this.db.compareStrings) - if (compare !== 0) return compare - } - return 0 - }) - - // Applying limit and skip - const limit = this._limit || res.length - const skip = this._skip || 0 - - res = res.slice(skip, skip + limit) - } - - // Apply projection - res = this._project(res) - if (this.mapFn) return this.mapFn(res) - return res - } - - /** - * @callback Cursor~execCallback - * @param {Error} err - * @param {document[]|*} res If a mapFn was given to the Cursor, then the type of this parameter is the one returned by the mapFn. - */ - - /** - * Callback version of {@link Cursor#exec}. - * @param {Cursor~execCallback} _callback - * @see Cursor#execAsync - */ - exec (_callback) { - callbackify(() => this.execAsync())(_callback) - } - - /** - * Get all matching elements. - * Will return pointers to matched elements (shallow copies), returning full copies is the role of {@link Datastore#findAsync} or {@link Datastore#findOneAsync}. - * @return {Promise} - * @async - */ - execAsync () { - return this.db.executor.pushAsync(() => this._execAsync()) - } - - then (onFulfilled, onRejected) { - return this.execAsync().then(onFulfilled, onRejected) - } - - catch (onRejected) { - return this.execAsync().catch(onRejected) - } - - finally (onFinally) { - return this.execAsync().finally(onFinally) - } -} - -// Interface -module.exports = Cursor diff --git a/node_modules/@seald-io/nedb/lib/customUtils.js b/node_modules/@seald-io/nedb/lib/customUtils.js deleted file mode 100755 index 34bfd94..0000000 --- a/node_modules/@seald-io/nedb/lib/customUtils.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Utility functions that need to be reimplemented for each environment. - * This is the version for Node.js - * @module customUtilsNode - * @private - */ -const crypto = require('crypto') - -/** - * Return a random alphanumerical string of length len - * There is a very small probability (less than 1/1,000,000) for the length to be less than len - * (il the base64 conversion yields too many pluses and slashes) but - * that's not an issue here - * The probability of a collision is extremely small (need 3*10^12 documents to have one chance in a million of a collision) - * See http://en.wikipedia.org/wiki/Birthday_problem - * @param {number} len - * @return {string} - * @alias module:customUtilsNode.uid - */ -const uid = len => crypto.randomBytes(Math.ceil(Math.max(8, len * 2))) - .toString('base64') - .replace(/[+/]/g, '') - .slice(0, len) - -// Interface -module.exports.uid = uid diff --git a/node_modules/@seald-io/nedb/lib/datastore.js b/node_modules/@seald-io/nedb/lib/datastore.js deleted file mode 100755 index 740abf8..0000000 --- a/node_modules/@seald-io/nedb/lib/datastore.js +++ /dev/null @@ -1,1137 +0,0 @@ -const { EventEmitter } = require('events') -const { callbackify, deprecate } = require('util') -const Cursor = require('./cursor.js') -const customUtils = require('./customUtils.js') -const Executor = require('./executor.js') -const Index = require('./indexes.js') -const model = require('./model.js') -const Persistence = require('./persistence.js') -const { isDate, pick, filterIndexNames } = require('./utils.js') - -/** - * Callback with no parameter - * @callback NoParamCallback - * @param {?Error} err - */ - -/** - * String comparison function. - * ``` - * if (a < b) return -1 - * if (a > b) return 1 - * return 0 - * ``` - * @callback compareStrings - * @param {string} a - * @param {string} b - * @return {number} - */ - -/** - * Callback that returns an Array of documents. - * @callback MultipleDocumentsCallback - * @param {?Error} err - * @param {?document[]} docs - */ - -/** - * Callback that returns a single document. - * @callback SingleDocumentCallback - * @param {?Error} err - * @param {?document} docs - */ - -/** - * Generic async function. - * @callback AsyncFunction - * @param {...*} args - * @return {Promise<*>} - */ - -/** - * Callback with generic parameters. - * @callback GenericCallback - * @param {?Error} err - * @param {...*} args - */ - -/** - * Compaction event. Happens when the Datastore's Persistence has been compacted. - * It happens when calling {@link Datastore#compactDatafileAsync}, which is called periodically if you have called - * {@link Datastore#setAutocompactionInterval}. - * - * @event Datastore#event:"compaction.done" - * @type {undefined} - */ - -/** - * Generic document in NeDB. - * It consists of an Object with anything you want inside. - * @typedef document - * @property {?string} [_id] Internal `_id` of the document, which can be `null` or undefined at some points (when not - * inserted yet for example). - * @type {object} - */ - -/** - * Nedb query. - * - * Each key of a query references a field name, which can use the dot-notation to reference subfields inside nested - * documents, arrays, arrays of subdocuments and to match a specific element of an array. - * - * Each value of a query can be one of the following: - * - `string`: matches all documents which have this string as value for the referenced field name - * - `number`: matches all documents which have this number as value for the referenced field name - * - `Regexp`: matches all documents which have a value that matches the given `Regexp` for the referenced field name - * - `object`: matches all documents which have this object as deep-value for the referenced field name - * - Comparison operators: the syntax is `{ field: { $op: value } }` where `$op` is any comparison operator: - * - `$lt`, `$lte`: less than, less than or equal - * - `$gt`, `$gte`: greater than, greater than or equal - * - `$in`: member of. `value` must be an array of values - * - `$ne`, `$nin`: not equal, not a member of - * - `$exists`: checks whether the document posses the property `field`. `value` should be true or false - * - `$regex`: checks whether a string is matched by the regular expression. Contrary to MongoDB, the use of - * `$options` with `$regex` is not supported, because it doesn't give you more power than regex flags. Basic - * queries are more readable so only use the `$regex` operator when you need to use another operator with it - * - `$size`: if the referenced filed is an Array, matches on the size of the array - * - `$elemMatch`: matches if at least one array element matches the sub-query entirely - * - Logical operators: You can combine queries using logical operators: - * - For `$or` and `$and`, the syntax is `{ $op: [query1, query2, ...] }`. - * - For `$not`, the syntax is `{ $not: query }` - * - For `$where`, the syntax is: - * ``` - * { $where: function () { - * // object is 'this' - * // return a boolean - * } } - * ``` - * @typedef query - * @type {Object.} - */ - -/** - * Nedb projection. - * - * You can give `find` and `findOne` an optional second argument, `projections`. - * The syntax is the same as MongoDB: `{ a: 1, b: 1 }` to return only the `a` - * and `b` fields, `{ a: 0, b: 0 }` to omit these two fields. You cannot use both - * modes at the time, except for `_id` which is by default always returned and - * which you can choose to omit. You can project on nested documents. - * - * To reference subfields, you can use the dot-notation. - * - * @typedef projection - * @type {Object.} - */ - -/** - * The `beforeDeserialization` and `afterDeserialization` callbacks are hooks which are executed respectively before - * parsing each document and after stringifying them. They can be used for example to encrypt the Datastore. - * The `beforeDeserialization` should revert what `afterDeserialization` has done. - * @callback serializationHook - * @param {string} x - * @return {string} - */ - -/** - * @external EventEmitter - * @see http://nodejs.org/api/events.html - */ - -/** - * @class - * @classdesc The `Datastore` class is the main class of NeDB. - * @extends external:EventEmitter - * @emits Datastore#event:"compaction.done" - * @typicalname NeDB - */ -class Datastore extends EventEmitter { - /** - * Create a new collection, either persistent or in-memory. - * - * If you use a persistent datastore without the `autoload` option, you need to call {@link Datastore#loadDatabase} or - * {@link Datastore#loadDatabaseAsync} manually. This function fetches the data from datafile and prepares the database. - * **Don't forget it!** If you use a persistent datastore, no command (insert, find, update, remove) will be executed - * before it is called, so make sure to call it yourself or use the `autoload` option. - * - * Also, if loading fails, all commands registered to the {@link Datastore#executor} afterwards will not be executed. - * They will be registered and executed, in sequence, only after a successful loading. - * - * @param {object|string} options Can be an object or a string. If options is a string, the behavior is the same as in - * v0.6: it will be interpreted as `options.filename`. **Giving a string is deprecated, and will be removed in the - * next major version.** - * @param {string} [options.filename = null] Path to the file where the data is persisted. If left blank, the datastore is - * automatically considered in-memory only. It cannot end with a `~` which is used in the temporary files NeDB uses to - * perform crash-safe writes. Not used if `options.inMemoryOnly` is `true`. - * @param {boolean} [options.inMemoryOnly = false] If set to true, no data will be written in storage. This option has - * priority over `options.filename`. - * @param {object} [options.modes] Permissions to use for FS. Only used for Node.js storage module. Will not work on Windows. - * @param {number} [options.modes.fileMode = 0o644] Permissions to use for database files - * @param {number} [options.modes.dirMode = 0o755] Permissions to use for database directories - * @param {boolean} [options.timestampData = false] If set to true, createdAt and updatedAt will be created and - * populated automatically (if not specified by user) - * @param {boolean} [options.autoload = false] If used, the database will automatically be loaded from the datafile - * upon creation (you don't need to call `loadDatabase`). Any command issued before load is finished is buffered and - * will be executed when load is done. When autoloading is done, you can either use the `onload` callback, or you can - * use `this.autoloadPromise` which resolves (or rejects) when autloading is done. - * @param {NoParamCallback} [options.onload] If you use autoloading, this is the handler called after the `loadDatabase`. It - * takes one `error` argument. If you use autoloading without specifying this handler, and an error happens during - * load, an error will be thrown. - * @param {serializationHook} [options.beforeDeserialization] Hook you can use to transform data after it was serialized and - * before it is written to disk. Can be used for example to encrypt data before writing database to disk. This - * function takes a string as parameter (one line of an NeDB data file) and outputs the transformed string, **which - * must absolutely not contain a `\n` character** (or data will be lost). - * @param {serializationHook} [options.afterSerialization] Inverse of `afterSerialization`. Make sure to include both and not - * just one, or you risk data loss. For the same reason, make sure both functions are inverses of one another. Some - * failsafe mechanisms are in place to prevent data loss if you misuse the serialization hooks: NeDB checks that never - * one is declared without the other, and checks that they are reverse of one another by testing on random strings of - * various lengths. In addition, if too much data is detected as corrupt, NeDB will refuse to start as it could mean - * you're not using the deserialization hook corresponding to the serialization hook used before. - * @param {number} [options.corruptAlertThreshold = 0.1] Between 0 and 1, defaults to 10%. NeDB will refuse to start - * if more than this percentage of the datafile is corrupt. 0 means you don't tolerate any corruption, 1 means you - * don't care. - * @param {compareStrings} [options.compareStrings] If specified, it overrides default string comparison which is not - * well adapted to non-US characters in particular accented letters. Native `localCompare` will most of the time be - * the right choice. - * @param {boolean} [options.testSerializationHooks=true] Whether to test the serialization hooks or not, - * might be CPU-intensive - */ - constructor (options) { - super() - let filename - - // Retrocompatibility with v0.6 and before - if (typeof options === 'string') { - deprecate(() => { - filename = options - this.inMemoryOnly = false // Default - }, '@seald-io/nedb: Giving a string to the Datastore constructor is deprecated and will be removed in the next major version. Please use an options object with an argument \'filename\'.')() - } else { - options = options || {} - filename = options.filename - /** - * Determines if the `Datastore` keeps data in-memory, or if it saves it in storage. Is not read after - * instanciation. - * @type {boolean} - * @protected - */ - this.inMemoryOnly = options.inMemoryOnly || false - /** - * Determines if the `Datastore` should autoload the database upon instantiation. Is not read after instanciation. - * @type {boolean} - * @protected - */ - this.autoload = options.autoload || false - /** - * Determines if the `Datastore` should add `createdAt` and `updatedAt` fields automatically if not set by the user. - * @type {boolean} - * @protected - */ - this.timestampData = options.timestampData || false - } - - // Determine whether in memory or persistent - if (!filename || typeof filename !== 'string' || filename.length === 0) { - /** - * If null, it means `inMemoryOnly` is `true`. The `filename` is the name given to the storage module. Is not read - * after instanciation. - * @type {?string} - * @protected - */ - this.filename = null - this.inMemoryOnly = true - } else { - this.filename = filename - } - - // String comparison function - /** - * Overrides default string comparison which is not well adapted to non-US characters in particular accented - * letters. Native `localCompare` will most of the time be the right choice - * @type {compareStrings} - * @function - * @protected - */ - this.compareStrings = options.compareStrings - - // Persistence handling - /** - * The `Persistence` instance for this `Datastore`. - * @type {Persistence} - */ - this.persistence = new Persistence({ - db: this, - afterSerialization: options.afterSerialization, - beforeDeserialization: options.beforeDeserialization, - corruptAlertThreshold: options.corruptAlertThreshold, - modes: options.modes, - testSerializationHooks: options.testSerializationHooks - }) - - // This new executor is ready if we don't use persistence - // If we do, it will only be ready once loadDatabase is called - /** - * The `Executor` instance for this `Datastore`. It is used in all methods exposed by the {@link Datastore}, - * any {@link Cursor} produced by the `Datastore` and by {@link Datastore#compactDatafileAsync} to ensure operations - * are performed sequentially in the database. - * @type {Executor} - * @protected - */ - this.executor = new Executor() - if (this.inMemoryOnly) this.executor.ready = true - - /** - * Indexed by field name, dot notation can be used. - * _id is always indexed and since _ids are generated randomly the underlying binary search tree is always well-balanced - * @type {Object.} - * @protected - */ - this.indexes = {} - this.indexes._id = new Index({ fieldName: '_id', unique: true }) - /** - * Stores the time to live (TTL) of the indexes created. The key represents the field name, the value the number of - * seconds after which data with this index field should be removed. - * @type {Object.} - * @protected - */ - this.ttlIndexes = {} - - // Queue a load of the database right away and call the onload handler - // By default (no onload handler), if there is an error there, no operation will be possible so warn the user by throwing an exception - if (this.autoload) { - /** - * A Promise that resolves when the autoload has finished. - * - * The onload callback is not awaited by this Promise, it is started immediately after that. - * @type {?Promise} - */ - this.autoloadPromise = this.loadDatabaseAsync() - this.autoloadPromise - .then(() => { - if (options.onload) options.onload() - }, err => { - if (options.onload) options.onload(err) - else throw err - }) - } else this.autoloadPromise = null - /** - * Interval if {@link Datastore#setAutocompactionInterval} was called. - * @private - * @type {null|number} - */ - this._autocompactionIntervalId = null - } - - /** - * Queue a compaction/rewrite of the datafile. - * It works by rewriting the database file, and compacts it since the cache always contains only the number of - * documents in the collection while the data file is append-only so it may grow larger. - * - * @async - */ - compactDatafileAsync () { - return this.executor.pushAsync(() => this.persistence.persistCachedDatabaseAsync()) - } - - /** - * Callback version of {@link Datastore#compactDatafileAsync}. - * @param {NoParamCallback} [callback = () => {}] - * @see Datastore#compactDatafileAsync - */ - compactDatafile (callback) { - const promise = this.compactDatafileAsync() - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Set automatic compaction every `interval` ms - * @param {Number} interval in milliseconds, with an enforced minimum of 5000 milliseconds - */ - setAutocompactionInterval (interval) { - const minInterval = 5000 - if (Number.isNaN(Number(interval))) throw new Error('Interval must be a non-NaN number') - const realInterval = Math.max(Number(interval), minInterval) - - this.stopAutocompaction() - - this._autocompactionIntervalId = setInterval(() => { - this.compactDatafile() - }, realInterval) - } - - /** - * Stop autocompaction (do nothing if automatic compaction was not running) - */ - stopAutocompaction () { - if (this._autocompactionIntervalId) { - clearInterval(this._autocompactionIntervalId) - this._autocompactionIntervalId = null - } - } - - /** - * Callback version of {@link Datastore#loadDatabaseAsync}. - * @param {NoParamCallback} [callback] - * @see Datastore#loadDatabaseAsync - */ - loadDatabase (callback) { - const promise = this.loadDatabaseAsync() - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Stops auto-compaction, finishes all queued operations, drops the database both in memory and in storage. - * **WARNING**: it is not recommended re-using an instance of NeDB if its database has been dropped, it is - * preferable to instantiate a new one. - * @async - * @return {Promise} - */ - dropDatabaseAsync () { - return this.persistence.dropDatabaseAsync() // the executor is exceptionally used by Persistence - } - - /** - * Callback version of {@link Datastore#dropDatabaseAsync}. - * @param {NoParamCallback} [callback] - * @see Datastore#dropDatabaseAsync - */ - dropDatabase (callback) { - const promise = this.dropDatabaseAsync() - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Load the database from the datafile, and trigger the execution of buffered commands if any. - * @async - * @return {Promise} - */ - loadDatabaseAsync () { - return this.executor.pushAsync(() => this.persistence.loadDatabaseAsync(), true) - } - - /** - * Get an array of all the data in the database. - * @return {document[]} - */ - getAllData () { - return this.indexes._id.getAll() - } - - /** - * Reset all currently defined indexes. - * @param {?document|?document[]} [newData] - * @private - */ - _resetIndexes (newData) { - for (const index of Object.values(this.indexes)) { - index.reset(newData) - } - } - - /** - * Callback version of {@link Datastore#ensureIndex}. - * @param {object} options - * @param {string|string[]} options.fieldName - * @param {boolean} [options.unique = false] - * @param {boolean} [options.sparse = false] - * @param {number} [options.expireAfterSeconds] - * @param {NoParamCallback} [callback] - * @see Datastore#ensureIndex - */ - ensureIndex (options = {}, callback) { - const promise = this.ensureIndexAsync(options) // to make sure the synchronous part of ensureIndexAsync is executed synchronously - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Ensure an index is kept for this field. Same parameters as lib/indexes - * This function acts synchronously on the indexes, however the persistence of the indexes is deferred with the - * executor. - * @param {object} options - * @param {string|string[]} options.fieldName Name of the field to index. Use the dot notation to index a field in a nested - * document. For a compound index, use an array of field names. Using a comma in a field name is not permitted. - * @param {boolean} [options.unique = false] Enforce field uniqueness. Note that a unique index will raise an error - * if you try to index two documents for which the field is not defined. - * @param {boolean} [options.sparse = false] Don't index documents for which the field is not defined. Use this option - * along with "unique" if you want to accept multiple documents for which it is not defined. - * @param {number} [options.expireAfterSeconds] - If set, the created index is a TTL (time to live) index, that will - * automatically remove documents when the system date becomes larger than the date on the indexed field plus - * `expireAfterSeconds`. Documents where the indexed field is not specified or not a `Date` object are ignored. - * @return {Promise} - */ - async ensureIndexAsync (options = {}) { - if (!options.fieldName) { - const err = new Error('Cannot create an index without a fieldName') - err.missingFieldName = true - throw err - } - - const _fields = [].concat(options.fieldName).sort() - - if (_fields.some(field => field.includes(','))) { - throw new Error('Cannot use comma in index fieldName') - } - - const _options = { - ...options, - fieldName: _fields.join(',') - } - - if (this.indexes[_options.fieldName]) return - - this.indexes[_options.fieldName] = new Index(_options) - if (options.expireAfterSeconds !== undefined) this.ttlIndexes[_options.fieldName] = _options.expireAfterSeconds // With this implementation index creation is not necessary to ensure TTL but we stick with MongoDB's API here - - try { - this.indexes[_options.fieldName].insert(this.getAllData()) - } catch (e) { - delete this.indexes[_options.fieldName] - throw e - } - - // We may want to force all options to be persisted including defaults, not just the ones passed the index creation function - await this.executor.pushAsync(() => this.persistence.persistNewStateAsync([{ $$indexCreated: _options }]), true) - } - - /** - * Callback version of {@link Datastore#removeIndexAsync}. - * @param {string} fieldName - * @param {NoParamCallback} [callback] - * @see Datastore#removeIndexAsync - */ - removeIndex (fieldName, callback = () => {}) { - const promise = this.removeIndexAsync(fieldName) - callbackify(() => promise)(callback) - } - - /** - * Remove an index. - * @param {string} fieldName Field name of the index to remove. Use the dot notation to remove an index referring to a - * field in a nested document. - * @return {Promise} - * @see Datastore#removeIndex - */ - async removeIndexAsync (fieldName) { - delete this.indexes[fieldName] - - await this.executor.pushAsync(() => this.persistence.persistNewStateAsync([{ $$indexRemoved: fieldName }]), true) - } - - /** - * Add one or several document(s) to all indexes. - * - * This is an internal function. - * @param {document} doc - * @private - */ - _addToIndexes (doc) { - let failingIndex - let error - const keys = Object.keys(this.indexes) - - for (let i = 0; i < keys.length; i += 1) { - try { - this.indexes[keys[i]].insert(doc) - } catch (e) { - failingIndex = i - error = e - break - } - } - - // If an error happened, we need to rollback the insert on all other indexes - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.indexes[keys[i]].remove(doc) - } - - throw error - } - } - - /** - * Remove one or several document(s) from all indexes. - * - * This is an internal function. - * @param {document} doc - * @private - */ - _removeFromIndexes (doc) { - for (const index of Object.values(this.indexes)) { - index.remove(doc) - } - } - - /** - * Update one or several documents in all indexes. - * - * To update multiple documents, oldDoc must be an array of { oldDoc, newDoc } pairs. - * - * If one update violates a constraint, all changes are rolled back. - * - * This is an internal function. - * @param {document|Array.<{oldDoc: document, newDoc: document}>} oldDoc Document to update, or an `Array` of - * `{oldDoc, newDoc}` pairs. - * @param {document} [newDoc] Document to replace the oldDoc with. If the first argument is an `Array` of - * `{oldDoc, newDoc}` pairs, this second argument is ignored. - * @private - */ - _updateIndexes (oldDoc, newDoc) { - let failingIndex - let error - const keys = Object.keys(this.indexes) - - for (let i = 0; i < keys.length; i += 1) { - try { - this.indexes[keys[i]].update(oldDoc, newDoc) - } catch (e) { - failingIndex = i - error = e - break - } - } - - // If an error happened, we need to rollback the update on all other indexes - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.indexes[keys[i]].revertUpdate(oldDoc, newDoc) - } - - throw error - } - } - - /** - * Get all candidate documents matching the query, regardless of their expiry status. - * @param {query} query - * @return {document[]} - * - * @private - */ - _getRawCandidates (query) { - const indexNames = Object.keys(this.indexes) - - // STEP 1: get candidates list by checking indexes from most to least frequent usecase - // For a basic match - - let usableQuery - usableQuery = Object.entries(query) - .filter(filterIndexNames(indexNames)) - .pop() - if (usableQuery) return this.indexes[usableQuery[0]].getMatching(usableQuery[1]) - - // For a compound match - const compoundQueryKeys = indexNames - .filter(indexName => indexName.indexOf(',') !== -1) - .map(indexName => indexName.split(',')) - .filter(subIndexNames => - Object.entries(query) - .filter(filterIndexNames(subIndexNames)).length === subIndexNames.length - ) - - if (compoundQueryKeys.length > 0) return this.indexes[compoundQueryKeys[0]].getMatching(pick(query, compoundQueryKeys[0])) - - // For a $in match - usableQuery = Object.entries(query) - .filter(([k, v]) => - !!(query[k] && Object.prototype.hasOwnProperty.call(query[k], '$in')) && - indexNames.includes(k) - ) - .pop() - if (usableQuery) return this.indexes[usableQuery[0]].getMatching(usableQuery[1].$in) - // For a comparison match - usableQuery = Object.entries(query) - .filter(([k, v]) => - !!(query[k] && (Object.prototype.hasOwnProperty.call(query[k], '$lt') || Object.prototype.hasOwnProperty.call(query[k], '$lte') || Object.prototype.hasOwnProperty.call(query[k], '$gt') || Object.prototype.hasOwnProperty.call(query[k], '$gte'))) && - indexNames.includes(k) - ) - .pop() - if (usableQuery) return this.indexes[usableQuery[0]].getBetweenBounds(usableQuery[1]) - // By default, return all the DB data - return this.getAllData() - } - - /** - * Return the list of candidates for a given query - * Crude implementation for now, we return the candidates given by the first usable index if any - * We try the following query types, in this order: basic match, $in match, comparison match - * One way to make it better would be to enable the use of multiple indexes if the first usable index - * returns too much data. I may do it in the future. - * - * Returned candidates will be scanned to find and remove all expired documents - * - * This is an internal function. - * @param {query} query - * @param {boolean} [dontExpireStaleDocs = false] If true don't remove stale docs. Useful for the remove function - * which shouldn't be impacted by expirations. - * @return {Promise} candidates - * @private - */ - async _getCandidatesAsync (query, dontExpireStaleDocs = false) { - const validDocs = [] - - // STEP 1: get candidates list by checking indexes from most to least frequent usecase - const docs = this._getRawCandidates(query) - // STEP 2: remove all expired documents - if (!dontExpireStaleDocs) { - const expiredDocsIds = [] - const ttlIndexesFieldNames = Object.keys(this.ttlIndexes) - - docs.forEach(doc => { - if (ttlIndexesFieldNames.every(i => !(doc[i] !== undefined && isDate(doc[i]) && Date.now() > doc[i].getTime() + this.ttlIndexes[i] * 1000))) validDocs.push(doc) - else expiredDocsIds.push(doc._id) - }) - for (const _id of expiredDocsIds) { - await this._removeAsync({ _id }, {}) - } - } else validDocs.push(...docs) - return validDocs - } - - /** - * Insert a new document - * This is an internal function, use {@link Datastore#insertAsync} which has the same signature. - * @param {document|document[]} newDoc - * @return {Promise} - * @private - */ - async _insertAsync (newDoc) { - const preparedDoc = this._prepareDocumentForInsertion(newDoc) - this._insertInCache(preparedDoc) - - await this.persistence.persistNewStateAsync(Array.isArray(preparedDoc) ? preparedDoc : [preparedDoc]) - return model.deepCopy(preparedDoc) - } - - /** - * Create a new _id that's not already in use - * @return {string} id - * @private - */ - _createNewId () { - let attemptId = customUtils.uid(16) - // Try as many times as needed to get an unused _id. As explained in customUtils, the probability of this ever happening is extremely small, so this is O(1) - if (this.indexes._id.getMatching(attemptId).length > 0) attemptId = this._createNewId() - return attemptId - } - - /** - * Prepare a document (or array of documents) to be inserted in a database - * Meaning adds _id and timestamps if necessary on a copy of newDoc to avoid any side effect on user input - * @param {document|document[]} newDoc document, or Array of documents, to prepare - * @return {document|document[]} prepared document, or Array of prepared documents - * @private - */ - _prepareDocumentForInsertion (newDoc) { - let preparedDoc - - if (Array.isArray(newDoc)) { - preparedDoc = [] - newDoc.forEach(doc => { preparedDoc.push(this._prepareDocumentForInsertion(doc)) }) - } else { - preparedDoc = model.deepCopy(newDoc) - if (preparedDoc._id === undefined) preparedDoc._id = this._createNewId() - const now = new Date() - if (this.timestampData && preparedDoc.createdAt === undefined) preparedDoc.createdAt = now - if (this.timestampData && preparedDoc.updatedAt === undefined) preparedDoc.updatedAt = now - model.checkObject(preparedDoc) - } - - return preparedDoc - } - - /** - * If newDoc is an array of documents, this will insert all documents in the cache - * @param {document|document[]} preparedDoc - * @private - */ - _insertInCache (preparedDoc) { - if (Array.isArray(preparedDoc)) this._insertMultipleDocsInCache(preparedDoc) - else this._addToIndexes(preparedDoc) - } - - /** - * If one insertion fails (e.g. because of a unique constraint), roll back all previous - * inserts and throws the error - * @param {document[]} preparedDocs - * @private - */ - _insertMultipleDocsInCache (preparedDocs) { - let failingIndex - let error - - for (let i = 0; i < preparedDocs.length; i += 1) { - try { - this._addToIndexes(preparedDocs[i]) - } catch (e) { - error = e - failingIndex = i - break - } - } - - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this._removeFromIndexes(preparedDocs[i]) - } - - throw error - } - } - - /** - * Callback version of {@link Datastore#insertAsync}. - * @param {document|document[]} newDoc - * @param {SingleDocumentCallback|MultipleDocumentsCallback} [callback] - * @see Datastore#insertAsync - */ - insert (newDoc, callback) { - const promise = this.insertAsync(newDoc) - if (typeof callback === 'function') callbackify(() => promise)(callback) - } - - /** - * Insert a new document, or new documents. - * @param {document|document[]} newDoc Document or array of documents to insert. - * @return {Promise} The document(s) inserted. - * @async - */ - insertAsync (newDoc) { - return this.executor.pushAsync(() => this._insertAsync(newDoc)) - } - - /** - * Callback for {@link Datastore#countCallback}. - * @callback Datastore~countCallback - * @param {?Error} err - * @param {?number} count - */ - - /** - * Callback-version of {@link Datastore#countAsync}. - * @param {query} query - * @param {Datastore~countCallback} [callback] - * @return {Cursor|undefined} - * @see Datastore#countAsync - */ - count (query, callback) { - const cursor = this.countAsync(query) - - if (typeof callback === 'function') callbackify(cursor.execAsync.bind(cursor))(callback) - else return cursor - } - - /** - * Count all documents matching the query. - * @param {query} query MongoDB-style query - * @return {Cursor} count - * @async - */ - countAsync (query) { - return new Cursor(this, query, docs => docs.length) - } - - /** - * Callback version of {@link Datastore#findAsync}. - * @param {query} query - * @param {projection|MultipleDocumentsCallback} [projection = {}] - * @param {MultipleDocumentsCallback} [callback] - * @return {Cursor|undefined} - * @see Datastore#findAsync - */ - find (query, projection, callback) { - if (arguments.length === 1) { - projection = {} - // callback is undefined, will return a cursor - } else if (arguments.length === 2) { - if (typeof projection === 'function') { - callback = projection - projection = {} - } // If not assume projection is an object and callback undefined - } - - const cursor = this.findAsync(query, projection) - - if (typeof callback === 'function') callbackify(cursor.execAsync.bind(cursor))(callback) - else return cursor - } - - /** - * Find all documents matching the query. - * We return the {@link Cursor} that the user can either `await` directly or use to can {@link Cursor#limit} or - * {@link Cursor#skip} before. - * @param {query} query MongoDB-style query - * @param {projection} [projection = {}] MongoDB-style projection - * @return {Cursor} - * @async - */ - findAsync (query, projection = {}) { - const cursor = new Cursor(this, query, docs => docs.map(doc => model.deepCopy(doc))) - - cursor.projection(projection) - return cursor - } - - /** - * @callback Datastore~findOneCallback - * @param {?Error} err - * @param {document} doc - */ - - /** - * Callback version of {@link Datastore#findOneAsync}. - * @param {query} query - * @param {projection|SingleDocumentCallback} [projection = {}] - * @param {SingleDocumentCallback} [callback] - * @return {Cursor|undefined} - * @see Datastore#findOneAsync - */ - findOne (query, projection, callback) { - if (arguments.length === 1) { - projection = {} - // callback is undefined, will return a cursor - } else if (arguments.length === 2) { - if (typeof projection === 'function') { - callback = projection - projection = {} - } // If not assume projection is an object and callback undefined - } - - const cursor = this.findOneAsync(query, projection) - - if (typeof callback === 'function') callbackify(cursor.execAsync.bind(cursor))(callback) - else return cursor - } - - /** - * Find one document matching the query. - * We return the {@link Cursor} that the user can either `await` directly or use to can {@link Cursor#skip} before. - * @param {query} query MongoDB-style query - * @param {projection} projection MongoDB-style projection - * @return {Cursor} - */ - findOneAsync (query, projection = {}) { - const cursor = new Cursor(this, query, docs => docs.length === 1 ? model.deepCopy(docs[0]) : null) - - cursor.projection(projection).limit(1) - return cursor - } - - /** - * See {@link Datastore#updateAsync} return type for the definition of the callback parameters. - * - * **WARNING:** Prior to 3.0.0, `upsert` was either `true` of falsy (but not `false`), it is now always a boolean. - * `affectedDocuments` could be `undefined` when `returnUpdatedDocs` was `false`, it is now `null` in these cases. - * - * **WARNING:** Prior to 1.8.0, the `upsert` argument was not given, it was impossible for the developer to determine - * during a `{ multi: false, returnUpdatedDocs: true, upsert: true }` update if it inserted a document or just updated - * it. - * - * @callback Datastore~updateCallback - * @param {?Error} err - * @param {number} numAffected - * @param {?document[]|?document} affectedDocuments - * @param {boolean} upsert - * @see {Datastore#updateAsync} - */ - - /** - * Version without the using {@link Datastore~executor} of {@link Datastore#updateAsync}, use it instead. - * - * @param {query} query - * @param {document|update} update - * @param {Object} options - * @param {boolean} [options.multi = false] - * @param {boolean} [options.upsert = false] - * @param {boolean} [options.returnUpdatedDocs = false] - * @return {Promise<{numAffected: number, affectedDocuments: document[]|document|null, upsert: boolean}>} - * @private - * @see Datastore#updateAsync - */ - async _updateAsync (query, update, options) { - const multi = options.multi !== undefined ? options.multi : false - const upsert = options.upsert !== undefined ? options.upsert : false - - // If upsert option is set, check whether we need to insert the doc - if (upsert) { - const cursor = new Cursor(this, query) - - // Need to use an internal function not tied to the executor to avoid deadlock - const docs = await cursor.limit(1)._execAsync() - - if (docs.length !== 1) { - let toBeInserted - - try { - model.checkObject(update) - // updateQuery is a simple object with no modifier, use it as the document to insert - toBeInserted = update - } catch (e) { - // updateQuery contains modifiers, use the find query as the base, - // strip it from all operators and update it according to updateQuery - toBeInserted = model.modify(model.deepCopy(query, true), update) - } - const newDoc = await this._insertAsync(toBeInserted) - return { numAffected: 1, affectedDocuments: newDoc, upsert: true } - } - } - // Perform the update - let numReplaced = 0 - let modifiedDoc - const modifications = [] - let createdAt - - const candidates = await this._getCandidatesAsync(query) - // Preparing update (if an error is thrown here neither the datafile nor - // the in-memory indexes are affected) - for (const candidate of candidates) { - if (model.match(candidate, query) && (multi || numReplaced === 0)) { - numReplaced += 1 - if (this.timestampData) { createdAt = candidate.createdAt } - modifiedDoc = model.modify(candidate, update) - if (this.timestampData) { - modifiedDoc.createdAt = createdAt - modifiedDoc.updatedAt = new Date() - } - modifications.push({ oldDoc: candidate, newDoc: modifiedDoc }) - } - } - - // Change the docs in memory - this._updateIndexes(modifications) - - // Update the datafile - const updatedDocs = modifications.map(x => x.newDoc) - await this.persistence.persistNewStateAsync(updatedDocs) - if (!options.returnUpdatedDocs) return { numAffected: numReplaced, upsert: false, affectedDocuments: null } - else { - let updatedDocsDC = [] - updatedDocs.forEach(doc => { updatedDocsDC.push(model.deepCopy(doc)) }) - if (!multi) updatedDocsDC = updatedDocsDC[0] - return { numAffected: numReplaced, affectedDocuments: updatedDocsDC, upsert: false } - } - } - - /** - * Callback version of {@link Datastore#updateAsync}. - * @param {query} query - * @param {document|*} update - * @param {Object|Datastore~updateCallback} [options|] - * @param {boolean} [options.multi = false] - * @param {boolean} [options.upsert = false] - * @param {boolean} [options.returnUpdatedDocs = false] - * @param {Datastore~updateCallback} [callback] - * @see Datastore#updateAsync - * - */ - update (query, update, options, callback) { - if (typeof options === 'function') { - callback = options - options = {} - } - const _callback = (err, res = {}) => { - if (callback) callback(err, res.numAffected, res.affectedDocuments, res.upsert) - } - callbackify((query, update, options) => this.updateAsync(query, update, options))(query, update, options, _callback) - } - - /** - * Update all docs matching query. - * @param {query} query is the same kind of finding query you use with `find` and `findOne`. - * @param {document|*} update specifies how the documents should be modified. It is either a new document or a - * set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the - * matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can - * apply them to subdocs. Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, - * `$inc` to increment a field's value and `$min`/`$max` to change field's value, only if provided value is - * less/greater than current value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special - * `$each` and `$slice`. - * @param {Object} [options = {}] Optional options - * @param {boolean} [options.multi = false] If true, can update multiple documents - * @param {boolean} [options.upsert = false] If true, can insert a new document corresponding to the `update` rules if - * your `query` doesn't match anything. If your `update` is a simple object with no modifiers, it is the inserted - * document. In the other case, the `query` is stripped from all operator recursively, and the `update` is applied to - * it. - * @param {boolean} [options.returnUpdatedDocs = false] (not Mongo-DB compatible) If true and update is not an upsert, - * will return the array of documents matched by the find query and updated. Updated documents will be returned even - * if the update did not actually modify them. - * @return {Promise<{numAffected: number, affectedDocuments: document[]|document|null, upsert: boolean}>} - * - `upsert` is `true` if and only if the update did insert a document, **cannot be true if `options.upsert !== true`**. - * - `numAffected` is the number of documents affected by the update or insertion (if `options.multi` is `false` or `options.upsert` is `true`, cannot exceed `1`); - * - `affectedDocuments` can be one of the following: - * - If `upsert` is `true`, the inserted document; - * - If `options.returnUpdatedDocs` is `false`, `null`; - * - If `options.returnUpdatedDocs` is `true`: - * - If `options.multi` is `false`, the updated document; - * - If `options.multi` is `true`, the array of updated documents. - * @async - */ - updateAsync (query, update, options = {}) { - return this.executor.pushAsync(() => this._updateAsync(query, update, options)) - } - - /** - * @callback Datastore~removeCallback - * @param {?Error} err - * @param {?number} numRemoved - */ - - /** - * Internal version without using the {@link Datastore#executor} of {@link Datastore#removeAsync}, use it instead. - * - * @param {query} query - * @param {object} [options] - * @param {boolean} [options.multi = false] - * @return {Promise} - * @private - * @see Datastore#removeAsync - */ - async _removeAsync (query, options = {}) { - const multi = options.multi !== undefined ? options.multi : false - - const candidates = await this._getCandidatesAsync(query, true) - const removedDocs = [] - let numRemoved = 0 - - candidates.forEach(d => { - if (model.match(d, query) && (multi || numRemoved === 0)) { - numRemoved += 1 - removedDocs.push({ $$deleted: true, _id: d._id }) - this._removeFromIndexes(d) - } - }) - - await this.persistence.persistNewStateAsync(removedDocs) - return numRemoved - } - - /** - * Callback version of {@link Datastore#removeAsync}. - * @param {query} query - * @param {object|Datastore~removeCallback} [options={}] - * @param {boolean} [options.multi = false] - * @param {Datastore~removeCallback} [cb = () => {}] - * @see Datastore#removeAsync - */ - remove (query, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - const callback = cb || (() => {}) - callbackify((query, options) => this.removeAsync(query, options))(query, options, callback) - } - - /** - * Remove all docs matching the query. - * @param {query} query MongoDB-style query - * @param {object} [options={}] Optional options - * @param {boolean} [options.multi = false] If true, can update multiple documents - * @return {Promise} How many documents were removed - * @async - */ - removeAsync (query, options = {}) { - return this.executor.pushAsync(() => this._removeAsync(query, options)) - } -} - -module.exports = Datastore diff --git a/node_modules/@seald-io/nedb/lib/executor.js b/node_modules/@seald-io/nedb/lib/executor.js deleted file mode 100755 index b7767f1..0000000 --- a/node_modules/@seald-io/nedb/lib/executor.js +++ /dev/null @@ -1,79 +0,0 @@ -const Waterfall = require('./waterfall') - -/** - * Executes operations sequentially. - * Has an option for a buffer that can be triggered afterwards. - * @private - */ -class Executor { - /** - * Instantiates a new Executor. - */ - constructor () { - /** - * If this.ready is `false`, then every task pushed will be buffered until this.processBuffer is called. - * @type {boolean} - * @private - */ - this.ready = false - /** - * The main queue - * @type {Waterfall} - * @private - */ - this.queue = new Waterfall() - /** - * The buffer queue - * @type {Waterfall} - * @private - */ - this.buffer = null - /** - * Method to trigger the buffer processing. - * - * Do not be use directly, use `this.processBuffer` instead. - * @function - * @private - */ - this._triggerBuffer = null - this.resetBuffer() - } - - /** - * If executor is ready, queue task (and process it immediately if executor was idle) - * If not, buffer task for later processing - * @param {AsyncFunction} task Function to execute - * @param {boolean} [forceQueuing = false] Optional (defaults to false) force executor to queue task even if it is not ready - * @return {Promise<*>} - * @async - * @see Executor#push - */ - pushAsync (task, forceQueuing = false) { - if (this.ready || forceQueuing) return this.queue.waterfall(task)() - else return this.buffer.waterfall(task)() - } - - /** - * Queue all tasks in buffer (in the same order they came in) - * Automatically sets executor as ready - */ - processBuffer () { - this.ready = true - this._triggerBuffer() - this.queue.waterfall(() => this.buffer.guardian) - } - - /** - * Removes all tasks queued up in the buffer - */ - resetBuffer () { - this.buffer = new Waterfall() - this.buffer.chain(new Promise(resolve => { - this._triggerBuffer = resolve - })) - if (this.ready) this._triggerBuffer() - } -} - -// Interface -module.exports = Executor diff --git a/node_modules/@seald-io/nedb/lib/indexes.js b/node_modules/@seald-io/nedb/lib/indexes.js deleted file mode 100755 index 53af04c..0000000 --- a/node_modules/@seald-io/nedb/lib/indexes.js +++ /dev/null @@ -1,333 +0,0 @@ -const BinarySearchTree = require('@seald-io/binary-search-tree').AVLTree -const model = require('./model.js') -const { uniq, isDate } = require('./utils.js') - -/** - * Two indexed pointers are equal if they point to the same place - * @param {*} a - * @param {*} b - * @return {boolean} - * @private - */ -const checkValueEquality = (a, b) => a === b - -/** - * Type-aware projection - * @param {*} elt - * @return {string|*} - * @private - */ -const projectForUnique = elt => { - if (elt === null) return '$null' - if (typeof elt === 'string') return '$string' + elt - if (typeof elt === 'boolean') return '$boolean' + elt - if (typeof elt === 'number') return '$number' + elt - if (isDate(elt)) return '$date' + elt.getTime() - - return elt // Arrays and objects, will check for pointer equality -} - -/** - * Indexes on field names, with atomic operations and which can optionally enforce a unique constraint or allow indexed - * fields to be undefined - * @private - */ -class Index { - /** - * Create a new index - * All methods on an index guarantee that either the whole operation was successful and the index changed - * or the operation was unsuccessful and an error is thrown while the index is unchanged - * @param {object} options - * @param {string} options.fieldName On which field should the index apply, can use dot notation to index on sub fields, can use comma-separated notation to use compound indexes - * @param {boolean} [options.unique = false] Enforces a unique constraint - * @param {boolean} [options.sparse = false] Allows a sparse index (we can have documents for which fieldName is `undefined`) - */ - constructor (options) { - /** - * On which field the index applies to, can use dot notation to index on sub fields, can use comma-separated notation to use compound indexes. - * @type {string} - */ - this.fieldName = options.fieldName - - if (typeof this.fieldName !== 'string') throw new Error('fieldName must be a string') - - /** - * Internal property which is an Array representing the fieldName split with `,`, useful only for compound indexes. - * @type {string[]} - * @private - */ - this._fields = this.fieldName.split(',') - - /** - * Defines if the index enforces a unique constraint for this index. - * @type {boolean} - */ - this.unique = options.unique || false - /** - * Defines if we can have documents for which fieldName is `undefined` - * @type {boolean} - */ - this.sparse = options.sparse || false - - /** - * Options object given to the underlying BinarySearchTree. - * @type {{unique: boolean, checkValueEquality: (function(*, *): boolean), compareKeys: ((function(*, *, compareStrings): (number|number))|*)}} - */ - this.treeOptions = { unique: this.unique, compareKeys: model.compareThings, checkValueEquality } - - /** - * Underlying BinarySearchTree for this index. Uses an AVLTree for optimization. - * @type {AVLTree} - */ - this.tree = new BinarySearchTree(this.treeOptions) - } - - /** - * Reset an index - * @param {?document|?document[]} [newData] Data to initialize the index with. If an error is thrown during - * insertion, the index is not modified. - */ - reset (newData) { - this.tree = new BinarySearchTree(this.treeOptions) - - if (newData) this.insert(newData) - } - - /** - * Insert a new document in the index - * If an array is passed, we insert all its elements (if one insertion fails the index is not modified) - * O(log(n)) - * @param {document|document[]} doc The document, or array of documents, to insert. - */ - insert (doc) { - let keys - let failingIndex - let error - - if (Array.isArray(doc)) { - this.insertMultipleDocs(doc) - return - } - - const key = model.getDotValues(doc, this._fields) - - // We don't index documents that don't contain the field if the index is sparse - if ((key === undefined || (typeof key === 'object' && key !== null && Object.values(key).every(el => el === undefined))) && this.sparse) return - - if (!Array.isArray(key)) this.tree.insert(key, doc) - else { - // If an insert fails due to a unique constraint, roll back all inserts before it - keys = uniq(key, projectForUnique) - - for (let i = 0; i < keys.length; i += 1) { - try { - this.tree.insert(keys[i], doc) - } catch (e) { - error = e - failingIndex = i - break - } - } - - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.tree.delete(keys[i], doc) - } - - throw error - } - } - } - - /** - * Insert an array of documents in the index - * If a constraint is violated, the changes should be rolled back and an error thrown - * @param {document[]} docs Array of documents to insert. - * @private - */ - insertMultipleDocs (docs) { - let error - let failingIndex - - for (let i = 0; i < docs.length; i += 1) { - try { - this.insert(docs[i]) - } catch (e) { - error = e - failingIndex = i - break - } - } - - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.remove(docs[i]) - } - - throw error - } - } - - /** - * Removes a document from the index. - * If an array is passed, we remove all its elements - * The remove operation is safe with regards to the 'unique' constraint - * O(log(n)) - * @param {document[]|document} doc The document, or Array of documents, to remove. - */ - remove (doc) { - if (Array.isArray(doc)) { - doc.forEach(d => { this.remove(d) }) - return - } - - const key = model.getDotValues(doc, this._fields) - if (key === undefined && this.sparse) return - - if (!Array.isArray(key)) { - this.tree.delete(key, doc) - } else { - uniq(key, projectForUnique).forEach(_key => { - this.tree.delete(_key, doc) - }) - } - } - - /** - * Update a document in the index - * If a constraint is violated, changes are rolled back and an error thrown - * Naive implementation, still in O(log(n)) - * @param {document|Array.<{oldDoc: document, newDoc: document}>} oldDoc Document to update, or an `Array` of - * `{oldDoc, newDoc}` pairs. - * @param {document} [newDoc] Document to replace the oldDoc with. If the first argument is an `Array` of - * `{oldDoc, newDoc}` pairs, this second argument is ignored. - */ - update (oldDoc, newDoc) { - if (Array.isArray(oldDoc)) { - this.updateMultipleDocs(oldDoc) - return - } - - this.remove(oldDoc) - - try { - this.insert(newDoc) - } catch (e) { - this.insert(oldDoc) - throw e - } - } - - /** - * Update multiple documents in the index - * If a constraint is violated, the changes need to be rolled back - * and an error thrown - * @param {Array.<{oldDoc: document, newDoc: document}>} pairs - * - * @private - */ - updateMultipleDocs (pairs) { - let failingIndex - let error - - for (let i = 0; i < pairs.length; i += 1) { - this.remove(pairs[i].oldDoc) - } - - for (let i = 0; i < pairs.length; i += 1) { - try { - this.insert(pairs[i].newDoc) - } catch (e) { - error = e - failingIndex = i - break - } - } - - // If an error was raised, roll back changes in the inverse order - if (error) { - for (let i = 0; i < failingIndex; i += 1) { - this.remove(pairs[i].newDoc) - } - - for (let i = 0; i < pairs.length; i += 1) { - this.insert(pairs[i].oldDoc) - } - - throw error - } - } - - /** - * Revert an update - * @param {document|Array.<{oldDoc: document, newDoc: document}>} oldDoc Document to revert to, or an `Array` of `{oldDoc, newDoc}` pairs. - * @param {document} [newDoc] Document to revert from. If the first argument is an Array of {oldDoc, newDoc}, this second argument is ignored. - */ - revertUpdate (oldDoc, newDoc) { - const revert = [] - - if (!Array.isArray(oldDoc)) this.update(newDoc, oldDoc) - else { - oldDoc.forEach(pair => { - revert.push({ oldDoc: pair.newDoc, newDoc: pair.oldDoc }) - }) - this.update(revert) - } - } - - /** - * Get all documents in index whose key match value (if it is a Thing) or one of the elements of value (if it is an array of Things) - * @param {Array.<*>|*} value Value to match the key against - * @return {document[]} - */ - getMatching (value) { - if (!Array.isArray(value)) return this.tree.search(value) - else { - const _res = {} - const res = [] - - value.forEach(v => { - this.getMatching(v).forEach(doc => { - _res[doc._id] = doc - }) - }) - - Object.keys(_res).forEach(_id => { - res.push(_res[_id]) - }) - - return res - } - } - - /** - * Get all documents in index whose key is between bounds are they are defined by query - * Documents are sorted by key - * @param {object} query An object with at least one matcher among $gt, $gte, $lt, $lte. - * @param {*} [query.$gt] Greater than matcher. - * @param {*} [query.$gte] Greater than or equal matcher. - * @param {*} [query.$lt] Lower than matcher. - * @param {*} [query.$lte] Lower than or equal matcher. - * @return {document[]} - */ - getBetweenBounds (query) { - return this.tree.betweenBounds(query) - } - - /** - * Get all elements in the index - * @return {document[]} - */ - getAll () { - const res = [] - - this.tree.executeOnEveryNode(node => { - res.push(...node.data) - }) - - return res - } -} - -// Interface -module.exports = Index diff --git a/node_modules/@seald-io/nedb/lib/model.js b/node_modules/@seald-io/nedb/lib/model.js deleted file mode 100755 index ca9fd89..0000000 --- a/node_modules/@seald-io/nedb/lib/model.js +++ /dev/null @@ -1,827 +0,0 @@ -/** - * Handle models (i.e. docs) - * Serialization/deserialization - * Copying - * Querying, update - * @module model - * @private - */ -const { uniq, isDate, isRegExp } = require('./utils.js') - -/** - * Check a key, throw an error if the key is non valid - * @param {string} k key - * @param {document} v value, needed to treat the Date edge case - * Non-treatable edge cases here: if part of the object if of the form { $$date: number } or { $$deleted: true } - * Its serialized-then-deserialized version it will transformed into a Date object - * But you really need to want it to trigger such behaviour, even when warned not to use '$' at the beginning of the field names... - * @private - */ -const checkKey = (k, v) => { - if (typeof k === 'number') k = k.toString() - - if ( - k[0] === '$' && - !(k === '$$date' && typeof v === 'number') && - !(k === '$$deleted' && v === true) && - !(k === '$$indexCreated') && - !(k === '$$indexRemoved') - ) throw new Error('Field names cannot begin with the $ character') - - if (k.indexOf('.') !== -1) throw new Error('Field names cannot contain a .') -} - -/** - * Check a DB object and throw an error if it's not valid - * Works by applying the above checkKey function to all fields recursively - * @param {document|document[]} obj - * @alias module:model.checkObject - */ -const checkObject = obj => { - if (Array.isArray(obj)) { - obj.forEach(o => { - checkObject(o) - }) - } - - if (typeof obj === 'object' && obj !== null) { - for (const k in obj) { - if (Object.prototype.hasOwnProperty.call(obj, k)) { - checkKey(k, obj[k]) - checkObject(obj[k]) - } - } - } -} - -/** - * Serialize an object to be persisted to a one-line string - * For serialization/deserialization, we use the native JSON parser and not eval or Function - * That gives us less freedom but data entered in the database may come from users - * so eval and the like are not safe - * Accepted primitive types: Number, String, Boolean, Date, null - * Accepted secondary types: Objects, Arrays - * @param {document} obj - * @return {string} - * @alias module:model.serialize - */ -const serialize = obj => { - return JSON.stringify(obj, function (k, v) { - checkKey(k, v) - - if (v === undefined) return undefined - if (v === null) return null - - // Hackish way of checking if object is Date (this way it works between execution contexts in node-webkit). - // We can't use value directly because for dates it is already string in this function (date.toJSON was already called), so we use this - if (typeof this[k].getTime === 'function') return { $$date: this[k].getTime() } - - return v - }) -} - -/** - * From a one-line representation of an object generate by the serialize function - * Return the object itself - * @param {string} rawData - * @return {document} - * @alias module:model.deserialize - */ -const deserialize = rawData => JSON.parse(rawData, function (k, v) { - if (k === '$$date') return new Date(v) - if ( - typeof v === 'string' || - typeof v === 'number' || - typeof v === 'boolean' || - v === null - ) return v - if (v && v.$$date) return v.$$date - - return v -}) - -/** - * Deep copy a DB object - * The optional strictKeys flag (defaulting to false) indicates whether to copy everything or only fields - * where the keys are valid, i.e. don't begin with $ and don't contain a . - * @param {?document} obj - * @param {boolean} [strictKeys=false] - * @return {?document} - * @alias module:modelel:(.*) - */ -function deepCopy (obj, strictKeys) { - if ( - typeof obj === 'boolean' || - typeof obj === 'number' || - typeof obj === 'string' || - obj === null || - (isDate(obj)) - ) return obj - - if (Array.isArray(obj)) return obj.map(o => deepCopy(o, strictKeys)) - - if (typeof obj === 'object') { - const res = {} - for (const k in obj) { - if ( - Object.prototype.hasOwnProperty.call(obj, k) && - (!strictKeys || (k[0] !== '$' && k.indexOf('.') === -1)) - ) { - res[k] = deepCopy(obj[k], strictKeys) - } - } - return res - } - - return undefined // For now everything else is undefined. We should probably throw an error instead -} - -/** - * Tells if an object is a primitive type or a "real" object - * Arrays are considered primitive - * @param {*} obj - * @return {boolean} - * @alias module:modelel:(.*) - */ -const isPrimitiveType = obj => ( - typeof obj === 'boolean' || - typeof obj === 'number' || - typeof obj === 'string' || - obj === null || - isDate(obj) || - Array.isArray(obj) -) - -/** - * Utility functions for comparing things - * Assumes type checking was already done (a and b already have the same type) - * compareNSB works for numbers, strings and booleans - * @param {number|string|boolean} a - * @param {number|string|boolean} b - * @return {number} 0 if a == b, 1 i a > b, -1 if a < b - * @private - */ -const compareNSB = (a, b) => { - if (a < b) return -1 - if (a > b) return 1 - return 0 -} - -/** - * Utility function for comparing array - * Assumes type checking was already done (a and b already have the same type) - * compareNSB works for numbers, strings and booleans - * @param {Array} a - * @param {Array} b - * @return {number} 0 if arrays have the same length and all elements equal one another. Else either 1 or -1. - * @private - */ -const compareArrays = (a, b) => { - const minLength = Math.min(a.length, b.length) - for (let i = 0; i < minLength; i += 1) { - const comp = compareThings(a[i], b[i]) - - if (comp !== 0) return comp - } - - // Common section was identical, longest one wins - return compareNSB(a.length, b.length) -} - -/** - * Compare { things U undefined } - * Things are defined as any native types (string, number, boolean, null, date) and objects - * We need to compare with undefined as it will be used in indexes - * In the case of objects and arrays, we deep-compare - * If two objects dont have the same type, the (arbitrary) type hierarchy is: undefined, null, number, strings, boolean, dates, arrays, objects - * Return -1 if a < b, 1 if a > b and 0 if a = b (note that equality here is NOT the same as defined in areThingsEqual!) - * @param {*} a - * @param {*} b - * @param {compareStrings} [_compareStrings] String comparing function, returning -1, 0 or 1, overriding default string comparison (useful for languages with accented letters) - * @return {number} - * @alias module:model.compareThings - */ -const compareThings = (a, b, _compareStrings) => { - const compareStrings = _compareStrings || compareNSB - - // undefined - if (a === undefined) return b === undefined ? 0 : -1 - if (b === undefined) return 1 // no need to test if a === undefined - - // null - if (a === null) return b === null ? 0 : -1 - if (b === null) return 1 // no need to test if a === null - - // Numbers - if (typeof a === 'number') return typeof b === 'number' ? compareNSB(a, b) : -1 - if (typeof b === 'number') return typeof a === 'number' ? compareNSB(a, b) : 1 - - // Strings - if (typeof a === 'string') return typeof b === 'string' ? compareStrings(a, b) : -1 - if (typeof b === 'string') return typeof a === 'string' ? compareStrings(a, b) : 1 - - // Booleans - if (typeof a === 'boolean') return typeof b === 'boolean' ? compareNSB(a, b) : -1 - if (typeof b === 'boolean') return typeof a === 'boolean' ? compareNSB(a, b) : 1 - - // Dates - if (isDate(a)) return isDate(b) ? compareNSB(a.getTime(), b.getTime()) : -1 - if (isDate(b)) return isDate(a) ? compareNSB(a.getTime(), b.getTime()) : 1 - - // Arrays (first element is most significant and so on) - if (Array.isArray(a)) return Array.isArray(b) ? compareArrays(a, b) : -1 - if (Array.isArray(b)) return Array.isArray(a) ? compareArrays(a, b) : 1 - - // Objects - const aKeys = Object.keys(a).sort() - const bKeys = Object.keys(b).sort() - - for (let i = 0; i < Math.min(aKeys.length, bKeys.length); i += 1) { - const comp = compareThings(a[aKeys[i]], b[bKeys[i]]) - - if (comp !== 0) return comp - } - - return compareNSB(aKeys.length, bKeys.length) -} - -// ============================================================== -// Updating documents -// ============================================================== - -/** - * @callback modifierFunction - * The signature of modifier functions is as follows - * Their structure is always the same: recursively follow the dot notation while creating - * the nested documents if needed, then apply the "last step modifier" - * @param {Object} obj The model to modify - * @param {String} field Can contain dots, in that case that means we will set a subfield recursively - * @param {document} value - */ - -/** - * Create the complete modifier function - * @param {modifierFunction} lastStepModifierFunction a lastStepModifierFunction - * @param {boolean} [unset = false] Bad looking specific fix, needs to be generalized modifiers that behave like $unset are implemented - * @return {modifierFunction} - * @private - */ -const createModifierFunction = (lastStepModifierFunction, unset = false) => (obj, field, value) => { - const func = (obj, field, value) => { - const fieldParts = typeof field === 'string' ? field.split('.') : field - - if (fieldParts.length === 1) lastStepModifierFunction(obj, field, value) - else { - if (obj[fieldParts[0]] === undefined) { - if (unset) return - obj[fieldParts[0]] = {} - } - func(obj[fieldParts[0]], fieldParts.slice(1), value) - } - } - return func(obj, field, value) -} - -const $addToSetPartial = (obj, field, value) => { - // Create the array if it doesn't exist - if (!Object.prototype.hasOwnProperty.call(obj, field)) { obj[field] = [] } - - if (!Array.isArray(obj[field])) throw new Error('Can\'t $addToSet an element on non-array values') - - if (value !== null && typeof value === 'object' && value.$each) { - if (Object.keys(value).length > 1) throw new Error('Can\'t use another field in conjunction with $each') - if (!Array.isArray(value.$each)) throw new Error('$each requires an array value') - - value.$each.forEach(v => { - $addToSetPartial(obj, field, v) - }) - } else { - let addToSet = true - obj[field].forEach(v => { - if (compareThings(v, value) === 0) addToSet = false - }) - if (addToSet) obj[field].push(value) - } -} - -/** - * @enum {modifierFunction} - */ -const modifierFunctions = { - /** - * Set a field to a new value - */ - $set: createModifierFunction((obj, field, value) => { - obj[field] = value - }), - /** - * Unset a field - */ - $unset: createModifierFunction((obj, field, value) => { - delete obj[field] - }, true), - /** - * Updates the value of the field, only if specified field is smaller than the current value of the field - */ - $min: createModifierFunction((obj, field, value) => { - if (typeof obj[field] === 'undefined') obj[field] = value - else if (value < obj[field]) obj[field] = value - }), - /** - * Updates the value of the field, only if specified field is greater than the current value of the field - */ - $max: createModifierFunction((obj, field, value) => { - if (typeof obj[field] === 'undefined') obj[field] = value - else if (value > obj[field]) obj[field] = value - }), - /** - * Increment a numeric field's value - */ - $inc: createModifierFunction((obj, field, value) => { - if (typeof value !== 'number') throw new Error(`${value} must be a number`) - - if (typeof obj[field] !== 'number') { - if (!Object.prototype.hasOwnProperty.call(obj, field)) obj[field] = value - else throw new Error('Don\'t use the $inc modifier on non-number fields') - } else obj[field] += value - }), - /** - * Removes all instances of a value from an existing array - */ - $pull: createModifierFunction((obj, field, value) => { - if (!Array.isArray(obj[field])) throw new Error('Can\'t $pull an element from non-array values') - - const arr = obj[field] - for (let i = arr.length - 1; i >= 0; i -= 1) { - if (match(arr[i], value)) arr.splice(i, 1) - } - }), - /** - * Remove the first or last element of an array - */ - $pop: createModifierFunction((obj, field, value) => { - if (!Array.isArray(obj[field])) throw new Error('Can\'t $pop an element from non-array values') - if (typeof value !== 'number') throw new Error(`${value} isn't an integer, can't use it with $pop`) - if (value === 0) return - - if (value > 0) obj[field] = obj[field].slice(0, obj[field].length - 1) - else obj[field] = obj[field].slice(1) - }), - /** - * Add an element to an array field only if it is not already in it - * No modification if the element is already in the array - * Note that it doesn't check whether the original array contains duplicates - */ - $addToSet: createModifierFunction($addToSetPartial), - /** - * Push an element to the end of an array field - * Optional modifier $each instead of value to push several values - * Optional modifier $slice to slice the resulting array, see https://docs.mongodb.org/manual/reference/operator/update/slice/ - * Difference with MongoDB: if $slice is specified and not $each, we act as if value is an empty array - */ - $push: createModifierFunction((obj, field, value) => { - // Create the array if it doesn't exist - if (!Object.prototype.hasOwnProperty.call(obj, field)) obj[field] = [] - - if (!Array.isArray(obj[field])) throw new Error('Can\'t $push an element on non-array values') - - if ( - value !== null && - typeof value === 'object' && - value.$slice && - value.$each === undefined - ) value.$each = [] - - if (value !== null && typeof value === 'object' && value.$each) { - if ( - Object.keys(value).length >= 3 || - (Object.keys(value).length === 2 && value.$slice === undefined) - ) throw new Error('Can only use $slice in cunjunction with $each when $push to array') - if (!Array.isArray(value.$each)) throw new Error('$each requires an array value') - - value.$each.forEach(v => { - obj[field].push(v) - }) - - if (value.$slice === undefined || typeof value.$slice !== 'number') return - - if (value.$slice === 0) obj[field] = [] - else { - let start - let end - const n = obj[field].length - if (value.$slice < 0) { - start = Math.max(0, n + value.$slice) - end = n - } else if (value.$slice > 0) { - start = 0 - end = Math.min(n, value.$slice) - } - obj[field] = obj[field].slice(start, end) - } - } else { - obj[field].push(value) - } - }) - -} - -/** - * Modify a DB object according to an update query - * @param {document} obj - * @param {query} updateQuery - * @return {document} - * @alias module:model.modify - */ -const modify = (obj, updateQuery) => { - const keys = Object.keys(updateQuery) - const firstChars = keys.map(item => item[0]) - const dollarFirstChars = firstChars.filter(c => c === '$') - let newDoc - let modifiers - - if (keys.indexOf('_id') !== -1 && updateQuery._id !== obj._id) throw new Error('You cannot change a document\'s _id') - - if (dollarFirstChars.length !== 0 && dollarFirstChars.length !== firstChars.length) throw new Error('You cannot mix modifiers and normal fields') - - if (dollarFirstChars.length === 0) { - // Simply replace the object with the update query contents - newDoc = deepCopy(updateQuery) - newDoc._id = obj._id - } else { - // Apply modifiers - modifiers = uniq(keys) - newDoc = deepCopy(obj) - modifiers.forEach(m => { - if (!modifierFunctions[m]) throw new Error(`Unknown modifier ${m}`) - - // Can't rely on Object.keys throwing on non objects since ES6 - // Not 100% satisfying as non objects can be interpreted as objects but no false negatives so we can live with it - if (typeof updateQuery[m] !== 'object') throw new Error(`Modifier ${m}'s argument must be an object`) - - const keys = Object.keys(updateQuery[m]) - keys.forEach(k => { - modifierFunctions[m](newDoc, k, updateQuery[m][k]) - }) - }) - } - - // Check result is valid and return it - checkObject(newDoc) - - if (obj._id !== newDoc._id) throw new Error('You can\'t change a document\'s _id') - return newDoc -} - -// ============================================================== -// Finding documents -// ============================================================== - -/** - * Get a value from object with dot notation - * @param {object} obj - * @param {string} field - * @return {*} - * @alias module:model.getDotValue - */ -const getDotValue = (obj, field) => { - const fieldParts = typeof field === 'string' ? field.split('.') : field - - if (!obj) return undefined // field cannot be empty so that means we should return undefined so that nothing can match - - if (fieldParts.length === 0) return obj - - if (fieldParts.length === 1) return obj[fieldParts[0]] - - if (Array.isArray(obj[fieldParts[0]])) { - // If the next field is an integer, return only this item of the array - const i = parseInt(fieldParts[1], 10) - if (typeof i === 'number' && !isNaN(i)) return getDotValue(obj[fieldParts[0]][i], fieldParts.slice(2)) - - // Return the array of values - return obj[fieldParts[0]].map(el => getDotValue(el, fieldParts.slice(1))) - } else return getDotValue(obj[fieldParts[0]], fieldParts.slice(1)) -} - -/** - * Get dot values for either a bunch of fields or just one. - */ -const getDotValues = (obj, fields) => { - if (!Array.isArray(fields)) throw new Error('fields must be an Array') - if (fields.length > 1) { - const key = {} - for (const field of fields) { - key[field] = getDotValue(obj, field) - } - return key - } else return getDotValue(obj, fields[0]) -} - -/** - * Check whether 'things' are equal - * Things are defined as any native types (string, number, boolean, null, date) and objects - * In the case of object, we check deep equality - * Returns true if they are, false otherwise - * @param {*} a - * @param {*} a - * @return {boolean} - * @alias module:model.areThingsEqual - */ -const areThingsEqual = (a, b) => { - // Strings, booleans, numbers, null - if ( - a === null || - typeof a === 'string' || - typeof a === 'boolean' || - typeof a === 'number' || - b === null || - typeof b === 'string' || - typeof b === 'boolean' || - typeof b === 'number' - ) return a === b - - // Dates - if (isDate(a) || isDate(b)) return isDate(a) && isDate(b) && a.getTime() === b.getTime() - - // Arrays (no match since arrays are used as a $in) - // undefined (no match since they mean field doesn't exist and can't be serialized) - if ( - (!(Array.isArray(a) && Array.isArray(b)) && (Array.isArray(a) || Array.isArray(b))) || - a === undefined || b === undefined - ) return false - - // General objects (check for deep equality) - // a and b should be objects at this point - let aKeys - let bKeys - try { - aKeys = Object.keys(a) - bKeys = Object.keys(b) - } catch (e) { - return false - } - - if (aKeys.length !== bKeys.length) return false - for (const el of aKeys) { - if (bKeys.indexOf(el) === -1) return false - if (!areThingsEqual(a[el], b[el])) return false - } - return true -} - -/** - * Check that two values are comparable - * @param {*} a - * @param {*} a - * @return {boolean} - * @private - */ -const areComparable = (a, b) => { - if ( - typeof a !== 'string' && - typeof a !== 'number' && - !isDate(a) && - typeof b !== 'string' && - typeof b !== 'number' && - !isDate(b) - ) return false - - if (typeof a !== typeof b) return false - - return true -} - -/** - * @callback comparisonOperator - * Arithmetic and comparison operators - * @param {*} a Value in the object - * @param {*} b Value in the query - * @return {boolean} - */ - -/** - * @enum {comparisonOperator} - */ -const comparisonFunctions = { - /** Lower than */ - $lt: (a, b) => areComparable(a, b) && a < b, - /** Lower than or equals */ - $lte: (a, b) => areComparable(a, b) && a <= b, - /** Greater than */ - $gt: (a, b) => areComparable(a, b) && a > b, - /** Greater than or equals */ - $gte: (a, b) => areComparable(a, b) && a >= b, - /** Does not equal */ - $ne: (a, b) => a === undefined || !areThingsEqual(a, b), - /** Is in Array */ - $in: (a, b) => { - if (!Array.isArray(b)) throw new Error('$in operator called with a non-array') - - for (const el of b) { - if (areThingsEqual(a, el)) return true - } - - return false - }, - /** Is not in Array */ - $nin: (a, b) => { - if (!Array.isArray(b)) throw new Error('$nin operator called with a non-array') - - return !comparisonFunctions.$in(a, b) - }, - /** Matches Regexp */ - $regex: (a, b) => { - if (!isRegExp(b)) throw new Error('$regex operator called with non regular expression') - - if (typeof a !== 'string') return false - else return b.test(a) - }, - /** Returns true if field exists */ - $exists: (a, b) => { - // This will be true for all values of stat except false, null, undefined and 0 - // That's strange behaviour (we should only use true/false) but that's the way Mongo does it... - if (b || b === '') b = true - else b = false - - if (a === undefined) return !b - else return b - }, - /** Specific to Arrays, returns true if a length equals b */ - $size: (a, b) => { - if (!Array.isArray(a)) return false - if (b % 1 !== 0) throw new Error('$size operator called without an integer') - - return a.length === b - }, - /** Specific to Arrays, returns true if some elements of a match the query b */ - $elemMatch: (a, b) => { - if (!Array.isArray(a)) return false - return a.some(el => match(el, b)) - } -} - -const arrayComparisonFunctions = { $size: true, $elemMatch: true } - -/** - * @enum - */ -const logicalOperators = { - /** - * Match any of the subqueries - * @param {document} obj - * @param {query[]} query - * @return {boolean} - */ - $or: (obj, query) => { - if (!Array.isArray(query)) throw new Error('$or operator used without an array') - - for (let i = 0; i < query.length; i += 1) { - if (match(obj, query[i])) return true - } - - return false - }, - /** - * Match all of the subqueries - * @param {document} obj - * @param {query[]} query - * @return {boolean} - */ - $and: (obj, query) => { - if (!Array.isArray(query)) throw new Error('$and operator used without an array') - - for (let i = 0; i < query.length; i += 1) { - if (!match(obj, query[i])) return false - } - - return true - }, - /** - * Inverted match of the query - * @param {document} obj - * @param {query} query - * @return {boolean} - */ - $not: (obj, query) => !match(obj, query), - - /** - * @callback whereCallback - * @param {document} obj - * @return {boolean} - */ - - /** - * Use a function to match - * @param {document} obj - * @param {whereCallback} fn - * @return {boolean} - */ - $where: (obj, fn) => { - if (typeof fn !== 'function') throw new Error('$where operator used without a function') - - const result = fn.call(obj) - if (typeof result !== 'boolean') throw new Error('$where function must return boolean') - - return result - } -} - -/** - * Tell if a given document matches a query - * @param {document} obj Document to check - * @param {query} query - * @return {boolean} - * @alias module:model.match - */ -const match = (obj, query) => { - // Primitive query against a primitive type - // This is a bit of a hack since we construct an object with an arbitrary key only to dereference it later - // But I don't have time for a cleaner implementation now - if (isPrimitiveType(obj) || isPrimitiveType(query)) return matchQueryPart({ needAKey: obj }, 'needAKey', query) - - // Normal query - for (const queryKey in query) { - if (Object.prototype.hasOwnProperty.call(query, queryKey)) { - const queryValue = query[queryKey] - if (queryKey[0] === '$') { - if (!logicalOperators[queryKey]) throw new Error(`Unknown logical operator ${queryKey}`) - if (!logicalOperators[queryKey](obj, queryValue)) return false - } else if (!matchQueryPart(obj, queryKey, queryValue)) return false - } - } - - return true -} - -/** - * Match an object against a specific { key: value } part of a query - * if the treatObjAsValue flag is set, don't try to match every part separately, but the array as a whole - * @param {object} obj - * @param {string} queryKey - * @param {*} queryValue - * @param {boolean} [treatObjAsValue=false] - * @return {boolean} - * @private - */ -function matchQueryPart (obj, queryKey, queryValue, treatObjAsValue) { - const objValue = getDotValue(obj, queryKey) - - // Check if the value is an array if we don't force a treatment as value - if (Array.isArray(objValue) && !treatObjAsValue) { - // If the queryValue is an array, try to perform an exact match - if (Array.isArray(queryValue)) return matchQueryPart(obj, queryKey, queryValue, true) - - // Check if we are using an array-specific comparison function - if (queryValue !== null && typeof queryValue === 'object' && !isRegExp(queryValue)) { - for (const key in queryValue) { - if (Object.prototype.hasOwnProperty.call(queryValue, key) && arrayComparisonFunctions[key]) { return matchQueryPart(obj, queryKey, queryValue, true) } - } - } - - // If not, treat it as an array of { obj, query } where there needs to be at least one match - for (const el of objValue) { - if (matchQueryPart({ k: el }, 'k', queryValue)) return true // k here could be any string - } - return false - } - - // queryValue is an actual object. Determine whether it contains comparison operators - // or only normal fields. Mixed objects are not allowed - if (queryValue !== null && typeof queryValue === 'object' && !isRegExp(queryValue) && !Array.isArray(queryValue)) { - const keys = Object.keys(queryValue) - const firstChars = keys.map(item => item[0]) - const dollarFirstChars = firstChars.filter(c => c === '$') - - if (dollarFirstChars.length !== 0 && dollarFirstChars.length !== firstChars.length) throw new Error('You cannot mix operators and normal fields') - - // queryValue is an object of this form: { $comparisonOperator1: value1, ... } - if (dollarFirstChars.length > 0) { - for (const key of keys) { - if (!comparisonFunctions[key]) throw new Error(`Unknown comparison function ${key}`) - - if (!comparisonFunctions[key](objValue, queryValue[key])) return false - } - return true - } - } - - // Using regular expressions with basic querying - if (isRegExp(queryValue)) return comparisonFunctions.$regex(objValue, queryValue) - - // queryValue is either a native value or a normal object - // Basic matching is possible - return areThingsEqual(objValue, queryValue) -} - -// Interface -module.exports.serialize = serialize -module.exports.deserialize = deserialize -module.exports.deepCopy = deepCopy -module.exports.checkObject = checkObject -module.exports.isPrimitiveType = isPrimitiveType -module.exports.modify = modify -module.exports.getDotValue = getDotValue -module.exports.getDotValues = getDotValues -module.exports.match = match -module.exports.areThingsEqual = areThingsEqual -module.exports.compareThings = compareThings diff --git a/node_modules/@seald-io/nedb/lib/persistence.js b/node_modules/@seald-io/nedb/lib/persistence.js deleted file mode 100755 index f8c7c16..0000000 --- a/node_modules/@seald-io/nedb/lib/persistence.js +++ /dev/null @@ -1,380 +0,0 @@ -const { deprecate } = require('util') -const byline = require('./byline') -const customUtils = require('./customUtils.js') -const Index = require('./indexes.js') -const model = require('./model.js') -const storage = require('./storage.js') - -const DEFAULT_DIR_MODE = 0o755 -const DEFAULT_FILE_MODE = 0o644 - -/** - * Under the hood, NeDB's persistence uses an append-only format, meaning that all - * updates and deletes actually result in lines added at the end of the datafile, - * for performance reasons. The database is automatically compacted (i.e. put back - * in the one-line-per-document format) every time you load each database within - * your application. - * - * Persistence handles the compaction exposed in the Datastore {@link Datastore#compactDatafileAsync}, - * {@link Datastore#setAutocompactionInterval}. - * - * Since version 3.0.0, using {@link Datastore.persistence} methods manually is deprecated. - * - * Compaction takes a bit of time (not too much: 130ms for 50k - * records on a typical development machine) and no other operation can happen when - * it does, so most projects actually don't need to use it. - * - * Compaction will also immediately remove any documents whose data line has become - * corrupted, assuming that the total percentage of all corrupted documents in that - * database still falls below the specified `corruptAlertThreshold` option's value. - * - * Durability works similarly to major databases: compaction forces the OS to - * physically flush data to disk, while appends to the data file do not (the OS is - * responsible for flushing the data). That guarantees that a server crash can - * never cause complete data loss, while preserving performance. The worst that can - * happen is a crash between two syncs, causing a loss of all data between the two - * syncs. Usually syncs are 30 seconds appart so that's at most 30 seconds of - * data. [This post by Antirez on Redis persistence](http://oldblog.antirez.com/post/redis-persistence-demystified.html) - * explains this in more details, NeDB being very close to Redis AOF persistence - * with `appendfsync` option set to `no`. - */ -class Persistence { - /** - * Create a new Persistence object for database options.db - * @param {Datastore} options.db - * @param {Number} [options.corruptAlertThreshold] Optional, threshold after which an alert is thrown if too much data is corrupt - * @param {serializationHook} [options.beforeDeserialization] Hook you can use to transform data after it was serialized and before it is written to disk. - * @param {serializationHook} [options.afterSerialization] Inverse of `afterSerialization`. - * @param {object} [options.modes] Modes to use for FS permissions. Will not work on Windows. - * @param {number} [options.modes.fileMode=0o644] Mode to use for files. - * @param {number} [options.modes.dirMode=0o755] Mode to use for directories. - * @param {boolean} [options.testSerializationHooks=true] Whether to test the serialization hooks or not, might be CPU-intensive - */ - constructor (options) { - this.db = options.db - this.inMemoryOnly = this.db.inMemoryOnly - this.filename = this.db.filename - this.corruptAlertThreshold = options.corruptAlertThreshold !== undefined ? options.corruptAlertThreshold : 0.1 - this.modes = options.modes !== undefined ? options.modes : { fileMode: DEFAULT_FILE_MODE, dirMode: DEFAULT_DIR_MODE } - if (this.modes.fileMode === undefined) this.modes.fileMode = DEFAULT_FILE_MODE - if (this.modes.dirMode === undefined) this.modes.dirMode = DEFAULT_DIR_MODE - if ( - !this.inMemoryOnly && - this.filename && - this.filename.charAt(this.filename.length - 1) === '~' - ) throw new Error('The datafile name can\'t end with a ~, which is reserved for crash safe backup files') - - // After serialization and before deserialization hooks with some basic sanity checks - if ( - options.afterSerialization && - !options.beforeDeserialization - ) throw new Error('Serialization hook defined but deserialization hook undefined, cautiously refusing to start NeDB to prevent dataloss') - if ( - !options.afterSerialization && - options.beforeDeserialization - ) throw new Error('Serialization hook undefined but deserialization hook defined, cautiously refusing to start NeDB to prevent dataloss') - - this.afterSerialization = options.afterSerialization || (s => s) - this.beforeDeserialization = options.beforeDeserialization || (s => s) - - if (options.testSerializationHooks === undefined || options.testSerializationHooks) { - for (let i = 1; i < 30; i += 1) { - for (let j = 0; j < 10; j += 1) { - const randomString = customUtils.uid(i) - if (this.beforeDeserialization(this.afterSerialization(randomString)) !== randomString) { - throw new Error('beforeDeserialization is not the reverse of afterSerialization, cautiously refusing to start NeDB to prevent dataloss') - } - } - } - } - } - - /** - * Internal version without using the {@link Datastore#executor} of {@link Datastore#compactDatafileAsync}, use it instead. - * @return {Promise} - * @private - */ - async persistCachedDatabaseAsync () { - const lines = [] - - if (this.inMemoryOnly) return - - this.db.getAllData().forEach(doc => { - lines.push(this.afterSerialization(model.serialize(doc))) - }) - Object.keys(this.db.indexes).forEach(fieldName => { - if (fieldName !== '_id') { // The special _id index is managed by datastore.js, the others need to be persisted - lines.push(this.afterSerialization(model.serialize({ - $$indexCreated: { - fieldName: this.db.indexes[fieldName].fieldName, - unique: this.db.indexes[fieldName].unique, - sparse: this.db.indexes[fieldName].sparse - } - }))) - } - }) - - await storage.crashSafeWriteFileLinesAsync(this.filename, lines, this.modes) - this.db.emit('compaction.done') - } - - /** - * @see Datastore#compactDatafile - * @deprecated - * @param {NoParamCallback} [callback = () => {}] - * @see Persistence#compactDatafileAsync - */ - compactDatafile (callback) { - deprecate(_callback => this.db.compactDatafile(_callback), '@seald-io/nedb: calling Datastore#persistence#compactDatafile is deprecated, please use Datastore#compactDatafile, it will be removed in the next major version.')(callback) - } - - /** - * @see Datastore#setAutocompactionInterval - * @deprecated - */ - setAutocompactionInterval (interval) { - deprecate(_interval => this.db.setAutocompactionInterval(_interval), '@seald-io/nedb: calling Datastore#persistence#setAutocompactionInterval is deprecated, please use Datastore#setAutocompactionInterval, it will be removed in the next major version.')(interval) - } - - /** - * @see Datastore#stopAutocompaction - * @deprecated - */ - stopAutocompaction () { - deprecate(() => this.db.stopAutocompaction(), '@seald-io/nedb: calling Datastore#persistence#stopAutocompaction is deprecated, please use Datastore#stopAutocompaction, it will be removed in the next major version.')() - } - - /** - * Persist new state for the given newDocs (can be insertion, update or removal) - * Use an append-only format - * - * Do not use directly, it should only used by a {@link Datastore} instance. - * @param {document[]} newDocs Can be empty if no doc was updated/removed - * @return {Promise} - * @private - */ - async persistNewStateAsync (newDocs) { - let toPersist = '' - - // In-memory only datastore - if (this.inMemoryOnly) return - - newDocs.forEach(doc => { - toPersist += this.afterSerialization(model.serialize(doc)) + '\n' - }) - - if (toPersist.length === 0) return - - await storage.appendFileAsync(this.filename, toPersist, { encoding: 'utf8', mode: this.modes.fileMode }) - } - - /** - * @typedef rawIndex - * @property {string} fieldName - * @property {boolean} [unique] - * @property {boolean} [sparse] - */ - - /** - * From a database's raw data, return the corresponding machine understandable collection. - * - * Do not use directly, it should only used by a {@link Datastore} instance. - * @param {string} rawData database file - * @return {{data: document[], indexes: Object.}} - * @private - */ - treatRawData (rawData) { - const data = rawData.split('\n') - const dataById = {} - const indexes = {} - let dataLength = data.length - - // Last line of every data file is usually blank so not really corrupt - let corruptItems = 0 - - for (const datum of data) { - if (datum === '') { dataLength--; continue } - try { - const doc = model.deserialize(this.beforeDeserialization(datum)) - if (doc._id) { - if (doc.$$deleted === true) delete dataById[doc._id] - else dataById[doc._id] = doc - } else if (doc.$$indexCreated && doc.$$indexCreated.fieldName != null) indexes[doc.$$indexCreated.fieldName] = doc.$$indexCreated - else if (typeof doc.$$indexRemoved === 'string') delete indexes[doc.$$indexRemoved] - } catch (e) { - corruptItems += 1 - } - } - - // A bit lenient on corruption - if (dataLength > 0) { - const corruptionRate = corruptItems / dataLength - if (corruptionRate > this.corruptAlertThreshold) { - const error = new Error(`${Math.floor(100 * corruptionRate)}% of the data file is corrupt, more than given corruptAlertThreshold (${Math.floor(100 * this.corruptAlertThreshold)}%). Cautiously refusing to start NeDB to prevent dataloss.`) - error.corruptionRate = corruptionRate - error.corruptItems = corruptItems - error.dataLength = dataLength - throw error - } - } - - const tdata = Object.values(dataById) - - return { data: tdata, indexes } - } - - /** - * From a database's raw data stream, return the corresponding machine understandable collection - * Is only used by a {@link Datastore} instance. - * - * Is only used in the Node.js version, since [React-Native]{@link module:storageReactNative} & - * [browser]{@link module:storageBrowser} storage modules don't provide an equivalent of - * {@link module:storage.readFileStream}. - * - * Do not use directly, it should only used by a {@link Datastore} instance. - * @param {Readable} rawStream - * @return {Promise<{data: document[], indexes: Object.}>} - * @async - * @private - */ - treatRawStreamAsync (rawStream) { - return new Promise((resolve, reject) => { - const dataById = {} - - const indexes = {} - - let corruptItems = 0 - - const lineStream = byline(rawStream) - let dataLength = 0 - - lineStream.on('data', (line) => { - if (line === '') return - try { - const doc = model.deserialize(this.beforeDeserialization(line)) - if (doc._id) { - if (doc.$$deleted === true) delete dataById[doc._id] - else dataById[doc._id] = doc - } else if (doc.$$indexCreated && doc.$$indexCreated.fieldName != null) indexes[doc.$$indexCreated.fieldName] = doc.$$indexCreated - else if (typeof doc.$$indexRemoved === 'string') delete indexes[doc.$$indexRemoved] - } catch (e) { - corruptItems += 1 - } - - dataLength++ - }) - - lineStream.on('end', () => { - // A bit lenient on corruption - if (dataLength > 0) { - const corruptionRate = corruptItems / dataLength - if (corruptionRate > this.corruptAlertThreshold) { - const error = new Error(`${Math.floor(100 * corruptionRate)}% of the data file is corrupt, more than given corruptAlertThreshold (${Math.floor(100 * this.corruptAlertThreshold)}%). Cautiously refusing to start NeDB to prevent dataloss.`) - error.corruptionRate = corruptionRate - error.corruptItems = corruptItems - error.dataLength = dataLength - reject(error, null) - return - } - } - const data = Object.values(dataById) - - resolve({ data, indexes }) - }) - - lineStream.on('error', function (err) { - reject(err, null) - }) - }) - } - - /** - * Load the database - * 1) Create all indexes - * 2) Insert all data - * 3) Compact the database - * - * This means pulling data out of the data file or creating it if it doesn't exist - * Also, all data is persisted right away, which has the effect of compacting the database file - * This operation is very quick at startup for a big collection (60ms for ~10k docs) - * - * Do not use directly as it does not use the [Executor]{@link Datastore.executor}, use {@link Datastore#loadDatabaseAsync} instead. - * @return {Promise} - * @private - */ - async loadDatabaseAsync () { - this.db._resetIndexes() - - // In-memory only datastore - if (this.inMemoryOnly) return - await Persistence.ensureParentDirectoryExistsAsync(this.filename, this.modes.dirMode) - await storage.ensureDatafileIntegrityAsync(this.filename, this.modes.fileMode) - - let treatedData - if (storage.readFileStream) { - // Server side - const fileStream = storage.readFileStream(this.filename, { encoding: 'utf8', mode: this.modes.fileMode }) - treatedData = await this.treatRawStreamAsync(fileStream) - } else { - // Browser - const rawData = await storage.readFileAsync(this.filename, { encoding: 'utf8', mode: this.modes.fileMode }) - treatedData = this.treatRawData(rawData) - } - // Recreate all indexes in the datafile - Object.keys(treatedData.indexes).forEach(key => { - this.db.indexes[key] = new Index(treatedData.indexes[key]) - }) - - // Fill cached database (i.e. all indexes) with data - try { - this.db._resetIndexes(treatedData.data) - } catch (e) { - this.db._resetIndexes() // Rollback any index which didn't fail - throw e - } - - await this.db.persistence.persistCachedDatabaseAsync() - this.db.executor.processBuffer() - } - - /** - * See {@link Datastore#dropDatabaseAsync}. This function uses {@link Datastore#executor} internally. Decorating this - * function with an {@link Executor#pushAsync} will result in a deadlock. - * @return {Promise} - * @private - * @see Datastore#dropDatabaseAsync - */ - async dropDatabaseAsync () { - this.db.stopAutocompaction() // stop autocompaction - this.db.executor.ready = false // prevent queuing new tasks - this.db.executor.resetBuffer() // remove pending buffered tasks - await this.db.executor.queue.guardian // wait for the ongoing tasks to end - // remove indexes (which means remove data from memory) - this.db.indexes = {} - // add back _id index, otherwise it will fail - this.db.indexes._id = new Index({ fieldName: '_id', unique: true }) - // reset TTL on indexes - this.db.ttlIndexes = {} - - // remove datastore file - if (!this.db.inMemoryOnly) { - await this.db.executor.pushAsync(async () => { - if (await storage.existsAsync(this.filename)) await storage.unlinkAsync(this.filename) - }, true) - } - } - - /** - * Check if a directory stat and create it on the fly if it is not the case. - * @param {string} dir - * @param {number} [mode=0o777] - * @return {Promise} - * @private - */ - static async ensureParentDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) { - return storage.ensureParentDirectoryExistsAsync(dir, mode) - } -} - -// Interface -module.exports = Persistence diff --git a/node_modules/@seald-io/nedb/lib/storage.js b/node_modules/@seald-io/nedb/lib/storage.js deleted file mode 100755 index c8fec6d..0000000 --- a/node_modules/@seald-io/nedb/lib/storage.js +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Way data is stored for this database. - * This version is the Node.js version. - * It's essentially fs, mkdirp and crash safe write and read functions. - * - * @see module:storageBrowser - * @see module:storageReactNative - * @module storage - * @private - */ -const fs = require('fs') -const fsPromises = fs.promises -const path = require('path') -const { Readable } = require('stream') - -const DEFAULT_DIR_MODE = 0o755 -const DEFAULT_FILE_MODE = 0o644 - -/** - * Returns true if file exists. - * @param {string} file - * @return {Promise} - * @async - * @alias module:storage.existsAsync - * @see module:storage.exists - */ -const existsAsync = file => fsPromises.access(file, fs.constants.F_OK).then(() => true, () => false) - -/** - * Node.js' [fsPromises.rename]{@link https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath} - * @function - * @param {string} oldPath - * @param {string} newPath - * @return {Promise} - * @alias module:storage.renameAsync - * @async - */ -const renameAsync = fsPromises.rename - -/** - * Node.js' [fsPromises.writeFile]{@link https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options}. - * @function - * @param {string} path - * @param {string} data - * @param {object} [options] - * @return {Promise} - * @alias module:storage.writeFileAsync - * @async - */ -const writeFileAsync = fsPromises.writeFile - -/** - * Node.js' [fs.createWriteStream]{@link https://nodejs.org/api/fs.html#fscreatewritestreampath-options}. - * @function - * @param {string} path - * @param {Object} [options] - * @return {fs.WriteStream} - * @alias module:storage.writeFileStream - */ -const writeFileStream = fs.createWriteStream - -/** - * Node.js' [fsPromises.unlink]{@link https://nodejs.org/api/fs.html#fspromisesunlinkpath}. - * @function - * @param {string} path - * @return {Promise} - * @async - * @alias module:storage.unlinkAsync - */ -const unlinkAsync = fsPromises.unlink - -/** - * Node.js' [fsPromises.appendFile]{@link https://nodejs.org/api/fs.html#fspromisesappendfilepath-data-options}. - * @function - * @param {string} path - * @param {string} data - * @param {object} [options] - * @return {Promise} - * @alias module:storage.appendFileAsync - * @async - */ -const appendFileAsync = fsPromises.appendFile - -/** - * Node.js' [fsPromises.readFile]{@link https://nodejs.org/api/fs.html#fspromisesreadfilepath-options}. - * @function - * @param {string} path - * @param {object} [options] - * @return {Promise} - * @alias module:storage.readFileAsync - * @async - */ -const readFileAsync = fsPromises.readFile - -/** - * Node.js' [fs.createReadStream]{@link https://nodejs.org/api/fs.html#fscreatereadstreampath-options}. - * @function - * @param {string} path - * @param {Object} [options] - * @return {fs.ReadStream} - * @alias module:storage.readFileStream - */ -const readFileStream = fs.createReadStream - -/** - * Node.js' [fsPromises.mkdir]{@link https://nodejs.org/api/fs.html#fspromisesmkdirpath-options}. - * @function - * @param {string} path - * @param {object} options - * @return {Promise} - * @alias module:storage.mkdirAsync - * @async - */ -const mkdirAsync = fsPromises.mkdir - -/** - * Removes file if it exists. - * @param {string} file - * @return {Promise} - * @alias module:storage.ensureFileDoesntExistAsync - * @async - */ -const ensureFileDoesntExistAsync = async file => { - if (await existsAsync(file)) await unlinkAsync(file) -} - -/** - * Flush data in OS buffer to storage if corresponding option is set. - * @param {object|string} options If options is a string, it is assumed that the flush of the file (not dir) called options was requested - * @param {string} [options.filename] - * @param {boolean} [options.isDir = false] Optional, defaults to false - * @param {number} [options.mode = 0o644] Optional, defaults to 0o644 - * @return {Promise} - * @alias module:storage.flushToStorageAsync - * @async - */ -const flushToStorageAsync = async (options) => { - let filename - let flags - let mode - if (typeof options === 'string') { - filename = options - flags = 'r+' - mode = DEFAULT_FILE_MODE - } else { - filename = options.filename - flags = options.isDir ? 'r' : 'r+' - mode = options.mode !== undefined ? options.mode : DEFAULT_FILE_MODE - } - /** - * Some OSes and/or storage backends (augmented node fs) do not support fsync (FlushFileBuffers) directories, - * or calling open() on directories at all. Flushing fails silently in this case, supported by following heuristics: - * + isDir === true - * |-- open() -> (err.code === 'EISDIR'): can't call open() on directories (eg. BrowserFS) - * `-- fsync() -> (errFS.code === 'EPERM' || errFS.code === 'EISDIR'): can't fsync directory: permissions are checked - * on open(); EPERM error should only occur on fsync incapability and not for general lack of permissions (e.g. Windows) - * - * We can live with this as it cannot cause 100% dataloss except in the very rare event of the first time - * database is loaded and a crash happens. - */ - - let filehandle, errorOnFsync, errorOnClose - try { - filehandle = await fsPromises.open(filename, flags, mode) - try { - await filehandle.sync() - } catch (errFS) { - errorOnFsync = errFS - } - } catch (error) { - if (error.code !== 'EISDIR' || !options.isDir) throw error - } finally { - try { - await filehandle.close() - } catch (errC) { - errorOnClose = errC - } - } - if ((errorOnFsync || errorOnClose) && !((errorOnFsync.code === 'EPERM' || errorOnClose.code === 'EISDIR') && options.isDir)) { - const e = new Error('Failed to flush to storage') - e.errorOnFsync = errorOnFsync - e.errorOnClose = errorOnClose - throw e - } -} - -/** - * Fully write or rewrite the datafile. - * @param {string} filename - * @param {string[]} lines - * @param {number} [mode=0o644] - * @return {Promise} - * @alias module:storage.writeFileLinesAsync - * @async - */ -const writeFileLinesAsync = (filename, lines, mode = DEFAULT_FILE_MODE) => new Promise((resolve, reject) => { - try { - const stream = writeFileStream(filename, { mode }) - const readable = Readable.from(lines) - readable.on('data', (line) => { - try { - stream.write(line + '\n') - } catch (err) { - reject(err) - } - }) - readable.on('end', () => { - stream.close(err => { - if (err) reject(err) - else resolve() - }) - }) - - readable.on('error', err => { - reject(err) - }) - - stream.on('error', err => { - reject(err) - }) - } catch (err) { - reject(err) - } -}) - -/** - * Fully write or rewrite the datafile, immune to crashes during the write operation (data will not be lost). - * @param {string} filename - * @param {string[]} lines - * @param {object} [modes={ fileMode: 0o644, dirMode: 0o755 }] - * @param {number} modes.dirMode - * @param {number} modes.fileMode - * @return {Promise} - * @alias module:storage.crashSafeWriteFileLinesAsync - */ -const crashSafeWriteFileLinesAsync = async (filename, lines, modes = { fileMode: DEFAULT_FILE_MODE, dirMode: DEFAULT_DIR_MODE }) => { - const tempFilename = filename + '~' - - await flushToStorageAsync({ filename: path.dirname(filename), isDir: true, mode: modes.dirMode }) - - const exists = await existsAsync(filename) - if (exists) await flushToStorageAsync({ filename, mode: modes.fileMode }) - - await writeFileLinesAsync(tempFilename, lines, modes.fileMode) - - await flushToStorageAsync({ filename: tempFilename, mode: modes.fileMode }) - - await renameAsync(tempFilename, filename) - - await flushToStorageAsync({ filename: path.dirname(filename), isDir: true, mode: modes.dirMode }) -} - -/** - * Ensure the datafile contains all the data, even if there was a crash during a full file write. - * @param {string} filename - * @param {number} [mode=0o644] - * @return {Promise} - * @alias module:storage.ensureDatafileIntegrityAsync - */ -const ensureDatafileIntegrityAsync = async (filename, mode = DEFAULT_FILE_MODE) => { - const tempFilename = filename + '~' - - const filenameExists = await existsAsync(filename) - // Write was successful - if (filenameExists) return - - const oldFilenameExists = await existsAsync(tempFilename) - // New database - if (!oldFilenameExists) await writeFileAsync(filename, '', { encoding: 'utf8', mode }) - // Write failed, use old version - else await renameAsync(tempFilename, filename) -} - -/** - * Check if a file's parent directory exists and create it on the fly if it is not the case. - * @param {string} filename - * @param {number} mode - * @return {Promise} - * @private - */ -const ensureParentDirectoryExistsAsync = async (filename, mode) => { - const dir = path.dirname(filename) - const parsedDir = path.parse(path.resolve(dir)) - // this is because on Windows mkdir throws a permission error when called on the root directory of a volume - if (process.platform !== 'win32' || parsedDir.dir !== parsedDir.root || parsedDir.base !== '') { - await mkdirAsync(dir, { recursive: true, mode }) - } -} - -// Interface -module.exports.existsAsync = existsAsync - -module.exports.renameAsync = renameAsync - -module.exports.writeFileAsync = writeFileAsync - -module.exports.writeFileLinesAsync = writeFileLinesAsync - -module.exports.crashSafeWriteFileLinesAsync = crashSafeWriteFileLinesAsync - -module.exports.appendFileAsync = appendFileAsync - -module.exports.readFileAsync = readFileAsync - -module.exports.unlinkAsync = unlinkAsync - -module.exports.mkdirAsync = mkdirAsync - -module.exports.readFileStream = readFileStream - -module.exports.flushToStorageAsync = flushToStorageAsync - -module.exports.ensureDatafileIntegrityAsync = ensureDatafileIntegrityAsync - -module.exports.ensureFileDoesntExistAsync = ensureFileDoesntExistAsync - -module.exports.ensureParentDirectoryExistsAsync = ensureParentDirectoryExistsAsync diff --git a/node_modules/@seald-io/nedb/lib/utils.js b/node_modules/@seald-io/nedb/lib/utils.js deleted file mode 100644 index cff0416..0000000 --- a/node_modules/@seald-io/nedb/lib/utils.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Utility functions for all environments. - * This replaces the underscore dependency. - * - * @module utils - * @private - */ - -/** - * @callback IterateeFunction - * @param {*} arg - * @return {*} - */ - -/** - * Produces a duplicate-free version of the array, using === to test object equality. In particular only the first - * occurrence of each value is kept. If you want to compute unique items based on a transformation, pass an iteratee - * function. - * - * Heavily inspired by {@link https://underscorejs.org/#uniq}. - * @param {Array} array - * @param {IterateeFunction} [iteratee] transformation applied to every element before checking for duplicates. This will not - * transform the items in the result. - * @return {Array} - * @alias module:utils.uniq - */ -const uniq = (array, iteratee) => { - if (iteratee) return [...(new Map(array.map(x => [iteratee(x), x]))).values()] - else return [...new Set(array)] -} -/** - * Returns true if arg is an Object. Note that JavaScript arrays and functions are objects, while (normal) strings - * and numbers are not. - * - * Heavily inspired by {@link https://underscorejs.org/#isObject}. - * @param {*} arg - * @return {boolean} - */ -const isObject = arg => typeof arg === 'object' && arg !== null - -/** - * Returns true if d is a Date. - * - * Heavily inspired by {@link https://underscorejs.org/#isDate}. - * @param {*} d - * @return {boolean} - * @alias module:utils.isDate - */ -const isDate = d => isObject(d) && Object.prototype.toString.call(d) === '[object Date]' - -/** - * Returns true if re is a RegExp. - * - * Heavily inspired by {@link https://underscorejs.org/#isRegExp}. - * @param {*} re - * @return {boolean} - * @alias module:utils.isRegExp - */ -const isRegExp = re => isObject(re) && Object.prototype.toString.call(re) === '[object RegExp]' - -/** - * Return a copy of the object filtered using the given keys. - * - * @param {object} object - * @param {string[]} keys - * @return {object} - */ -const pick = (object, keys) => { - return keys.reduce((obj, key) => { - if (object && Object.prototype.hasOwnProperty.call(object, key)) { - obj[key] = object[key] - } - return obj - }, {}) -} - -const filterIndexNames = (indexNames) => ([k, v]) => !!(typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || isDate(v) || v === null) && -indexNames.includes(k) - -module.exports.uniq = uniq -module.exports.isDate = isDate -module.exports.isRegExp = isRegExp -module.exports.pick = pick -module.exports.filterIndexNames = filterIndexNames diff --git a/node_modules/@seald-io/nedb/lib/waterfall.js b/node_modules/@seald-io/nedb/lib/waterfall.js deleted file mode 100644 index bf2895d..0000000 --- a/node_modules/@seald-io/nedb/lib/waterfall.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Responsible for sequentially executing actions on the database - * @private - */ -class Waterfall { - /** - * Instantiate a new Waterfall. - */ - constructor () { - /** - * This is the internal Promise object which resolves when all the tasks of the `Waterfall` are done. - * - * It will change any time `this.waterfall` is called. - * - * @type {Promise} - */ - this.guardian = Promise.resolve() - } - - /** - * - * @param {AsyncFunction} func - * @return {AsyncFunction} - */ - waterfall (func) { - return (...args) => { - this.guardian = this.guardian.then(() => { - return func(...args) - .then(result => ({ error: false, result }), result => ({ error: true, result })) - }) - return this.guardian.then(({ error, result }) => { - if (error) return Promise.reject(result) - else return Promise.resolve(result) - }) - } - } - - /** - * Shorthand for chaining a promise to the Waterfall - * @param {Promise} promise - * @return {Promise} - */ - chain (promise) { - return this.waterfall(() => promise)() - } -} - -module.exports = Waterfall diff --git a/node_modules/@seald-io/nedb/package.json b/node_modules/@seald-io/nedb/package.json deleted file mode 100755 index 9ce2aa7..0000000 --- a/node_modules/@seald-io/nedb/package.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "name": "@seald-io/nedb", - "version": "4.0.4", - "files": [ - "lib/**/*.js", - "browser-version/**/*.js", - "index.js", - "index.d.ts" - ], - "types": "index.d.ts", - "author": { - "name": "Timothée Rebours", - "email": "tim@seald.io", - "url": "https://www.seald.io/" - }, - "contributors": [ - { - "name": "Louis Chatriot", - "email": "louis.chatriot@gmail.com" - }, - { - "name": "Timothée Rebours", - "email": "tim@seald.io", - "url": "https://www.seald.io/" - }, - { - "name": "Eliot Akira", - "email": "me@eliotakira.com", - "url": "https://eliotakira.com/" - }, - { - "name": " Loïc Hermann", - "email": "loic.hermann@outlook.fr" - } - ], - "description": "File-based embedded data store for node.js", - "keywords": [ - "database", - "datastore", - "embedded" - ], - "homepage": "https://github.com/seald/nedb", - "repository": { - "type": "git", - "url": "git@github.com:seald/nedb.git" - }, - "dependencies": { - "@seald-io/binary-search-tree": "^1.0.3", - "localforage": "^1.9.0", - "util": "^0.12.4" - }, - "devDependencies": { - "@react-native-async-storage/async-storage": "^1.17.11", - "@types/jest": "^27.5.2", - "browser-resolve": "^2.0.0", - "chai": "^4.3.7", - "commander": "^7.2.0", - "events": "^3.3.0", - "jest": "^27.5.1", - "jsdoc-to-markdown": "^8.0.0", - "karma": "^6.4.1", - "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^3.1.1", - "karma-junit-reporter": "^2.0.1", - "karma-mocha": "^2.0.1", - "karma-source-map-support": "^1.4.0", - "mocha": "^10.2.0", - "mocha-junit-reporter": "^2.2.0", - "path-browserify": "^1.0.1", - "process": "^0.11.10", - "react": "^18.2.0", - "react-native": "^0.71.2", - "semver": "^7.3.8", - "source-map-loader": "^4.0.1", - "standard": "^17.0.0", - "terser-webpack-plugin": "^5.3.6", - "timers-browserify": "^2.0.12", - "ts-jest": "^27.1.5", - "typescript": "^4.9.5", - "webpack": "^5.75.0", - "webpack-cli": "^5.0.1", - "xvfb-maybe": "^0.2.1" - }, - "scripts": { - "lint": "standard", - "test": "mocha --reporter spec --timeout 10000", - "build:browser": "webpack && webpack --optimization-minimize", - "pretest:browser": "npm run build:browser", - "test:browser": "xvfb-maybe karma start karma.conf.local.js", - "test:react-native": "jest test/react-native", - "test:typings": "tsc ./typings-tests.ts", - "prepublishOnly": "npm run build:browser", - "generateDocs:markdown": "jsdoc2md --no-cache -c jsdoc.conf.js --param-list-format list --files ./lib/*.js > API.md" - }, - "main": "index.js", - "browser": { - "./lib/customUtils.js": "./browser-version/lib/customUtils.js", - "./lib/storage.js": "./browser-version/lib/storage.browser.js", - "./lib/byline.js": "./browser-version/lib/byline.js" - }, - "react-native": { - "./lib/customUtils.js": "./browser-version/lib/customUtils.js", - "./lib/storage.js": "./browser-version/lib/storage.react-native.js", - "./lib/byline.js": "./browser-version/lib/byline.js" - }, - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "standard": { - "ignore": [ - "browser-version/out", - "**/*.ts" - ] - }, - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "resolver": "/test/react-native/resolver.js" - } -} diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE deleted file mode 100644 index 9e841e7..0000000 --- a/node_modules/@types/estree/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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/@types/estree/README.md b/node_modules/@types/estree/README.md deleted file mode 100644 index 5a6f4c8..0000000 --- a/node_modules/@types/estree/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/estree` - -# Summary -This package contains type definitions for estree (https://github.com/estree/estree). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. - -### Additional Details - * Last updated: Wed, 18 Sep 2024 09:37:00 GMT - * Dependencies: none - -# Credits -These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts deleted file mode 100644 index 9d001a9..0000000 --- a/node_modules/@types/estree/flow.d.ts +++ /dev/null @@ -1,167 +0,0 @@ -declare namespace ESTree { - interface FlowTypeAnnotation extends Node {} - - interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} - - interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} - - interface FlowDeclaration extends Declaration {} - - interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface ArrayTypeAnnotation extends FlowTypeAnnotation { - elementType: FlowTypeAnnotation; - } - - interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} - - interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface ClassImplements extends Node { - id: Identifier; - typeParameters?: TypeParameterInstantiation | null; - } - - interface ClassProperty { - key: Expression; - value?: Expression | null; - typeAnnotation?: TypeAnnotation | null; - computed: boolean; - static: boolean; - } - - interface DeclareClass extends FlowDeclaration { - id: Identifier; - typeParameters?: TypeParameterDeclaration | null; - body: ObjectTypeAnnotation; - extends: InterfaceExtends[]; - } - - interface DeclareFunction extends FlowDeclaration { - id: Identifier; - } - - interface DeclareModule extends FlowDeclaration { - id: Literal | Identifier; - body: BlockStatement; - } - - interface DeclareVariable extends FlowDeclaration { - id: Identifier; - } - - interface FunctionTypeAnnotation extends FlowTypeAnnotation { - params: FunctionTypeParam[]; - returnType: FlowTypeAnnotation; - rest?: FunctionTypeParam | null; - typeParameters?: TypeParameterDeclaration | null; - } - - interface FunctionTypeParam { - name: Identifier; - typeAnnotation: FlowTypeAnnotation; - optional: boolean; - } - - interface GenericTypeAnnotation extends FlowTypeAnnotation { - id: Identifier | QualifiedTypeIdentifier; - typeParameters?: TypeParameterInstantiation | null; - } - - interface InterfaceExtends extends Node { - id: Identifier | QualifiedTypeIdentifier; - typeParameters?: TypeParameterInstantiation | null; - } - - interface InterfaceDeclaration extends FlowDeclaration { - id: Identifier; - typeParameters?: TypeParameterDeclaration | null; - extends: InterfaceExtends[]; - body: ObjectTypeAnnotation; - } - - interface IntersectionTypeAnnotation extends FlowTypeAnnotation { - types: FlowTypeAnnotation[]; - } - - interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface NullableTypeAnnotation extends FlowTypeAnnotation { - typeAnnotation: TypeAnnotation; - } - - interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} - - interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} - - interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface TupleTypeAnnotation extends FlowTypeAnnotation { - types: FlowTypeAnnotation[]; - } - - interface TypeofTypeAnnotation extends FlowTypeAnnotation { - argument: FlowTypeAnnotation; - } - - interface TypeAlias extends FlowDeclaration { - id: Identifier; - typeParameters?: TypeParameterDeclaration | null; - right: FlowTypeAnnotation; - } - - interface TypeAnnotation extends Node { - typeAnnotation: FlowTypeAnnotation; - } - - interface TypeCastExpression extends Expression { - expression: Expression; - typeAnnotation: TypeAnnotation; - } - - interface TypeParameterDeclaration extends Node { - params: Identifier[]; - } - - interface TypeParameterInstantiation extends Node { - params: FlowTypeAnnotation[]; - } - - interface ObjectTypeAnnotation extends FlowTypeAnnotation { - properties: ObjectTypeProperty[]; - indexers: ObjectTypeIndexer[]; - callProperties: ObjectTypeCallProperty[]; - } - - interface ObjectTypeCallProperty extends Node { - value: FunctionTypeAnnotation; - static: boolean; - } - - interface ObjectTypeIndexer extends Node { - id: Identifier; - key: FlowTypeAnnotation; - value: FlowTypeAnnotation; - static: boolean; - } - - interface ObjectTypeProperty extends Node { - key: Expression; - value: FlowTypeAnnotation; - optional: boolean; - static: boolean; - } - - interface QualifiedTypeIdentifier extends Node { - qualification: Identifier | QualifiedTypeIdentifier; - id: Identifier; - } - - interface UnionTypeAnnotation extends FlowTypeAnnotation { - types: FlowTypeAnnotation[]; - } - - interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} -} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts deleted file mode 100644 index 81a351f..0000000 --- a/node_modules/@types/estree/index.d.ts +++ /dev/null @@ -1,684 +0,0 @@ -// This definition file follows a somewhat unusual format. ESTree allows -// runtime type checks based on the `type` parameter. In order to explain this -// to typescript we want to use discriminated union types: -// https://github.com/Microsoft/TypeScript/pull/9163 -// -// For ESTree this is a bit tricky because the high level interfaces like -// Node or Function are pulling double duty. We want to pass common fields down -// to the interfaces that extend them (like Identifier or -// ArrowFunctionExpression), but you can't extend a type union or enforce -// common fields on them. So we've split the high level interfaces into two -// types, a base type which passes down inherited fields, and a type union of -// all types which extend the base type. Only the type union is exported, and -// the union is how other types refer to the collection of inheriting types. -// -// This makes the definitions file here somewhat more difficult to maintain, -// but it has the notable advantage of making ESTree much easier to use as -// an end user. - -export interface BaseNodeWithoutComments { - // Every leaf interface that extends BaseNode must specify a type property. - // The type property should be a string literal. For example, Identifier - // has: `type: "Identifier"` - type: string; - loc?: SourceLocation | null | undefined; - range?: [number, number] | undefined; -} - -export interface BaseNode extends BaseNodeWithoutComments { - leadingComments?: Comment[] | undefined; - trailingComments?: Comment[] | undefined; -} - -export interface NodeMap { - AssignmentProperty: AssignmentProperty; - CatchClause: CatchClause; - Class: Class; - ClassBody: ClassBody; - Expression: Expression; - Function: Function; - Identifier: Identifier; - Literal: Literal; - MethodDefinition: MethodDefinition; - ModuleDeclaration: ModuleDeclaration; - ModuleSpecifier: ModuleSpecifier; - Pattern: Pattern; - PrivateIdentifier: PrivateIdentifier; - Program: Program; - Property: Property; - PropertyDefinition: PropertyDefinition; - SpreadElement: SpreadElement; - Statement: Statement; - Super: Super; - SwitchCase: SwitchCase; - TemplateElement: TemplateElement; - VariableDeclarator: VariableDeclarator; -} - -export type Node = NodeMap[keyof NodeMap]; - -export interface Comment extends BaseNodeWithoutComments { - type: "Line" | "Block"; - value: string; -} - -export interface SourceLocation { - source?: string | null | undefined; - start: Position; - end: Position; -} - -export interface Position { - /** >= 1 */ - line: number; - /** >= 0 */ - column: number; -} - -export interface Program extends BaseNode { - type: "Program"; - sourceType: "script" | "module"; - body: Array; - comments?: Comment[] | undefined; -} - -export interface Directive extends BaseNode { - type: "ExpressionStatement"; - expression: Literal; - directive: string; -} - -export interface BaseFunction extends BaseNode { - params: Pattern[]; - generator?: boolean | undefined; - async?: boolean | undefined; - // The body is either BlockStatement or Expression because arrow functions - // can have a body that's either. FunctionDeclarations and - // FunctionExpressions have only BlockStatement bodies. - body: BlockStatement | Expression; -} - -export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; - -export type Statement = - | ExpressionStatement - | BlockStatement - | StaticBlock - | EmptyStatement - | DebuggerStatement - | WithStatement - | ReturnStatement - | LabeledStatement - | BreakStatement - | ContinueStatement - | IfStatement - | SwitchStatement - | ThrowStatement - | TryStatement - | WhileStatement - | DoWhileStatement - | ForStatement - | ForInStatement - | ForOfStatement - | Declaration; - -export interface BaseStatement extends BaseNode {} - -export interface EmptyStatement extends BaseStatement { - type: "EmptyStatement"; -} - -export interface BlockStatement extends BaseStatement { - type: "BlockStatement"; - body: Statement[]; - innerComments?: Comment[] | undefined; -} - -export interface StaticBlock extends Omit { - type: "StaticBlock"; -} - -export interface ExpressionStatement extends BaseStatement { - type: "ExpressionStatement"; - expression: Expression; -} - -export interface IfStatement extends BaseStatement { - type: "IfStatement"; - test: Expression; - consequent: Statement; - alternate?: Statement | null | undefined; -} - -export interface LabeledStatement extends BaseStatement { - type: "LabeledStatement"; - label: Identifier; - body: Statement; -} - -export interface BreakStatement extends BaseStatement { - type: "BreakStatement"; - label?: Identifier | null | undefined; -} - -export interface ContinueStatement extends BaseStatement { - type: "ContinueStatement"; - label?: Identifier | null | undefined; -} - -export interface WithStatement extends BaseStatement { - type: "WithStatement"; - object: Expression; - body: Statement; -} - -export interface SwitchStatement extends BaseStatement { - type: "SwitchStatement"; - discriminant: Expression; - cases: SwitchCase[]; -} - -export interface ReturnStatement extends BaseStatement { - type: "ReturnStatement"; - argument?: Expression | null | undefined; -} - -export interface ThrowStatement extends BaseStatement { - type: "ThrowStatement"; - argument: Expression; -} - -export interface TryStatement extends BaseStatement { - type: "TryStatement"; - block: BlockStatement; - handler?: CatchClause | null | undefined; - finalizer?: BlockStatement | null | undefined; -} - -export interface WhileStatement extends BaseStatement { - type: "WhileStatement"; - test: Expression; - body: Statement; -} - -export interface DoWhileStatement extends BaseStatement { - type: "DoWhileStatement"; - body: Statement; - test: Expression; -} - -export interface ForStatement extends BaseStatement { - type: "ForStatement"; - init?: VariableDeclaration | Expression | null | undefined; - test?: Expression | null | undefined; - update?: Expression | null | undefined; - body: Statement; -} - -export interface BaseForXStatement extends BaseStatement { - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; -} - -export interface ForInStatement extends BaseForXStatement { - type: "ForInStatement"; -} - -export interface DebuggerStatement extends BaseStatement { - type: "DebuggerStatement"; -} - -export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; - -export interface BaseDeclaration extends BaseStatement {} - -export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { - type: "FunctionDeclaration"; - /** It is null when a function declaration is a part of the `export default function` statement */ - id: Identifier | null; - body: BlockStatement; -} - -export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { - id: Identifier; -} - -export interface VariableDeclaration extends BaseDeclaration { - type: "VariableDeclaration"; - declarations: VariableDeclarator[]; - kind: "var" | "let" | "const"; -} - -export interface VariableDeclarator extends BaseNode { - type: "VariableDeclarator"; - id: Pattern; - init?: Expression | null | undefined; -} - -export interface ExpressionMap { - ArrayExpression: ArrayExpression; - ArrowFunctionExpression: ArrowFunctionExpression; - AssignmentExpression: AssignmentExpression; - AwaitExpression: AwaitExpression; - BinaryExpression: BinaryExpression; - CallExpression: CallExpression; - ChainExpression: ChainExpression; - ClassExpression: ClassExpression; - ConditionalExpression: ConditionalExpression; - FunctionExpression: FunctionExpression; - Identifier: Identifier; - ImportExpression: ImportExpression; - Literal: Literal; - LogicalExpression: LogicalExpression; - MemberExpression: MemberExpression; - MetaProperty: MetaProperty; - NewExpression: NewExpression; - ObjectExpression: ObjectExpression; - SequenceExpression: SequenceExpression; - TaggedTemplateExpression: TaggedTemplateExpression; - TemplateLiteral: TemplateLiteral; - ThisExpression: ThisExpression; - UnaryExpression: UnaryExpression; - UpdateExpression: UpdateExpression; - YieldExpression: YieldExpression; -} - -export type Expression = ExpressionMap[keyof ExpressionMap]; - -export interface BaseExpression extends BaseNode {} - -export type ChainElement = SimpleCallExpression | MemberExpression; - -export interface ChainExpression extends BaseExpression { - type: "ChainExpression"; - expression: ChainElement; -} - -export interface ThisExpression extends BaseExpression { - type: "ThisExpression"; -} - -export interface ArrayExpression extends BaseExpression { - type: "ArrayExpression"; - elements: Array; -} - -export interface ObjectExpression extends BaseExpression { - type: "ObjectExpression"; - properties: Array; -} - -export interface PrivateIdentifier extends BaseNode { - type: "PrivateIdentifier"; - name: string; -} - -export interface Property extends BaseNode { - type: "Property"; - key: Expression | PrivateIdentifier; - value: Expression | Pattern; // Could be an AssignmentProperty - kind: "init" | "get" | "set"; - method: boolean; - shorthand: boolean; - computed: boolean; -} - -export interface PropertyDefinition extends BaseNode { - type: "PropertyDefinition"; - key: Expression | PrivateIdentifier; - value?: Expression | null | undefined; - computed: boolean; - static: boolean; -} - -export interface FunctionExpression extends BaseFunction, BaseExpression { - id?: Identifier | null | undefined; - type: "FunctionExpression"; - body: BlockStatement; -} - -export interface SequenceExpression extends BaseExpression { - type: "SequenceExpression"; - expressions: Expression[]; -} - -export interface UnaryExpression extends BaseExpression { - type: "UnaryExpression"; - operator: UnaryOperator; - prefix: true; - argument: Expression; -} - -export interface BinaryExpression extends BaseExpression { - type: "BinaryExpression"; - operator: BinaryOperator; - left: Expression | PrivateIdentifier; - right: Expression; -} - -export interface AssignmentExpression extends BaseExpression { - type: "AssignmentExpression"; - operator: AssignmentOperator; - left: Pattern | MemberExpression; - right: Expression; -} - -export interface UpdateExpression extends BaseExpression { - type: "UpdateExpression"; - operator: UpdateOperator; - argument: Expression; - prefix: boolean; -} - -export interface LogicalExpression extends BaseExpression { - type: "LogicalExpression"; - operator: LogicalOperator; - left: Expression; - right: Expression; -} - -export interface ConditionalExpression extends BaseExpression { - type: "ConditionalExpression"; - test: Expression; - alternate: Expression; - consequent: Expression; -} - -export interface BaseCallExpression extends BaseExpression { - callee: Expression | Super; - arguments: Array; -} -export type CallExpression = SimpleCallExpression | NewExpression; - -export interface SimpleCallExpression extends BaseCallExpression { - type: "CallExpression"; - optional: boolean; -} - -export interface NewExpression extends BaseCallExpression { - type: "NewExpression"; -} - -export interface MemberExpression extends BaseExpression, BasePattern { - type: "MemberExpression"; - object: Expression | Super; - property: Expression | PrivateIdentifier; - computed: boolean; - optional: boolean; -} - -export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; - -export interface BasePattern extends BaseNode {} - -export interface SwitchCase extends BaseNode { - type: "SwitchCase"; - test?: Expression | null | undefined; - consequent: Statement[]; -} - -export interface CatchClause extends BaseNode { - type: "CatchClause"; - param: Pattern | null; - body: BlockStatement; -} - -export interface Identifier extends BaseNode, BaseExpression, BasePattern { - type: "Identifier"; - name: string; -} - -export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; - -export interface SimpleLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value: string | boolean | number | null; - raw?: string | undefined; -} - -export interface RegExpLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value?: RegExp | null | undefined; - regex: { - pattern: string; - flags: string; - }; - raw?: string | undefined; -} - -export interface BigIntLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value?: bigint | null | undefined; - bigint: string; - raw?: string | undefined; -} - -export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; - -export type BinaryOperator = - | "==" - | "!=" - | "===" - | "!==" - | "<" - | "<=" - | ">" - | ">=" - | "<<" - | ">>" - | ">>>" - | "+" - | "-" - | "*" - | "/" - | "%" - | "**" - | "|" - | "^" - | "&" - | "in" - | "instanceof"; - -export type LogicalOperator = "||" | "&&" | "??"; - -export type AssignmentOperator = - | "=" - | "+=" - | "-=" - | "*=" - | "/=" - | "%=" - | "**=" - | "<<=" - | ">>=" - | ">>>=" - | "|=" - | "^=" - | "&=" - | "||=" - | "&&=" - | "??="; - -export type UpdateOperator = "++" | "--"; - -export interface ForOfStatement extends BaseForXStatement { - type: "ForOfStatement"; - await: boolean; -} - -export interface Super extends BaseNode { - type: "Super"; -} - -export interface SpreadElement extends BaseNode { - type: "SpreadElement"; - argument: Expression; -} - -export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { - type: "ArrowFunctionExpression"; - expression: boolean; - body: BlockStatement | Expression; -} - -export interface YieldExpression extends BaseExpression { - type: "YieldExpression"; - argument?: Expression | null | undefined; - delegate: boolean; -} - -export interface TemplateLiteral extends BaseExpression { - type: "TemplateLiteral"; - quasis: TemplateElement[]; - expressions: Expression[]; -} - -export interface TaggedTemplateExpression extends BaseExpression { - type: "TaggedTemplateExpression"; - tag: Expression; - quasi: TemplateLiteral; -} - -export interface TemplateElement extends BaseNode { - type: "TemplateElement"; - tail: boolean; - value: { - /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ - cooked?: string | null | undefined; - raw: string; - }; -} - -export interface AssignmentProperty extends Property { - value: Pattern; - kind: "init"; - method: boolean; // false -} - -export interface ObjectPattern extends BasePattern { - type: "ObjectPattern"; - properties: Array; -} - -export interface ArrayPattern extends BasePattern { - type: "ArrayPattern"; - elements: Array; -} - -export interface RestElement extends BasePattern { - type: "RestElement"; - argument: Pattern; -} - -export interface AssignmentPattern extends BasePattern { - type: "AssignmentPattern"; - left: Pattern; - right: Expression; -} - -export type Class = ClassDeclaration | ClassExpression; -export interface BaseClass extends BaseNode { - superClass?: Expression | null | undefined; - body: ClassBody; -} - -export interface ClassBody extends BaseNode { - type: "ClassBody"; - body: Array; -} - -export interface MethodDefinition extends BaseNode { - type: "MethodDefinition"; - key: Expression | PrivateIdentifier; - value: FunctionExpression; - kind: "constructor" | "method" | "get" | "set"; - computed: boolean; - static: boolean; -} - -export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { - type: "ClassDeclaration"; - /** It is null when a class declaration is a part of the `export default class` statement */ - id: Identifier | null; -} - -export interface ClassDeclaration extends MaybeNamedClassDeclaration { - id: Identifier; -} - -export interface ClassExpression extends BaseClass, BaseExpression { - type: "ClassExpression"; - id?: Identifier | null | undefined; -} - -export interface MetaProperty extends BaseExpression { - type: "MetaProperty"; - meta: Identifier; - property: Identifier; -} - -export type ModuleDeclaration = - | ImportDeclaration - | ExportNamedDeclaration - | ExportDefaultDeclaration - | ExportAllDeclaration; -export interface BaseModuleDeclaration extends BaseNode {} - -export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; -export interface BaseModuleSpecifier extends BaseNode { - local: Identifier; -} - -export interface ImportDeclaration extends BaseModuleDeclaration { - type: "ImportDeclaration"; - specifiers: Array; - source: Literal; -} - -export interface ImportSpecifier extends BaseModuleSpecifier { - type: "ImportSpecifier"; - imported: Identifier | Literal; -} - -export interface ImportExpression extends BaseExpression { - type: "ImportExpression"; - source: Expression; -} - -export interface ImportDefaultSpecifier extends BaseModuleSpecifier { - type: "ImportDefaultSpecifier"; -} - -export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { - type: "ImportNamespaceSpecifier"; -} - -export interface ExportNamedDeclaration extends BaseModuleDeclaration { - type: "ExportNamedDeclaration"; - declaration?: Declaration | null | undefined; - specifiers: ExportSpecifier[]; - source?: Literal | null | undefined; -} - -export interface ExportSpecifier extends Omit { - type: "ExportSpecifier"; - local: Identifier | Literal; - exported: Identifier | Literal; -} - -export interface ExportDefaultDeclaration extends BaseModuleDeclaration { - type: "ExportDefaultDeclaration"; - declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; -} - -export interface ExportAllDeclaration extends BaseModuleDeclaration { - type: "ExportAllDeclaration"; - exported: Identifier | Literal | null; - source: Literal; -} - -export interface AwaitExpression extends BaseExpression { - type: "AwaitExpression"; - argument: Expression; -} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json deleted file mode 100644 index f410761..0000000 --- a/node_modules/@types/estree/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@types/estree", - "version": "1.0.6", - "description": "TypeScript definitions for estree", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", - "license": "MIT", - "contributors": [ - { - "name": "RReverser", - "githubUsername": "RReverser", - "url": "https://github.com/RReverser" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/estree" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "0310b41994a6f8d7530af6c53d47d8b227f32925e43718507fdb1178e05006b1", - "typeScriptVersion": "4.8", - "nonNpm": true -} \ No newline at end of file diff --git a/node_modules/@types/json-schema/LICENSE b/node_modules/@types/json-schema/LICENSE deleted file mode 100644 index 9e841e7..0000000 --- a/node_modules/@types/json-schema/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - 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/@types/json-schema/README.md b/node_modules/@types/json-schema/README.md deleted file mode 100644 index 78c610f..0000000 --- a/node_modules/@types/json-schema/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/json-schema` - -# Summary -This package contains type definitions for json-schema (https://github.com/kriszyp/json-schema). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema. - -### Additional Details - * Last updated: Tue, 07 Nov 2023 03:09:37 GMT - * Dependencies: none - -# Credits -These definitions were written by [Boris Cherny](https://github.com/bcherny), [Lucian Buzzo](https://github.com/lucianbuzzo), [Roland Groza](https://github.com/rolandjitsu), and [Jason Kwok](https://github.com/JasonHK). diff --git a/node_modules/@types/json-schema/index.d.ts b/node_modules/@types/json-schema/index.d.ts deleted file mode 100644 index 9381e99..0000000 --- a/node_modules/@types/json-schema/index.d.ts +++ /dev/null @@ -1,749 +0,0 @@ -// ================================================================================================== -// JSON Schema Draft 04 -// ================================================================================================== - -/** - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1 - */ -export type JSONSchema4TypeName = - | "string" // - | "number" - | "integer" - | "boolean" - | "object" - | "array" - | "null" - | "any"; - -/** - * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5 - */ -export type JSONSchema4Type = - | string // - | number - | boolean - | JSONSchema4Object - | JSONSchema4Array - | null; - -// Workaround for infinite type recursion -export interface JSONSchema4Object { - [key: string]: JSONSchema4Type; -} - -// Workaround for infinite type recursion -// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540 -export interface JSONSchema4Array extends Array {} - -/** - * Meta schema - * - * Recommended values: - * - 'http://json-schema.org/schema#' - * - 'http://json-schema.org/hyper-schema#' - * - 'http://json-schema.org/draft-04/schema#' - * - 'http://json-schema.org/draft-04/hyper-schema#' - * - 'http://json-schema.org/draft-03/schema#' - * - 'http://json-schema.org/draft-03/hyper-schema#' - * - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5 - */ -export type JSONSchema4Version = string; - -/** - * JSON Schema V4 - * @see https://tools.ietf.org/html/draft-zyp-json-schema-04 - */ -export interface JSONSchema4 { - id?: string | undefined; - $ref?: string | undefined; - $schema?: JSONSchema4Version | undefined; - - /** - * This attribute is a string that provides a short description of the - * instance property. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21 - */ - title?: string | undefined; - - /** - * This attribute is a string that provides a full description of the of - * purpose the instance property. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22 - */ - description?: string | undefined; - - default?: JSONSchema4Type | undefined; - multipleOf?: number | undefined; - maximum?: number | undefined; - exclusiveMaximum?: boolean | undefined; - minimum?: number | undefined; - exclusiveMinimum?: boolean | undefined; - maxLength?: number | undefined; - minLength?: number | undefined; - pattern?: string | undefined; - - /** - * May only be defined when "items" is defined, and is a tuple of JSONSchemas. - * - * This provides a definition for additional items in an array instance - * when tuple definitions of the items is provided. This can be false - * to indicate additional items in the array are not allowed, or it can - * be a schema that defines the schema of the additional items. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6 - */ - additionalItems?: boolean | JSONSchema4 | undefined; - - /** - * This attribute defines the allowed items in an instance array, and - * MUST be a schema or an array of schemas. The default value is an - * empty schema which allows any value for items in the instance array. - * - * When this attribute value is a schema and the instance value is an - * array, then all the items in the array MUST be valid according to the - * schema. - * - * When this attribute value is an array of schemas and the instance - * value is an array, each position in the instance array MUST conform - * to the schema in the corresponding position for this array. This - * called tuple typing. When tuple typing is used, additional items are - * allowed, disallowed, or constrained by the "additionalItems" - * (Section 5.6) attribute using the same rules as - * "additionalProperties" (Section 5.4) for objects. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5 - */ - items?: JSONSchema4 | JSONSchema4[] | undefined; - - maxItems?: number | undefined; - minItems?: number | undefined; - uniqueItems?: boolean | undefined; - maxProperties?: number | undefined; - minProperties?: number | undefined; - - /** - * This attribute indicates if the instance must have a value, and not - * be undefined. This is false by default, making the instance - * optional. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7 - */ - required?: boolean | string[] | undefined; - - /** - * This attribute defines a schema for all properties that are not - * explicitly defined in an object type definition. If specified, the - * value MUST be a schema or a boolean. If false is provided, no - * additional properties are allowed beyond the properties defined in - * the schema. The default value is an empty schema which allows any - * value for additional properties. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4 - */ - additionalProperties?: boolean | JSONSchema4 | undefined; - - definitions?: { - [k: string]: JSONSchema4; - } | undefined; - - /** - * This attribute is an object with property definitions that define the - * valid values of instance object property values. When the instance - * value is an object, the property values of the instance object MUST - * conform to the property definitions in this object. In this object, - * each property definition's value MUST be a schema, and the property's - * name MUST be the name of the instance property that it defines. The - * instance property value MUST be valid according to the schema from - * the property definition. Properties are considered unordered, the - * order of the instance properties MAY be in any order. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2 - */ - properties?: { - [k: string]: JSONSchema4; - } | undefined; - - /** - * This attribute is an object that defines the schema for a set of - * property names of an object instance. The name of each property of - * this attribute's object is a regular expression pattern in the ECMA - * 262/Perl 5 format, while the value is a schema. If the pattern - * matches the name of a property on the instance object, the value of - * the instance's property MUST be valid against the pattern name's - * schema value. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3 - */ - patternProperties?: { - [k: string]: JSONSchema4; - } | undefined; - dependencies?: { - [k: string]: JSONSchema4 | string[]; - } | undefined; - - /** - * This provides an enumeration of all possible values that are valid - * for the instance property. This MUST be an array, and each item in - * the array represents a possible value for the instance value. If - * this attribute is defined, the instance value MUST be one of the - * values in the array in order for the schema to be valid. - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 - */ - enum?: JSONSchema4Type[] | undefined; - - /** - * A single type, or a union of simple types - */ - type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined; - - allOf?: JSONSchema4[] | undefined; - anyOf?: JSONSchema4[] | undefined; - oneOf?: JSONSchema4[] | undefined; - not?: JSONSchema4 | undefined; - - /** - * The value of this property MUST be another schema which will provide - * a base schema which the current schema will inherit from. The - * inheritance rules are such that any instance that is valid according - * to the current schema MUST be valid according to the referenced - * schema. This MAY also be an array, in which case, the instance MUST - * be valid for all the schemas in the array. A schema that extends - * another schema MAY define additional attributes, constrain existing - * attributes, or add other constraints. - * - * Conceptually, the behavior of extends can be seen as validating an - * instance against all constraints in the extending schema as well as - * the extended schema(s). - * - * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26 - */ - extends?: string | string[] | undefined; - - /** - * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6 - */ - [k: string]: any; - - format?: string | undefined; -} - -// ================================================================================================== -// JSON Schema Draft 06 -// ================================================================================================== - -export type JSONSchema6TypeName = - | "string" // - | "number" - | "integer" - | "boolean" - | "object" - | "array" - | "null" - | "any"; - -export type JSONSchema6Type = - | string // - | number - | boolean - | JSONSchema6Object - | JSONSchema6Array - | null; - -// Workaround for infinite type recursion -export interface JSONSchema6Object { - [key: string]: JSONSchema6Type; -} - -// Workaround for infinite type recursion -// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540 -export interface JSONSchema6Array extends Array {} - -/** - * Meta schema - * - * Recommended values: - * - 'http://json-schema.org/schema#' - * - 'http://json-schema.org/hyper-schema#' - * - 'http://json-schema.org/draft-06/schema#' - * - 'http://json-schema.org/draft-06/hyper-schema#' - * - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5 - */ -export type JSONSchema6Version = string; - -/** - * JSON Schema V6 - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01 - */ -export type JSONSchema6Definition = JSONSchema6 | boolean; -export interface JSONSchema6 { - $id?: string | undefined; - $ref?: string | undefined; - $schema?: JSONSchema6Version | undefined; - - /** - * Must be strictly greater than 0. - * A numeric instance is valid only if division by this keyword's value results in an integer. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1 - */ - multipleOf?: number | undefined; - - /** - * Representing an inclusive upper limit for a numeric instance. - * This keyword validates only if the instance is less than or exactly equal to "maximum". - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2 - */ - maximum?: number | undefined; - - /** - * Representing an exclusive upper limit for a numeric instance. - * This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum". - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3 - */ - exclusiveMaximum?: number | undefined; - - /** - * Representing an inclusive lower limit for a numeric instance. - * This keyword validates only if the instance is greater than or exactly equal to "minimum". - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4 - */ - minimum?: number | undefined; - - /** - * Representing an exclusive lower limit for a numeric instance. - * This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum". - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5 - */ - exclusiveMinimum?: number | undefined; - - /** - * Must be a non-negative integer. - * A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6 - */ - maxLength?: number | undefined; - - /** - * Must be a non-negative integer. - * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. - * Omitting this keyword has the same behavior as a value of 0. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7 - */ - minLength?: number | undefined; - - /** - * Should be a valid regular expression, according to the ECMA 262 regular expression dialect. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8 - */ - pattern?: string | undefined; - - /** - * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. - * Omitting this keyword has the same behavior as an empty schema. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9 - */ - items?: JSONSchema6Definition | JSONSchema6Definition[] | undefined; - - /** - * This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself. - * If "items" is an array of schemas, validation succeeds if every instance element - * at a position greater than the size of "items" validates against "additionalItems". - * Otherwise, "additionalItems" MUST be ignored, as the "items" schema - * (possibly the default value of an empty schema) is applied to all elements. - * Omitting this keyword has the same behavior as an empty schema. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10 - */ - additionalItems?: JSONSchema6Definition | undefined; - - /** - * Must be a non-negative integer. - * An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11 - */ - maxItems?: number | undefined; - - /** - * Must be a non-negative integer. - * An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword. - * Omitting this keyword has the same behavior as a value of 0. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12 - */ - minItems?: number | undefined; - - /** - * If this keyword has boolean value false, the instance validates successfully. - * If it has boolean value true, the instance validates successfully if all of its elements are unique. - * Omitting this keyword has the same behavior as a value of false. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13 - */ - uniqueItems?: boolean | undefined; - - /** - * An array instance is valid against "contains" if at least one of its elements is valid against the given schema. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14 - */ - contains?: JSONSchema6Definition | undefined; - - /** - * Must be a non-negative integer. - * An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15 - */ - maxProperties?: number | undefined; - - /** - * Must be a non-negative integer. - * An object instance is valid against "maxProperties" if its number of properties is greater than, - * or equal to, the value of this keyword. - * Omitting this keyword has the same behavior as a value of 0. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16 - */ - minProperties?: number | undefined; - - /** - * Elements of this array must be unique. - * An object instance is valid against this keyword if every item in the array is the name of a property in the instance. - * Omitting this keyword has the same behavior as an empty array. - * - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17 - */ - required?: string[] | undefined; - - /** - * This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself. - * Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, - * the child instance for that name successfully validates against the corresponding schema. - * Omitting this keyword has the same behavior as an empty object. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18 - */ - properties?: { - [k: string]: JSONSchema6Definition; - } | undefined; - - /** - * This attribute is an object that defines the schema for a set of property names of an object instance. - * The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema. - * If the pattern matches the name of a property on the instance object, the value of the instance's property - * MUST be valid against the pattern name's schema value. - * Omitting this keyword has the same behavior as an empty object. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19 - */ - patternProperties?: { - [k: string]: JSONSchema6Definition; - } | undefined; - - /** - * This attribute defines a schema for all properties that are not explicitly defined in an object type definition. - * If specified, the value MUST be a schema or a boolean. - * If false is provided, no additional properties are allowed beyond the properties defined in the schema. - * The default value is an empty schema which allows any value for additional properties. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20 - */ - additionalProperties?: JSONSchema6Definition | undefined; - - /** - * This keyword specifies rules that are evaluated if the instance is an object and contains a certain property. - * Each property specifies a dependency. - * If the dependency value is an array, each element in the array must be unique. - * Omitting this keyword has the same behavior as an empty object. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21 - */ - dependencies?: { - [k: string]: JSONSchema6Definition | string[]; - } | undefined; - - /** - * Takes a schema which validates the names of all properties rather than their values. - * Note the property name that the schema is testing will always be a string. - * Omitting this keyword has the same behavior as an empty schema. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22 - */ - propertyNames?: JSONSchema6Definition | undefined; - - /** - * This provides an enumeration of all possible values that are valid - * for the instance property. This MUST be an array, and each item in - * the array represents a possible value for the instance value. If - * this attribute is defined, the instance value MUST be one of the - * values in the array in order for the schema to be valid. - * - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23 - */ - enum?: JSONSchema6Type[] | undefined; - - /** - * More readable form of a one-element "enum" - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24 - */ - const?: JSONSchema6Type | undefined; - - /** - * A single type, or a union of simple types - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25 - */ - type?: JSONSchema6TypeName | JSONSchema6TypeName[] | undefined; - - /** - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26 - */ - allOf?: JSONSchema6Definition[] | undefined; - - /** - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27 - */ - anyOf?: JSONSchema6Definition[] | undefined; - - /** - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28 - */ - oneOf?: JSONSchema6Definition[] | undefined; - - /** - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29 - */ - not?: JSONSchema6Definition | undefined; - - /** - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1 - */ - definitions?: { - [k: string]: JSONSchema6Definition; - } | undefined; - - /** - * This attribute is a string that provides a short description of the instance property. - * - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 - */ - title?: string | undefined; - - /** - * This attribute is a string that provides a full description of the of purpose the instance property. - * - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2 - */ - description?: string | undefined; - - /** - * This keyword can be used to supply a default JSON value associated with a particular schema. - * It is RECOMMENDED that a default value be valid against the associated schema. - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3 - */ - default?: JSONSchema6Type | undefined; - - /** - * Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4 - */ - examples?: JSONSchema6Type[] | undefined; - - /** - * @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8 - */ - format?: string | undefined; -} - -// ================================================================================================== -// JSON Schema Draft 07 -// ================================================================================================== -// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01 -// -------------------------------------------------------------------------------------------------- - -/** - * Primitive type - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1 - */ -export type JSONSchema7TypeName = - | "string" // - | "number" - | "integer" - | "boolean" - | "object" - | "array" - | "null"; - -/** - * Primitive type - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1 - */ -export type JSONSchema7Type = - | string // - | number - | boolean - | JSONSchema7Object - | JSONSchema7Array - | null; - -// Workaround for infinite type recursion -export interface JSONSchema7Object { - [key: string]: JSONSchema7Type; -} - -// Workaround for infinite type recursion -// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540 -export interface JSONSchema7Array extends Array {} - -/** - * Meta schema - * - * Recommended values: - * - 'http://json-schema.org/schema#' - * - 'http://json-schema.org/hyper-schema#' - * - 'http://json-schema.org/draft-07/schema#' - * - 'http://json-schema.org/draft-07/hyper-schema#' - * - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5 - */ -export type JSONSchema7Version = string; - -/** - * JSON Schema v7 - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01 - */ -export type JSONSchema7Definition = JSONSchema7 | boolean; -export interface JSONSchema7 { - $id?: string | undefined; - $ref?: string | undefined; - $schema?: JSONSchema7Version | undefined; - $comment?: string | undefined; - - /** - * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4 - * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A - */ - $defs?: { - [key: string]: JSONSchema7Definition; - } | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1 - */ - type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined; - enum?: JSONSchema7Type[] | undefined; - const?: JSONSchema7Type | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2 - */ - multipleOf?: number | undefined; - maximum?: number | undefined; - exclusiveMaximum?: number | undefined; - minimum?: number | undefined; - exclusiveMinimum?: number | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3 - */ - maxLength?: number | undefined; - minLength?: number | undefined; - pattern?: string | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4 - */ - items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined; - additionalItems?: JSONSchema7Definition | undefined; - maxItems?: number | undefined; - minItems?: number | undefined; - uniqueItems?: boolean | undefined; - contains?: JSONSchema7Definition | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5 - */ - maxProperties?: number | undefined; - minProperties?: number | undefined; - required?: string[] | undefined; - properties?: { - [key: string]: JSONSchema7Definition; - } | undefined; - patternProperties?: { - [key: string]: JSONSchema7Definition; - } | undefined; - additionalProperties?: JSONSchema7Definition | undefined; - dependencies?: { - [key: string]: JSONSchema7Definition | string[]; - } | undefined; - propertyNames?: JSONSchema7Definition | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6 - */ - if?: JSONSchema7Definition | undefined; - then?: JSONSchema7Definition | undefined; - else?: JSONSchema7Definition | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7 - */ - allOf?: JSONSchema7Definition[] | undefined; - anyOf?: JSONSchema7Definition[] | undefined; - oneOf?: JSONSchema7Definition[] | undefined; - not?: JSONSchema7Definition | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7 - */ - format?: string | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8 - */ - contentMediaType?: string | undefined; - contentEncoding?: string | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9 - */ - definitions?: { - [key: string]: JSONSchema7Definition; - } | undefined; - - /** - * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10 - */ - title?: string | undefined; - description?: string | undefined; - default?: JSONSchema7Type | undefined; - readOnly?: boolean | undefined; - writeOnly?: boolean | undefined; - examples?: JSONSchema7Type | undefined; -} - -export interface ValidationResult { - valid: boolean; - errors: ValidationError[]; -} - -export interface ValidationError { - property: string; - message: string; -} - -/** - * To use the validator call JSONSchema.validate with an instance object and an optional schema object. - * If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating), - * that schema will be used to validate and the schema parameter is not necessary (if both exist, - * both validations will occur). - */ -export function validate(instance: {}, schema: JSONSchema4 | JSONSchema6 | JSONSchema7): ValidationResult; - -/** - * The checkPropertyChange method will check to see if an value can legally be in property with the given schema - * This is slightly different than the validate method in that it will fail if the schema is readonly and it will - * not check for self-validation, it is assumed that the passed in value is already internally valid. - */ -export function checkPropertyChange( - value: any, - schema: JSONSchema4 | JSONSchema6 | JSONSchema7, - property: string, -): ValidationResult; - -/** - * This checks to ensure that the result is valid and will throw an appropriate error message if it is not. - */ -export function mustBeValid(result: ValidationResult): void; diff --git a/node_modules/@types/json-schema/package.json b/node_modules/@types/json-schema/package.json deleted file mode 100644 index 3c41bd7..0000000 --- a/node_modules/@types/json-schema/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@types/json-schema", - "version": "7.0.15", - "description": "TypeScript definitions for json-schema", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema", - "license": "MIT", - "contributors": [ - { - "name": "Boris Cherny", - "githubUsername": "bcherny", - "url": "https://github.com/bcherny" - }, - { - "name": "Lucian Buzzo", - "githubUsername": "lucianbuzzo", - "url": "https://github.com/lucianbuzzo" - }, - { - "name": "Roland Groza", - "githubUsername": "rolandjitsu", - "url": "https://github.com/rolandjitsu" - }, - { - "name": "Jason Kwok", - "githubUsername": "JasonHK", - "url": "https://github.com/JasonHK" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/json-schema" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "79984fd70cd25c3f7d72b84368778c763c89728ea0073832d745d4691b705257", - "typeScriptVersion": "4.5" -} \ No newline at end of file diff --git a/node_modules/abstract-level/CHANGELOG.md b/node_modules/abstract-level/CHANGELOG.md deleted file mode 100644 index 7efb8a5..0000000 --- a/node_modules/abstract-level/CHANGELOG.md +++ /dev/null @@ -1,48 +0,0 @@ -# Changelog - -## [1.0.4] - 2024-01-20 - -### Fixed - -- Fix TypeScript definitions of `all()` and `nextv()` ([#67](https://github.com/Level/abstract-level/issues/67)) ([`8e85993`](https://github.com/Level/abstract-level/commit/8e85993), [`9f17757`](https://github.com/Level/abstract-level/commit/9f17757)) (Bryan) - -## [1.0.3] - 2022-03-20 - -### Added - -- Document error codes of `classic-level` and `many-level` ([#20](https://github.com/Level/abstract-level/issues/20)) ([`4b3464c`](https://github.com/Level/abstract-level/commit/4b3464c)) (Vincent Weevers) - -### Fixed - -- Add hidden `abortOnClose` option to iterators ([`2935180`](https://github.com/Level/abstract-level/commit/2935180)) (Vincent Weevers) -- Make internal iterator decoding options enumerable ([`eb08363`](https://github.com/Level/abstract-level/commit/eb08363)) (Vincent Weevers) -- Restore Sauce Labs browser tests ([`90b8816`](https://github.com/Level/abstract-level/commit/90b8816)) (Vincent Weevers) - -## [1.0.2] - 2022-03-06 - -### Fixed - -- Fix TypeScript declaration of chained batch `write()` options ([`392b7f7`](https://github.com/Level/abstract-level/commit/392b7f7)) (Vincent Weevers) -- Document the return type of `db.batch()` and add example ([`9739bba`](https://github.com/Level/abstract-level/commit/9739bba)) (Vincent Weevers) - -## [1.0.1] - 2022-02-06 - -### Fixed - -- Add `highWaterMarkBytes` option to tests where it matters ([`6b25a91`](https://github.com/Level/abstract-level/commit/6b25a91)) (Vincent Weevers) -- Clarify the meaning of `db.status` ([`2e90b05`](https://github.com/Level/abstract-level/commit/2e90b05)) (Vincent Weevers) -- Use `new` in README examples ([`379503e`](https://github.com/Level/abstract-level/commit/379503e)) (Vincent Weevers). - -## [1.0.0] - 2022-01-30 - -_:seedling: Initial release. If you are upgrading from `abstract-leveldown` please see [`UPGRADING.md`](UPGRADING.md)_ - -[1.0.4]: https://github.com/Level/abstract-level/releases/tag/v1.0.4 - -[1.0.3]: https://github.com/Level/abstract-level/releases/tag/v1.0.3 - -[1.0.2]: https://github.com/Level/abstract-level/releases/tag/v1.0.2 - -[1.0.1]: https://github.com/Level/abstract-level/releases/tag/v1.0.1 - -[1.0.0]: https://github.com/Level/abstract-level/releases/tag/v1.0.0 diff --git a/node_modules/abstract-level/LICENSE b/node_modules/abstract-level/LICENSE deleted file mode 100644 index 2b3ffdb..0000000 --- a/node_modules/abstract-level/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright © 2013 Rod Vagg and the contributors to abstract-level. - -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/abstract-level/README.md b/node_modules/abstract-level/README.md deleted file mode 100644 index d772630..0000000 --- a/node_modules/abstract-level/README.md +++ /dev/null @@ -1,1436 +0,0 @@ -# abstract-level - -**Abstract class for a lexicographically sorted key-value database.** The successor to [`abstract-leveldown`](https://github.com/Level/abstract-leveldown) with builtin encodings, sublevels, events, promises and support of Uint8Array. If you are upgrading please see [`UPGRADING.md`](UPGRADING.md). - -> :pushpin: Which module should I use? What happened to `levelup`? Head over to the [FAQ](https://github.com/Level/community#faq). - -[![level badge][level-badge]](https://github.com/Level/awesome) -[![npm](https://img.shields.io/npm/v/abstract-level.svg)](https://www.npmjs.com/package/abstract-level) -[![Node version](https://img.shields.io/node/v/abstract-level.svg)](https://www.npmjs.com/package/abstract-level) -[![Test](https://img.shields.io/github/workflow/status/Level/abstract-level/Test?label=test)](https://github.com/Level/abstract-level/actions/workflows/test.yml) -[![Browsers](https://img.shields.io/github/workflow/status/Level/abstract-level/Browsers?label=browsers)](https://github.com/Level/abstract-level/actions/workflows/browsers.yml) -[![Coverage](https://img.shields.io/codecov/c/github/Level/abstract-level?label=\&logo=codecov\&logoColor=fff)](https://codecov.io/gh/Level/abstract-level) -[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript\&logoColor=fff)](https://standardjs.com) -[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org) -[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective\&logoColor=fff)](https://opencollective.com/level) - -## Table of Contents - -
Click to expand - -- [Usage](#usage) -- [Supported Platforms](#supported-platforms) -- [Public API For Consumers](#public-api-for-consumers) - - [`db = new Constructor(...[, options])`](#db--new-constructor-options) - - [`db.status`](#dbstatus) - - [`db.open([options][, callback])`](#dbopenoptions-callback) - - [`db.close([callback])`](#dbclosecallback) - - [`db.supports`](#dbsupports) - - [`db.get(key[, options][, callback])`](#dbgetkey-options-callback) - - [`db.getMany(keys[, options][, callback])`](#dbgetmanykeys-options-callback) - - [`db.put(key, value[, options][, callback])`](#dbputkey-value-options-callback) - - [`db.del(key[, options][, callback])`](#dbdelkey-options-callback) - - [`db.batch(operations[, options][, callback])`](#dbbatchoperations-options-callback) - - [`chainedBatch = db.batch()`](#chainedbatch--dbbatch) - - [`iterator = db.iterator([options])`](#iterator--dbiteratoroptions) - - [`keyIterator = db.keys([options])`](#keyiterator--dbkeysoptions) - - [`valueIterator = db.values([options])`](#valueiterator--dbvaluesoptions) - - [`db.clear([options][, callback])`](#dbclearoptions-callback) - - [`sublevel = db.sublevel(name[, options])`](#sublevel--dbsublevelname-options) - - [`encoding = db.keyEncoding([encoding])`](#encoding--dbkeyencodingencoding) - - [`encoding = db.valueEncoding([encoding])`](#encoding--dbvalueencodingencoding) - - [`key = db.prefixKey(key, keyFormat)`](#key--dbprefixkeykey-keyformat) - - [`db.defer(fn)`](#dbdeferfn) - - [`chainedBatch`](#chainedbatch) - - [`chainedBatch.put(key, value[, options])`](#chainedbatchputkey-value-options) - - [`chainedBatch.del(key[, options])`](#chainedbatchdelkey-options) - - [`chainedBatch.clear()`](#chainedbatchclear) - - [`chainedBatch.write([options][, callback])`](#chainedbatchwriteoptions-callback) - - [`chainedBatch.close([callback])`](#chainedbatchclosecallback) - - [`chainedBatch.length`](#chainedbatchlength) - - [`chainedBatch.db`](#chainedbatchdb) - - [`iterator`](#iterator) - - [`for await...of iterator`](#for-awaitof-iterator) - - [`iterator.next([callback])`](#iteratornextcallback) - - [`iterator.nextv(size[, options][, callback])`](#iteratornextvsize-options-callback) - - [`iterator.all([options][, callback])`](#iteratoralloptions-callback) - - [`iterator.seek(target[, options])`](#iteratorseektarget-options) - - [`iterator.close([callback])`](#iteratorclosecallback) - - [`iterator.db`](#iteratordb) - - [`iterator.count`](#iteratorcount) - - [`iterator.limit`](#iteratorlimit) - - [`keyIterator`](#keyiterator) - - [`valueIterator`](#valueiterator) - - [`sublevel`](#sublevel) - - [`sublevel.prefix`](#sublevelprefix) - - [`sublevel.db`](#subleveldb) - - [Encodings](#encodings) - - [Events](#events) - - [Errors](#errors) - - [`LEVEL_NOT_FOUND`](#level_not_found) - - [`LEVEL_DATABASE_NOT_OPEN`](#level_database_not_open) - - [`LEVEL_DATABASE_NOT_CLOSED`](#level_database_not_closed) - - [`LEVEL_ITERATOR_NOT_OPEN`](#level_iterator_not_open) - - [`LEVEL_ITERATOR_BUSY`](#level_iterator_busy) - - [`LEVEL_BATCH_NOT_OPEN`](#level_batch_not_open) - - [`LEVEL_ENCODING_NOT_FOUND`](#level_encoding_not_found) - - [`LEVEL_ENCODING_NOT_SUPPORTED`](#level_encoding_not_supported) - - [`LEVEL_DECODE_ERROR`](#level_decode_error) - - [`LEVEL_INVALID_KEY`](#level_invalid_key) - - [`LEVEL_INVALID_VALUE`](#level_invalid_value) - - [`LEVEL_CORRUPTION`](#level_corruption) - - [`LEVEL_IO_ERROR`](#level_io_error) - - [`LEVEL_INVALID_PREFIX`](#level_invalid_prefix) - - [`LEVEL_NOT_SUPPORTED`](#level_not_supported) - - [`LEVEL_LEGACY`](#level_legacy) - - [`LEVEL_LOCKED`](#level_locked) - - [`LEVEL_READONLY`](#level_readonly) - - [`LEVEL_CONNECTION_LOST`](#level_connection_lost) - - [`LEVEL_REMOTE_ERROR`](#level_remote_error) - - [Shared Access](#shared-access) -- [Private API For Implementors](#private-api-for-implementors) - - [Example](#example) - - [`db = AbstractLevel(manifest[, options])`](#db--abstractlevelmanifest-options) - - [`db._open(options, callback)`](#db_openoptions-callback) - - [`db._close(callback)`](#db_closecallback) - - [`db._get(key, options, callback)`](#db_getkey-options-callback) - - [`db._getMany(keys, options, callback)`](#db_getmanykeys-options-callback) - - [`db._put(key, value, options, callback)`](#db_putkey-value-options-callback) - - [`db._del(key, options, callback)`](#db_delkey-options-callback) - - [`db._batch(operations, options, callback)`](#db_batchoperations-options-callback) - - [`db._chainedBatch()`](#db_chainedbatch) - - [`db._iterator(options)`](#db_iteratoroptions) - - [`db._keys(options)`](#db_keysoptions) - - [`db._values(options)`](#db_valuesoptions) - - [`db._clear(options, callback)`](#db_clearoptions-callback) - - [`sublevel = db._sublevel(name, options)`](#sublevel--db_sublevelname-options) - - [`iterator = AbstractIterator(db, options)`](#iterator--abstractiteratordb-options) - - [`iterator._next(callback)`](#iterator_nextcallback) - - [`iterator._nextv(size, options, callback)`](#iterator_nextvsize-options-callback) - - [`iterator._all(options, callback)`](#iterator_alloptions-callback) - - [`iterator._seek(target, options)`](#iterator_seektarget-options) - - [`iterator._close(callback)`](#iterator_closecallback) - - [`keyIterator = AbstractKeyIterator(db, options)`](#keyiterator--abstractkeyiteratordb-options) - - [`valueIterator = AbstractValueIterator(db, options)`](#valueiterator--abstractvalueiteratordb-options) - - [`chainedBatch = AbstractChainedBatch(db)`](#chainedbatch--abstractchainedbatchdb) - - [`chainedBatch._put(key, value, options)`](#chainedbatch_putkey-value-options) - - [`chainedBatch._del(key, options)`](#chainedbatch_delkey-options) - - [`chainedBatch._clear()`](#chainedbatch_clear) - - [`chainedBatch._write(options, callback)`](#chainedbatch_writeoptions-callback) - - [`chainedBatch._close(callback)`](#chainedbatch_closecallback) -- [Test Suite](#test-suite) - - [Excluding tests](#excluding-tests) - - [Reusing `testCommon`](#reusing-testcommon) -- [Spread The Word](#spread-the-word) -- [Install](#install) -- [Contributing](#contributing) -- [Donate](#donate) -- [License](#license) - -
- -## Usage - -Usage of a typical implementation looks as follows. - -```js -// Create a database -const db = new Level('./db', { valueEncoding: 'json' }) - -// Add an entry with key 'a' and value 1 -await db.put('a', 1) - -// Add multiple entries -await db.batch([{ type: 'put', key: 'b', value: 2 }]) - -// Get value of key 'a': 1 -const value = await db.get('a') - -// Iterate entries with keys that are greater than 'a' -for await (const [key, value] of db.iterator({ gt: 'a' })) { - console.log(value) // 2 -} -``` - -All asynchronous methods also support callbacks. - -
Callback example - -```js -db.put('a', { x: 123 }, function (err) { - if (err) throw err - - db.get('a', function (err, value) { - console.log(value) // { x: 123 } - }) -}) -``` - -
- -Usage from TypeScript requires generic type parameters. - -
TypeScript example - -```ts -// Specify types of keys and values (any, in the case of json). -// The generic type parameters default to Level. -const db = new Level('./db', { valueEncoding: 'json' }) - -// All relevant methods then use those types -await db.put('a', { x: 123 }) - -// Specify different types when overriding encoding per operation -await db.get('a', { valueEncoding: 'utf8' }) - -// Though in some cases TypeScript can infer them -await db.get('a', { valueEncoding: db.valueEncoding('utf8') }) - -// It works the same for sublevels -const abc = db.sublevel('abc') -const xyz = db.sublevel('xyz', { valueEncoding: 'json' }) -``` - -
- -## Supported Platforms - -We aim to support Active LTS and Current Node.js releases, as well as evergreen browsers that are based on Chromium, Firefox or Webkit. Supported runtime environments may differ per implementation. - -## Public API For Consumers - -This module has a public API for consumers of a database and a [private API](#private-api-for-implementors) for concrete implementations. The public API, as documented in this section, offers a simple yet rich interface that is common between all implementations. Implementations may have additional options or methods. TypeScript [type declarations](https://www.typescriptlang.org/docs/handbook/2/type-declarations.html) are [included](./index.d.ts) (and exported for reuse) only for the public API. - -An `abstract-level` database is at its core a [key-value database](https://en.wikipedia.org/wiki/Key%E2%80%93value_database). A key-value pair is referred to as an _entry_ here and typically returned as an array, comparable to [`Object.entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries). - -### `db = new Constructor(...[, options])` - -Creating a database is done by calling a class constructor. Implementations export a class that extends the [`AbstractLevel`](./abstract-level.js) class and has its own constructor with an implementation-specific signature. All constructors should have an `options` argument as the last. Typically, constructors take a `location` as their first argument, pointing to where the data will be stored. That may be a file path, URL, something else or none at all, since not all implementations are disk-based or persistent. Others take another database rather than a location as their first argument. - -The optional `options` object may contain: - -- `keyEncoding` (string or object, default `'utf8'`): encoding to use for keys -- `valueEncoding` (string or object, default `'utf8'`): encoding to use for values. - -See [Encodings](#encodings) for a full description of these options. Other `options` (except `passive`) are forwarded to `db.open()` which is automatically called in a next tick after the constructor returns. Any read & write operations are queued internally until the database has finished opening. If opening fails, those queued operations will yield errors. - -### `db.status` - -Read-only getter that returns a string reflecting the current state of the database: - -- `'opening'` - waiting for the database to be opened -- `'open'` - successfully opened the database -- `'closing'` - waiting for the database to be closed -- `'closed'` - successfully closed the database. - -### `db.open([options][, callback])` - -Open the database. The `callback` function will be called with no arguments when successfully opened, or with a single error argument if opening failed. If no callback is provided, a promise is returned. Options passed to `open()` take precedence over options passed to the database constructor. Not all implementations support the `createIfMissing` and `errorIfExists` options (notably [`memory-level`](https://github.com/Level/memory-level) and [`browser-level`](https://github.com/Level/browser-level)) and will indicate so via `db.supports.createIfMissing` and `db.supports.errorIfExists`. - -The optional `options` object may contain: - -- `createIfMissing` (boolean, default: `true`): If `true`, create an empty database if one doesn't already exist. If `false` and the database doesn't exist, opening will fail. -- `errorIfExists` (boolean, default: `false`): If `true` and the database already exists, opening will fail. -- `passive` (boolean, default: `false`): Wait for, but do not initiate, opening of the database. - -It's generally not necessary to call `open()` because it's automatically called by the database constructor. It may however be useful to capture an error from failure to open, that would otherwise not surface until another method like `db.get()` is called. It's also possible to reopen the database after it has been closed with [`close()`](#dbclosecallback). Once `open()` has then been called, any read & write operations will again be queued internally until opening has finished. - -The `open()` and `close()` methods are idempotent. If the database is already open, the `callback` will be called in a next tick. If opening is already in progress, the `callback` will be called when that has finished. If closing is in progress, the database will be reopened once closing has finished. Likewise, if `close()` is called after `open()`, the database will be closed once opening has finished and the prior `open()` call will receive an error. - -### `db.close([callback])` - -Close the database. The `callback` function will be called with no arguments if closing succeeded or with a single `error` argument if closing failed. If no callback is provided, a promise is returned. - -A database may have associated resources like file handles and locks. When the database is no longer needed (for the remainder of a program) it's recommended to call `db.close()` to free up resources. - -After `db.close()` has been called, no further read & write operations are allowed unless and until `db.open()` is called again. For example, `db.get(key)` will yield an error with code [`LEVEL_DATABASE_NOT_OPEN`](#errors). Any unclosed iterators or chained batches will be closed by `db.close()` and can then no longer be used even when `db.open()` is called again. - -### `db.supports` - -A [manifest](https://github.com/Level/supports) describing the features supported by this database. Might be used like so: - -```js -if (!db.supports.permanence) { - throw new Error('Persistent storage is required') -} -``` - -### `db.get(key[, options][, callback])` - -Get a value from the database by `key`. The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this operation, used to encode the `key`. -- `valueEncoding`: custom value encoding for this operation, used to decode the value. - -The `callback` function will be called with an error if the operation failed. If the key was not found, the error will have code [`LEVEL_NOT_FOUND`](#errors). If successful the first argument will be `null` and the second argument will be the value. If no callback is provided, a promise is returned. - -If the database indicates support of snapshots via `db.supports.snapshots` then `db.get()` _should_ read from a snapshot of the database, created at the time `db.get()` was called. This means it should not see the data of simultaneous write operations. However, this is currently not verified by the [abstract test suite](#test-suite). - -### `db.getMany(keys[, options][, callback])` - -Get multiple values from the database by an array of `keys`. The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this operation, used to encode the `keys`. -- `valueEncoding`: custom value encoding for this operation, used to decode values. - -The `callback` function will be called with an error if the operation failed. If successful the first argument will be `null` and the second argument will be an array of values with the same order as `keys`. If a key was not found, the relevant value will be `undefined`. If no callback is provided, a promise is returned. - -If the database indicates support of snapshots via `db.supports.snapshots` then `db.getMany()` _should_ read from a snapshot of the database, created at the time `db.getMany()` was called. This means it should not see the data of simultaneous write operations. However, this is currently not verified by the [abstract test suite](#test-suite). - -### `db.put(key, value[, options][, callback])` - -Add a new entry or overwrite an existing entry. The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this operation, used to encode the `key`. -- `valueEncoding`: custom value encoding for this operation, used to encode the `value`. - -The `callback` function will be called with no arguments if the operation was successful or with an error if it failed. If no callback is provided, a promise is returned. - -### `db.del(key[, options][, callback])` - -Delete an entry by `key`. The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this operation, used to encode the `key`. - -The `callback` function will be called with no arguments if the operation was successful or with an error if it failed. If no callback is provided, a promise is returned. - -### `db.batch(operations[, options][, callback])` - -Perform multiple _put_ and/or _del_ operations in bulk. The `operations` argument must be an array containing a list of operations to be executed sequentially, although as a whole they are performed as an atomic operation. - -Each operation must be an object with at least a `type` property set to either `'put'` or `'del'`. If the `type` is `'put'`, the operation must have `key` and `value` properties. It may optionally have `keyEncoding` and / or `valueEncoding` properties to encode keys or values with a custom encoding for just that operation. If the `type` is `'del'`, the operation must have a `key` property and may optionally have a `keyEncoding` property. - -An operation of either type may also have a `sublevel` property, to prefix the key of the operation with the prefix of that sublevel. This allows atomically committing data to multiple sublevels. Keys and values will be encoded by the sublevel, to the same effect as a `sublevel.batch(..)` call. In the following example, the first `value` will be encoded with `'json'` rather than the default encoding of `db`: - -```js -const people = db.sublevel('people', { valueEncoding: 'json' }) -const nameIndex = db.sublevel('names') - -await db.batch([{ - type: 'put', - sublevel: people, - key: '123', - value: { - name: 'Alice' - } -}, { - type: 'put', - sublevel: nameIndex, - key: 'Alice', - value: '123' -}]) -``` - -The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this batch, used to encode keys. -- `valueEncoding`: custom value encoding for this batch, used to encode values. - -Encoding properties on individual operations take precedence. In the following example, the first value will be encoded with the `'utf8'` encoding and the second with `'json'`. - -```js -await db.batch([ - { type: 'put', key: 'a', value: 'foo' }, - { type: 'put', key: 'b', value: 123, valueEncoding: 'json' } -], { valueEncoding: 'utf8' }) -``` - -The `callback` function will be called with no arguments if the batch was successful or with an error if it failed. If no callback is provided, a promise is returned. - -### `chainedBatch = db.batch()` - -Create a [chained batch](#chainedbatch), when `batch()` is called with zero arguments. A chained batch can be used to build and eventually commit an atomic batch of operations. Depending on how it's used, it is possible to obtain greater performance with this form of `batch()`. On several implementations however, it is just sugar. - -```js -await db.batch() - .del('bob') - .put('alice', 361) - .put('kim', 220) - .write() -``` - -### `iterator = db.iterator([options])` - -Create an [iterator](#iterator). The optional `options` object may contain the following _range options_ to control the range of entries to be iterated: - -- `gt` (greater than) or `gte` (greater than or equal): define the lower bound of the range to be iterated. Only entries where the key is greater than (or equal to) this option will be included in the range. When `reverse` is true the order will be reversed, but the entries iterated will be the same. -- `lt` (less than) or `lte` (less than or equal): define the higher bound of the range to be iterated. Only entries where the key is less than (or equal to) this option will be included in the range. When `reverse` is true the order will be reversed, but the entries iterated will be the same. -- `reverse` (boolean, default: `false`): iterate entries in reverse order. Beware that a reverse seek can be slower than a forward seek. -- `limit` (number, default: `Infinity`): limit the number of entries yielded. This number represents a _maximum_ number of entries and will not be reached if the end of the range is reached first. A value of `Infinity` or `-1` means there is no limit. When `reverse` is true the entries with the highest keys will be returned instead of the lowest keys. - -The `gte` and `lte` range options take precedence over `gt` and `lt` respectively. If no range options are provided, the iterator will visit all entries of the database, starting at the lowest key and ending at the highest key (unless `reverse` is true). In addition to range options, the `options` object may contain: - -- `keys` (boolean, default: `true`): whether to return the key of each entry. If set to `false`, the iterator will yield keys that are `undefined`. Prefer to use `db.keys()` instead. -- `values` (boolean, default: `true`): whether to return the value of each entry. If set to `false`, the iterator will yield values that are `undefined`. Prefer to use `db.values()` instead. -- `keyEncoding`: custom key encoding for this iterator, used to encode range options, to encode `seek()` targets and to decode keys. -- `valueEncoding`: custom value encoding for this iterator, used to decode values. - -Lastly, an implementation is free to add its own options. - -> :pushpin: To instead consume data using streams, see [`level-read-stream`](https://github.com/Level/read-stream) and [`level-web-stream`](https://github.com/Level/web-stream). - -### `keyIterator = db.keys([options])` - -Create a [key iterator](#keyiterator), having the same interface as `db.iterator()` except that it yields keys instead of entries. If only keys are needed, using `db.keys()` may increase performance because values won't have to fetched, copied or decoded. Options are the same as for `db.iterator()` except that `db.keys()` does not take `keys`, `values` and `valueEncoding` options. - -```js -// Iterate lazily -for await (const key of db.keys({ gt: 'a' })) { - console.log(key) -} - -// Get all at once. Setting a limit is recommended. -const keys = await db.keys({ gt: 'a', limit: 10 }).all() -``` - -### `valueIterator = db.values([options])` - -Create a [value iterator](#valueiterator), having the same interface as `db.iterator()` except that it yields values instead of entries. If only values are needed, using `db.values()` may increase performance because keys won't have to fetched, copied or decoded. Options are the same as for `db.iterator()` except that `db.values()` does not take `keys` and `values` options. Note that it _does_ take a `keyEncoding` option, relevant for the encoding of range options. - -```js -// Iterate lazily -for await (const value of db.values({ gt: 'a' })) { - console.log(value) -} - -// Get all at once. Setting a limit is recommended. -const values = await db.values({ gt: 'a', limit: 10 }).all() -``` - -### `db.clear([options][, callback])` - -Delete all entries or a range. Not guaranteed to be atomic. Accepts the following options (with the same rules as on iterators): - -- `gt` (greater than) or `gte` (greater than or equal): define the lower bound of the range to be deleted. Only entries where the key is greater than (or equal to) this option will be included in the range. When `reverse` is true the order will be reversed, but the entries deleted will be the same. -- `lt` (less than) or `lte` (less than or equal): define the higher bound of the range to be deleted. Only entries where the key is less than (or equal to) this option will be included in the range. When `reverse` is true the order will be reversed, but the entries deleted will be the same. -- `reverse` (boolean, default: `false`): delete entries in reverse order. Only effective in combination with `limit`, to delete the last N entries. -- `limit` (number, default: `Infinity`): limit the number of entries to be deleted. This number represents a _maximum_ number of entries and will not be reached if the end of the range is reached first. A value of `Infinity` or `-1` means there is no limit. When `reverse` is true the entries with the highest keys will be deleted instead of the lowest keys. -- `keyEncoding`: custom key encoding for this operation, used to encode range options. - -The `gte` and `lte` range options take precedence over `gt` and `lt` respectively. If no options are provided, all entries will be deleted. The `callback` function will be called with no arguments if the operation was successful or with an error if it failed. If no callback is provided, a promise is returned. - -### `sublevel = db.sublevel(name[, options])` - -Create a [sublevel](#sublevel) that has the same interface as `db` (except for additional, implementation-specific methods) and prefixes the keys of operations before passing them on to `db`. The `name` argument is required and must be a string. - -```js -const example = db.sublevel('example') - -await example.put('hello', 'world') -await db.put('a', '1') - -// Prints ['hello', 'world'] -for await (const [key, value] of example.iterator()) { - console.log([key, value]) -} -``` - -Sublevels effectively separate a database into sections. Think SQL tables, but evented, ranged and realtime! Each sublevel is an `AbstractLevel` instance with its own keyspace, [events](https://github.com/Level/abstract-level#events) and [encodings](https://github.com/Level/abstract-level#encodings). For example, it's possible to have one sublevel with `'buffer'` keys and another with `'utf8'` keys. The same goes for values. Like so: - -```js -db.sublevel('one', { valueEncoding: 'json' }) -db.sublevel('two', { keyEncoding: 'buffer' }) -``` - -An own keyspace means that `sublevel.iterator()` only includes entries of that sublevel, `sublevel.clear()` will only delete entries of that sublevel, and so forth. Range options get prefixed too. - -Fully qualified keys (as seen from the parent database) take the form of `prefix + key` where `prefix` is `separator + name + separator`. If `name` is empty, the effective prefix is two separators. Sublevels can be nested: if `db` is itself a sublevel then the effective prefix is a combined prefix, e.g. `'!one!!two!'`. Note that a parent database will see its own keys as well as keys of any nested sublevels: - -```js -// Prints ['!example!hello', 'world'] and ['a', '1'] -for await (const [key, value] of db.iterator()) { - console.log([key, value]) -} -``` - -> :pushpin: The key structure is equal to that of [`subleveldown`](https://github.com/Level/subleveldown) which offered sublevels before they were built-in to `abstract-level`. This means that an `abstract-level` sublevel can read sublevels previously created with (and populated by) `subleveldown`. - -Internally, sublevels operate on keys that are either a string, Buffer or Uint8Array, depending on parent database and choice of encoding. Which is to say: binary keys are fully supported. The `name` must however always be a string and can only contain ASCII characters. - -The optional `options` object may contain: - -- `separator` (string, default: `'!'`): Character for separating sublevel names from user keys and each other. Must sort before characters used in `name`. An error will be thrown if that's not the case. -- `keyEncoding` (string or object, default `'utf8'`): encoding to use for keys -- `valueEncoding` (string or object, default `'utf8'`): encoding to use for values. - -The `keyEncoding` and `valueEncoding` options are forwarded to the `AbstractLevel` constructor and work the same, as if a new, separate database was created. They default to `'utf8'` regardless of the encodings configured on `db`. Other options are forwarded too but `abstract-level` has no relevant options at the time of writing. For example, setting the `createIfMissing` option will have no effect. Why is that? - -Like regular databases, sublevels open themselves but they do not affect the state of the parent database. This means a sublevel can be individually closed and (re)opened. If the sublevel is created while the parent database is opening, it will wait for that to finish. If the parent database is closed, then opening the sublevel will fail and subsequent operations on the sublevel will yield errors with code [`LEVEL_DATABASE_NOT_OPEN`](#errors). - -### `encoding = db.keyEncoding([encoding])` - -Returns the given `encoding` argument as a normalized encoding object that follows the [`level-transcoder`](https://github.com/Level/transcoder) encoding interface. See [Encodings](#encodings) for an introduction. The `encoding` argument may be: - -- A string to select a known encoding by its name -- An object that follows one of the following interfaces: [`level-transcoder`](https://github.com/Level/transcoder#encoding-interface), [`level-codec`](https://github.com/Level/codec#encoding-format), [`abstract-encoding`](https://github.com/mafintosh/abstract-encoding), [`multiformats`](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts) -- A previously normalized encoding, such that `keyEncoding(x)` equals `keyEncoding(keyEncoding(x))` -- Omitted, `null` or `undefined`, in which case the default `keyEncoding` of the database is returned. - -Other methods that take `keyEncoding` or `valueEncoding` options, accept the same as above. Results are cached. If the `encoding` argument is an object and it has a name then subsequent calls can refer to that encoding by name. - -Depending on the encodings supported by a database, this method may return a _transcoder encoding_ that translates the desired encoding from / to an encoding supported by the database. Its `encode()` and `decode()` methods will have respectively the same input and output types as a non-transcoded encoding, but its `name` property will differ. - -Assume that e.g. `db.keyEncoding().encode(key)` is safe to call at any time including if the database isn't open, because encodings must be stateless. If the given encoding is not found or supported, a [`LEVEL_ENCODING_NOT_FOUND` or `LEVEL_ENCODING_NOT_SUPPORTED` error](#errors) is thrown. - -### `encoding = db.valueEncoding([encoding])` - -Same as `db.keyEncoding([encoding])` except that it returns the default `valueEncoding` of the database (if the `encoding` argument is omitted, `null` or `undefined`). - -### `key = db.prefixKey(key, keyFormat)` - -Add sublevel prefix to the given `key`, which must be already-encoded. If this database is not a sublevel, the given `key` is returned as-is. The `keyFormat` must be one of `'utf8'`, `'buffer'`, `'view'`. If `'utf8'` then `key` must be a string and the return value will be a string. If `'buffer'` then Buffer, if `'view'` then Uint8Array. - -```js -const sublevel = db.sublevel('example') - -console.log(db.prefixKey('a', 'utf8')) // 'a' -console.log(sublevel.prefixKey('a', 'utf8')) // '!example!a' -``` - -### `db.defer(fn)` - -Call the function `fn` at a later time when [`db.status`](#dbstatus) changes to `'open'` or `'closed'`. Used by `abstract-level` itself to implement "deferred open" which is a feature that makes it possible to call operations like `db.put()` before the database has finished opening. The `defer()` method is exposed for implementations and plugins to achieve the same on their custom operations: - -```js -db.foo = function (key, callback) { - if (this.status === 'opening') { - this.defer(() => this.foo(key, callback)) - } else { - // .. - } -} -``` - -When deferring a custom operation, do it early: after normalizing optional arguments but before encoding (to avoid double encoding and to emit original input if the operation has events) and before any _fast paths_ (to avoid calling back before the database has finished opening). For example, `db.batch([])` has an internal fast path where it skips work if the array of operations is empty. Resources that can be closed on their own (like iterators) should however first check such state before deferring, in order to reject operations after close (including when the database was reopened). - -### `chainedBatch` - -#### `chainedBatch.put(key, value[, options])` - -Queue a `put` operation on this batch, not committed until `write()` is called. This will throw a [`LEVEL_INVALID_KEY`](#errors) or [`LEVEL_INVALID_VALUE`](#errors) error if `key` or `value` is invalid. The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this operation, used to encode the `key`. -- `valueEncoding`: custom value encoding for this operation, used to encode the `value`. -- `sublevel` (sublevel instance): act as though the `put` operation is performed on the given sublevel, to similar effect as `sublevel.batch().put(key, value)`. This allows atomically committing data to multiple sublevels. The `key` will be prefixed with the `prefix` of the sublevel, and the `key` and `value` will be encoded by the sublevel (using the default encodings of the sublevel unless `keyEncoding` and / or `valueEncoding` are provided). - -#### `chainedBatch.del(key[, options])` - -Queue a `del` operation on this batch, not committed until `write()` is called. This will throw a [`LEVEL_INVALID_KEY`](#errors) error if `key` is invalid. The optional `options` object may contain: - -- `keyEncoding`: custom key encoding for this operation, used to encode the `key`. -- `sublevel` (sublevel instance): act as though the `del` operation is performed on the given sublevel, to similar effect as `sublevel.batch().del(key)`. This allows atomically committing data to multiple sublevels. The `key` will be prefixed with the `prefix` of the sublevel, and the `key` will be encoded by the sublevel (using the default key encoding of the sublevel unless `keyEncoding` is provided). - -#### `chainedBatch.clear()` - -Clear all queued operations on this batch. - -#### `chainedBatch.write([options][, callback])` - -Commit the queued operations for this batch. All operations will be written atomically, that is, they will either all succeed or fail with no partial commits. - -There are no `options` by default but implementations may add theirs. Note that `write()` does not take encoding options. Those can only be set on `put()` and `del()` because implementations may synchronously forward such calls to an underlying store and thus need keys and values to be encoded at that point. - -The `callback` function will be called with no arguments if the batch was successful or with an error if it failed. If no callback is provided, a promise is returned. - -After `write()` or `close()` has been called, no further operations are allowed. - -#### `chainedBatch.close([callback])` - -Free up underlying resources. This should be done even if the chained batch has zero queued operations. Automatically called by `write()` so normally not necessary to call, unless the intent is to discard a chained batch without committing it. The `callback` function will be called with no arguments. If no callback is provided, a promise is returned. Closing the batch is an idempotent operation, such that calling `close()` more than once is allowed and makes no difference. - -#### `chainedBatch.length` - -The number of queued operations on the current batch. - -#### `chainedBatch.db` - -A reference to the database that created this chained batch. - -### `iterator` - -An iterator allows one to lazily read a range of entries stored in the database. The entries will be sorted by keys in [lexicographic order](https://en.wikipedia.org/wiki/Lexicographic_order) (in other words: byte order) which in short means key `'a'` comes before `'b'` and key `'10'` comes before `'2'`. - -An iterator reads from a snapshot of the database, created at the time `db.iterator()` was called. This means the iterator will not see the data of simultaneous write operations. Most but not all implementations can offer this guarantee, as indicated by `db.supports.snapshots`. - -Iterators can be consumed with [`for await...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of) and `iterator.all()`, or by manually calling `iterator.next()` or `nextv()` in succession. In the latter case, `iterator.close()` must always be called. In contrast, finishing, throwing, breaking or returning from a `for await...of` loop automatically calls `iterator.close()`, as does `iterator.all()`. - -An iterator reaches its natural end in the following situations: - -- The end of the database has been reached -- The end of the range has been reached -- The last `iterator.seek()` was out of range. - -An iterator keeps track of calls that are in progress. It doesn't allow concurrent `next()`, `nextv()` or `all()` calls (including a combination thereof) and will throw an error with code [`LEVEL_ITERATOR_BUSY`](#errors) if that happens: - -```js -// Not awaited and no callback provided -iterator.next() - -try { - // Which means next() is still in progress here - iterator.all() -} catch (err) { - console.log(err.code) // 'LEVEL_ITERATOR_BUSY' -} -``` - -#### `for await...of iterator` - -Yields entries, which are arrays containing a `key` and `value`. The type of `key` and `value` depends on the options passed to `db.iterator()`. - -```js -try { - for await (const [key, value] of db.iterator()) { - console.log(key) - } -} catch (err) { - console.error(err) -} -``` - -Note for implementors: this uses `iterator.next()` and `iterator.close()` under the hood so no further method implementations are needed to support `for await...of`. - -#### `iterator.next([callback])` - -Advance to the next entry and yield that entry. If an error occurs, the `callback` function will be called with an error. Otherwise, the `callback` receives `null`, a `key` and a `value`. The type of `key` and `value` depends on the options passed to `db.iterator()`. If the iterator has reached its natural end, both `key` and `value` will be `undefined`. - -If no callback is provided, a promise is returned for either an entry array (containing a `key` and `value`) or `undefined` if the iterator reached its natural end. - -**Note:** `iterator.close()` must always be called once there's no intention to call `next()` or `nextv()` again. Even if such calls yielded an error and even if the iterator reached its natural end. Not closing the iterator will result in memory leaks and may also affect performance of other operations if many iterators are unclosed and each is holding a snapshot of the database. - -#### `iterator.nextv(size[, options][, callback])` - -Advance repeatedly and get at most `size` amount of entries in a single call. Can be faster than repeated `next()` calls. The `size` argument must be an integer and has a soft minimum of 1. There are no `options` by default but implementations may add theirs. - -If an error occurs, the `callback` function will be called with an error. Otherwise, the `callback` receives `null` and an array of entries, where each entry is an array containing a key and value. The natural end of the iterator will be signaled by yielding an empty array. If no callback is provided, a promise is returned. - -```js -const iterator = db.iterator() - -while (true) { - const entries = await iterator.nextv(100) - - if (entries.length === 0) { - break - } - - for (const [key, value] of entries) { - // .. - } -} - -await iterator.close() -``` - -#### `iterator.all([options][, callback])` - -Advance repeatedly and get all (remaining) entries as an array, automatically closing the iterator. Assumes that those entries fit in memory. If that's not the case, instead use `next()`, `nextv()` or `for await...of`. There are no `options` by default but implementations may add theirs. If an error occurs, the `callback` function will be called with an error. Otherwise, the `callback` receives `null` and an array of entries, where each entry is an array containing a key and value. If no callback is provided, a promise is returned. - -```js -const entries = await db.iterator({ limit: 100 }).all() - -for (const [key, value] of entries) { - // .. -} -``` - -#### `iterator.seek(target[, options])` - -Seek to the key closest to `target`. Subsequent calls to `iterator.next()`, `nextv()` or `all()` (including implicit calls in a `for await...of` loop) will yield entries with keys equal to or larger than `target`, or equal to or smaller than `target` if the `reverse` option passed to `db.iterator()` was true. - -The optional `options` object may contain: - -- `keyEncoding`: custom key encoding, used to encode the `target`. By default the `keyEncoding` option of the iterator is used or (if that wasn't set) the `keyEncoding` of the database. - -If range options like `gt` were passed to `db.iterator()` and `target` does not fall within that range, the iterator will reach its natural end. - -**Note:** Not all implementations support `seek()`. Consult `db.supports.seek` or the [support matrix](https://github.com/Level/supports#seek-boolean). - -#### `iterator.close([callback])` - -Free up underlying resources. The `callback` function will be called with no arguments. If no callback is provided, a promise is returned. Closing the iterator is an idempotent operation, such that calling `close()` more than once is allowed and makes no difference. - -If a `next()` ,`nextv()` or `all()` call is in progress, closing will wait for that to finish. After `close()` has been called, further calls to `next()` ,`nextv()` or `all()` will yield an error with code [`LEVEL_ITERATOR_NOT_OPEN`](#errors). - -#### `iterator.db` - -A reference to the database that created this iterator. - -#### `iterator.count` - -Read-only getter that indicates how many keys have been yielded so far (by any method) excluding calls that errored or yielded `undefined`. - -#### `iterator.limit` - -Read-only getter that reflects the `limit` that was set in options. Greater than or equal to zero. Equals `Infinity` if no limit, which allows for easy math: - -```js -const hasMore = iterator.count < iterator.limit -const remaining = iterator.limit - iterator.count -``` - -### `keyIterator` - -A key iterator has the same interface as `iterator` except that its methods yield keys instead of entries. For the `keyIterator.next(callback)` method, this means that the `callback` will receive two arguments (an error and key) instead of three. Usage is otherwise the same. - -### `valueIterator` - -A value iterator has the same interface as `iterator` except that its methods yield values instead of entries. For the `valueIterator.next(callback)` method, this means that the `callback` will receive two arguments (an error and value) instead of three. Usage is otherwise the same. - -### `sublevel` - -A sublevel is an instance of the `AbstractSublevel` class, which extends `AbstractLevel` and thus has the same API as documented above. Sublevels have a few additional properties. - -#### `sublevel.prefix` - -Prefix of the sublevel. A read-only string property. - -```js -const example = db.sublevel('example') -const nested = example.sublevel('nested') - -console.log(example.prefix) // '!example!' -console.log(nested.prefix) // '!example!!nested!' -``` - -#### `sublevel.db` - -Parent database. A read-only property. - -```js -const example = db.sublevel('example') -const nested = example.sublevel('nested') - -console.log(example.db === db) // true -console.log(nested.db === db) // true -``` - -### Encodings - -Any method that takes a `key` argument, `value` argument or range options like `gte`, hereby jointly referred to as `data`, runs that `data` through an _encoding_. This means to encode input `data` and decode output `data`. - -[Several encodings](https://github.com/Level/transcoder#built-in-encodings) are builtin courtesy of [`level-transcoder`](https://github.com/Level/transcoder) and can be selected by a short name like `'utf8'` or `'json'`. The default encoding is `'utf8'` which ensures you'll always get back a string. Encodings can be specified for keys and values independently with `keyEncoding` and `valueEncoding` options, either in the database constructor or per method to apply an encoding selectively. For example: - -```js -const db = level('./db', { - keyEncoding: 'view', - valueEncoding: 'json' -}) - -// Use binary keys -const key = Uint8Array.from([1, 2]) - -// Encode the value with JSON -await db.put(key, { x: 2 }) - -// Decode the value with JSON. Yields { x: 2 } -const obj = await db.get(key) - -// Decode the value with utf8. Yields '{"x":2}' -const str = await db.get(key, { valueEncoding: 'utf8' }) -``` - -The `keyEncoding` and `valueEncoding` options accept a string to select a known encoding by its name, or an object to use a custom encoding like [`charwise`](https://github.com/dominictarr/charwise). See [`keyEncoding()`](#encoding--dbkeyencodingencoding) for details. If a custom encoding is passed to the database constructor, subsequent method calls can refer to that encoding by name. Supported encodings are exposed in the `db.supports` manifest: - -```js -const db = level('./db', { - keyEncoding: require('charwise'), - valueEncoding: 'json' -}) - -// Includes builtin and custom encodings -console.log(db.supports.encodings.utf8) // true -console.log(db.supports.encodings.charwise) // true -``` - -An encoding can both widen and limit the range of `data` types. The default `'utf8'` encoding can only store strings. Other types, though accepted, are irreversibly stringified before storage. That includes JavaScript primitives which are converted with [`String(x)`](https://tc39.es/ecma262/multipage/text-processing.html#sec-string-constructor-string-value), Buffer which is converted with [`x.toString('utf8')`](https://nodejs.org/api/buffer.html#buftostringencoding-start-end) and Uint8Array converted with [`TextDecoder#decode(x)`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode). Use other encodings for a richer set of `data` types, as well as binary data without a conversion cost - or loss of non-unicode bytes. - -For binary data two builtin encodings are available: `'buffer'` and `'view'`. They use a Buffer or Uint8Array respectively. To some extent these encodings are interchangeable, as the `'buffer'` encoding also accepts Uint8Array as input `data` (and will convert that to a Buffer without copying the underlying ArrayBuffer), the `'view'` encoding also accepts Buffer as input `data` and so forth. Output `data` will be either a Buffer or Uint8Array respectively and can also be converted: - -```js -const db = level('./db', { valueEncoding: 'view' }) -const buffer = await db.get('example', { valueEncoding: 'buffer' }) -``` - -In browser environments it may be preferable to only use `'view'`. When bundling JavaScript with Webpack, Browserify or other, you can choose not to use the `'buffer'` encoding and (through configuration of the bundler) exclude the [`buffer`](https://github.com/feross/buffer) shim in order to reduce bundle size. - -Regardless of the choice of encoding, a `key` or `value` may not be `null` or `undefined` due to preexisting significance in iterators and streams. No such restriction exists on range options because `null` and `undefined` are significant types in encodings like [`charwise`](https://github.com/dominictarr/charwise) as well as some underlying stores like IndexedDB. Consumers of an `abstract-level` implementation must assume that range options like `{ gt: undefined }` are _not_ the same as `{}`. The [abstract test suite](#test-suite) does not test these types. Whether they are supported or how they sort may differ per implementation. An implementation can choose to: - -- Encode these types to make them meaningful -- Have no defined behavior (moving the concern to a higher level) -- Delegate to an underlying database (moving the concern to a lower level). - -Lastly, one way or another, every implementation _must_ support `data` of type String and _should_ support `data` of type Buffer or Uint8Array. - -### Events - -An `abstract-level` database is an [`EventEmitter`](https://nodejs.org/api/events.html) and emits the following events. - -| Event | Description | Arguments | -| :-------- | :------------------- | :------------------- | -| `put` | Entry was updated | `key, value` (any) | -| `del` | Entry was deleted | `key` (any) | -| `batch` | Batch has executed | `operations` (array) | -| `clear` | Entries were deleted | `options` (object) | -| `opening` | Database is opening | - | -| `open` | Database has opened | - | -| `ready` | Alias for `open` | - | -| `closing` | Database is closing | - | -| `closed` | Database has closed. | - | - -For example you can do: - -```js -db.on('put', function (key, value) { - console.log('Updated', { key, value }) -}) -``` - -Any keys, values and range options in these events are the original arguments passed to the relevant operation that triggered the event, before having encoded them. - -### Errors - -Errors thrown or yielded from the methods above will have a `code` property that is an uppercase string. Error codes will not change between major versions, but error messages will. Messages may also differ between implementations; they are free and encouraged to tune messages. - -A database may also throw [`TypeError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) errors (or other core error constructors in JavaScript) without a `code` and without any guarantee on the stability of error properties - because these errors indicate invalid arguments and other programming mistakes that should not be catched much less have associated logic. - -Error codes will be one of the following. - -#### `LEVEL_NOT_FOUND` - -When a key was not found. - -#### `LEVEL_DATABASE_NOT_OPEN` - -When an operation was made on a database while it was closing or closed. Or when a database failed to `open()` including when `close()` was called in the mean time, thus changing the eventual `status`. The error may have a `cause` property that explains a failure to open: - -```js -try { - await db.open() -} catch (err) { - console.error(err.code) // 'LEVEL_DATABASE_NOT_OPEN' - - if (err.cause && err.cause.code === 'LEVEL_LOCKED') { - // Another process or instance has opened the database - } -} -``` - -#### `LEVEL_DATABASE_NOT_CLOSED` - -When a database failed to `close()`. Including when `open()` was called in the mean time, thus changing the eventual `status`. The error may have a `cause` property that explains a failure to close. - -#### `LEVEL_ITERATOR_NOT_OPEN` - -When an operation was made on an iterator while it was closing or closed, which may also be the result of the database being closed. - -#### `LEVEL_ITERATOR_BUSY` - -When `iterator.next()` or `seek()` was called while a previous `next()` call was still in progress. - -#### `LEVEL_BATCH_NOT_OPEN` - -When an operation was made on a chained batch while it was closing or closed, which may also be the result of the database being closed or that `write()` was called on the chained batch. - -#### `LEVEL_ENCODING_NOT_FOUND` - -When a `keyEncoding` or `valueEncoding` option specified a named encoding that does not exist. - -#### `LEVEL_ENCODING_NOT_SUPPORTED` - -When a `keyEncoding` or `valueEncoding` option specified an encoding that isn't supported by the database. - -#### `LEVEL_DECODE_ERROR` - -When decoding of keys or values failed. The error _may_ have a [`cause`](https://github.com/tc39/proposal-error-cause) property containing an original error. For example, it might be a [`SyntaxError`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError) from an internal [`JSON.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) call: - -```js -await db.put('key', 'invalid json', { valueEncoding: 'utf8' }) - -try { - const value = await db.get('key', { valueEncoding: 'json' }) -} catch (err) { - console.log(err.code) // 'LEVEL_DECODE_ERROR' - console.log(err.cause) // 'SyntaxError: Unexpected token i in JSON at position 0' -} -``` - -#### `LEVEL_INVALID_KEY` - -When a key is `null`, `undefined` or (if an implementation deems it so) otherwise invalid. - -#### `LEVEL_INVALID_VALUE` - -When a value is `null`, `undefined` or (if an implementation deems it so) otherwise invalid. - -#### `LEVEL_CORRUPTION` - -Data could not be read (from an underlying store) due to a corruption. - -#### `LEVEL_IO_ERROR` - -Data could not be read (from an underlying store) due to an input/output error, for example from the filesystem. - -#### `LEVEL_INVALID_PREFIX` - -When a sublevel prefix contains characters outside of the supported byte range. - -#### `LEVEL_NOT_SUPPORTED` - -When a module needs a certain feature, typically as indicated by `db.supports`, but that feature is not available on a database argument or other. For example, some kind of plugin may depend on `seek()`: - -```js -const ModuleError = require('module-error') - -module.exports = function plugin (db) { - if (!db.supports.seek) { - throw new ModuleError('Database must support seeking', { - code: 'LEVEL_NOT_SUPPORTED' - }) - } - - // .. -} -``` - -#### `LEVEL_LEGACY` - -When a method, option or other property was used that has been removed from the API. - -#### `LEVEL_LOCKED` - -When an attempt was made to open a database that is already open in another process or instance. Used by `classic-level` and other implementations of `abstract-level` that use exclusive locks. - -#### `LEVEL_READONLY` - -When an attempt was made to write data to a read-only database. Used by `many-level`. - -#### `LEVEL_CONNECTION_LOST` - -When a database relies on a connection to a remote party and that connection has been lost. Used by `many-level`. - -#### `LEVEL_REMOTE_ERROR` - -When a remote party encountered an unexpected condition that it can't reflect with a more specific code. Used by `many-level`. - -### Shared Access - -Unless documented otherwise, implementations of `abstract-level` do _not_ support accessing a database from multiple processes running in parallel. That includes Node.js clusters and Electron renderer processes. - -See [`Level/awesome`](https://github.com/Level/awesome#shared-access) for modules like [`multileveldown`](https://github.com/Level/multileveldown) and [`level-party`](https://github.com/Level/party) that allow a database to be shared across processes and/or machines. Note: at the time of writing these modules are not yet ported to `abstract-level` and thus incompatible. - -## Private API For Implementors - -To implement an `abstract-level` database, extend the [`AbstractLevel`](./abstract-level.js) class and override the private underscored versions of its methods. For example, to implement the public `put()` method, override the private `_put()` method. The same goes for other classes (some of which are optional to override). All classes can be found on the main export of the npm package: - -```js -const { - AbstractLevel, - AbstractSublevel, - AbstractIterator, - AbstractKeyIterator, - AbstractValueIterator, - AbstractChainedBatch -} = require('abstract-level') -``` - -Naming-wise, implementations should use a class name in the form of `*Level` (suffixed, for example `MemoryLevel`) and an npm package name in the form of `*-level` (for example `memory-level`). While utilities and plugins should use a package name in the form of `level-*` (prefixed). - -Each of the private methods listed below will receive exactly the number and types of arguments described, regardless of what is passed in through the public API. Public methods provide type checking: if a consumer calls `db.batch(123)` they'll get an error that the first argument must be an array. Optional arguments get sensible defaults: a `db.get(key)` call translates to a `db._get(key, options, callback)` call. - -All callbacks are error-first and must be asynchronous. If an operation within your implementation is synchronous, invoke the callback on a next tick using microtask scheduling. For convenience, instances of `AbstractLevel`, `AbstractIterator` and other classes include a `nextTick(fn, ...args)` utility method that uses [`process.nextTick()`](https://nodejs.org/api/process.html#processnexttickcallback-args) in Node.js and [`queueMicrotask()`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) in browsers. It's recommended to exclusively use this utility (including in unit tests) as it guarantees a consistent order of operations. - -Where possible, the default private methods are sensible noops that do nothing. For example, `db._open(callback)` will merely invoke `callback` on a next tick. Other methods have functional defaults. Each method documents whether implementing it is mandatory. - -When throwing or yielding an error, prefer using a [known error code](#errors). If new codes are required for your implementation and you wish to use the `LEVEL_` prefix for consistency, feel free to open an issue to discuss. We'll likely want to document those codes here. - -### Example - -Let's implement a basic in-memory database: - -```js -const { AbstractLevel } = require('abstract-level') -const ModuleError = require('module-error') - -class ExampleLevel extends AbstractLevel { - // This in-memory example doesn't have a location argument - constructor (options) { - // Declare supported encodings - const encodings = { utf8: true } - - // Call AbstractLevel constructor - super({ encodings }, options) - - // Create a map to store entries - this._entries = new Map() - } - - _open (options, callback) { - // Here you would open any necessary resources. - // Use nextTick to be a nice async citizen - this.nextTick(callback) - } - - _put (key, value, options, callback) { - this._entries.set(key, value) - this.nextTick(callback) - } - - _get (key, options, callback) { - const value = this._entries.get(key) - - if (value === undefined) { - return this.nextTick(callback, new ModuleError(`Key ${key} was not found`, { - code: 'LEVEL_NOT_FOUND' - })) - } - - this.nextTick(callback, null, value) - } - - _del (key, options, callback) { - this._entries.delete(key) - this.nextTick(callback) - } -} -``` - -Now we can use our implementation (with either callbacks or promises): - -```js -const db = new ExampleLevel() - -await db.put('foo', 'bar') -const value = await db.get('foo') - -console.log(value) // 'bar' -``` - -Although our basic implementation only supports `'utf8'` strings internally, we do get to use [encodings](#encodings) that encode _to_ that. For example, the `'json'` encoding which encodes to `'utf8'`: - -```js -const db = new ExampleLevel({ valueEncoding: 'json' }) -await db.put('foo', { a: 123 }) -const value = await db.get('foo') - -console.log(value) // { a: 123 } -``` - -See [`memory-level`](https://github.com/Level/memory-level) if you are looking for a complete in-memory implementation. The example above notably lacks iterator support and would not pass the [abstract test suite](#test-suite). - -### `db = AbstractLevel(manifest[, options])` - -The database constructor. Sets the [`status`](#dbstatus) to `'opening'`. Takes a [manifest](https://github.com/Level/supports) object that the constructor will enrich with defaults. At minimum, the manifest must declare which `encodings` are supported in the private API. For example: - -```js -class ExampleLevel extends AbstractLevel { - constructor (location, options) { - const manifest = { - encodings: { buffer: true } - } - - // Call AbstractLevel constructor. - // Location is not handled by AbstractLevel. - super(manifest, options) - } -} -``` - -Both the public and private API of `abstract-level` are encoding-aware. This means that private methods receive `keyEncoding` and `valueEncoding` options too. Implementations don't need to perform encoding or decoding themselves. Rather, the `keyEncoding` and `valueEncoding` options are lower-level encodings that indicate the type of already-encoded input data or the expected type of yet-to-be-decoded output data. They're one of `'buffer'`, `'view'`, `'utf8'` and always strings in the private API. - -If the manifest declared support of `'buffer'`, then `keyEncoding` and `valueEncoding` will always be `'buffer'`. If the manifest declared support of `'utf8'` then `keyEncoding` and `valueEncoding` will be `'utf8'`. - -For example: a call like `await db.put(key, { x: 2 }, { valueEncoding: 'json' })` will encode the `{ x: 2 }` value and might forward it to the private API as `db._put(key, '{"x":2}', { valueEncoding: 'utf8' }, callback)`. Same for the key (omitted for brevity). - -The public API will coerce user input as necessary. If the manifest declared support of `'utf8'` then `await db.get(24)` will forward that number key as a string: `db._get('24', { keyEncoding: 'utf8', ... }, callback)`. However, this is _not_ true for output: a private API call like `db._get(key, { keyEncoding: 'utf8', valueEncoding: 'utf8' }, callback)` _must_ yield a string value to the callback. - -All private methods below that take a `key` argument, `value` argument or range option, will receive that data in encoded form. That includes `iterator._seek()` with its `target` argument. So if the manifest declared support of `'buffer'` then `db.iterator({ gt: 2 })` translates into `db._iterator({ gt: Buffer.from('2'), ...options })` and `iterator.seek(128)` translates into `iterator._seek(Buffer.from('128'), options)`. - -The `AbstractLevel` constructor will add other supported encodings to the public manifest. If the private API only supports `'buffer'`, the resulting `db.supports.encodings` will nevertheless be as follows because all other encodings can be transcoded to `'buffer'`: - -```js -{ buffer: true, view: true, utf8: true, json: true, ... } -``` - -Implementations can also declare support of multiple encodings. Keys and values will then be encoded and decoded via the most optimal path. For example, in [`classic-level`](https://github.com/Level/classic-level) (previously `leveldown`) it's: - -```js -super({ encodings: { buffer: true, utf8: true } }, options, callback) -``` - -This has the benefit that user input needs less conversion steps: if the input is a string then `classic-level` can pass that to its LevelDB binding as-is. Vice versa for output. - -### `db._open(options, callback)` - -Open the database. The `options` object will always have the following properties: `createIfMissing`, `errorIfExists`. If opening failed, call the `callback` function with an error. Otherwise call `callback` without any arguments. - -The default `_open()` is a sensible noop and invokes `callback` on a next tick. - -### `db._close(callback)` - -Close the database. When this is called, `db.status` will be `'closing'`. If closing failed, call the `callback` function with an error, which resets the `status` to `'open'`. Otherwise call `callback` without any arguments, which sets `status` to `'closed'`. Make an effort to avoid failing, or if it does happen that it is subsequently safe to keep using the database. If the database was never opened or failed to open then `_close()` will not be called. - -The default `_close()` is a sensible noop and invokes `callback` on a next tick. In native implementations (native addons written in C++ or other) it's recommended to delay closing if any operations are in flight. See [`classic-level`](https://github.com/Level/classic-level) (previously `leveldown`) for an example of this behavior. The JavaScript side in `abstract-level` will prevent _new_ operations before the database is reopened (as explained in constructor documentation above) while the C++ side should prevent closing the database before _existing_ operations have completed. - -### `db._get(key, options, callback)` - -Get a value by `key`. The `options` object will always have the following properties: `keyEncoding` and `valueEncoding`. If the key does not exist, call the `callback` function with an error that has code [`LEVEL_NOT_FOUND`](#errors). Otherwise call `callback` with `null` as the first argument and the value as the second. - -The default `_get()` invokes `callback` on a next tick with a `LEVEL_NOT_FOUND` error. It must be overridden. - -### `db._getMany(keys, options, callback)` - -Get multiple values by an array of `keys`. The `options` object will always have the following properties: `keyEncoding` and `valueEncoding`. If an error occurs, call the `callback` function with an error. Otherwise call `callback` with `null` as the first argument and an array of values as the second. If a key does not exist, set the relevant value to `undefined`. - -The default `_getMany()` invokes `callback` on a next tick with an array of values that is equal in length to `keys` and is filled with `undefined`. It must be overridden. - -### `db._put(key, value, options, callback)` - -Add a new entry or overwrite an existing entry. The `options` object will always have the following properties: `keyEncoding` and `valueEncoding`. If putting failed, call the `callback` function with an error. Otherwise call `callback` without any arguments. - -The default `_put()` invokes `callback` on a next tick. It must be overridden. - -### `db._del(key, options, callback)` - -Delete an entry. The `options` object will always have the following properties: `keyEncoding`. If deletion failed, call the `callback` function with an error. Otherwise call `callback` without any arguments. - -The default `_del()` invokes `callback` on a next tick. It must be overridden. - -### `db._batch(operations, options, callback)` - -Perform multiple _put_ and/or _del_ operations in bulk. The `operations` argument is always an array containing a list of operations to be executed sequentially, although as a whole they should be performed as an atomic operation. The `_batch()` method will not be called if the `operations` array is empty. Each operation is guaranteed to have at least `type`, `key` and `keyEncoding` properties. If the type is `put`, the operation will also have `value` and `valueEncoding` properties. There are no default options but `options` will always be an object. If the batch failed, call the `callback` function with an error. Otherwise call `callback` without any arguments. - -The public `batch()` method supports encoding options both in the `options` argument and per operation. The private `_batch()` method only receives encoding options per operation. - -The default `_batch()` invokes `callback` on a next tick. It must be overridden. - -### `db._chainedBatch()` - -The default `_chainedBatch()` returns a functional `AbstractChainedBatch` instance that uses `db._batch(array, options, callback)` under the hood. To implement chained batch in an optimized manner, extend `AbstractChainedBatch` and return an instance of this class in the `_chainedBatch()` method: - -```js -const { AbstractChainedBatch } = require('abstract-level') - -class ExampleChainedBatch extends AbstractChainedBatch { - constructor (db) { - super(db) - } -} - -class ExampleLevel extends AbstractLevel { - _chainedBatch () { - return new ExampleChainedBatch(this) - } -} -``` - -### `db._iterator(options)` - -The default `_iterator()` returns a noop `AbstractIterator` instance. It must be overridden, by extending `AbstractIterator` and returning an instance of this class in the `_iterator(options)` method: - -```js -const { AbstractIterator } = require('abstract-level') - -class ExampleIterator extends AbstractIterator { - constructor (db, options) { - super(db, options) - } - - // .. -} - -class ExampleLevel extends AbstractLevel { - _iterator (options) { - return new ExampleIterator(this, options) - } -} -``` - -The `options` object will always have the following properties: `reverse`, `keys`, `values`, `limit`, `keyEncoding` and `valueEncoding`. The `limit` will always be an integer, greater than or equal to `-1` and less than `Infinity`. If the user passed range options to `db.iterator()`, those will be encoded and set in `options`. - -### `db._keys(options)` - -The default `_keys()` returns a functional iterator that wraps `db._iterator()` in order to map entries to keys. For optimal performance it can be overridden by extending `AbstractKeyIterator`: - -```js -const { AbstractKeyIterator } = require('abstract-level') - -class ExampleKeyIterator extends AbstractKeyIterator { - constructor (db, options) { - super(db, options) - } - - // .. -} - -class ExampleLevel extends AbstractLevel { - _keys (options) { - return new ExampleKeyIterator(this, options) - } -} -``` - -The `options` object will always have the following properties: `reverse`, `limit` and `keyEncoding`. The `limit` will always be an integer, greater than or equal to `-1` and less than `Infinity`. If the user passed range options to `db.keys()`, those will be encoded and set in `options`. - -### `db._values(options)` - -The default `_values()` returns a functional iterator that wraps `db._iterator()` in order to map entries to values. For optimal performance it can be overridden by extending `AbstractValueIterator`: - -```js -const { AbstractValueIterator } = require('abstract-level') - -class ExampleValueIterator extends AbstractValueIterator { - constructor (db, options) { - super(db, options) - } - - // .. -} - -class ExampleLevel extends AbstractLevel { - _values (options) { - return new ExampleValueIterator(this, options) - } -} -``` - -The `options` object will always have the following properties: `reverse`, `limit`, `keyEncoding` and `valueEncoding`. The `limit` will always be an integer, greater than or equal to -1 and less than Infinity. If the user passed range options to `db.values()`, those will be encoded and set in `options`. - -### `db._clear(options, callback)` - -Delete all entries or a range. Does not have to be atomic. It is recommended (and possibly mandatory in the future) to operate on a snapshot so that writes scheduled after a call to `clear()` will not be affected. - -Implementations that wrap another database can typically forward the `_clear()` call to that database, having transformed range options if necessary. - -The `options` object will always have the following properties: `reverse`, `limit` and `keyEncoding`. If the user passed range options to `db.clear()`, those will be encoded and set in `options`. - -### `sublevel = db._sublevel(name, options)` - -Create a [sublevel](#sublevel). The `options` object will always have the following properties: `separator`. The default `_sublevel()` returns a new instance of the [`AbstractSublevel`](./lib/abstract-sublevel.js) class. Overriding is optional. The `AbstractSublevel` can be extended in order to add additional methods to sublevels: - -```js -const { AbstractLevel, AbstractSublevel } = require('abstract-level') - -class ExampleLevel extends AbstractLevel { - _sublevel (name, options) { - return new ExampleSublevel(this, name, options) - } -} - -// For brevity this does not handle deferred open -class ExampleSublevel extends AbstractSublevel { - example (key, options) { - // Encode and prefix the key - const keyEncoding = this.keyEncoding(options.keyEncoding) - const keyFormat = keyEncoding.format - - key = this.prefixKey(keyEncoding.encode(key), keyFormat) - - // The parent database can be accessed like so. Make sure - // to forward encoding options and use the full key. - this.db.del(key, { keyEncoding: keyFormat }, ...) - } -} -``` - -### `iterator = AbstractIterator(db, options)` - -The first argument to this constructor must be an instance of the relevant `AbstractLevel` implementation. The constructor will set `iterator.db` which is used (among other things) to access encodings and ensures that `db` will not be garbage collected in case there are no other references to it. The `options` argument must be the original `options` object that was passed to `db._iterator()` and it is therefore not (publicly) possible to create an iterator via constructors alone. - -#### `iterator._next(callback)` - -Advance to the next entry and yield that entry. If the operation failed, call the `callback` function with an error. Otherwise, call `callback` with `null`, a `key` and a `value`. If a `limit` was set and the iterator already yielded that many entries (via any of the methods) then `_next()` will not be called. - -The default `_next()` invokes `callback` on a next tick. It must be overridden. - -#### `iterator._nextv(size, options, callback)` - -Advance repeatedly and get at most `size` amount of entries in a single call. The `size` argument will always be an integer greater than 0. If a `limit` was set then `size` will be at most `limit - iterator.count`. If a `limit` was set and the iterator already yielded that many entries (via any of the methods) then `_nextv()` will not be called. There are no default options but `options` will always be an object. If the operation failed, call the `callback` function with an error. Otherwise, call `callback` with `null` and an array of entries. An empty array signifies the natural end of the iterator, so yield an array with at least one entry if the end has not been reached yet. - -The default `_nextv()` is a functional default that makes repeated calls to `_next()` and should be overridden for better performance. - -#### `iterator._all(options, callback)` - -Advance repeatedly and get all (remaining) entries as an array. If a `limit` was set and the iterator already yielded that many entries (via any of the methods) then `_all()` will not be called. Do not call `close()` here because `all()` will do so (regardless of any error) and this may become an opt-out behavior in the future. There are no default options but `options` will always be an object. If the operation failed, call the `callback` function with an error. Otherwise, call `callback` with `null` and an array of entries. - -The default `_all()` is a functional default that makes repeated calls to `_nextv()` and should be overridden for better performance. - -#### `iterator._seek(target, options)` - -Seek to the key closest to `target`. The `options` object will always have the following properties: `keyEncoding`. This method is optional. The default will throw an error with code [`LEVEL_NOT_SUPPORTED`](#errors). If supported, set `db.supports.seek` to `true` (via the manifest passed to the database constructor) which also enables relevant tests in the [test suite](#test-suite). - -#### `iterator._close(callback)` - -Free up underlying resources. This method is guaranteed to only be called once. Once closing is done, call `callback` without any arguments. It is not allowed to yield an error. - -The default `_close()` invokes `callback` on a next tick. Overriding is optional. - -### `keyIterator = AbstractKeyIterator(db, options)` - -A key iterator has the same interface and constructor arguments as `AbstractIterator` except that it must yields keys instead of entries. For the `keyIterator._next(callback)` method, this means that the `callback` must be given two arguments (an error and key) instead of three. The same goes for value iterators: - -```js -class ExampleKeyIterator extends AbstractKeyIterator { - _next (callback) { - this.nextTick(callback, null, 'key') - } -} - -class ExampleValueIterator extends AbstractValueIterator { - _next (callback) { - this.nextTick(callback, null, 'value') - } -} -``` - -The `options` argument must be the original `options` object that was passed to `db._keys()` and it is therefore not (publicly) possible to create a key iterator via constructors alone. The same goes for value iterators via `db._values()`. - -**Note:** the `AbstractKeyIterator` and `AbstractValueIterator` classes do _not_ extend the `AbstractIterator` class. Similarly, if your implementation overrides `db._keys()` returning a custom subclass of `AbstractKeyIterator`, then that subclass must implement methods like `_next()` separately from your subclass of `AbstractIterator`. - -### `valueIterator = AbstractValueIterator(db, options)` - -A value iterator has the same interface and constructor arguments as `AbstractIterator` except that it must yields values instead of entries. For further details, see `keyIterator` above. - -### `chainedBatch = AbstractChainedBatch(db)` - -The first argument to this constructor must be an instance of the relevant `AbstractLevel` implementation. The constructor will set `chainedBatch.db` which is used (among other things) to access encodings and ensures that `db` will not be garbage collected in case there are no other references to it. - -#### `chainedBatch._put(key, value, options)` - -Queue a `put` operation on this batch. The `options` object will always have the following properties: `keyEncoding` and `valueEncoding`. - -#### `chainedBatch._del(key, options)` - -Queue a `del` operation on this batch. The `options` object will always have the following properties: `keyEncoding`. - -#### `chainedBatch._clear()` - -Clear all queued operations on this batch. - -#### `chainedBatch._write(options, callback)` - -The default `_write` method uses `db._batch`. If the `_write` method is overridden it must atomically commit the queued operations. There are no default options but `options` will always be an object. If committing fails, call the `callback` function with an error. Otherwise call `callback` without any arguments. The `_write()` method will not be called if the chained batch has zero queued operations. - -#### `chainedBatch._close(callback)` - -Free up underlying resources. This method is guaranteed to only be called once. Once closing is done, call `callback` without any arguments. It is not allowed to yield an error. - -The default `_close()` invokes `callback` on a next tick. Overriding is optional. - -## Test Suite - -To prove that your implementation is `abstract-level` compliant, include the abstract test suite in your `test.js` (or similar): - -```js -const test = require('tape') -const suite = require('abstract-level/test') -const ExampleLevel = require('.') - -suite({ - test, - factory (options) { - return new ExampleLevel(options) - } -}) -``` - -The `test` option _must_ be a function that is API-compatible with [`tape`](https://github.com/substack/tape). The `factory` option _must_ be a function that returns a unique and isolated instance of your implementation. The factory will be called many times by the test suite. - -If your implementation is disk-based we recommend using [`tempy`](https://github.com/sindresorhus/tempy) (or similar) to create unique temporary directories. Your setup could look something like: - -```js -const test = require('tape') -const tempy = require('tempy') -const suite = require('abstract-level/test') -const ExampleLevel = require('.') - -suite({ - test, - factory (options) { - return new ExampleLevel(tempy.directory(), options) - } -}) -``` - -### Excluding tests - -As not every implementation can be fully compliant due to limitations of its underlying storage, some tests may be skipped. This must be done via `db.supports` which is set via the constructor. For example, to skip snapshot tests: - -```js -const { AbstractLevel } = require('abstract-level') - -class ExampleLevel extends AbstractLevel { - constructor (location, options) { - super({ snapshots: false }, options) - } -} -``` - -This also serves as a signal to users of your implementation. - -### Reusing `testCommon` - -The input to the test suite is a `testCommon` object. Should you need to reuse `testCommon` for your own (additional) tests, use the included utility to create a `testCommon` with defaults: - -```js -const test = require('tape') -const suite = require('abstract-level/test') -const ExampleLevel = require('.') - -const testCommon = suite.common({ - test, - factory (options) { - return new ExampleLevel(options) - } -}) - -suite(testCommon) -``` - -The `testCommon` object will have the `test` and `factory` properties described above, as well as a convenience `supports` property that is lazily copied from a `factory().supports`. You might use it like so: - -```js -test('custom test', function (t) { - const db = testCommon.factory() - // .. -}) - -testCommon.supports.seek && test('another test', function (t) { - const db = testCommon.factory() - // .. -}) -``` - -## Spread The Word - -If you'd like to share your awesome implementation with the world, here's what you might want to do: - -- Add an awesome badge to your `README`: `![level badge](https://leveljs.org/img/badge.svg)` -- Publish your awesome module to [npm](https://npmjs.org) -- Send a Pull Request to [Level/awesome](https://github.com/Level/awesome) to advertise your work! - -## Install - -With [npm](https://npmjs.org) do: - -``` -npm install abstract-level -``` - -## Contributing - -[`Level/abstract-level`](https://github.com/Level/abstract-level) is an **OPEN Open Source Project**. This means that: - -> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. - -See the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details. - -## Donate - -Support us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work. - -## License - -[MIT](LICENSE) - -[level-badge]: https://leveljs.org/img/badge.svg diff --git a/node_modules/abstract-level/UPGRADING.md b/node_modules/abstract-level/UPGRADING.md deleted file mode 100644 index 5b82feb..0000000 --- a/node_modules/abstract-level/UPGRADING.md +++ /dev/null @@ -1,479 +0,0 @@ -# Upgrade Guide - -This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the [changelog](CHANGELOG.md). - -## Table of Contents - -
Click to expand - -- [1.0.0](#100) - - [1. API parity with `levelup`](#1-api-parity-with-levelup) - - [1.1. New: promises](#11-new-promises) - - [1.2. New: events](#12-new-events) - - [1.3. New: idempotent open](#13-new-idempotent-open) - - [1.4. New: deferred open](#14-new-deferred-open) - - [1.5. No constructor callback](#15-no-constructor-callback) - - [1.6. New: state checks](#16-new-state-checks) - - [1.7. New: chained batch length](#17-new-chained-batch-length) - - [2. API parity with `level`](#2-api-parity-with-level) - - [2.1. For consumers](#21-for-consumers) - - [2.2. For implementors](#22-for-implementors) - - [2.3. Other notable changes](#23-other-notable-changes) - - [3. Streams have moved](#3-streams-have-moved) - - [4. Zero-length keys and range options are now valid](#4-zero-length-keys-and-range-options-are-now-valid) - - [5. Resources are auto-closed](#5-resources-are-auto-closed) - - [5.1. Closing iterators is idempotent](#51-closing-iterators-is-idempotent) - - [5.2. Chained batch can be closed](#52-chained-batch-can-be-closed) - - [6. Errors now use codes](#6-errors-now-use-codes) - - [7. Semi-private properties have been removed](#7-semi-private-properties-have-been-removed) - - [8. Changes to test suite](#8-changes-to-test-suite) - - [9. Sublevels are builtin](#9-sublevels-are-builtin) - -
- -## 1.0.0 - -**Introducing `abstract-level`: a fork of [`abstract-leveldown`](https://github.com/Level/abstract-leveldown) that removes the need for [`levelup`](https://github.com/Level/levelup), [`encoding-down`](https://github.com/Level/encoding-down) and more. An `abstract-level` database is a complete solution that doesn't need to be wrapped. It has the same API as `level(up)` including encodings, promises and events. In addition, implementations can now choose to use Uint8Array instead of Buffer. Consumers of an implementation can use both. Sublevels are builtin.** - -We've put together several upgrade guides for different modules. See the [FAQ](https://github.com/Level/community#faq) to find the best upgrade guide for you. This upgrade guide describes how to replace `abstract-leveldown` with `abstract-level`. Implementations that do so, can no longer be wrapped with `levelup`. - -The npm package name is `abstract-level` and the main export is called `AbstractLevel` rather than `AbstractLevelDOWN`. It started using classes. Support of Node.js 10 has been dropped. - -For most folks, a database that upgraded from `abstract-leveldown` to `abstract-level` can be a drop-in replacement for a `level(up)` database (with the exception of stream methods). Let's start this guide there: all methods have been enhanced to reach API parity with `levelup` and `level`. - -### 1. API parity with `levelup` - -#### 1.1. New: promises - -Methods that take a callback now also support promises. They return a promise if no callback is provided, the same as `levelup`. Implementations that override public (non-underscored) methods _must_ do the same and any implementation _should_ do the same for additional methods if any. - -#### 1.2. New: events - -An `abstract-level` database emits the same events as `levelup` would. - -#### 1.3. New: idempotent open - -Opening and closing a database is idempotent and safe, similar to `levelup` but more precise. If `open()` and `close()` are called repeatedly, the last call dictates the final status. Callbacks are not called (or promises not resolved) until any pending state changes are done. Same for events. Unlike on `levelup` it is safe to call `open()` while status is `'closing'`: the database will wait for closing to complete and then reopen. None of these changes are likely to constitute a breaking change; they increase state consistency in edge cases. - -The `open()` method has a new option called `passive`. If set to `true` the call will wait for, but not initiate, opening of the database. To similar effect as `db.once('open', callback)` with added benefit that it also works if the database is already open. Implementations that wrap another database can use the `passive` option to open themselves without taking full control of the database that they wrap. - -#### 1.4. New: deferred open - -Deferred open is built-in. This means a database opens itself a tick after its constructor returns (unless `open()` was called manually). Any operations made until opening has completed are queued up in memory. When opening completes the operations are replayed. If opening failed (and this is a new behavior compared to `levelup`) the operations will yield errors. The `AbstractLevel` class has a new `defer()` method for an implementation to defer custom operations. - -The initial `status` of a database is `'opening'` rather than `'new'`, which no longer exists. Wrapping a database with [`deferred-leveldown`](https://github.com/Level/deferred-leveldown) is not supported and will exhibit undefined behavior. - -Implementations must also accept options for `open()` in their constructor, which was previously done by `levelup`. For example, usage of the [`classic-level`](https://github.com/Level/classic-level) implementation is as follows: - -```js -const db = new ClassicLevel('./db', { - createIfMissing: false, - compression: false -}) -``` - -This works by first forwarding options to the `AbstractLevel` constructor, which in turn forwards them to `open(options)`. If `open(options)` is called manually those options will be shallowly merged with options from the constructor: - -```js -// Results in { createIfMissing: false, compression: true } -await db.open({ compression: true }) -``` - -A database is not "patch-safe". If some form of plugin monkey-patches a database like in the following example, it must now also take the responsibility of deferring the operation (as well as handling promises and callbacks) using `db.defer()`. I.e. this example is incomplete: - -```js -function plugin (db) { - const original = db.get - - db.get = function (...args) { - original.call(this, ...args) - } -} -``` - -#### 1.5. No constructor callback - -The database constructor does not take a callback argument, unlike `levelup`. This goes for `abstract-level` as well as implementations - which is to say, implementors don't have to (and should not) support this old pattern. - -Instead call `db.open()` if you wish to wait for opening (which is not necessary to use the database) or to capture an error. If that's your reason for using the callback and you previously initialized a database like so (simplified): - -```js -levelup(function (err, db) { - // .. -}) -``` - -You must now do: - -```js -db.open(function (err) { - // .. -}) -``` - -Or using promises: - -```js -await db.open() -``` - -#### 1.6. New: state checks - -On any operation, an `abstract-level` database checks if it's open. If not, it will either throw an error (if the relevant API is synchronous) or asynchronously yield an error. For example: - -```js -await db.close() - -try { - db.iterator() -} catch (err) { - console.log(err.code) // LEVEL_DATABASE_NOT_OPEN -} -``` - -_Errors now have a `code` property. More on that below\._ - -This may be a breaking change downstream because it changes error messages for implementations that had their own safety checks (which will now be ineffective because `abstract-level` checks are performed first) or implicitly relied on `levelup` checks. By safety we mean mainly that yielding a JavaScript error is preferred over segmentation faults, though non-native implementations also benefit from detecting incorrect usage. - -Implementations that have additional methods should add or align their own safety checks for consistency. Like so: - -
-Click to expand - -```js -const ModuleError = require('module-error') - -class ExampleLevel extends AbstractLevel { - // For brevity this example does not implement promises or encodings - approximateSize (start, end, callback) { - if (this.status === 'opening') { - this.defer(() => this.approximateSize(start, end, callback)) - } else if (this.status !== 'open') { - this.nextTick(callback, new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN' - })) - } else { - // .. - } - } -} -``` - -
- -#### 1.7. New: chained batch length - -The `AbstractChainedBatch` prototype has a new `length` property that, like a chained batch in `levelup`, returns the number of queued operations in the batch. Implementations should not have to make changes for this unless they monkey-patched public methods of `AbstractChainedBatch`. - -### 2. API parity with `level` - -It was previously necessary to use [`level`](https://github.com/Level/level) to get the "full experience". Or similar modules like [`level-mem`](https://github.com/Level/mem), [`level-rocksdb`](https://github.com/Level/level-rocksdb) and more. These modules combined an `abstract-leveldown` implementation with [`encoding-down`](https://github.com/Level/encoding-down) and [`levelup`](https://github.com/Level/levelup). Encodings are now built-in to `abstract-level`, using [`level-transcoder`](https://github.com/Level/transcoder) rather than [`level-codec`](https://github.com/Level/codec). The main change is that logic from the existing public API has been expanded down into the storage layer. - -The `level` module still has a place, for its support of both Node.js and browsers and for being the main entrypoint into the Level ecosystem. The next major version of `level`, that's v8.0.0, will likely simply export [`classic-level`](https://github.com/Level/classic-level) in Node.js and [`browser-level`](https://github.com/Level/browser-level) in browsers. To differentiate, the text below will refer to the old version as `level@7`. - -#### 2.1. For consumers - -All relevant methods including the database constructor now accept `keyEncoding` and `valueEncoding` options, the same as `level@7`. Read operations now yield strings rather than buffers by default, having the same default `'utf8'` encoding as `level@7` and friends. - -There are a few differences from `level@7` and `encoding-down`. Some breaking: - -- The lesser-used `'ascii'`, `'ucs2'` and `'utf16le'` encodings are not supported -- The `'id'` encoding, which was not supported by any active `abstract-leveldown` implementation and aliased as `'none'`, has been removed -- The undocumented `encoding` option (as an alias for `valueEncoding`) is not supported. - -And some non-breaking: - -- The `'binary'` encoding has been renamed to `'buffer'`, with `'binary'` as an alias -- The `'utf8'` encoding previously did not touch Buffers. Now it will call `buffer.toString('utf8')` for consistency. Consumers can use the `'buffer'` encoding to avoid this conversion. - -If you previously did one of the following (on a database that's defaulting to the `'utf8'` encoding): - -```js -await db.put('a', Buffer.from('x')) -await db.put('a', Buffer.from('x'), { valueEncoding: 'binary' }) -``` - -Both examples will still work (assuming the buffer contains only UTF8 data) but you should now do: - -```js -await db.put('a', Buffer.from('x'), { valueEncoding: 'buffer' }) -``` - -Or use the new `'view'` encoding which accepts Uint8Arrays (and therefore also Buffer): - -```js -await db.put('a', new Uint8Array(...), { valueEncoding: 'view' }) -``` - -#### 2.2. For implementors - -_You can skip this section if you're consuming (rather than writing) an `abstract-level` implementation._ - -Both the public and private API of `abstract-level` are encoding-aware. This means that private methods receive `keyEncoding` and `valueEncoding` options too, instead of the `keyAsBuffer`, `valueAsBuffer` and `asBuffer` options that `abstract-leveldown` had. Implementations don't need to perform encoding or decoding themselves. In fact they can do less: the `_serializeKey()` and `_serializeValue()` methods are also gone and implementations are less likely to have to convert between strings and buffers. - -For example: a call like `db.put(key, { x: 2 }, { valueEncoding: 'json' })` will encode the `{ x: 2 }` value and might forward it to the private API as `db._put(key, '{"x":2}', { valueEncoding: 'utf8' }, callback)`. Same for the key, omitted for brevity. We say "might" because it depends on the implementation, which can now declare which encodings it supports. - -To first give a concrete example for `get()`, if your implementation previously did: - -```js -class ExampleLeveldown extends AbstractLevelDOWN { - _get (key, options, callback) { - if (options.asBuffer) { - this.nextTick(callback, null, Buffer.from('abc')) - } else { - this.nextTick(callback, null, 'abc') - } - } -} -``` - -You must now do (if still relevant): - -```js -class ExampleLevel extends AbstractLevel { - _get (key, options, callback) { - if (options.valueEncoding === 'buffer') { - this.nextTick(callback, null, Buffer.from('abc')) - } else { - this.nextTick(callback, null, 'abc') - } - } -} -``` - -The encoding options and data received by the private API depend on which encodings it supports. It must declare those via the manifest passed to the `AbstractLevel` constructor. See the [`README`](README.md) for details. For example, an implementation might only support storing data as Uint8Arrays, known here as the `'view'` encoding: - -```js -class ExampleLevel extends AbstractLevel { - constructor (location, options) { - super({ encodings: { view: true } }, options) - } -} -``` - -The earlier `put()` example would then result in `db._put(key, value, { valueEncoding: 'view' }, callback)` where `value` is a Uint8Array containing JSON in binary form. And the earlier `_get()` example can be simplified to: - -```js -class ExampleLevel extends AbstractLevel { - _get (key, options, callback) { - // No need to check valueEncoding as it's always 'view' - this.nextTick(callback, null, new Uint8Array(...)) - } -} -``` - -Implementations can also declare support of multiple encodings; keys and values will then be encoded via the most optimal path. For example: - -```js -super({ - encodings: { - view: true, - utf8: true - } -}) -``` - -#### 2.3. Other notable changes - -- The `AbstractIterator` constructor now requires an `options` argument, for encoding options -- The `AbstractIterator#_seek()` method got a new `options` argument, for a `keyEncoding` option -- The `db.supports.bufferKeys` property has been removed. Use `db.supports.encodings.buffer` instead. - -### 3. Streams have moved - -Node.js readable streams must now be created with a new standalone module called [`level-read-stream`](https://github.com/Level/read-stream), rather than database methods like `db.createReadStream()`. Please see its [upgrade guide](https://github.com/Level/read-stream/blob/main/UPGRADING.md#100) for details. - -To offer an alternative to `db.createKeyStream()` and `db.createValueStream()`, two new types of iterators have been added: `db.keys()` and `db.values()`. Their default implementations are functional but implementors may want to override them for optimal performance. The same goes for two new methods on iterators: `nextv()` and `all()`. To achieve this and honor the `limit` option, abstract iterators now count how many items they yielded, which may remove the need for implementations to do so on their own. Please see the README for details. - -### 4. Zero-length keys and range options are now valid - -These keys sort before anything else. Historically they weren't supported for causing segmentation faults in `leveldown`. That doesn't apply to today's codebase. Implementations must now support: - -```js -await db.put('', 'example') - -console.log(await db.get('')) // 'example' - -for await (const [key, value] of db.iterator({ lte: '' })) { - console.log(value) // 'example' -} -``` - -Same goes for zero-length Buffer and Uint8Array keys. Zero-length keys would previously result in an error and never reach the private API. - -### 5. Resources are auto-closed - -To further improve safety and consistency, additional changes were made that make an `abstract-level` database safer to use than `abstract-leveldown` wrapped with `levelup`. - -#### 5.1. Closing iterators is idempotent - -The `iterator.end()` method has been renamed to `iterator.close()`, with `end()` being an alias until a next major version in the future. The term "close" makes it easier to differentiate between the iterator having reached its natural end (data-wise) versus closing it to cleanup resources. If you previously did: - -```js -const iterator = db.iterator() -iterator.end(callback) -``` - -You should now do one of: - -```js -iterator.close(callback) -await iterator.close() -``` - -Likewise, in the private API for implementors, `_end()` has been renamed to `_close()` but without an alias. This method is no longer allowed to yield an error. - -On `db.close()`, non-closed iterators are now automatically closed. This may be a breaking change but only if an implementation has (at its own risk) overridden the public `end()` method, because `close()` or `end()` is now an idempotent operation rather than yielding an `end() already called on iterator` error. If a `next()` call is in progress, closing the iterator (or database) will wait for that. - -The error message `cannot call next() after end()` has been replaced with code `LEVEL_ITERATOR_NOT_OPEN`, the error `cannot call seek() after end()` has been removed in favor of a silent return, and `cannot call next() before previous next() has completed` and `cannot call seek() before next() has completed` have been replaced with code `LEVEL_ITERATOR_BUSY`. - -The `next()` method no longer returns `this` (when a callback is provided). - -#### 5.2. Chained batch can be closed - -Chained batch has a new method `close()` which is an idempotent operation and automatically called after `write()` (for backwards compatibility) or on `db.close()`. This to ensure batches can't be used after closing and reopening a db. If a `write()` is in progress, closing will wait for that. If `write()` is never called then `close()` must be. For example: - -```js -const batch = db.batch() - .put('abc', 'zyz') - .del('foo') - -if (someCondition) { - await batch.write() -} else { - // Decided not to commit - await batch.close() -} - -// In either case this will throw -batch.put('more', 'data') -``` - -These changes could be breaking for an implementation that has (at its own risk) overridden the public `write()` method. In addition, the error message `write() already called on this batch` has been replaced with code `LEVEL_BATCH_NOT_OPEN`. - -An implementation can optionally override `AbstractChainedBatch#_close()` if it has resources to free and wishes to free them earlier than GC would. - -### 6. Errors now use codes - -The [`level-errors`](https://github.com/Level/errors) module as used by `levelup` and friends, is not used or exposed by `abstract-level`. Instead errors thrown or yielded from a database have a `code` property. See the [`README`](./README.md#errors) for details. Going forward, the semver contract will be on `code` and error messages will change without a semver-major bump. - -To minimize breakage, the most used error as yielded by `get()` when an entry is not found, has the same properties that `level-errors` added (`notFound` and `status`) in addition to code `LEVEL_NOT_FOUND`. Those properties will be removed in a future version. Implementations can still yield an error that matches `/NotFound/i.test(err)` or they can start using the code. Either way `abstract-level` will normalize the error. - -If you previously did: - -```js -db.get('abc', function (err, value) { - if (err && err.notFound) { - // Handle missing entry - } -}) -``` - -That will still work but it's preferred to do: - -```js -db.get('abc', function (err, value) { - if (err && err.code === 'LEVEL_NOT_FOUND') { - // Handle missing entry - } -}) -``` - -Or using promises: - -```js -try { - const value = await db.get('abc') -} catch (err) { - if (err.code === 'LEVEL_NOT_FOUND') { - // Handle missing entry - } -} -``` - -### 7. Semi-private properties have been removed - -The following properties and methods can no longer be accessed, as they've been removed or replaced with internal [symbols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol): - -- `AbstractIterator#_nexting` -- `AbstractIterator#_ended` -- `AbstractChainedBatch#_written` -- `AbstractChainedBatch#_checkWritten()` -- `AbstractChainedBatch#_operations` -- `AbstractLevel#_setupIteratorOptions()` - -### 8. Changes to test suite - -_You can skip this section if you're consuming (rather than writing) an `abstract-level` implementation._ - -The abstract test suite of `abstract-level` has some breaking changes compared to `abstract-leveldown`: - -- Options to skip tests have been removed in favor of `db.supports` -- Support of `db.clear()` and `db.getMany()` is now mandatory. The default (slow) implementation of `_clear()` has been removed. -- Added tests that `gte` and `lte` range options take precedence over `gt` and `lt` respectively. This is incompatible with [`ltgt`](https://github.com/dominictarr/ltgt) but aligns with `subleveldown`, [`level-option-wrap`](https://github.com/substack/level-option-wrap) and half of `leveldown`. There was no good choice. -- The `setUp` and `tearDown` functions have been removed from the test suite and `suite.common()`. -- Added ability to access manifests via `testCommon.supports`, by lazily copying it from `testCommon.factory().supports`. This requires that the manifest does not change during the lifetime of a `db`. -- Your `factory()` function must now accept an `options` argument. - -Many tests were imported from `levelup`, `encoding-down`, `deferred-leveldown`, `memdown`, `level-js` and `leveldown`. They test the changes described above and improve coverage of existing behavior. - -Lastly, it's recommended to revisit any custom tests of an implementation. In particular if those tests relied upon the previously loose state checking of `abstract-leveldown`. For example, making a `db.put()` call before `db.open()`. Such a test now has a different meaning. The previous meaning can typically be restored by inserting `db.once('open', ...)` or `await db.open()` logic. - -### 9. Sublevels are builtin - -_This section is only relevant if you use [`subleveldown`](https://github.com/Level/subleveldown) (which can not wrap an `abstract-level` database)._ - -Sublevels are now builtin. If you previously did: - -```js -const sub = require('subleveldown') -const example1 = sub(db, 'example1') -const example2 = sub(db, 'example2', { valueEncoding: 'json' }) -``` - -You must now do: - -```js -const example1 = db.sublevel('example1') -const example2 = db.sublevel('example2', { valueEncoding: 'json' }) -``` - -The key structure is equal to that of `subleveldown`. This means that an `abstract-level` sublevel can read sublevels previously created with (and populated by) `subleveldown`. There are some new features: - -- `db.batch(..)` takes a `sublevel` option on operations, to atomically commit data to multiple sublevels -- Sublevels support Uint8Array in addition to Buffer -- `AbstractLevel#_sublevel()` can be overridden to add additional methods to sublevels. - -To reduce function overloads, the prefix argument (`example1` above) is now required and it's called `name` here. If you previously did one of the following, resulting in an empty name: - -```js -subleveldown(db) -subleveldown(db, { separator: '@' }) -``` - -You must now use an explicit empty name: - -```js -db.sublevel('') -db.sublevel('', { separator: '@' }) -``` - -The string shorthand for `{ separator }` has also been removed. If you previously did: - -```js -subleveldown(db, 'example', '@') -``` - -You must now do: - -```js -db.sublevel('example', { separator: '@' }) -``` - -Third, the `open` option has been removed. If you need an asynchronous open hook, feel free to open an issue to discuss restoring this API. Should it support promises? Should `abstract-level` support it on any database and not just sublevels? - -Lastly, the error message `Parent database is not open` (courtesy of `subleveldown` which had to check open state to prevent segmentation faults from underlying databases) changed to error code [`LEVEL_DATABASE_NOT_OPEN`](https://github.com/Level/abstract-level#errors) (courtesy of `abstract-level` which does those checks on any database). - ---- - -_For earlier releases, before `abstract-level` was forked from `abstract-leveldown` (v7.2.0), please see [the upgrade guide of `abstract-leveldown`](https://github.com/Level/abstract-leveldown/blob/master/UPGRADING.md)._ diff --git a/node_modules/abstract-level/abstract-chained-batch.js b/node_modules/abstract-level/abstract-chained-batch.js deleted file mode 100644 index 3f77b3c..0000000 --- a/node_modules/abstract-level/abstract-chained-batch.js +++ /dev/null @@ -1,181 +0,0 @@ -'use strict' - -const { fromCallback } = require('catering') -const ModuleError = require('module-error') -const { getCallback, getOptions } = require('./lib/common') - -const kPromise = Symbol('promise') -const kStatus = Symbol('status') -const kOperations = Symbol('operations') -const kFinishClose = Symbol('finishClose') -const kCloseCallbacks = Symbol('closeCallbacks') - -class AbstractChainedBatch { - constructor (db) { - if (typeof db !== 'object' || db === null) { - const hint = db === null ? 'null' : typeof db - throw new TypeError(`The first argument must be an abstract-level database, received ${hint}`) - } - - this[kOperations] = [] - this[kCloseCallbacks] = [] - this[kStatus] = 'open' - this[kFinishClose] = this[kFinishClose].bind(this) - - this.db = db - this.db.attachResource(this) - this.nextTick = db.nextTick - } - - get length () { - return this[kOperations].length - } - - put (key, value, options) { - if (this[kStatus] !== 'open') { - throw new ModuleError('Batch is not open: cannot call put() after write() or close()', { - code: 'LEVEL_BATCH_NOT_OPEN' - }) - } - - const err = this.db._checkKey(key) || this.db._checkValue(value) - if (err) throw err - - const db = options && options.sublevel != null ? options.sublevel : this.db - const original = options - const keyEncoding = db.keyEncoding(options && options.keyEncoding) - const valueEncoding = db.valueEncoding(options && options.valueEncoding) - const keyFormat = keyEncoding.format - - // Forward encoding options - options = { ...options, keyEncoding: keyFormat, valueEncoding: valueEncoding.format } - - // Prevent double prefixing - if (db !== this.db) { - options.sublevel = null - } - - const mappedKey = db.prefixKey(keyEncoding.encode(key), keyFormat) - const mappedValue = valueEncoding.encode(value) - - this._put(mappedKey, mappedValue, options) - this[kOperations].push({ ...original, type: 'put', key, value }) - - return this - } - - _put (key, value, options) {} - - del (key, options) { - if (this[kStatus] !== 'open') { - throw new ModuleError('Batch is not open: cannot call del() after write() or close()', { - code: 'LEVEL_BATCH_NOT_OPEN' - }) - } - - const err = this.db._checkKey(key) - if (err) throw err - - const db = options && options.sublevel != null ? options.sublevel : this.db - const original = options - const keyEncoding = db.keyEncoding(options && options.keyEncoding) - const keyFormat = keyEncoding.format - - // Forward encoding options - options = { ...options, keyEncoding: keyFormat } - - // Prevent double prefixing - if (db !== this.db) { - options.sublevel = null - } - - this._del(db.prefixKey(keyEncoding.encode(key), keyFormat), options) - this[kOperations].push({ ...original, type: 'del', key }) - - return this - } - - _del (key, options) {} - - clear () { - if (this[kStatus] !== 'open') { - throw new ModuleError('Batch is not open: cannot call clear() after write() or close()', { - code: 'LEVEL_BATCH_NOT_OPEN' - }) - } - - this._clear() - this[kOperations] = [] - - return this - } - - _clear () {} - - write (options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options) - - if (this[kStatus] !== 'open') { - this.nextTick(callback, new ModuleError('Batch is not open: cannot call write() after write() or close()', { - code: 'LEVEL_BATCH_NOT_OPEN' - })) - } else if (this.length === 0) { - this.close(callback) - } else { - this[kStatus] = 'writing' - this._write(options, (err) => { - this[kStatus] = 'closing' - this[kCloseCallbacks].push(() => callback(err)) - - // Emit after setting 'closing' status, because event may trigger a - // db close which in turn triggers (idempotently) closing this batch. - if (!err) this.db.emit('batch', this[kOperations]) - - this._close(this[kFinishClose]) - }) - } - - return callback[kPromise] - } - - _write (options, callback) {} - - close (callback) { - callback = fromCallback(callback, kPromise) - - if (this[kStatus] === 'closing') { - this[kCloseCallbacks].push(callback) - } else if (this[kStatus] === 'closed') { - this.nextTick(callback) - } else { - this[kCloseCallbacks].push(callback) - - if (this[kStatus] !== 'writing') { - this[kStatus] = 'closing' - this._close(this[kFinishClose]) - } - } - - return callback[kPromise] - } - - _close (callback) { - this.nextTick(callback) - } - - [kFinishClose] () { - this[kStatus] = 'closed' - this.db.detachResource(this) - - const callbacks = this[kCloseCallbacks] - this[kCloseCallbacks] = [] - - for (const cb of callbacks) { - cb() - } - } -} - -exports.AbstractChainedBatch = AbstractChainedBatch diff --git a/node_modules/abstract-level/abstract-iterator.js b/node_modules/abstract-level/abstract-iterator.js deleted file mode 100644 index 48330ec..0000000 --- a/node_modules/abstract-level/abstract-iterator.js +++ /dev/null @@ -1,490 +0,0 @@ -'use strict' - -const { fromCallback } = require('catering') -const ModuleError = require('module-error') -const { getOptions, getCallback } = require('./lib/common') - -const kPromise = Symbol('promise') -const kCallback = Symbol('callback') -const kWorking = Symbol('working') -const kHandleOne = Symbol('handleOne') -const kHandleMany = Symbol('handleMany') -const kAutoClose = Symbol('autoClose') -const kFinishWork = Symbol('finishWork') -const kReturnMany = Symbol('returnMany') -const kClosing = Symbol('closing') -const kHandleClose = Symbol('handleClose') -const kClosed = Symbol('closed') -const kCloseCallbacks = Symbol('closeCallbacks') -const kKeyEncoding = Symbol('keyEncoding') -const kValueEncoding = Symbol('valueEncoding') -const kAbortOnClose = Symbol('abortOnClose') -const kLegacy = Symbol('legacy') -const kKeys = Symbol('keys') -const kValues = Symbol('values') -const kLimit = Symbol('limit') -const kCount = Symbol('count') - -const emptyOptions = Object.freeze({}) -const noop = () => {} -let warnedEnd = false - -// This class is an internal utility for common functionality between AbstractIterator, -// AbstractKeyIterator and AbstractValueIterator. It's not exported. -class CommonIterator { - constructor (db, options, legacy) { - if (typeof db !== 'object' || db === null) { - const hint = db === null ? 'null' : typeof db - throw new TypeError(`The first argument must be an abstract-level database, received ${hint}`) - } - - if (typeof options !== 'object' || options === null) { - throw new TypeError('The second argument must be an options object') - } - - this[kClosed] = false - this[kCloseCallbacks] = [] - this[kWorking] = false - this[kClosing] = false - this[kAutoClose] = false - this[kCallback] = null - this[kHandleOne] = this[kHandleOne].bind(this) - this[kHandleMany] = this[kHandleMany].bind(this) - this[kHandleClose] = this[kHandleClose].bind(this) - this[kKeyEncoding] = options[kKeyEncoding] - this[kValueEncoding] = options[kValueEncoding] - this[kLegacy] = legacy - this[kLimit] = Number.isInteger(options.limit) && options.limit >= 0 ? options.limit : Infinity - this[kCount] = 0 - - // Undocumented option to abort pending work on close(). Used by the - // many-level module as a temporary solution to a blocked close(). - // TODO (next major): consider making this the default behavior. Native - // implementations should have their own logic to safely close iterators. - this[kAbortOnClose] = !!options.abortOnClose - - this.db = db - this.db.attachResource(this) - this.nextTick = db.nextTick - } - - get count () { - return this[kCount] - } - - get limit () { - return this[kLimit] - } - - next (callback) { - let promise - - if (callback === undefined) { - promise = new Promise((resolve, reject) => { - callback = (err, key, value) => { - if (err) reject(err) - else if (!this[kLegacy]) resolve(key) - else if (key === undefined && value === undefined) resolve() - else resolve([key, value]) - } - }) - } else if (typeof callback !== 'function') { - throw new TypeError('Callback must be a function') - } - - if (this[kClosing]) { - this.nextTick(callback, new ModuleError('Iterator is not open: cannot call next() after close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } else if (this[kWorking]) { - this.nextTick(callback, new ModuleError('Iterator is busy: cannot call next() until previous call has completed', { - code: 'LEVEL_ITERATOR_BUSY' - })) - } else { - this[kWorking] = true - this[kCallback] = callback - - if (this[kCount] >= this[kLimit]) this.nextTick(this[kHandleOne], null) - else this._next(this[kHandleOne]) - } - - return promise - } - - _next (callback) { - this.nextTick(callback) - } - - nextv (size, options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, emptyOptions) - - if (!Number.isInteger(size)) { - this.nextTick(callback, new TypeError("The first argument 'size' must be an integer")) - return callback[kPromise] - } - - if (this[kClosing]) { - this.nextTick(callback, new ModuleError('Iterator is not open: cannot call nextv() after close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } else if (this[kWorking]) { - this.nextTick(callback, new ModuleError('Iterator is busy: cannot call nextv() until previous call has completed', { - code: 'LEVEL_ITERATOR_BUSY' - })) - } else { - if (size < 1) size = 1 - if (this[kLimit] < Infinity) size = Math.min(size, this[kLimit] - this[kCount]) - - this[kWorking] = true - this[kCallback] = callback - - if (size <= 0) this.nextTick(this[kHandleMany], null, []) - else this._nextv(size, options, this[kHandleMany]) - } - - return callback[kPromise] - } - - _nextv (size, options, callback) { - const acc = [] - const onnext = (err, key, value) => { - if (err) { - return callback(err) - } else if (this[kLegacy] ? key === undefined && value === undefined : key === undefined) { - return callback(null, acc) - } - - acc.push(this[kLegacy] ? [key, value] : key) - - if (acc.length === size) { - callback(null, acc) - } else { - this._next(onnext) - } - } - - this._next(onnext) - } - - all (options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, emptyOptions) - - if (this[kClosing]) { - this.nextTick(callback, new ModuleError('Iterator is not open: cannot call all() after close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } else if (this[kWorking]) { - this.nextTick(callback, new ModuleError('Iterator is busy: cannot call all() until previous call has completed', { - code: 'LEVEL_ITERATOR_BUSY' - })) - } else { - this[kWorking] = true - this[kCallback] = callback - this[kAutoClose] = true - - if (this[kCount] >= this[kLimit]) this.nextTick(this[kHandleMany], null, []) - else this._all(options, this[kHandleMany]) - } - - return callback[kPromise] - } - - _all (options, callback) { - // Must count here because we're directly calling _nextv() - let count = this[kCount] - const acc = [] - - const nextv = () => { - // Not configurable, because implementations should optimize _all(). - const size = this[kLimit] < Infinity ? Math.min(1e3, this[kLimit] - count) : 1e3 - - if (size <= 0) { - this.nextTick(callback, null, acc) - } else { - this._nextv(size, emptyOptions, onnextv) - } - } - - const onnextv = (err, items) => { - if (err) { - callback(err) - } else if (items.length === 0) { - callback(null, acc) - } else { - acc.push.apply(acc, items) - count += items.length - nextv() - } - } - - nextv() - } - - [kFinishWork] () { - const cb = this[kCallback] - - // Callback will be null if work was aborted on close - if (this[kAbortOnClose] && cb === null) return noop - - this[kWorking] = false - this[kCallback] = null - - if (this[kClosing]) this._close(this[kHandleClose]) - - return cb - } - - [kReturnMany] (cb, err, items) { - if (this[kAutoClose]) { - this.close(cb.bind(null, err, items)) - } else { - cb(err, items) - } - } - - seek (target, options) { - options = getOptions(options, emptyOptions) - - if (this[kClosing]) { - // Don't throw here, to be kind to implementations that wrap - // another db and don't necessarily control when the db is closed - } else if (this[kWorking]) { - throw new ModuleError('Iterator is busy: cannot call seek() until next() has completed', { - code: 'LEVEL_ITERATOR_BUSY' - }) - } else { - const keyEncoding = this.db.keyEncoding(options.keyEncoding || this[kKeyEncoding]) - const keyFormat = keyEncoding.format - - if (options.keyEncoding !== keyFormat) { - options = { ...options, keyEncoding: keyFormat } - } - - const mapped = this.db.prefixKey(keyEncoding.encode(target), keyFormat) - this._seek(mapped, options) - } - } - - _seek (target, options) { - throw new ModuleError('Iterator does not support seek()', { - code: 'LEVEL_NOT_SUPPORTED' - }) - } - - close (callback) { - callback = fromCallback(callback, kPromise) - - if (this[kClosed]) { - this.nextTick(callback) - } else if (this[kClosing]) { - this[kCloseCallbacks].push(callback) - } else { - this[kClosing] = true - this[kCloseCallbacks].push(callback) - - if (!this[kWorking]) { - this._close(this[kHandleClose]) - } else if (this[kAbortOnClose]) { - // Don't wait for work to finish. Subsequently ignore the result. - const cb = this[kFinishWork]() - - cb(new ModuleError('Aborted on iterator close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } - } - - return callback[kPromise] - } - - _close (callback) { - this.nextTick(callback) - } - - [kHandleClose] () { - this[kClosed] = true - this.db.detachResource(this) - - const callbacks = this[kCloseCallbacks] - this[kCloseCallbacks] = [] - - for (const cb of callbacks) { - cb() - } - } - - async * [Symbol.asyncIterator] () { - try { - let item - - while ((item = (await this.next())) !== undefined) { - yield item - } - } finally { - if (!this[kClosed]) await this.close() - } - } -} - -// For backwards compatibility this class is not (yet) called AbstractEntryIterator. -class AbstractIterator extends CommonIterator { - constructor (db, options) { - super(db, options, true) - this[kKeys] = options.keys !== false - this[kValues] = options.values !== false - } - - [kHandleOne] (err, key, value) { - const cb = this[kFinishWork]() - if (err) return cb(err) - - try { - key = this[kKeys] && key !== undefined ? this[kKeyEncoding].decode(key) : undefined - value = this[kValues] && value !== undefined ? this[kValueEncoding].decode(value) : undefined - } catch (err) { - return cb(new IteratorDecodeError('entry', err)) - } - - if (!(key === undefined && value === undefined)) { - this[kCount]++ - } - - cb(null, key, value) - } - - [kHandleMany] (err, entries) { - const cb = this[kFinishWork]() - if (err) return this[kReturnMany](cb, err) - - try { - for (const entry of entries) { - const key = entry[0] - const value = entry[1] - - entry[0] = this[kKeys] && key !== undefined ? this[kKeyEncoding].decode(key) : undefined - entry[1] = this[kValues] && value !== undefined ? this[kValueEncoding].decode(value) : undefined - } - } catch (err) { - return this[kReturnMany](cb, new IteratorDecodeError('entries', err)) - } - - this[kCount] += entries.length - this[kReturnMany](cb, null, entries) - } - - end (callback) { - if (!warnedEnd && typeof console !== 'undefined') { - warnedEnd = true - console.warn(new ModuleError( - 'The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version', - { code: 'LEVEL_LEGACY' } - )) - } - - return this.close(callback) - } -} - -class AbstractKeyIterator extends CommonIterator { - constructor (db, options) { - super(db, options, false) - } - - [kHandleOne] (err, key) { - const cb = this[kFinishWork]() - if (err) return cb(err) - - try { - key = key !== undefined ? this[kKeyEncoding].decode(key) : undefined - } catch (err) { - return cb(new IteratorDecodeError('key', err)) - } - - if (key !== undefined) this[kCount]++ - cb(null, key) - } - - [kHandleMany] (err, keys) { - const cb = this[kFinishWork]() - if (err) return this[kReturnMany](cb, err) - - try { - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - keys[i] = key !== undefined ? this[kKeyEncoding].decode(key) : undefined - } - } catch (err) { - return this[kReturnMany](cb, new IteratorDecodeError('keys', err)) - } - - this[kCount] += keys.length - this[kReturnMany](cb, null, keys) - } -} - -class AbstractValueIterator extends CommonIterator { - constructor (db, options) { - super(db, options, false) - } - - [kHandleOne] (err, value) { - const cb = this[kFinishWork]() - if (err) return cb(err) - - try { - value = value !== undefined ? this[kValueEncoding].decode(value) : undefined - } catch (err) { - return cb(new IteratorDecodeError('value', err)) - } - - if (value !== undefined) this[kCount]++ - cb(null, value) - } - - [kHandleMany] (err, values) { - const cb = this[kFinishWork]() - if (err) return this[kReturnMany](cb, err) - - try { - for (let i = 0; i < values.length; i++) { - const value = values[i] - values[i] = value !== undefined ? this[kValueEncoding].decode(value) : undefined - } - } catch (err) { - return this[kReturnMany](cb, new IteratorDecodeError('values', err)) - } - - this[kCount] += values.length - this[kReturnMany](cb, null, values) - } -} - -// Internal utility, not typed or exported -class IteratorDecodeError extends ModuleError { - constructor (subject, cause) { - super(`Iterator could not decode ${subject}`, { - code: 'LEVEL_DECODE_ERROR', - cause - }) - } -} - -// To help migrating to abstract-level -for (const k of ['_ended property', '_nexting property', '_end method']) { - Object.defineProperty(AbstractIterator.prototype, k.split(' ')[0], { - get () { throw new ModuleError(`The ${k} has been removed`, { code: 'LEVEL_LEGACY' }) }, - set () { throw new ModuleError(`The ${k} has been removed`, { code: 'LEVEL_LEGACY' }) } - }) -} - -// Exposed so that AbstractLevel can set these options -AbstractIterator.keyEncoding = kKeyEncoding -AbstractIterator.valueEncoding = kValueEncoding - -exports.AbstractIterator = AbstractIterator -exports.AbstractKeyIterator = AbstractKeyIterator -exports.AbstractValueIterator = AbstractValueIterator diff --git a/node_modules/abstract-level/abstract-level.js b/node_modules/abstract-level/abstract-level.js deleted file mode 100644 index 82878ea..0000000 --- a/node_modules/abstract-level/abstract-level.js +++ /dev/null @@ -1,818 +0,0 @@ -'use strict' - -const { supports } = require('level-supports') -const { Transcoder } = require('level-transcoder') -const { EventEmitter } = require('events') -const { fromCallback } = require('catering') -const ModuleError = require('module-error') -const { AbstractIterator } = require('./abstract-iterator') -const { DefaultKeyIterator, DefaultValueIterator } = require('./lib/default-kv-iterator') -const { DeferredIterator, DeferredKeyIterator, DeferredValueIterator } = require('./lib/deferred-iterator') -const { DefaultChainedBatch } = require('./lib/default-chained-batch') -const { getCallback, getOptions } = require('./lib/common') -const rangeOptions = require('./lib/range-options') - -const kPromise = Symbol('promise') -const kLanded = Symbol('landed') -const kResources = Symbol('resources') -const kCloseResources = Symbol('closeResources') -const kOperations = Symbol('operations') -const kUndefer = Symbol('undefer') -const kDeferOpen = Symbol('deferOpen') -const kOptions = Symbol('options') -const kStatus = Symbol('status') -const kDefaultOptions = Symbol('defaultOptions') -const kTranscoder = Symbol('transcoder') -const kKeyEncoding = Symbol('keyEncoding') -const kValueEncoding = Symbol('valueEncoding') -const noop = () => {} - -class AbstractLevel extends EventEmitter { - constructor (manifest, options) { - super() - - if (typeof manifest !== 'object' || manifest === null) { - throw new TypeError("The first argument 'manifest' must be an object") - } - - options = getOptions(options) - const { keyEncoding, valueEncoding, passive, ...forward } = options - - this[kResources] = new Set() - this[kOperations] = [] - this[kDeferOpen] = true - this[kOptions] = forward - this[kStatus] = 'opening' - - this.supports = supports(manifest, { - status: true, - promises: true, - clear: true, - getMany: true, - deferredOpen: true, - - // TODO (next major): add seek - snapshots: manifest.snapshots !== false, - permanence: manifest.permanence !== false, - - // TODO: remove from level-supports because it's always supported - keyIterator: true, - valueIterator: true, - iteratorNextv: true, - iteratorAll: true, - - encodings: manifest.encodings || {}, - events: Object.assign({}, manifest.events, { - opening: true, - open: true, - closing: true, - closed: true, - put: true, - del: true, - batch: true, - clear: true - }) - }) - - this[kTranscoder] = new Transcoder(formats(this)) - this[kKeyEncoding] = this[kTranscoder].encoding(keyEncoding || 'utf8') - this[kValueEncoding] = this[kTranscoder].encoding(valueEncoding || 'utf8') - - // Add custom and transcoder encodings to manifest - for (const encoding of this[kTranscoder].encodings()) { - if (!this.supports.encodings[encoding.commonName]) { - this.supports.encodings[encoding.commonName] = true - } - } - - this[kDefaultOptions] = { - empty: Object.freeze({}), - entry: Object.freeze({ - keyEncoding: this[kKeyEncoding].commonName, - valueEncoding: this[kValueEncoding].commonName - }), - key: Object.freeze({ - keyEncoding: this[kKeyEncoding].commonName - }) - } - - // Let subclass finish its constructor - this.nextTick(() => { - if (this[kDeferOpen]) { - this.open({ passive: false }, noop) - } - }) - } - - get status () { - return this[kStatus] - } - - keyEncoding (encoding) { - return this[kTranscoder].encoding(encoding != null ? encoding : this[kKeyEncoding]) - } - - valueEncoding (encoding) { - return this[kTranscoder].encoding(encoding != null ? encoding : this[kValueEncoding]) - } - - open (options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - - options = { ...this[kOptions], ...getOptions(options) } - - options.createIfMissing = options.createIfMissing !== false - options.errorIfExists = !!options.errorIfExists - - const maybeOpened = (err) => { - if (this[kStatus] === 'closing' || this[kStatus] === 'opening') { - // Wait until pending state changes are done - this.once(kLanded, err ? () => maybeOpened(err) : maybeOpened) - } else if (this[kStatus] !== 'open') { - callback(new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN', - cause: err - })) - } else { - callback() - } - } - - if (options.passive) { - if (this[kStatus] === 'opening') { - this.once(kLanded, maybeOpened) - } else { - this.nextTick(maybeOpened) - } - } else if (this[kStatus] === 'closed' || this[kDeferOpen]) { - this[kDeferOpen] = false - this[kStatus] = 'opening' - this.emit('opening') - - this._open(options, (err) => { - if (err) { - this[kStatus] = 'closed' - - // Resources must be safe to close in any db state - this[kCloseResources](() => { - this.emit(kLanded) - maybeOpened(err) - }) - - this[kUndefer]() - return - } - - this[kStatus] = 'open' - this[kUndefer]() - this.emit(kLanded) - - // Only emit public event if pending state changes are done - if (this[kStatus] === 'open') this.emit('open') - - // TODO (next major): remove this alias - if (this[kStatus] === 'open') this.emit('ready') - - maybeOpened() - }) - } else if (this[kStatus] === 'open') { - this.nextTick(maybeOpened) - } else { - this.once(kLanded, () => this.open(options, callback)) - } - - return callback[kPromise] - } - - _open (options, callback) { - this.nextTick(callback) - } - - close (callback) { - callback = fromCallback(callback, kPromise) - - const maybeClosed = (err) => { - if (this[kStatus] === 'opening' || this[kStatus] === 'closing') { - // Wait until pending state changes are done - this.once(kLanded, err ? maybeClosed(err) : maybeClosed) - } else if (this[kStatus] !== 'closed') { - callback(new ModuleError('Database is not closed', { - code: 'LEVEL_DATABASE_NOT_CLOSED', - cause: err - })) - } else { - callback() - } - } - - if (this[kStatus] === 'open') { - this[kStatus] = 'closing' - this.emit('closing') - - const cancel = (err) => { - this[kStatus] = 'open' - this[kUndefer]() - this.emit(kLanded) - maybeClosed(err) - } - - this[kCloseResources](() => { - this._close((err) => { - if (err) return cancel(err) - - this[kStatus] = 'closed' - this[kUndefer]() - this.emit(kLanded) - - // Only emit public event if pending state changes are done - if (this[kStatus] === 'closed') this.emit('closed') - - maybeClosed() - }) - }) - } else if (this[kStatus] === 'closed') { - this.nextTick(maybeClosed) - } else { - this.once(kLanded, () => this.close(callback)) - } - - return callback[kPromise] - } - - [kCloseResources] (callback) { - if (this[kResources].size === 0) { - return this.nextTick(callback) - } - - let pending = this[kResources].size - let sync = true - - const next = () => { - if (--pending === 0) { - // We don't have tests for generic resources, so dezalgo - if (sync) this.nextTick(callback) - else callback() - } - } - - // In parallel so that all resources know they are closed - for (const resource of this[kResources]) { - resource.close(next) - } - - sync = false - this[kResources].clear() - } - - _close (callback) { - this.nextTick(callback) - } - - get (key, options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, this[kDefaultOptions].entry) - - if (this[kStatus] === 'opening') { - this.defer(() => this.get(key, options, callback)) - return callback[kPromise] - } - - if (maybeError(this, callback)) { - return callback[kPromise] - } - - const err = this._checkKey(key) - - if (err) { - this.nextTick(callback, err) - return callback[kPromise] - } - - const keyEncoding = this.keyEncoding(options.keyEncoding) - const valueEncoding = this.valueEncoding(options.valueEncoding) - const keyFormat = keyEncoding.format - const valueFormat = valueEncoding.format - - // Forward encoding options to the underlying store - if (options.keyEncoding !== keyFormat || options.valueEncoding !== valueFormat) { - // Avoid spread operator because of https://bugs.chromium.org/p/chromium/issues/detail?id=1204540 - options = Object.assign({}, options, { keyEncoding: keyFormat, valueEncoding: valueFormat }) - } - - this._get(this.prefixKey(keyEncoding.encode(key), keyFormat), options, (err, value) => { - if (err) { - // Normalize not found error for backwards compatibility with abstract-leveldown and level(up) - if (err.code === 'LEVEL_NOT_FOUND' || err.notFound || /NotFound/i.test(err)) { - if (!err.code) err.code = 'LEVEL_NOT_FOUND' // Preferred way going forward - if (!err.notFound) err.notFound = true // Same as level-errors - if (!err.status) err.status = 404 // Same as level-errors - } - - return callback(err) - } - - try { - value = valueEncoding.decode(value) - } catch (err) { - return callback(new ModuleError('Could not decode value', { - code: 'LEVEL_DECODE_ERROR', - cause: err - })) - } - - callback(null, value) - }) - - return callback[kPromise] - } - - _get (key, options, callback) { - this.nextTick(callback, new Error('NotFound')) - } - - getMany (keys, options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, this[kDefaultOptions].entry) - - if (this[kStatus] === 'opening') { - this.defer(() => this.getMany(keys, options, callback)) - return callback[kPromise] - } - - if (maybeError(this, callback)) { - return callback[kPromise] - } - - if (!Array.isArray(keys)) { - this.nextTick(callback, new TypeError("The first argument 'keys' must be an array")) - return callback[kPromise] - } - - if (keys.length === 0) { - this.nextTick(callback, null, []) - return callback[kPromise] - } - - const keyEncoding = this.keyEncoding(options.keyEncoding) - const valueEncoding = this.valueEncoding(options.valueEncoding) - const keyFormat = keyEncoding.format - const valueFormat = valueEncoding.format - - // Forward encoding options - if (options.keyEncoding !== keyFormat || options.valueEncoding !== valueFormat) { - options = Object.assign({}, options, { keyEncoding: keyFormat, valueEncoding: valueFormat }) - } - - const mappedKeys = new Array(keys.length) - - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - const err = this._checkKey(key) - - if (err) { - this.nextTick(callback, err) - return callback[kPromise] - } - - mappedKeys[i] = this.prefixKey(keyEncoding.encode(key), keyFormat) - } - - this._getMany(mappedKeys, options, (err, values) => { - if (err) return callback(err) - - try { - for (let i = 0; i < values.length; i++) { - if (values[i] !== undefined) { - values[i] = valueEncoding.decode(values[i]) - } - } - } catch (err) { - return callback(new ModuleError(`Could not decode one or more of ${values.length} value(s)`, { - code: 'LEVEL_DECODE_ERROR', - cause: err - })) - } - - callback(null, values) - }) - - return callback[kPromise] - } - - _getMany (keys, options, callback) { - this.nextTick(callback, null, new Array(keys.length).fill(undefined)) - } - - put (key, value, options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, this[kDefaultOptions].entry) - - if (this[kStatus] === 'opening') { - this.defer(() => this.put(key, value, options, callback)) - return callback[kPromise] - } - - if (maybeError(this, callback)) { - return callback[kPromise] - } - - const err = this._checkKey(key) || this._checkValue(value) - - if (err) { - this.nextTick(callback, err) - return callback[kPromise] - } - - const keyEncoding = this.keyEncoding(options.keyEncoding) - const valueEncoding = this.valueEncoding(options.valueEncoding) - const keyFormat = keyEncoding.format - const valueFormat = valueEncoding.format - - // Forward encoding options - if (options.keyEncoding !== keyFormat || options.valueEncoding !== valueFormat) { - options = Object.assign({}, options, { keyEncoding: keyFormat, valueEncoding: valueFormat }) - } - - const mappedKey = this.prefixKey(keyEncoding.encode(key), keyFormat) - const mappedValue = valueEncoding.encode(value) - - this._put(mappedKey, mappedValue, options, (err) => { - if (err) return callback(err) - this.emit('put', key, value) - callback() - }) - - return callback[kPromise] - } - - _put (key, value, options, callback) { - this.nextTick(callback) - } - - del (key, options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, this[kDefaultOptions].key) - - if (this[kStatus] === 'opening') { - this.defer(() => this.del(key, options, callback)) - return callback[kPromise] - } - - if (maybeError(this, callback)) { - return callback[kPromise] - } - - const err = this._checkKey(key) - - if (err) { - this.nextTick(callback, err) - return callback[kPromise] - } - - const keyEncoding = this.keyEncoding(options.keyEncoding) - const keyFormat = keyEncoding.format - - // Forward encoding options - if (options.keyEncoding !== keyFormat) { - options = Object.assign({}, options, { keyEncoding: keyFormat }) - } - - this._del(this.prefixKey(keyEncoding.encode(key), keyFormat), options, (err) => { - if (err) return callback(err) - this.emit('del', key) - callback() - }) - - return callback[kPromise] - } - - _del (key, options, callback) { - this.nextTick(callback) - } - - batch (operations, options, callback) { - if (!arguments.length) { - if (this[kStatus] === 'opening') return new DefaultChainedBatch(this) - if (this[kStatus] !== 'open') { - throw new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN' - }) - } - return this._chainedBatch() - } - - if (typeof operations === 'function') callback = operations - else callback = getCallback(options, callback) - - callback = fromCallback(callback, kPromise) - options = getOptions(options, this[kDefaultOptions].empty) - - if (this[kStatus] === 'opening') { - this.defer(() => this.batch(operations, options, callback)) - return callback[kPromise] - } - - if (maybeError(this, callback)) { - return callback[kPromise] - } - - if (!Array.isArray(operations)) { - this.nextTick(callback, new TypeError("The first argument 'operations' must be an array")) - return callback[kPromise] - } - - if (operations.length === 0) { - this.nextTick(callback) - return callback[kPromise] - } - - const mapped = new Array(operations.length) - const { keyEncoding: ke, valueEncoding: ve, ...forward } = options - - for (let i = 0; i < operations.length; i++) { - if (typeof operations[i] !== 'object' || operations[i] === null) { - this.nextTick(callback, new TypeError('A batch operation must be an object')) - return callback[kPromise] - } - - const op = Object.assign({}, operations[i]) - - if (op.type !== 'put' && op.type !== 'del') { - this.nextTick(callback, new TypeError("A batch operation must have a type property that is 'put' or 'del'")) - return callback[kPromise] - } - - const err = this._checkKey(op.key) - - if (err) { - this.nextTick(callback, err) - return callback[kPromise] - } - - const db = op.sublevel != null ? op.sublevel : this - const keyEncoding = db.keyEncoding(op.keyEncoding || ke) - const keyFormat = keyEncoding.format - - op.key = db.prefixKey(keyEncoding.encode(op.key), keyFormat) - op.keyEncoding = keyFormat - - if (op.type === 'put') { - const valueErr = this._checkValue(op.value) - - if (valueErr) { - this.nextTick(callback, valueErr) - return callback[kPromise] - } - - const valueEncoding = db.valueEncoding(op.valueEncoding || ve) - - op.value = valueEncoding.encode(op.value) - op.valueEncoding = valueEncoding.format - } - - // Prevent double prefixing - if (db !== this) { - op.sublevel = null - } - - mapped[i] = op - } - - this._batch(mapped, forward, (err) => { - if (err) return callback(err) - this.emit('batch', operations) - callback() - }) - - return callback[kPromise] - } - - _batch (operations, options, callback) { - this.nextTick(callback) - } - - sublevel (name, options) { - return this._sublevel(name, AbstractSublevel.defaults(options)) - } - - _sublevel (name, options) { - return new AbstractSublevel(this, name, options) - } - - prefixKey (key, keyFormat) { - return key - } - - clear (options, callback) { - callback = getCallback(options, callback) - callback = fromCallback(callback, kPromise) - options = getOptions(options, this[kDefaultOptions].empty) - - if (this[kStatus] === 'opening') { - this.defer(() => this.clear(options, callback)) - return callback[kPromise] - } - - if (maybeError(this, callback)) { - return callback[kPromise] - } - - const original = options - const keyEncoding = this.keyEncoding(options.keyEncoding) - - options = rangeOptions(options, keyEncoding) - options.keyEncoding = keyEncoding.format - - if (options.limit === 0) { - this.nextTick(callback) - } else { - this._clear(options, (err) => { - if (err) return callback(err) - this.emit('clear', original) - callback() - }) - } - - return callback[kPromise] - } - - _clear (options, callback) { - this.nextTick(callback) - } - - iterator (options) { - const keyEncoding = this.keyEncoding(options && options.keyEncoding) - const valueEncoding = this.valueEncoding(options && options.valueEncoding) - - options = rangeOptions(options, keyEncoding) - options.keys = options.keys !== false - options.values = options.values !== false - - // We need the original encoding options in AbstractIterator in order to decode data - options[AbstractIterator.keyEncoding] = keyEncoding - options[AbstractIterator.valueEncoding] = valueEncoding - - // Forward encoding options to private API - options.keyEncoding = keyEncoding.format - options.valueEncoding = valueEncoding.format - - if (this[kStatus] === 'opening') { - return new DeferredIterator(this, options) - } else if (this[kStatus] !== 'open') { - throw new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN' - }) - } - - return this._iterator(options) - } - - _iterator (options) { - return new AbstractIterator(this, options) - } - - keys (options) { - // Also include valueEncoding (though unused) because we may fallback to _iterator() - const keyEncoding = this.keyEncoding(options && options.keyEncoding) - const valueEncoding = this.valueEncoding(options && options.valueEncoding) - - options = rangeOptions(options, keyEncoding) - - // We need the original encoding options in AbstractKeyIterator in order to decode data - options[AbstractIterator.keyEncoding] = keyEncoding - options[AbstractIterator.valueEncoding] = valueEncoding - - // Forward encoding options to private API - options.keyEncoding = keyEncoding.format - options.valueEncoding = valueEncoding.format - - if (this[kStatus] === 'opening') { - return new DeferredKeyIterator(this, options) - } else if (this[kStatus] !== 'open') { - throw new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN' - }) - } - - return this._keys(options) - } - - _keys (options) { - return new DefaultKeyIterator(this, options) - } - - values (options) { - const keyEncoding = this.keyEncoding(options && options.keyEncoding) - const valueEncoding = this.valueEncoding(options && options.valueEncoding) - - options = rangeOptions(options, keyEncoding) - - // We need the original encoding options in AbstractValueIterator in order to decode data - options[AbstractIterator.keyEncoding] = keyEncoding - options[AbstractIterator.valueEncoding] = valueEncoding - - // Forward encoding options to private API - options.keyEncoding = keyEncoding.format - options.valueEncoding = valueEncoding.format - - if (this[kStatus] === 'opening') { - return new DeferredValueIterator(this, options) - } else if (this[kStatus] !== 'open') { - throw new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN' - }) - } - - return this._values(options) - } - - _values (options) { - return new DefaultValueIterator(this, options) - } - - defer (fn) { - if (typeof fn !== 'function') { - throw new TypeError('The first argument must be a function') - } - - this[kOperations].push(fn) - } - - [kUndefer] () { - if (this[kOperations].length === 0) { - return - } - - const operations = this[kOperations] - this[kOperations] = [] - - for (const op of operations) { - op() - } - } - - // TODO: docs and types - attachResource (resource) { - if (typeof resource !== 'object' || resource === null || - typeof resource.close !== 'function') { - throw new TypeError('The first argument must be a resource object') - } - - this[kResources].add(resource) - } - - // TODO: docs and types - detachResource (resource) { - this[kResources].delete(resource) - } - - _chainedBatch () { - return new DefaultChainedBatch(this) - } - - _checkKey (key) { - if (key === null || key === undefined) { - return new ModuleError('Key cannot be null or undefined', { - code: 'LEVEL_INVALID_KEY' - }) - } - } - - _checkValue (value) { - if (value === null || value === undefined) { - return new ModuleError('Value cannot be null or undefined', { - code: 'LEVEL_INVALID_VALUE' - }) - } - } -} - -// Expose browser-compatible nextTick for dependents -// TODO: after we drop node 10, also use queueMicrotask in node -AbstractLevel.prototype.nextTick = require('./lib/next-tick') - -const { AbstractSublevel } = require('./lib/abstract-sublevel')({ AbstractLevel }) - -exports.AbstractLevel = AbstractLevel -exports.AbstractSublevel = AbstractSublevel - -const maybeError = function (db, callback) { - if (db[kStatus] !== 'open') { - db.nextTick(callback, new ModuleError('Database is not open', { - code: 'LEVEL_DATABASE_NOT_OPEN' - })) - return true - } - - return false -} - -const formats = function (db) { - return Object.keys(db.supports.encodings) - .filter(k => !!db.supports.encodings[k]) -} diff --git a/node_modules/abstract-level/index.d.ts b/node_modules/abstract-level/index.d.ts deleted file mode 100644 index 3cdcc8c..0000000 --- a/node_modules/abstract-level/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export { - AbstractLevel, - AbstractDatabaseOptions, - AbstractOpenOptions, - AbstractGetOptions, - AbstractGetManyOptions, - AbstractPutOptions, - AbstractDelOptions, - AbstractBatchOptions, - AbstractBatchOperation, - AbstractBatchPutOperation, - AbstractBatchDelOperation, - AbstractClearOptions -} from './types/abstract-level' - -export { - AbstractIterator, - AbstractIteratorOptions, - AbstractSeekOptions, - AbstractKeyIterator, - AbstractKeyIteratorOptions, - AbstractValueIterator, - AbstractValueIteratorOptions -} from './types/abstract-iterator' - -export { - AbstractChainedBatch, - AbstractChainedBatchPutOptions, - AbstractChainedBatchDelOptions, - AbstractChainedBatchWriteOptions -} from './types/abstract-chained-batch' - -export { - AbstractSublevel, - AbstractSublevelOptions -} from './types/abstract-sublevel' - -export { - NodeCallback -} from './types/interfaces' - -export * as Transcoder from 'level-transcoder' diff --git a/node_modules/abstract-level/index.js b/node_modules/abstract-level/index.js deleted file mode 100644 index cf5dee4..0000000 --- a/node_modules/abstract-level/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' - -exports.AbstractLevel = require('./abstract-level').AbstractLevel -exports.AbstractSublevel = require('./abstract-level').AbstractSublevel -exports.AbstractIterator = require('./abstract-iterator').AbstractIterator -exports.AbstractKeyIterator = require('./abstract-iterator').AbstractKeyIterator -exports.AbstractValueIterator = require('./abstract-iterator').AbstractValueIterator -exports.AbstractChainedBatch = require('./abstract-chained-batch').AbstractChainedBatch diff --git a/node_modules/abstract-level/lib/abstract-sublevel-iterator.js b/node_modules/abstract-level/lib/abstract-sublevel-iterator.js deleted file mode 100644 index ab6976a..0000000 --- a/node_modules/abstract-level/lib/abstract-sublevel-iterator.js +++ /dev/null @@ -1,124 +0,0 @@ -'use strict' - -const { AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('../abstract-iterator') - -const kUnfix = Symbol('unfix') -const kIterator = Symbol('iterator') -const kHandleOne = Symbol('handleOne') -const kHandleMany = Symbol('handleMany') -const kCallback = Symbol('callback') - -// TODO: unfix natively if db supports it -class AbstractSublevelIterator extends AbstractIterator { - constructor (db, options, iterator, unfix) { - super(db, options) - - this[kIterator] = iterator - this[kUnfix] = unfix - this[kHandleOne] = this[kHandleOne].bind(this) - this[kHandleMany] = this[kHandleMany].bind(this) - this[kCallback] = null - } - - [kHandleOne] (err, key, value) { - const callback = this[kCallback] - if (err) return callback(err) - if (key !== undefined) key = this[kUnfix](key) - callback(err, key, value) - } - - [kHandleMany] (err, entries) { - const callback = this[kCallback] - if (err) return callback(err) - - for (const entry of entries) { - const key = entry[0] - if (key !== undefined) entry[0] = this[kUnfix](key) - } - - callback(err, entries) - } -} - -class AbstractSublevelKeyIterator extends AbstractKeyIterator { - constructor (db, options, iterator, unfix) { - super(db, options) - - this[kIterator] = iterator - this[kUnfix] = unfix - this[kHandleOne] = this[kHandleOne].bind(this) - this[kHandleMany] = this[kHandleMany].bind(this) - this[kCallback] = null - } - - [kHandleOne] (err, key) { - const callback = this[kCallback] - if (err) return callback(err) - if (key !== undefined) key = this[kUnfix](key) - callback(err, key) - } - - [kHandleMany] (err, keys) { - const callback = this[kCallback] - if (err) return callback(err) - - for (let i = 0; i < keys.length; i++) { - const key = keys[i] - if (key !== undefined) keys[i] = this[kUnfix](key) - } - - callback(err, keys) - } -} - -class AbstractSublevelValueIterator extends AbstractValueIterator { - constructor (db, options, iterator) { - super(db, options) - this[kIterator] = iterator - } -} - -for (const Iterator of [AbstractSublevelIterator, AbstractSublevelKeyIterator]) { - Iterator.prototype._next = function (callback) { - this[kCallback] = callback - this[kIterator].next(this[kHandleOne]) - } - - Iterator.prototype._nextv = function (size, options, callback) { - this[kCallback] = callback - this[kIterator].nextv(size, options, this[kHandleMany]) - } - - Iterator.prototype._all = function (options, callback) { - this[kCallback] = callback - this[kIterator].all(options, this[kHandleMany]) - } -} - -for (const Iterator of [AbstractSublevelValueIterator]) { - Iterator.prototype._next = function (callback) { - this[kIterator].next(callback) - } - - Iterator.prototype._nextv = function (size, options, callback) { - this[kIterator].nextv(size, options, callback) - } - - Iterator.prototype._all = function (options, callback) { - this[kIterator].all(options, callback) - } -} - -for (const Iterator of [AbstractSublevelIterator, AbstractSublevelKeyIterator, AbstractSublevelValueIterator]) { - Iterator.prototype._seek = function (target, options) { - this[kIterator].seek(target, options) - } - - Iterator.prototype._close = function (callback) { - this[kIterator].close(callback) - } -} - -exports.AbstractSublevelIterator = AbstractSublevelIterator -exports.AbstractSublevelKeyIterator = AbstractSublevelKeyIterator -exports.AbstractSublevelValueIterator = AbstractSublevelValueIterator diff --git a/node_modules/abstract-level/lib/abstract-sublevel.js b/node_modules/abstract-level/lib/abstract-sublevel.js deleted file mode 100644 index aaca0fc..0000000 --- a/node_modules/abstract-level/lib/abstract-sublevel.js +++ /dev/null @@ -1,258 +0,0 @@ -'use strict' - -const ModuleError = require('module-error') -const { Buffer } = require('buffer') || {} -const { - AbstractSublevelIterator, - AbstractSublevelKeyIterator, - AbstractSublevelValueIterator -} = require('./abstract-sublevel-iterator') - -const kPrefix = Symbol('prefix') -const kUpperBound = Symbol('upperBound') -const kPrefixRange = Symbol('prefixRange') -const kParent = Symbol('parent') -const kUnfix = Symbol('unfix') - -const textEncoder = new TextEncoder() -const defaults = { separator: '!' } - -// Wrapped to avoid circular dependency -module.exports = function ({ AbstractLevel }) { - class AbstractSublevel extends AbstractLevel { - static defaults (options) { - // To help migrating from subleveldown to abstract-level - if (typeof options === 'string') { - throw new ModuleError('The subleveldown string shorthand for { separator } has been removed', { - code: 'LEVEL_LEGACY' - }) - } else if (options && options.open) { - throw new ModuleError('The subleveldown open option has been removed', { - code: 'LEVEL_LEGACY' - }) - } - - if (options == null) { - return defaults - } else if (!options.separator) { - return { ...options, separator: '!' } - } else { - return options - } - } - - // TODO: add autoClose option, which if true, does parent.attachResource(this) - constructor (db, name, options) { - // Don't forward AbstractSublevel options to AbstractLevel - const { separator, manifest, ...forward } = AbstractSublevel.defaults(options) - name = trim(name, separator) - - // Reserve one character between separator and name to give us an upper bound - const reserved = separator.charCodeAt(0) + 1 - const parent = db[kParent] || db - - // Keys should sort like ['!a!', '!a!!a!', '!a"', '!aa!', '!b!']. - // Use ASCII for consistent length between string, Buffer and Uint8Array - if (!textEncoder.encode(name).every(x => x > reserved && x < 127)) { - throw new ModuleError(`Prefix must use bytes > ${reserved} < ${127}`, { - code: 'LEVEL_INVALID_PREFIX' - }) - } - - super(mergeManifests(parent, manifest), forward) - - const prefix = (db.prefix || '') + separator + name + separator - const upperBound = prefix.slice(0, -1) + String.fromCharCode(reserved) - - this[kParent] = parent - this[kPrefix] = new MultiFormat(prefix) - this[kUpperBound] = new MultiFormat(upperBound) - this[kUnfix] = new Unfixer() - - this.nextTick = parent.nextTick - } - - prefixKey (key, keyFormat) { - if (keyFormat === 'utf8') { - return this[kPrefix].utf8 + key - } else if (key.byteLength === 0) { - // Fast path for empty key (no copy) - return this[kPrefix][keyFormat] - } else if (keyFormat === 'view') { - const view = this[kPrefix].view - const result = new Uint8Array(view.byteLength + key.byteLength) - - result.set(view, 0) - result.set(key, view.byteLength) - - return result - } else { - const buffer = this[kPrefix].buffer - return Buffer.concat([buffer, key], buffer.byteLength + key.byteLength) - } - } - - // Not exposed for now. - [kPrefixRange] (range, keyFormat) { - if (range.gte !== undefined) { - range.gte = this.prefixKey(range.gte, keyFormat) - } else if (range.gt !== undefined) { - range.gt = this.prefixKey(range.gt, keyFormat) - } else { - range.gte = this[kPrefix][keyFormat] - } - - if (range.lte !== undefined) { - range.lte = this.prefixKey(range.lte, keyFormat) - } else if (range.lt !== undefined) { - range.lt = this.prefixKey(range.lt, keyFormat) - } else { - range.lte = this[kUpperBound][keyFormat] - } - } - - get prefix () { - return this[kPrefix].utf8 - } - - get db () { - return this[kParent] - } - - _open (options, callback) { - // The parent db must open itself or be (re)opened by the user because - // a sublevel should not initiate state changes on the rest of the db. - this[kParent].open({ passive: true }, callback) - } - - _put (key, value, options, callback) { - this[kParent].put(key, value, options, callback) - } - - _get (key, options, callback) { - this[kParent].get(key, options, callback) - } - - _getMany (keys, options, callback) { - this[kParent].getMany(keys, options, callback) - } - - _del (key, options, callback) { - this[kParent].del(key, options, callback) - } - - _batch (operations, options, callback) { - this[kParent].batch(operations, options, callback) - } - - _clear (options, callback) { - // TODO (refactor): move to AbstractLevel - this[kPrefixRange](options, options.keyEncoding) - this[kParent].clear(options, callback) - } - - _iterator (options) { - // TODO (refactor): move to AbstractLevel - this[kPrefixRange](options, options.keyEncoding) - const iterator = this[kParent].iterator(options) - const unfix = this[kUnfix].get(this[kPrefix].utf8.length, options.keyEncoding) - return new AbstractSublevelIterator(this, options, iterator, unfix) - } - - _keys (options) { - this[kPrefixRange](options, options.keyEncoding) - const iterator = this[kParent].keys(options) - const unfix = this[kUnfix].get(this[kPrefix].utf8.length, options.keyEncoding) - return new AbstractSublevelKeyIterator(this, options, iterator, unfix) - } - - _values (options) { - this[kPrefixRange](options, options.keyEncoding) - const iterator = this[kParent].values(options) - return new AbstractSublevelValueIterator(this, options, iterator) - } - } - - return { AbstractSublevel } -} - -const mergeManifests = function (parent, manifest) { - return { - // Inherit manifest of parent db - ...parent.supports, - - // Disable unsupported features - createIfMissing: false, - errorIfExists: false, - - // Unset additional events because we're not forwarding them - events: {}, - - // Unset additional methods (like approximateSize) which we can't support here unless - // the AbstractSublevel class is overridden by an implementation of `abstract-level`. - additionalMethods: {}, - - // Inherit manifest of custom AbstractSublevel subclass. Such a class is not - // allowed to override encodings. - ...manifest, - - encodings: { - utf8: supportsEncoding(parent, 'utf8'), - buffer: supportsEncoding(parent, 'buffer'), - view: supportsEncoding(parent, 'view') - } - } -} - -const supportsEncoding = function (parent, encoding) { - // Prefer a non-transcoded encoding for optimal performance - return parent.supports.encodings[encoding] - ? parent.keyEncoding(encoding).name === encoding - : false -} - -class MultiFormat { - constructor (key) { - this.utf8 = key - this.view = textEncoder.encode(key) - this.buffer = Buffer ? Buffer.from(this.view.buffer, 0, this.view.byteLength) : {} - } -} - -class Unfixer { - constructor () { - this.cache = new Map() - } - - get (prefixLength, keyFormat) { - let unfix = this.cache.get(keyFormat) - - if (unfix === undefined) { - if (keyFormat === 'view') { - unfix = function (prefixLength, key) { - // Avoid Uint8Array#slice() because it copies - return key.subarray(prefixLength) - }.bind(null, prefixLength) - } else { - unfix = function (prefixLength, key) { - // Avoid Buffer#subarray() because it's slow - return key.slice(prefixLength) - }.bind(null, prefixLength) - } - - this.cache.set(keyFormat, unfix) - } - - return unfix - } -} - -const trim = function (str, char) { - let start = 0 - let end = str.length - - while (start < end && str[start] === char) start++ - while (end > start && str[end - 1] === char) end-- - - return str.slice(start, end) -} diff --git a/node_modules/abstract-level/lib/common.js b/node_modules/abstract-level/lib/common.js deleted file mode 100644 index 2786f5d..0000000 --- a/node_modules/abstract-level/lib/common.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -exports.getCallback = function (options, callback) { - return typeof options === 'function' ? options : callback -} - -exports.getOptions = function (options, def) { - if (typeof options === 'object' && options !== null) { - return options - } - - if (def !== undefined) { - return def - } - - return {} -} diff --git a/node_modules/abstract-level/lib/default-chained-batch.js b/node_modules/abstract-level/lib/default-chained-batch.js deleted file mode 100644 index cebb31c..0000000 --- a/node_modules/abstract-level/lib/default-chained-batch.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict' - -const { AbstractChainedBatch } = require('../abstract-chained-batch') -const ModuleError = require('module-error') -const kEncoded = Symbol('encoded') - -// Functional default for chained batch, with support of deferred open -class DefaultChainedBatch extends AbstractChainedBatch { - constructor (db) { - super(db) - this[kEncoded] = [] - } - - _put (key, value, options) { - this[kEncoded].push({ ...options, type: 'put', key, value }) - } - - _del (key, options) { - this[kEncoded].push({ ...options, type: 'del', key }) - } - - _clear () { - this[kEncoded] = [] - } - - // Assumes this[kEncoded] cannot change after write() - _write (options, callback) { - if (this.db.status === 'opening') { - this.db.defer(() => this._write(options, callback)) - } else if (this.db.status === 'open') { - if (this[kEncoded].length === 0) this.nextTick(callback) - else this.db._batch(this[kEncoded], options, callback) - } else { - this.nextTick(callback, new ModuleError('Batch is not open: cannot call write() after write() or close()', { - code: 'LEVEL_BATCH_NOT_OPEN' - })) - } - } -} - -exports.DefaultChainedBatch = DefaultChainedBatch diff --git a/node_modules/abstract-level/lib/default-kv-iterator.js b/node_modules/abstract-level/lib/default-kv-iterator.js deleted file mode 100644 index 7020d9e..0000000 --- a/node_modules/abstract-level/lib/default-kv-iterator.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict' - -const { AbstractKeyIterator, AbstractValueIterator } = require('../abstract-iterator') - -const kIterator = Symbol('iterator') -const kCallback = Symbol('callback') -const kHandleOne = Symbol('handleOne') -const kHandleMany = Symbol('handleMany') - -class DefaultKeyIterator extends AbstractKeyIterator { - constructor (db, options) { - super(db, options) - - this[kIterator] = db.iterator({ ...options, keys: true, values: false }) - this[kHandleOne] = this[kHandleOne].bind(this) - this[kHandleMany] = this[kHandleMany].bind(this) - } -} - -class DefaultValueIterator extends AbstractValueIterator { - constructor (db, options) { - super(db, options) - - this[kIterator] = db.iterator({ ...options, keys: false, values: true }) - this[kHandleOne] = this[kHandleOne].bind(this) - this[kHandleMany] = this[kHandleMany].bind(this) - } -} - -for (const Iterator of [DefaultKeyIterator, DefaultValueIterator]) { - const keys = Iterator === DefaultKeyIterator - const mapEntry = keys ? (entry) => entry[0] : (entry) => entry[1] - - Iterator.prototype._next = function (callback) { - this[kCallback] = callback - this[kIterator].next(this[kHandleOne]) - } - - Iterator.prototype[kHandleOne] = function (err, key, value) { - const callback = this[kCallback] - if (err) callback(err) - else callback(null, keys ? key : value) - } - - Iterator.prototype._nextv = function (size, options, callback) { - this[kCallback] = callback - this[kIterator].nextv(size, options, this[kHandleMany]) - } - - Iterator.prototype._all = function (options, callback) { - this[kCallback] = callback - this[kIterator].all(options, this[kHandleMany]) - } - - Iterator.prototype[kHandleMany] = function (err, entries) { - const callback = this[kCallback] - if (err) callback(err) - else callback(null, entries.map(mapEntry)) - } - - Iterator.prototype._seek = function (target, options) { - this[kIterator].seek(target, options) - } - - Iterator.prototype._close = function (callback) { - this[kIterator].close(callback) - } -} - -// Internal utilities, should be typed as AbstractKeyIterator and AbstractValueIterator -exports.DefaultKeyIterator = DefaultKeyIterator -exports.DefaultValueIterator = DefaultValueIterator diff --git a/node_modules/abstract-level/lib/deferred-iterator.js b/node_modules/abstract-level/lib/deferred-iterator.js deleted file mode 100644 index 6da54ea..0000000 --- a/node_modules/abstract-level/lib/deferred-iterator.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict' - -const { AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('../abstract-iterator') -const ModuleError = require('module-error') - -const kNut = Symbol('nut') -const kUndefer = Symbol('undefer') -const kFactory = Symbol('factory') - -class DeferredIterator extends AbstractIterator { - constructor (db, options) { - super(db, options) - - this[kNut] = null - this[kFactory] = () => db.iterator(options) - - this.db.defer(() => this[kUndefer]()) - } -} - -class DeferredKeyIterator extends AbstractKeyIterator { - constructor (db, options) { - super(db, options) - - this[kNut] = null - this[kFactory] = () => db.keys(options) - - this.db.defer(() => this[kUndefer]()) - } -} - -class DeferredValueIterator extends AbstractValueIterator { - constructor (db, options) { - super(db, options) - - this[kNut] = null - this[kFactory] = () => db.values(options) - - this.db.defer(() => this[kUndefer]()) - } -} - -for (const Iterator of [DeferredIterator, DeferredKeyIterator, DeferredValueIterator]) { - Iterator.prototype[kUndefer] = function () { - if (this.db.status === 'open') { - this[kNut] = this[kFactory]() - } - } - - Iterator.prototype._next = function (callback) { - if (this[kNut] !== null) { - this[kNut].next(callback) - } else if (this.db.status === 'opening') { - this.db.defer(() => this._next(callback)) - } else { - this.nextTick(callback, new ModuleError('Iterator is not open: cannot call next() after close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } - } - - Iterator.prototype._nextv = function (size, options, callback) { - if (this[kNut] !== null) { - this[kNut].nextv(size, options, callback) - } else if (this.db.status === 'opening') { - this.db.defer(() => this._nextv(size, options, callback)) - } else { - this.nextTick(callback, new ModuleError('Iterator is not open: cannot call nextv() after close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } - } - - Iterator.prototype._all = function (options, callback) { - if (this[kNut] !== null) { - this[kNut].all(callback) - } else if (this.db.status === 'opening') { - this.db.defer(() => this._all(options, callback)) - } else { - this.nextTick(callback, new ModuleError('Iterator is not open: cannot call all() after close()', { - code: 'LEVEL_ITERATOR_NOT_OPEN' - })) - } - } - - Iterator.prototype._seek = function (target, options) { - if (this[kNut] !== null) { - // TODO: explain why we need _seek() rather than seek() here - this[kNut]._seek(target, options) - } else if (this.db.status === 'opening') { - this.db.defer(() => this._seek(target, options)) - } - } - - Iterator.prototype._close = function (callback) { - if (this[kNut] !== null) { - this[kNut].close(callback) - } else if (this.db.status === 'opening') { - this.db.defer(() => this._close(callback)) - } else { - this.nextTick(callback) - } - } -} - -exports.DeferredIterator = DeferredIterator -exports.DeferredKeyIterator = DeferredKeyIterator -exports.DeferredValueIterator = DeferredValueIterator diff --git a/node_modules/abstract-level/lib/next-tick-browser.js b/node_modules/abstract-level/lib/next-tick-browser.js deleted file mode 100644 index d924b40..0000000 --- a/node_modules/abstract-level/lib/next-tick-browser.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict' - -const queueMicrotask = require('queue-microtask') - -module.exports = function (fn, ...args) { - if (args.length === 0) { - queueMicrotask(fn) - } else { - queueMicrotask(() => fn(...args)) - } -} diff --git a/node_modules/abstract-level/lib/next-tick.js b/node_modules/abstract-level/lib/next-tick.js deleted file mode 100644 index cebc1fd..0000000 --- a/node_modules/abstract-level/lib/next-tick.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict' - -module.exports = process.nextTick diff --git a/node_modules/abstract-level/lib/range-options.js b/node_modules/abstract-level/lib/range-options.js deleted file mode 100644 index 0821ec8..0000000 --- a/node_modules/abstract-level/lib/range-options.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict' - -const ModuleError = require('module-error') -const hasOwnProperty = Object.prototype.hasOwnProperty -const rangeOptions = new Set(['lt', 'lte', 'gt', 'gte']) - -module.exports = function (options, keyEncoding) { - const result = {} - - for (const k in options) { - if (!hasOwnProperty.call(options, k)) continue - if (k === 'keyEncoding' || k === 'valueEncoding') continue - - if (k === 'start' || k === 'end') { - throw new ModuleError(`The legacy range option '${k}' has been removed`, { - code: 'LEVEL_LEGACY' - }) - } else if (k === 'encoding') { - // To help migrating to abstract-level - throw new ModuleError("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead", { - code: 'LEVEL_LEGACY' - }) - } - - if (rangeOptions.has(k)) { - // Note that we don't reject nullish and empty options here. While - // those types are invalid as keys, they are valid as range options. - result[k] = keyEncoding.encode(options[k]) - } else { - result[k] = options[k] - } - } - - result.reverse = !!result.reverse - result.limit = Number.isInteger(result.limit) && result.limit >= 0 ? result.limit : -1 - - return result -} diff --git a/node_modules/abstract-level/package.json b/node_modules/abstract-level/package.json deleted file mode 100644 index 7e1c587..0000000 --- a/node_modules/abstract-level/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "abstract-level", - "version": "1.0.4", - "description": "Abstract class for a lexicographically sorted key-value database", - "license": "MIT", - "main": "index.js", - "browser": { - "./lib/next-tick.js": "./lib/next-tick-browser.js" - }, - "types": "./index.d.ts", - "scripts": { - "test": "standard && ts-standard *.ts types/*.ts && hallmark && (nyc -s node test/self.js | faucet) && nyc report", - "test-browsers": "airtap --coverage test/self.js", - "coverage": "nyc report -r lcovonly" - }, - "files": [ - "abstract-chained-batch.js", - "abstract-iterator.js", - "abstract-level.js", - "index.js", - "index.d.ts", - "lib", - "test", - "types", - "CHANGELOG.md", - "UPGRADING.md" - ], - "dependencies": { - "buffer": "^6.0.3", - "catering": "^2.1.0", - "is-buffer": "^2.0.5", - "level-supports": "^4.0.0", - "level-transcoder": "^1.0.1", - "module-error": "^1.0.1", - "queue-microtask": "^1.2.3" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "@voxpelli/tsconfig": "^4.0.0", - "airtap": "^4.0.4", - "airtap-playwright": "^1.0.1", - "faucet": "^0.0.3", - "hallmark": "^4.0.0", - "nyc": "^15.1.0", - "sinon": "^14.0.0", - "standard": "^16.0.4", - "tape": "^5.4.0", - "ts-standard": "^11.0.0", - "typescript": "^4.5.5" - }, - "repository": { - "type": "git", - "url": "https://github.com/Level/abstract-level.git" - }, - "homepage": "https://github.com/Level/abstract-level", - "keywords": [ - "abstract-level", - "level", - "leveldb" - ], - "engines": { - "node": ">=12" - } -} diff --git a/node_modules/abstract-level/test/async-iterator-test.js b/node_modules/abstract-level/test/async-iterator-test.js deleted file mode 100644 index 3f84e7d..0000000 --- a/node_modules/abstract-level/test/async-iterator-test.js +++ /dev/null @@ -1,143 +0,0 @@ -'use strict' - -const input = [{ key: '1', value: '1' }, { key: '2', value: '2' }] - -let db - -exports.setup = function (test, testCommon) { - test('setup', function (t) { - t.plan(2) - - db = testCommon.factory() - db.open(function (err) { - t.ifError(err, 'no open() error') - - db.batch(input.map(entry => ({ ...entry, type: 'put' })), function (err) { - t.ifError(err, 'no batch() error') - }) - }) - }) -} - -exports.asyncIterator = function (test, testCommon) { - for (const mode of ['iterator', 'keys', 'values']) { - test(`for await...of ${mode}()`, async function (t) { - t.plan(1) - - const it = db[mode]({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - const output = [] - - for await (const item of it) { - output.push(item) - } - - t.same(output, input.map(({ key, value }) => { - return mode === 'iterator' ? [key, value] : mode === 'keys' ? key : value - })) - }) - - testCommon.supports.permanence && test(`for await...of ${mode}() (deferred)`, async function (t) { - t.plan(1) - - const db = testCommon.factory() - await db.batch(input.map(entry => ({ ...entry, type: 'put' }))) - await db.close() - - // Don't await - db.open() - - const it = db[mode]({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - const output = [] - - for await (const item of it) { - output.push(item) - } - - t.same(output, input.map(({ key, value }) => { - return mode === 'iterator' ? [key, value] : mode === 'keys' ? key : value - })) - - await db.close() - }) - - testCommon.supports.snapshots && test(`for await...of ${mode}() (deferred, with snapshot)`, async function (t) { - t.plan(2) - - const db = testCommon.factory() - const it = db[mode]({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - const promise = db.batch(input.map(entry => ({ ...entry, type: 'put' }))) - const output = [] - - for await (const item of it) { - output.push(item) - } - - t.same(output, [], 'used snapshot') - - // Wait for data to be written - await promise - - for await (const item of db[mode]({ keyEncoding: 'utf8', valueEncoding: 'utf8' })) { - output.push(item) - } - - t.same(output, input.map(({ key, value }) => { - return mode === 'iterator' ? [key, value] : mode === 'keys' ? key : value - })) - - await db.close() - }) - - for (const deferred of [false, true]) { - test(`for await...of ${mode}() (empty, deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - const entries = [] - - if (!deferred) await db.open() - - for await (const item of db[mode]({ keyEncoding: 'utf8', valueEncoding: 'utf8' })) { - entries.push(item) - } - - t.same(entries, []) - await db.close() - }) - } - - test(`for await...of ${mode}() does not permit reuse`, async function (t) { - t.plan(3) - - const it = db[mode]() - - // eslint-disable-next-line no-unused-vars - for await (const item of it) { - t.pass('nexted') - } - - try { - // eslint-disable-next-line no-unused-vars - for await (const item of it) { - t.fail('should not be called') - } - } catch (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - } - }) - } -} - -exports.teardown = function (test, testCommon) { - test('teardown', function (t) { - t.plan(1) - - db.close(function (err) { - t.ifError(err, 'no close() error') - }) - }) -} - -exports.all = function (test, testCommon) { - exports.setup(test, testCommon) - exports.asyncIterator(test, testCommon) - exports.teardown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/batch-test.js b/node_modules/abstract-level/test/batch-test.js deleted file mode 100644 index 927316f..0000000 --- a/node_modules/abstract-level/test/batch-test.js +++ /dev/null @@ -1,320 +0,0 @@ -'use strict' - -const { Buffer } = require('buffer') -const { verifyNotFoundError, assertAsync } = require('./util') -const { illegalKeys, illegalValues } = require('./util') - -let db - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.args = function (test, testCommon) { - test('test batch() with missing `value`', assertAsync.ctx(function (t) { - t.plan(3) - - db.batch([{ type: 'put', key: 'foo1' }], assertAsync(function (err) { - t.is(err && err.code, 'LEVEL_INVALID_VALUE', 'correct error code (callback)') - })) - - db.batch([{ type: 'put', key: 'foo1' }]).catch((err) => { - t.is(err.code, 'LEVEL_INVALID_VALUE', 'correct error code (promise)') - }) - })) - - test('test batch() with illegal values', assertAsync.ctx(function (t) { - t.plan(illegalValues.length * 6) - - for (const { name, value } of illegalValues) { - db.batch([{ type: 'put', key: 'foo1', value }], assertAsync(function (err) { - t.ok(err, name + ' - has error (callback)') - t.ok(err instanceof Error, name + ' - is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_VALUE', 'correct error code (callback)') - })) - - db.batch([{ type: 'put', key: 'foo1', value }]).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_VALUE', name + ' - correct error code (promise)') - }) - } - })) - - test('test batch() with missing `key`', assertAsync.ctx(function (t) { - t.plan(3) - - db.batch([{ type: 'put', value: 'foo1' }], assertAsync(function (err) { - t.is(err && err.code, 'LEVEL_INVALID_KEY', 'correct error code (callback)') - })) - - db.batch([{ type: 'put', value: 'foo1' }]).catch(function (err) { - t.is(err.code, 'LEVEL_INVALID_KEY', 'correct error code (promise)') - }) - })) - - test('test batch() with illegal keys', assertAsync.ctx(function (t) { - t.plan(illegalKeys.length * 6) - - for (const { name, key } of illegalKeys) { - db.batch([{ type: 'put', key, value: 'foo1' }], assertAsync(function (err) { - t.ok(err, name + ' - has error (callback)') - t.ok(err instanceof Error, name + ' - is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_KEY', 'correct error code (callback)') - })) - - db.batch([{ type: 'put', key, value: 'foo1' }]).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (promise)') - }) - } - })) - - test('test batch() with missing or incorrect type', assertAsync.ctx(function (t) { - t.plan(10) - - db.batch([{ key: 'key', value: 'value' }], assertAsync(function (err) { - t.is(err && err.name, 'TypeError') - t.is(err && err.message, "A batch operation must have a type property that is 'put' or 'del'", 'correct error message (callback)') - })) - - db.batch([{ key: 'key', value: 'value', type: 'foo' }], assertAsync(function (err) { - t.is(err && err.name, 'TypeError') - t.is(err && err.message, "A batch operation must have a type property that is 'put' or 'del'", 'correct error message (callback)') - })) - - db.batch([{ key: 'key', value: 'value' }]).catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err.message, "A batch operation must have a type property that is 'put' or 'del'", 'correct error message (promise)') - }) - - db.batch([{ key: 'key', value: 'value', type: 'foo' }]).catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err.message, "A batch operation must have a type property that is 'put' or 'del'", 'correct error message (promise)') - }) - })) - - test('test batch() with missing or nullish operations', assertAsync.ctx(function (t) { - t.plan(13) - - db.batch(assertAsync(function (err) { - t.is(err && err.name, 'TypeError') - t.is(err && err.message, "The first argument 'operations' must be an array", 'correct error message (callback)') - })) - - for (const array of [null, undefined]) { - db.batch(array, assertAsync(function (err) { - t.is(err && err.name, 'TypeError') - t.is(err && err.message, "The first argument 'operations' must be an array", 'correct error message (callback)') - })) - - db.batch(array).catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err.message, "The first argument 'operations' must be an array", 'correct error message (promise)') - }) - } - })) - - test('test batch() with null options', function (t) { - t.plan(2) - - db.batch([], null, function (err) { - t.error(err) - }) - - db.batch([], null).then(function () { - t.pass('resolved') - }).catch(t.fail.bind(t)) - }) - - ;[null, undefined, 1, true].forEach(function (operation) { - const type = operation === null ? 'null' : typeof operation - - test('test batch() with ' + type + ' operation', assertAsync.ctx(function (t) { - t.plan(5) - - db.batch([operation], assertAsync(function (err) { - t.is(err && err.name, 'TypeError') - t.is(err && err.message, 'A batch operation must be an object', 'correct error message (callback)') - })) - - db.batch([operation]).catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'A batch operation must be an object', 'correct error message (promise)') - }) - })) - }) - - test('test batch() with empty array', assertAsync.ctx(function (t) { - t.plan(3) - - db.batch([], assertAsync(function (err) { - t.error(err, 'no error from batch()') - })) - - db.batch([]).then(function () { - t.pass('resolved') - }).catch(t.fail.bind(t)) - })) -} - -exports.batch = function (test, testCommon) { - test('test simple batch()', function (t) { - db.batch([{ type: 'put', key: 'foo', value: 'bar' }], function (err) { - t.error(err) - - db.get('foo', function (err, value) { - t.error(err) - t.is(value, 'bar') - t.end() - }) - }) - }) - - test('test simple batch() with promise', async function (t) { - const db = testCommon.factory() - - await db.open() - await db.batch([{ type: 'put', key: 'foo', value: 'bar' }]) - - t.is(await db.get('foo', { valueEncoding: 'utf8' }), 'bar') - return db.close() - }) - - test('test multiple batch()', function (t) { - db.batch([ - { type: 'put', key: 'foobatch1', value: 'bar1' }, - { type: 'put', key: 'foobatch2', value: 'bar2' }, - { type: 'put', key: 'foobatch3', value: 'bar3' }, - { type: 'del', key: 'foobatch2' } - ], function (err) { - t.error(err) - - let r = 0 - const done = function () { - if (++r === 3) { t.end() } - } - - db.get('foobatch1', function (err, value) { - t.error(err) - t.is(value, 'bar1') - done() - }) - - db.get('foobatch2', function (err, value) { - t.ok(err, 'entry not found') - t.ok(typeof value === 'undefined', 'value is undefined') - t.ok(verifyNotFoundError(err), 'NotFound error') - done() - }) - - db.get('foobatch3', function (err, value) { - t.error(err) - t.is(value, 'bar3') - done() - }) - }) - }) - - for (const encoding of ['utf8', 'buffer', 'view']) { - if (!testCommon.supports.encodings[encoding]) continue - - // NOTE: adapted from memdown - test(`empty values in batch with ${encoding} valueEncoding`, async function (t) { - const db = testCommon.factory({ valueEncoding: encoding }) - const values = ['', Uint8Array.from([]), Buffer.alloc(0)] - const expected = encoding === 'utf8' ? values[0] : encoding === 'view' ? values[1] : values[2] - - await db.open() - await db.batch(values.map((value, i) => ({ type: 'put', key: String(i), value }))) - - for (let i = 0; i < values.length; i++) { - const value = await db.get(String(i)) - - // Buffer is a Uint8Array, so this is allowed - if (encoding === 'view' && Buffer.isBuffer(value)) { - t.same(value, values[2]) - } else { - t.same(value, expected) - } - } - - return db.close() - }) - - test(`empty keys in batch with ${encoding} keyEncoding`, async function (t) { - const db = testCommon.factory({ keyEncoding: encoding }) - const keys = ['', Uint8Array.from([]), Buffer.alloc(0)] - - await db.open() - - for (let i = 0; i < keys.length; i++) { - await db.batch([{ type: 'put', key: keys[i], value: String(i) }]) - t.same(await db.get(keys[i]), String(i), `got value ${i}`) - } - - return db.close() - }) - } -} - -exports.atomic = function (test, testCommon) { - test('test batch() is atomic', function (t) { - t.plan(4) - - let async = false - - db.batch([ - { type: 'put', key: 'foobah1', value: 'bar1' }, - { type: 'put', value: 'bar2' }, - { type: 'put', key: 'foobah3', value: 'bar3' } - ], function (err) { - t.ok(err, 'should error') - t.ok(async, 'callback is asynchronous') - - db.get('foobah1', function (err) { - t.ok(err, 'should not be found') - }) - db.get('foobah3', function (err) { - t.ok(err, 'should not be found') - }) - }) - - async = true - }) -} - -exports.events = function (test, testCommon) { - test('test batch([]) (array-form) emits batch event', async function (t) { - t.plan(2) - - const db = testCommon.factory() - await db.open() - - t.ok(db.supports.events.batch) - - db.on('batch', function (ops) { - t.same(ops, [{ type: 'put', key: 456, value: 99, custom: 123 }]) - }) - - await db.batch([{ type: 'put', key: 456, value: 99, custom: 123 }]) - await db.close() - }) -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.batch(test, testCommon) - exports.atomic(test, testCommon) - exports.events(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/chained-batch-test.js b/node_modules/abstract-level/test/chained-batch-test.js deleted file mode 100644 index 9e217a7..0000000 --- a/node_modules/abstract-level/test/chained-batch-test.js +++ /dev/null @@ -1,295 +0,0 @@ -'use strict' - -let db - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.args = function (test, testCommon) { - test('test batch has db reference', function (t) { - t.ok(db.batch().db === db) - t.end() - }) - - test('test batch#put() with missing, null or undefined `value`', function (t) { - t.plan(3 * 2) - - for (const args of [[null], [undefined], []]) { - const batch = db.batch() - - try { - batch.put('key', ...args) - } catch (err) { - t.is(err.code, 'LEVEL_INVALID_VALUE', 'correct error code') - t.is(batch.length, 0, 'length is not incremented on error') - } - } - }) - - test('test batch#put() with missing, null or undefined `key`', function (t) { - t.plan(3 * 2) - - for (const args of [[], [null, 'foo'], [undefined, 'foo']]) { - const batch = db.batch() - - try { - batch.put(...args) - } catch (err) { - t.is(err.code, 'LEVEL_INVALID_KEY', 'correct error code') - t.is(batch.length, 0, 'length is not incremented on error') - } - } - }) - - test('test batch#del() with missing, null or undefined `key`', function (t) { - t.plan(3 * 2) - - for (const args of [[null], [undefined], []]) { - const batch = db.batch() - - try { - batch.del(...args) - } catch (err) { - t.is(err.code, 'LEVEL_INVALID_KEY', 'correct error code') - t.is(batch.length, 0, 'length is not incremented on error') - } - } - }) - - test('test batch#clear() doesn\'t throw', function (t) { - db.batch().clear() - t.end() - }) - - test('test batch#put() after write()', function (t) { - const batch = db.batch().put('foo', 'bar') - batch.write(function () {}) - try { - batch.put('boom', 'bang') - } catch (err) { - t.is(err.code, 'LEVEL_BATCH_NOT_OPEN', 'correct error code') - return t.end() - } - t.fail('should have thrown') - t.end() - }) - - test('test batch#del() after write()', function (t) { - const batch = db.batch().put('foo', 'bar') - batch.write(function () {}) - try { - batch.del('foo') - } catch (err) { - t.is(err.code, 'LEVEL_BATCH_NOT_OPEN', 'correct error code') - return t.end() - } - t.fail('should have thrown') - t.end() - }) - - test('test batch#clear() after write()', function (t) { - const batch = db.batch().put('foo', 'bar') - batch.write(function () {}) - try { - batch.clear() - } catch (err) { - t.is(err.code, 'LEVEL_BATCH_NOT_OPEN', 'correct error code') - return t.end() - } - t.fail('should have thrown') - t.end() - }) - - test('test batch#write() after write()', function (t) { - t.plan(1) - const batch = db.batch().put('foo', 'bar') - batch.write(function () {}) - batch.write(function (err) { - t.is(err && err.code, 'LEVEL_BATCH_NOT_OPEN', 'correct error code') - }) - }) - - test('test batch#write() with no operations', function (t) { - let async = false - - db.batch().write(function (err) { - t.ifError(err, 'no error from write()') - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - - test('test batch#write() with promise and no operations', function (t) { - db.batch().write() - .then(t.end.bind(t)) - .catch(t.end.bind(t)) - }) - - test('test twice batch#close() is idempotent', function (t) { - const batch = db.batch() - batch.close(function () { - let async = false - - batch.close(function () { - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - }) -} - -exports.batch = function (test, testCommon) { - test('test basic batch', function (t) { - db.batch([ - { type: 'put', key: 'one', value: '1' }, - { type: 'put', key: 'two', value: '2' }, - { type: 'put', key: 'three', value: '3' } - ], function (err) { - t.error(err) - - const batch = db.batch() - .put('1', 'one') - .del('2', 'two') - .put('3', 'three') - - t.is(batch.length, 3, 'length was incremented') - - batch.clear() - t.is(batch.length, 0, 'length is reset') - - batch.put('one', 'I') - .put('two', 'II') - .del('three') - .put('foo', 'bar') - - t.is(batch.length, 4, 'length was incremented') - - batch.write(function (err) { - t.error(err, 'no write() error') - - db.iterator({ keyEncoding: 'utf8', valueEncoding: 'utf8' }).all(function (err, entries) { - t.error(err) - t.same(entries, [ - ['foo', 'bar'], - ['one', 'I'], - ['two', 'II'] - ]) - t.end() - }) - }) - }) - }) - - test('test basic batch with promise', function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.error(err) - - db.batch() - .put('1', 'one') - .put('2', 'two') - .put('3', 'three') - .write().then(function () { - db.iterator({ keyEncoding: 'utf8', valueEncoding: 'utf8' }).all(function (err, entries) { - t.error(err) - t.same(entries, [ - ['1', 'one'], - ['2', 'two'], - ['3', 'three'] - ]) - db.close(t.end.bind(t)) - }) - }).catch(t.fail.bind(t)) - }) - }) - - // NOTE: adapted from levelup - test('chained batch with per-operation encoding options', async function (t) { - t.plan(2) - - const db = testCommon.factory() - await db.open() - - db.once('batch', function (operations) { - t.same(operations, [ - { type: 'put', key: 'a', value: 'a', valueEncoding: 'json' }, - { type: 'put', key: 'b', value: 'b' }, - { type: 'put', key: '"c"', value: 'c' }, - { type: 'del', key: 'c', keyEncoding: 'json', arbitraryOption: true } - ]) - }) - - await db.batch() - .put('a', 'a', { valueEncoding: 'json' }) - .put('b', 'b') - .put('"c"', 'c') - .del('c', { keyEncoding: 'json', arbitraryOption: true }) - .write() - - t.same(await db.iterator().all(), [ - ['a', '"a"'], - ['b', 'b'] - ]) - - return db.close() - }) -} - -exports.events = function (test, testCommon) { - test('test chained batch() emits batch event', async function (t) { - t.plan(2) - - const db = testCommon.factory() - await db.open() - - t.ok(db.supports.events.batch) - - db.on('batch', function (ops) { - t.same(ops, [ - { type: 'put', key: 987, value: 'b', custom: 123 }, - { type: 'del', key: 216, custom: 999 } - ]) - }) - - await db.batch().put(987, 'b', { custom: 123 }).del(216, { custom: 999 }).write() - await db.close() - }) - - test('test close() on chained batch event', async function () { - const db = testCommon.factory() - await db.open() - - let promise - - db.on('batch', function () { - // Should not interfere with the current write() operation - promise = db.close() - }) - - await db.batch().put('a', 'b').write() - await promise - }) -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.batch(test, testCommon) - exports.events(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/clear-range-test.js b/node_modules/abstract-level/test/clear-range-test.js deleted file mode 100644 index 850b9c8..0000000 --- a/node_modules/abstract-level/test/clear-range-test.js +++ /dev/null @@ -1,274 +0,0 @@ -'use strict' - -const data = (function () { - const d = [] - let i = 0 - let k - for (; i < 100; i++) { - k = (i < 10 ? '0' : '') + i - d.push({ - key: k, - value: String(Math.random()) - }) - } - return d -}()) - -exports.range = function (test, testCommon) { - function rangeTest (name, opts, expected) { - test('db#clear() with ' + name, function (t) { - prepare(t, function (db) { - db.clear(opts, function (err) { - t.ifError(err, 'no clear error') - verify(t, db, expected) - }) - }) - }) - } - - function prepare (t, callback) { - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err, 'no open error') - - db.batch(data.map(function (d) { - return { - type: 'put', - key: d.key, - value: d.value - } - }), function (err) { - t.ifError(err, 'no batch error') - callback(db) - }) - }) - } - - function verify (t, db, expected) { - const it = db.iterator({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - - it.all(function (err, entries) { - t.ifError(err, 'no all() error') - t.is(entries.length, expected.length, 'correct number of entries') - t.same(entries, expected.map(kv => [kv.key, kv.value])) - - db.close(t.end.bind(t)) - }) - } - - function exclude (data, start, end, expectedLength) { - data = data.slice() - const removed = data.splice(start, end - start + 1) // Inclusive - if (expectedLength != null) checkLength(removed, expectedLength) - return data - } - - // For sanity checks on test arguments - function checkLength (arr, length) { - if (arr.length !== length) { - throw new RangeError('Expected ' + length + ' elements, got ' + arr.length) - } - - return arr - } - - rangeTest('full range', {}, []) - - // Reversing has no effect without limit - rangeTest('reverse=true', { - reverse: true - }, []) - - rangeTest('gte=00', { - gte: '00' - }, []) - - rangeTest('gte=50', { - gte: '50' - }, data.slice(0, 50)) - - rangeTest('lte=50 and reverse=true', { - lte: '50', - reverse: true - }, data.slice(51)) - - rangeTest('gte=49.5 (midway)', { - gte: '49.5' - }, data.slice(0, 50)) - - rangeTest('gte=49999 (midway)', { - gte: '49999' - }, data.slice(0, 50)) - - rangeTest('lte=49.5 (midway) and reverse=true', { - lte: '49.5', - reverse: true - }, data.slice(50)) - - rangeTest('lt=49.5 (midway) and reverse=true', { - lt: '49.5', - reverse: true - }, data.slice(50)) - - rangeTest('lt=50 and reverse=true', { - lt: '50', - reverse: true - }, data.slice(50)) - - rangeTest('lte=50', { - lte: '50' - }, data.slice(51)) - - rangeTest('lte=50.5 (midway)', { - lte: '50.5' - }, data.slice(51)) - - rangeTest('lte=50555 (midway)', { - lte: '50555' - }, data.slice(51)) - - rangeTest('lt=50555 (midway)', { - lt: '50555' - }, data.slice(51)) - - rangeTest('gte=50.5 (midway) and reverse=true', { - gte: '50.5', - reverse: true - }, data.slice(0, 51)) - - rangeTest('gt=50.5 (midway) and reverse=true', { - gt: '50.5', - reverse: true - }, data.slice(0, 51)) - - rangeTest('gt=50 and reverse=true', { - gt: '50', - reverse: true - }, data.slice(0, 51)) - - // First key is actually '00' so it should avoid it - rangeTest('lte=0', { - lte: '0' - }, data) - - // First key is actually '00' so it should avoid it - rangeTest('lt=0', { - lt: '0' - }, data) - - rangeTest('gte=30 and lte=70', { - gte: '30', - lte: '70' - }, exclude(data, 30, 70)) - - // The gte and lte options should take precedence over gt and lt respectively. - rangeTest('test iterator with gte=30 and lte=70 and gt=40 and lt=60', { - gte: '30', - lte: '70', - gt: '40', - lt: '60' - }, exclude(data, 30, 70)) - - // Also test the other way around: if gt and lt were to select a bigger range. - rangeTest('test iterator with gte=30 and lte=70 and gt=20 and lt=80', { - gte: '30', - lte: '70', - gt: '20', - lt: '80' - }, exclude(data, 30, 70)) - - rangeTest('gt=29 and lt=71', { - gt: '29', - lt: '71' - }, exclude(data, 30, 70)) - - rangeTest('gte=30 and lte=70 and reverse=true', { - lte: '70', - gte: '30', - reverse: true - }, exclude(data, 30, 70)) - - rangeTest('gt=29 and lt=71 and reverse=true', { - lt: '71', - gt: '29', - reverse: true - }, exclude(data, 30, 70)) - - rangeTest('limit=20', { - limit: 20 - }, data.slice(20)) - - rangeTest('limit=20 and gte=20', { - limit: 20, - gte: '20' - }, exclude(data, 20, 39, 20)) - - rangeTest('limit=20 and reverse=true', { - limit: 20, - reverse: true - }, data.slice(0, -20)) - - rangeTest('limit=20 and lte=79 and reverse=true', { - limit: 20, - lte: '79', - reverse: true - }, exclude(data, 60, 79, 20)) - - rangeTest('limit=-1 should clear whole database', { - limit: -1 - }, []) - - rangeTest('limit=0 should not clear anything', { - limit: 0 - }, data) - - rangeTest('lte after limit', { - limit: 20, - lte: '50' - }, data.slice(20)) - - rangeTest('lte before limit', { - limit: 50, - lte: '19' - }, data.slice(20)) - - rangeTest('gte after database end', { - gte: '9a' - }, data) - - rangeTest('gt after database end', { - gt: '9a' - }, data) - - rangeTest('lte after database end and reverse=true', { - lte: '9a', - reverse: true - }, []) - - rangeTest('lte and gte after database and reverse=true', { - lte: '9b', - gte: '9a', - reverse: true - }, data) - - rangeTest('lt and gt after database and reverse=true', { - lt: '9b', - gt: '9a', - reverse: true - }, data) - - rangeTest('gt greater than lt', { - gt: '20', - lt: '10' - }, data) - - rangeTest('gte greater than lte', { - gte: '20', - lte: '10' - }, data) -} - -exports.all = function (test, testCommon) { - exports.range(test, testCommon) -} diff --git a/node_modules/abstract-level/test/clear-test.js b/node_modules/abstract-level/test/clear-test.js deleted file mode 100644 index 04b76a6..0000000 --- a/node_modules/abstract-level/test/clear-test.js +++ /dev/null @@ -1,183 +0,0 @@ -'use strict' - -const isBuffer = require('is-buffer') -const { Buffer } = require('buffer') - -exports.args = function (test, testCommon) { - test('test clear() with legacy range options', function (t) { - t.plan(4) - - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err) - - try { - db.clear({ start: 'foo' }, t.fail.bind(t)) - } catch (err) { - t.is(err.code, 'LEVEL_LEGACY') - } - - try { - db.clear({ end: 'foo' }).catch(t.fail.bind(t)) - } catch (err) { - t.is(err.code, 'LEVEL_LEGACY') - } - - db.close(t.ifError.bind(t)) - }) - }) -} - -exports.clear = function (test, testCommon) { - makeTest('string', ['a', 'b']) - - if (testCommon.supports.encodings.buffer) { - makeTest('buffer', [Buffer.from('a'), Buffer.from('b')]) - makeTest('mixed', [Buffer.from('a'), 'b']) - - // These keys would be equal when compared as utf8 strings - makeTest('non-utf8 buffer', [Buffer.from('80', 'hex'), Buffer.from('c0', 'hex')]) - } - - function makeTest (type, keys) { - test('test simple clear() on ' + type + ' keys', function (t) { - t.plan(8) - - const db = testCommon.factory() - const ops = keys.map(function (key) { - return { type: 'put', key: key, value: 'foo', keyEncoding: isBuffer(key) ? 'buffer' : 'utf8' } - }) - - db.open(function (err) { - t.ifError(err, 'no open error') - - db.batch(ops, function (err) { - t.ifError(err, 'no batch error') - - db.iterator().all(function (err, entries) { - t.ifError(err, 'no all() error') - t.is(entries.length, keys.length, 'has entries') - - db.clear(function (err) { - t.ifError(err, 'no clear error') - - db.iterator().all(function (err, entries) { - t.ifError(err, 'no all() error') - t.is(entries.length, 0, 'has no entries') - - db.close(function (err) { - t.ifError(err, 'no close error') - }) - }) - }) - }) - }) - }) - }) - - test('test simple clear() on ' + type + ' keys, with promise', function (t) { - t.plan(8) - - const db = testCommon.factory() - const ops = keys.map(function (key) { - return { type: 'put', key: key, value: 'foo', keyEncoding: isBuffer(key) ? 'buffer' : 'utf8' } - }) - - db.open(function (err) { - t.ifError(err, 'no open error') - - db.batch(ops, function (err) { - t.ifError(err, 'no batch error') - - db.iterator().all(function (err, entries) { - t.ifError(err, 'no all() error') - t.is(entries.length, keys.length, 'has entries') - - db.clear().then(function () { - t.ifError(err, 'no clear error') - - db.iterator().all(function (err, entries) { - t.ifError(err, 'no all() error') - t.is(entries.length, 0, 'has no entries') - - db.close(function (err) { - t.ifError(err, 'no close error') - }) - }) - }).catch(t.fail.bind(t)) - }) - }) - }) - }) - } - - // NOTE: adapted from levelup - for (const deferred of [false, true]) { - for (const [gte, keyEncoding] of [['"b"', 'utf8'], ['b', 'json']]) { - test(`clear() with ${keyEncoding} encoding (deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - - await db.open() - await db.batch([ - { type: 'put', key: '"a"', value: 'a' }, - { type: 'put', key: '"b"', value: 'b' } - ]) - - if (deferred) { - await db.close() - t.is(db.status, 'closed') - db.open(t.ifError.bind(t)) - t.is(db.status, 'opening') - } - - await db.clear({ gte, keyEncoding }) - - const keys = await db.keys().all() - t.same(keys, ['"a"'], 'got expected keys') - - return db.close() - }) - } - } -} - -exports.events = function (test, testCommon) { - test('test clear() with options emits clear event', async function (t) { - t.plan(2) - - const db = testCommon.factory() - await db.open() - - t.ok(db.supports.events.clear) - - db.on('clear', function (options) { - t.same(options, { gt: 567, custom: 123 }) - }) - - await db.clear({ gt: 567, custom: 123 }) - await db.close() - }) - - test('test clear() without options emits clear event', async function (t) { - t.plan(2) - - const db = testCommon.factory() - await db.open() - - t.ok(db.supports.events.clear) - - db.on('clear', function (options) { - t.same(options, {}) - }) - - await db.clear() - await db.close() - }) -} - -exports.all = function (test, testCommon) { - exports.args(test, testCommon) - exports.events(test, testCommon) - exports.clear(test, testCommon) -} diff --git a/node_modules/abstract-level/test/close-test.js b/node_modules/abstract-level/test/close-test.js deleted file mode 100644 index d0b77c4..0000000 --- a/node_modules/abstract-level/test/close-test.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict' - -exports.close = function (test, testCommon) { - test('test close()', function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err, 'no open() error') - - db.close(function (err) { - t.error(err) - t.end() - }) - }) - }) - - test('test close() with promise', function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err, 'no open() error') - - db.close() - .then(t.end.bind(t)) - .catch(t.end.bind(t)) - }) - }) -} - -exports.all = function (test, testCommon) { - exports.close(test, testCommon) -} diff --git a/node_modules/abstract-level/test/common.js b/node_modules/abstract-level/test/common.js deleted file mode 100644 index c034d91..0000000 --- a/node_modules/abstract-level/test/common.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict' - -const kNone = Symbol('none') -const kProtected = Symbol('protected') - -function testCommon (options) { - const factory = options.factory - const test = options.test - - if (typeof factory !== 'function') { - throw new TypeError('factory must be a function') - } - - if (typeof test !== 'function') { - throw new TypeError('test must be a function') - } - - if (options.legacyRange != null) { - throw new Error('The legacyRange option has been removed') - } - - let supports = kNone - - return protect(options, { - test: test, - factory: factory, - internals: options.internals || {}, - - // Expose manifest through testCommon to more easily skip tests based on - // supported features. Use a getter to only create a db once. Implicitly - // we also test that the manifest doesn't change after the db constructor. - get supports () { - if (supports === kNone) this.supports = this.factory().supports - return supports - }, - - // Prefer assigning early via manifest-test unless test.only() is used - // in which case we create the manifest on-demand. Copy it to be safe. - set supports (value) { - if (supports === kNone) supports = JSON.parse(JSON.stringify(value)) - } - }) -} - -module.exports = testCommon - -// To help migrating from abstract-leveldown. -// Throw if test suite options are used instead of db.supports -function protect (options, testCommon) { - const legacyOptions = [ - ['createIfMissing', true], - ['errorIfExists', true], - ['snapshots', true], - ['seek', true], - ['encodings', true], - ['deferredOpen', true], - ['streams', true], - ['clear', true], - ['getMany', true], - ['bufferKeys', false], - ['serialize', false], - ['idempotentOpen', false], - ['passiveOpen', false], - ['openCallback', false] - ] - - Object.defineProperty(testCommon, kProtected, { - value: true - }) - - for (const [k, exists] of legacyOptions) { - const msg = exists ? 'has moved to db.supports' : 'has been removed' - - // Options may be a testCommon instance - if (!options[kProtected] && k in options) { - throw new Error(`The test suite option '${k}' ${msg}`) - } - - Object.defineProperty(testCommon, k, { - get () { - throw new Error(`The test suite option '${k}' ${msg}`) - }, - set () { - throw new Error(`The test suite option '${k}' ${msg}`) - } - }) - } - - return testCommon -} diff --git a/node_modules/abstract-level/test/deferred-open-test.js b/node_modules/abstract-level/test/deferred-open-test.js deleted file mode 100644 index 2129173..0000000 --- a/node_modules/abstract-level/test/deferred-open-test.js +++ /dev/null @@ -1,329 +0,0 @@ -'use strict' - -const { DeferredIterator } = require('../lib/deferred-iterator') - -exports.all = function (test, testCommon) { - function verifyValues (t, db, entries) { - let pendingGets = 3 - - for (let k = 1; k <= entries; k++) { - db.get('k' + k, { valueEncoding: 'utf8' }, function (err, v) { - t.ifError(err, 'no get() error') - t.is(v, 'v' + k, 'value is ok') - t.is(db.status, 'open', 'status is ok') - - if (--pendingGets <= 0) { - db.get('k4', { valueEncoding: 'utf8' }, function (err) { - t.ok(err) - db.close(t.ifError.bind(t)) - }) - } - }) - } - } - - // NOTE: copied from levelup - test('deferred open(): put() and get() on new database', function (t) { - t.plan(15) - - // Open database without callback, opens in next tick - const db = testCommon.factory() - - let pendingPuts = 3 - - // Insert 3 values with put(), these should be deferred until the database is actually open - for (let k = 1; k <= 3; k++) { - db.put('k' + k, 'v' + k, function (err) { - t.ifError(err, 'no put() error') - - if (--pendingPuts <= 0) { - verifyValues(t, db, 3) - } - }) - } - - t.is(db.status, 'opening') - }) - - // NOTE: copied from levelup - test('deferred open(): batch() on new database', function (t) { - t.plan(13) - - // Open database without callback, opens in next tick - const db = testCommon.factory() - - // Insert 3 values with batch(), these should be deferred until the database is actually open - db.batch([ - { type: 'put', key: 'k1', value: 'v1' }, - { type: 'put', key: 'k2', value: 'v2' }, - { type: 'put', key: 'k3', value: 'v3' } - ], function (err) { - t.ifError(err, 'no batch() error') - verifyValues(t, db, 3) - }) - - t.is(db.status, 'opening') - }) - - // NOTE: copied from levelup - test('deferred open(): chained batch() on new database', function (t) { - t.plan(13) - - // Open database without callback, opens in next tick - const db = testCommon.factory() - - // Insert 3 values with batch(), these should be deferred until the database is actually open - db.batch() - .put('k1', 'v1') - .put('k2', 'v2') - .put('k3', 'v3') - .write(function (err) { - t.ifError(err, 'no write() error') - verifyValues(t, db, 3) - }) - - t.is(db.status, 'opening') - }) - - // NOTE: copied from levelup - test('deferred open(): put() and get() on reopened database', async function (t) { - const db = testCommon.factory() - - await db.close() - t.is(db.status, 'closed') - - db.open(() => {}) - t.is(db.status, 'opening') - - await db.put('beep', 'boop') - - t.is(db.status, 'open') - t.is(await db.get('beep', { valueEncoding: 'utf8' }), 'boop') - - await db.close() - }) - - // NOTE: copied from levelup - test('deferred open(): value of queued operation is not stringified', function (t) { - t.plan(4) - - const db = testCommon.factory({ valueEncoding: 'json' }) - - db.put('key', { thing: 2 }, function (err) { - t.ifError(err) - - db.get('key', function (err, value) { - t.ifError(err) - t.same(value, { thing: 2 }) - db.close(t.ifError.bind(t)) - }) - }) - }) - - // NOTE: copied from levelup - test('deferred open(): key of queued operation is not stringified', function (t) { - t.plan(4) - - const db = testCommon.factory({ keyEncoding: 'json' }) - - db.put({ thing: 2 }, 'value', function (err) { - t.ifError(err) - - db.iterator().next(function (err, key, value) { - t.ifError(err, 'no next() error') - t.same(key, { thing: 2 }) - db.close(t.ifError.bind(t)) - }) - }) - }) - - // NOTE: copied from deferred-leveldown - test('cannot operate on closed db', function (t) { - t.plan(6) - - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err) - - db.close(function (err) { - t.ifError(err) - - db.put('foo', 'bar', function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - }) - - try { - db.iterator() - } catch (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - - try { - db.keys() - } catch (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - - try { - db.values() - } catch (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - }) - }) - }) - - // NOTE: copied from deferred-leveldown - test('cannot operate on closing db', function (t) { - t.plan(6) - - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err) - - db.close(function (err) { - t.ifError(err) - }) - - db.put('foo', 'bar', function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - }) - - try { - db.iterator() - } catch (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - - try { - db.keys() - } catch (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - - try { - db.values() - } catch (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - }) - }) - - // NOTE: copied from deferred-leveldown - test('deferred iterator - cannot operate on closed db', function (t) { - t.plan(10) - - const db = testCommon.factory() - - db.open(function (err) { - t.error(err, 'no error') - - db.close(function (err) { - t.ifError(err) - - it.next(function (err, key, value) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.next().catch(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.nextv(10, function (err, items) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.nextv(10).catch(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.all(function (err, items) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.all().catch(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - // Was already closed - it.close(function () { - t.ifError(err, 'no close() error') - }) - - it.close().catch(function () { - t.fail('no close() error') - }) - - try { - it.seek('foo') - } catch (err) { - // Should *not* throw - t.fail(err) - } - }) - }) - - const it = db.iterator({ gt: 'foo' }) - t.ok(it instanceof DeferredIterator) - }) - - // NOTE: copied from deferred-leveldown - test('deferred iterator - cannot operate on closing db', function (t) { - t.plan(10) - - const db = testCommon.factory() - - db.open(function (err) { - t.error(err, 'no error') - - db.close(function (err) { - t.ifError(err) - }) - - it.next(function (err, key, value) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.next().catch(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.nextv(10, function (err) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.nextv(10).catch(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.all(function (err) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - it.all().catch(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - // Is already closing - it.close(function (err) { - t.ifError(err, 'no close() error') - }) - - it.close().catch(function () { - t.fail('no close() error') - }) - - try { - it.seek('foo') - } catch (err) { - // Should *not* throw - t.fail(err) - } - }) - - const it = db.iterator({ gt: 'foo' }) - t.ok(it instanceof DeferredIterator) - }) -} diff --git a/node_modules/abstract-level/test/del-test.js b/node_modules/abstract-level/test/del-test.js deleted file mode 100644 index bab9b0d..0000000 --- a/node_modules/abstract-level/test/del-test.js +++ /dev/null @@ -1,105 +0,0 @@ -'use strict' - -const { verifyNotFoundError, illegalKeys, assertAsync } = require('./util') - -let db - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.args = function (test, testCommon) { - test('test del() with illegal keys', assertAsync.ctx(function (t) { - t.plan(illegalKeys.length * 5) - - for (const { name, key } of illegalKeys) { - db.del(key, assertAsync(function (err) { - t.ok(err instanceof Error, name + ' - is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (callback)') - })) - - db.del(key).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (callback)') - }) - } - })) -} - -exports.del = function (test, testCommon) { - test('test simple del()', function (t) { - db.put('foo', 'bar', function (err) { - t.error(err) - db.del('foo', function (err) { - t.error(err) - db.get('foo', function (err, value) { - t.ok(err, 'entry properly deleted') - t.ok(typeof value === 'undefined', 'value is undefined') - t.ok(verifyNotFoundError(err), 'NotFound error') - t.end() - }) - }) - }) - }) - - test('test simple del() with promise', function (t) { - db.put('foo', 'bar', function (err) { - t.error(err) - db.del('foo').then(function (err) { - t.error(err) - db.get('foo', function (err, value) { - t.ok(err, 'entry properly deleted') - t.ok(typeof value === 'undefined', 'value is undefined') - t.ok(verifyNotFoundError(err), 'NotFound error') - t.end() - }) - }).catch(t.fail.bind(t)) - }) - }) - - test('test del on non-existent key', function (t) { - db.del('blargh', function (err) { - t.error(err) - t.end() - }) - }) - - test('test del on non-existent key, with promise', async function (t) { - return db.del('blargh') - }) -} - -exports.events = function (test, testCommon) { - test('test del() emits del event', async function (t) { - t.plan(2) - - const db = testCommon.factory() - await db.open() - - t.ok(db.supports.events.del) - - db.on('del', function (key) { - t.is(key, 456) - }) - - await db.del(456) - await db.close() - }) -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.del(test, testCommon) - exports.events(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/encoding-buffer-test.js b/node_modules/abstract-level/test/encoding-buffer-test.js deleted file mode 100644 index 6535422..0000000 --- a/node_modules/abstract-level/test/encoding-buffer-test.js +++ /dev/null @@ -1,255 +0,0 @@ -'use strict' - -const { Buffer } = require('buffer') -const textEncoder = new TextEncoder() - -exports.all = function (test, testCommon) { - if (!testCommon.supports.encodings.buffer) return - - // NOTE: adapted from levelup - test('test put() and get() with buffer value and buffer valueEncoding', async function (t) { - const db = testCommon.factory() - await db.open() - await db.put('test', testBuffer(), { valueEncoding: 'buffer' }) - t.same(await db.get('test', { valueEncoding: 'buffer' }), testBuffer()) - return db.close() - }) - - // NOTE: adapted from levelup - test('test put() and get() with buffer value and buffer valueEncoding in factory', async function (t) { - const db = testCommon.factory({ valueEncoding: 'buffer' }) - await db.open() - await db.put('test', testBuffer()) - t.same(await db.get('test'), testBuffer()) - return db.close() - }) - - // NOTE: adapted from levelup - test('test put() and get() with buffer key and buffer keyEncoding', async function (t) { - const db = testCommon.factory() - await db.open() - await db.put(testBuffer(), 'test', { keyEncoding: 'buffer' }) - t.same(await db.get(testBuffer(), { keyEncoding: 'buffer' }), 'test') - return db.close() - }) - - // NOTE: adapted from levelup - test('test put() and get() with buffer key and utf8 keyEncoding', async function (t) { - const db = testCommon.factory() - await db.open() - await db.put(Buffer.from('foo🐄'), 'test', { keyEncoding: 'utf8' }) - t.same(await db.get(Buffer.from('foo🐄'), { keyEncoding: 'utf8' }), 'test') - return db.close() - }) - - // NOTE: adapted from levelup - test('test put() and get() with string value and buffer valueEncoding', async function (t) { - const db = testCommon.factory() - await db.open() - await db.put('test', 'foo🐄', { valueEncoding: 'buffer' }) - t.same(await db.get('test', { valueEncoding: 'buffer' }), Buffer.from('foo🐄')) - t.same(await db.get('test', { valueEncoding: 'utf8' }), 'foo🐄') - return db.close() - }) - - // NOTE: adapted from memdown - test('put() as string, get() as buffer and vice versa', async function (t) { - const db = testCommon.factory() - await db.open() - const enc = { keyEncoding: 'buffer', valueEncoding: 'buffer' } - const [a, b] = ['🐄', '🐄 says moo'] - - const promise1 = db.put(a, a).then(async () => { - const value = await db.get(Buffer.from(a), enc) - t.same(value, Buffer.from(a), 'got buffer value') - }) - - const promise2 = db.put(Buffer.from(b), Buffer.from(b), enc).then(async () => { - const value = await db.get(b) - t.same(value, b, 'got string value') - }) - - await Promise.all([promise1, promise2]) - return db.close() - }) - - // NOTE: adapted from memdown - test('put() stringifies input to buffer', async function (t) { - const db = testCommon.factory() - await db.open() - await db.put(1, 2) - - const it = db.iterator({ keyEncoding: 'buffer', valueEncoding: 'buffer' }) - const entries = await it.all() - - t.same(entries[0][0], Buffer.from('1'), 'key was stringified') - t.same(entries[0][1], Buffer.from('2'), 'value was stringified') - - return db.close() - }) - - // NOTE: adapted from memdown - test('put() as string, iterate as buffer', async function (t) { - const db = testCommon.factory({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - await db.open() - await db.put('🐄', '🐄') - - const it = db.iterator({ keyEncoding: 'buffer', valueEncoding: 'buffer' }) - const entries = await it.all() - - t.same(entries, [[Buffer.from('🐄'), Buffer.from('🐄')]]) - return db.close() - }) - - // NOTE: adapted from memdown - test('put() as buffer, iterate as string', async function (t) { - const db = testCommon.factory({ keyEncoding: 'buffer', valueEncoding: 'buffer' }) - await db.open() - await db.put(Buffer.from('🐄'), Buffer.from('🐄')) - - const it = db.iterator({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - const entries = await it.all() - - t.same(entries, [['🐄', '🐄']]) - return db.close() - }) - - test('put() as view, iterate as view', async function (t) { - const db = testCommon.factory({ keyEncoding: 'view', valueEncoding: 'view' }) - const cow = textEncoder.encode('🐄') - await db.open() - await db.put(cow, cow) - - const it = db.iterator() - const entries = await it.all() - const key = Buffer.isBuffer(entries[0][0]) ? Buffer.from(cow) : cow // Valid, Buffer is a Uint8Array - const value = Buffer.isBuffer(entries[0][1]) ? Buffer.from(cow) : cow - - t.same(entries, [[key, value]]) - return db.close() - }) - - test('put() as string, iterate as view', async function (t) { - const db = testCommon.factory({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - const cow = textEncoder.encode('🐄') - await db.open() - await db.put('🐄', '🐄') - - const it = db.iterator({ keyEncoding: 'view', valueEncoding: 'view' }) - const entries = await it.all() - const key = Buffer.isBuffer(entries[0][0]) ? Buffer.from(cow) : cow // Valid, Buffer is a Uint8Array - const value = Buffer.isBuffer(entries[0][1]) ? Buffer.from(cow) : cow - - t.same(entries, [[key, value]]) - return db.close() - }) - - test('put() as view, iterate as string', async function (t) { - const db = testCommon.factory({ keyEncoding: 'view', valueEncoding: 'view' }) - const cow = textEncoder.encode('🐄') - await db.open() - await db.put(cow, cow) - - const it = db.iterator({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - const entries = await it.all() - - t.same(entries, [['🐄', '🐄']]) - return db.close() - }) - - // NOTE: adapted from levelup - test('batch() with multiple puts with buffer valueEncoding per batch', async function (t) { - const db = testCommon.factory() - await db.open() - await db.batch([ - { type: 'put', key: 'foo', value: testBuffer() }, - { type: 'put', key: 'bar', value: testBuffer() }, - { type: 'put', key: 'baz', value: 'abazvalue' } - ], { valueEncoding: 'buffer' }) - - t.same(await db.get('foo', { valueEncoding: 'buffer' }), testBuffer()) - t.same(await db.get('bar', { valueEncoding: 'buffer' }), testBuffer()) - t.same(await db.get('baz', { valueEncoding: 'buffer' }), Buffer.from('abazvalue')) - - return db.close() - }) - - test('batch() with multiple puts with buffer valueEncoding per operation', async function (t) { - const db = testCommon.factory() - await db.open() - await db.batch([ - { type: 'put', key: 'foo', value: testBuffer(), valueEncoding: 'buffer' }, - { type: 'put', key: 'bar', value: testBuffer(), valueEncoding: 'buffer' }, - { type: 'put', key: 'baz', value: 'abazvalue', valueEncoding: 'buffer' } - ]) - - t.same(await db.get('foo', { valueEncoding: 'buffer' }), testBuffer()) - t.same(await db.get('bar', { valueEncoding: 'buffer' }), testBuffer()) - t.same(await db.get('baz', { valueEncoding: 'buffer' }), Buffer.from('abazvalue')) - - return db.close() - }) - - // NOTE: adapted from encoding-down - test('batch() with buffer encoding in factory', async function (t) { - const operations = [{ - type: 'put', - key: Buffer.from([1, 2, 3]), - value: Buffer.from([4, 5, 6]) - }, { - type: 'put', - key: Buffer.from([7, 8, 9]), - value: Buffer.from([10, 11, 12]) - }] - - const db = testCommon.factory({ keyEncoding: 'buffer', valueEncoding: 'buffer' }) - await db.open() - await db.batch(operations) - - t.same(await db.get(operations[0].key), operations[0].value) - t.same(await db.get(operations[1].key), operations[1].value) - - return db.close() - }) - - for (const keyEncoding of ['buffer', 'view']) { - // NOTE: adapted from memdown - test(`storage is byte-aware (${keyEncoding} encoding)`, function (t) { - const db = testCommon.factory({ keyEncoding }) - - db.open(function (err) { - t.ifError(err, 'no open error') - - const one = Buffer.from('80', 'hex') - const two = Buffer.from('c0', 'hex') - - t.ok(two.toString() === one.toString(), 'would be equal when not byte-aware') - t.ok(two.compare(one) > 0, 'but greater when byte-aware') - - db.put(one, 'one', function (err) { - t.ifError(err, 'no put() error') - - db.get(one, function (err, value) { - t.ifError(err, 'no get() error') - t.is(value, 'one', 'value one ok') - - db.put(two, 'two', function (err) { - t.ifError(err, 'no put() error') - - db.get(one, function (err, value) { - t.ifError(err, 'no get() error') - t.is(value, 'one', 'value one did not change') - - db.close(t.end.bind(t)) - }) - }) - }) - }) - }) - }) - } -} - -function testBuffer () { - return Buffer.from('0080c0ff', 'hex') -} diff --git a/node_modules/abstract-level/test/encoding-custom-test.js b/node_modules/abstract-level/test/encoding-custom-test.js deleted file mode 100644 index f0ff27a..0000000 --- a/node_modules/abstract-level/test/encoding-custom-test.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict' - -// NOTE: copied from levelup -exports.all = function (test, testCommon) { - for (const deferred of [false, true]) { - test(`custom encoding: simple-object values (deferred: ${deferred})`, function (t) { - run(t, deferred, [ - { key: '0', value: 0 }, - { key: '1', value: 1 }, - { key: 'string', value: 'a string' }, - { key: 'true', value: true }, - { key: 'false', value: false } - ]) - }) - - test(`custom encoding: simple-object keys (deferred: ${deferred})`, function (t) { - // Test keys that would be considered the same with default utf8 encoding. - // Because String([1]) === String(1). - run(t, deferred, [ - { value: '0', key: [1] }, - { value: '1', key: 1 }, - { value: 'string', key: 'a string' }, - { value: 'true', key: true }, - { value: 'false', key: false } - ]) - }) - - test(`custom encoding: complex-object values (deferred: ${deferred})`, function (t) { - run(t, deferred, [{ - key: '0', - value: { - foo: 'bar', - bar: [1, 2, 3], - bang: { yes: true, no: false } - } - }]) - }) - - test(`custom encoding: complex-object keys (deferred: ${deferred})`, function (t) { - // Test keys that would be considered the same with default utf8 encoding. - // Because String({}) === String({}) === '[object Object]'. - run(t, deferred, [{ - value: '0', - key: { - foo: 'bar', - bar: [1, 2, 3], - bang: { yes: true, no: false } - } - }, { - value: '1', - key: { - foo: 'different', - bar: [1, 2, 3], - bang: { yes: true, no: false } - } - }]) - }) - } - - function run (t, deferred, entries) { - const customEncoding = { - encode: JSON.stringify, - decode: JSON.parse, - format: 'utf8', - type: 'custom' - } - - const db = testCommon.factory({ - keyEncoding: customEncoding, - valueEncoding: customEncoding - }) - - const operations = entries.map(entry => ({ type: 'put', ...entry })) - const init = deferred ? (fn) => fn() : db.open.bind(db) - - init(function (err) { - t.ifError(err, 'no init() error') - - db.batch(operations, function (err) { - t.ifError(err, 'no batch() error') - - let pending = entries.length - const next = () => { - if (--pending === 0) { - db.close(t.end.bind(t)) - } - } - - for (const entry of entries) { - db.get(entry.key, function (err, value) { - t.ifError(err, 'no get() error') - t.same(value, entry.value) - next() - }) - } - }) - }) - } -} diff --git a/node_modules/abstract-level/test/encoding-decode-error-test.js b/node_modules/abstract-level/test/encoding-decode-error-test.js deleted file mode 100644 index e2a6986..0000000 --- a/node_modules/abstract-level/test/encoding-decode-error-test.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict' - -let db -let keySequence = 0 - -const testKey = () => 'test' + (++keySequence) - -exports.all = function (test, testCommon) { - test('setup', async function (t) { - db = testCommon.factory() - return db.open() - }) - - // NOTE: adapted from encoding-down - test('get() and getMany() forward decode error', function (t) { - const key = testKey() - const valueEncoding = { - encode: (v) => v, - decode: (v) => { throw new Error('decode error xyz') }, - format: 'utf8' - } - - db.put(key, 'bar', { valueEncoding }, function (err) { - t.ifError(err, 'no put() error') - - db.get(key, { valueEncoding }, function (err, value) { - t.is(err && err.code, 'LEVEL_DECODE_ERROR') - t.is(err && err.cause && err.cause.message, 'decode error xyz') - t.is(value, undefined) - - db.getMany(['other-key', key], { valueEncoding }, function (err, values) { - t.is(err && err.code, 'LEVEL_DECODE_ERROR') - t.is(err && err.cause && err.cause.message, 'decode error xyz') - t.is(values, undefined) - t.end() - }) - }) - }) - }) - - // NOTE: adapted from encoding-down - test('get() and getMany() yield encoding error if stored value is invalid', function (t) { - const key = testKey() - - db.put(key, 'this {} is [] not : json', { valueEncoding: 'utf8' }, function (err) { - t.ifError(err, 'no put() error') - - db.get(key, { valueEncoding: 'json' }, function (err) { - t.is(err && err.code, 'LEVEL_DECODE_ERROR') - t.is(err && err.cause.name, 'SyntaxError') // From JSON.parse() - - db.getMany(['other-key', key], { valueEncoding: 'json' }, function (err) { - t.is(err && err.code, 'LEVEL_DECODE_ERROR') - t.is(err && err.cause.name, 'SyntaxError') // From JSON.parse() - t.end() - }) - }) - }) - }) - - test('teardown', async function (t) { - return db.close() - }) -} diff --git a/node_modules/abstract-level/test/encoding-json-test.js b/node_modules/abstract-level/test/encoding-json-test.js deleted file mode 100644 index bb744f9..0000000 --- a/node_modules/abstract-level/test/encoding-json-test.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict' - -// NOTE: copied from levelup -exports.all = function (test, testCommon) { - for (const deferred of [false, true]) { - test(`json encoding: simple-object values (deferred: ${deferred})`, function (t) { - run(t, deferred, [ - { key: '0', value: 0 }, - { key: '1', value: 1 }, - { key: '2', value: 'a string' }, - { key: '3', value: true }, - { key: '4', value: false } - ]) - }) - - test(`json encoding: simple-object keys (deferred: ${deferred})`, function (t) { - run(t, deferred, [ - { value: 'string', key: 'a string' }, - { value: '0', key: 0 }, - { value: '1', key: 1 }, - { value: 'false', key: false }, - { value: 'true', key: true } - ]) - }) - - test(`json encoding: complex-object values (deferred: ${deferred})`, function (t) { - run(t, deferred, [{ - key: '0', - value: { - foo: 'bar', - bar: [1, 2, 3], - bang: { yes: true, no: false } - } - }]) - }) - - test(`json encoding: complex-object keys (deferred: ${deferred})`, function (t) { - run(t, deferred, [{ - value: '0', - key: { - foo: 'bar', - bar: [1, 2, 3], - bang: { yes: true, no: false } - } - }]) - }) - } - - function run (t, deferred, entries) { - const db = testCommon.factory({ keyEncoding: 'json', valueEncoding: 'json' }) - const operations = entries.map(entry => ({ type: 'put', ...entry })) - const init = deferred ? (fn) => fn() : db.open.bind(db) - - init(function (err) { - t.ifError(err, 'no init() error') - - db.batch(operations, function (err) { - t.ifError(err, 'no batch() error') - - let pending = entries.length + 1 - const next = () => { - if (--pending === 0) db.close(t.end.bind(t)) - } - - testGet(next) - testIterator(next) - }) - }) - - function testGet (next) { - for (const entry of entries) { - db.get(entry.key, function (err, value) { - t.ifError(err, 'no get() error') - t.same(value, entry.value) - next() - }) - } - } - - function testIterator (next) { - db.iterator().all(function (err, result) { - t.ifError(err, 'no all() error') - t.same(result, entries.map(kv => [kv.key, kv.value])) - next() - }) - } - } -} diff --git a/node_modules/abstract-level/test/encoding-test.js b/node_modules/abstract-level/test/encoding-test.js deleted file mode 100644 index e9969a8..0000000 --- a/node_modules/abstract-level/test/encoding-test.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict' - -let db -let keySequence = 0 - -const testKey = () => 'test' + (++keySequence) - -// TODO: test encoding options on every method. This is largely -// covered (indirectly) by other tests, but a dedicated property- -// based test for each would be good to have. -exports.all = function (test, testCommon) { - test('setup', async function (t) { - db = testCommon.factory() - return db.open() - }) - - // NOTE: adapted from encoding-down - test('encodings default to utf8', function (t) { - t.is(db.keyEncoding().commonName, 'utf8') - t.is(db.valueEncoding().commonName, 'utf8') - t.end() - }) - - test('can set encoding options in factory', async function (t) { - const dbs = [] - - for (const name of ['buffer', 'view', 'json']) { - if (!testCommon.supports.encodings[name]) continue - - const db1 = testCommon.factory({ keyEncoding: name }) - const db2 = testCommon.factory({ valueEncoding: name }) - const db3 = testCommon.factory({ keyEncoding: name, valueEncoding: name }) - - t.is(db1.keyEncoding().commonName, name) - t.is(db1.keyEncoding(), db1.keyEncoding(name)) - t.is(db1.valueEncoding().commonName, 'utf8') - t.is(db1.valueEncoding(), db1.valueEncoding('utf8')) - - t.is(db2.keyEncoding().commonName, 'utf8') - t.is(db2.keyEncoding(), db2.keyEncoding('utf8')) - t.is(db2.valueEncoding().commonName, name) - t.is(db2.valueEncoding(), db2.valueEncoding(name)) - - t.is(db3.keyEncoding().commonName, name) - t.is(db3.keyEncoding(), db3.keyEncoding(name)) - t.is(db3.valueEncoding().commonName, name) - t.is(db3.valueEncoding(), db3.valueEncoding(name)) - - dbs.push(db1, db2, db3) - } - - await Promise.all(dbs.map(db => db.close())) - }) - - // NOTE: adapted from encoding-down - for (const deferred of [false, true]) { - test(`default utf8 encoding stringifies numbers (deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - if (!deferred) await db.open() - await db.put(1, 2) - t.is(await db.get(1), '2') - return db.close() - }) - } - - // NOTE: adapted from encoding-down - test('can decode from string to json', function (t) { - const key = testKey() - const data = { thisis: 'json' } - - db.put(key, JSON.stringify(data), { valueEncoding: 'utf8' }, function (err) { - t.ifError(err, 'no put() error') - - db.get(key, { valueEncoding: 'json' }, function (err, value) { - t.ifError(err, 'no get() error') - t.same(value, data, 'got parsed object') - t.end() - }) - }) - }) - - // NOTE: adapted from encoding-down - test('can decode from json to string', function (t) { - const data = { thisis: 'json' } - const key = testKey() - - db.put(key, data, { valueEncoding: 'json' }, function (err) { - t.ifError(err, 'no put() error') - - db.get(key, { valueEncoding: 'utf8' }, function (err, value) { - t.ifError(err, 'no get() error') - t.is(value, JSON.stringify(data), 'got unparsed JSON string') - t.end() - }) - }) - }) - - // NOTE: adapted from encoding-down - test('getMany() skips decoding not-found values', function (t) { - t.plan(4) - - const valueEncoding = { - encode: JSON.stringify, - decode (value) { - t.is(value, JSON.stringify(data)) - return JSON.parse(value) - }, - format: 'utf8' - } - - const data = { beep: 'boop' } - const key = testKey() - - db.put(key, data, { valueEncoding }, function (err) { - t.ifError(err, 'no put() error') - - db.getMany([key, testKey()], { valueEncoding }, function (err, values) { - t.ifError(err, 'no getMany() error') - t.same(values, [data, undefined]) - }) - }) - }) - - // NOTE: adapted from memdown - test('number keys with utf8 encoding', async function (t) { - const db = testCommon.factory() - const numbers = [-Infinity, 0, 12, 2, +Infinity] - - await db.open() - await db.batch(numbers.map(key => ({ type: 'put', key, value: 'value' }))) - - const keys = await db.keys({ keyEncoding: 'utf8' }).all() - t.same(keys, numbers.map(String), 'sorts lexicographically') - - return db.close() - }) - - test('teardown', async function (t) { - return db.close() - }) -} diff --git a/node_modules/abstract-level/test/factory-test.js b/node_modules/abstract-level/test/factory-test.js deleted file mode 100644 index 519b84e..0000000 --- a/node_modules/abstract-level/test/factory-test.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict' - -module.exports = function (test, testCommon) { - test('testCommon.factory() returns valid database', function (t) { - t.plan(6) - - const db = testCommon.factory() - const kEvent = Symbol('event') - - // Avoid instanceof, for levelup compatibility tests - t.is(typeof db, 'object', 'is an object') - t.isNot(db, null, 'is not null') - t.is(typeof db.open, 'function', 'has open() method') - t.is(typeof db.on, 'function', 'has on() method') - t.is(typeof db.emit, 'function', 'has emit() method') - - db.once(kEvent, (v) => t.is(v, 'foo', 'got event')) - db.emit(kEvent, 'foo') - }) - - test('testCommon.factory() returns a unique database', function (t) { - const db1 = testCommon.factory() - const db2 = testCommon.factory() - - t.isNot(db1, db2, 'unique instances') - - function close () { - db1.close(function (err) { - t.error(err, 'no error while closing db1') - db2.close(function (err) { - t.error(err, 'no error while closing db2') - t.end() - }) - }) - } - - db1.open(function (err) { - t.error(err, 'no error while opening db1') - db2.open(function (err) { - t.error(err, 'no error while opening db2') - db1.put('key', 'value', function (err) { - t.error(err, 'put key in db1') - db2.get('key', function (err, value) { - t.ok(err, 'db2 should be empty') - t.is(value, undefined, 'db2 should be empty') - close() - }) - }) - }) - }) - }) -} diff --git a/node_modules/abstract-level/test/get-many-test.js b/node_modules/abstract-level/test/get-many-test.js deleted file mode 100644 index 2221e69..0000000 --- a/node_modules/abstract-level/test/get-many-test.js +++ /dev/null @@ -1,276 +0,0 @@ -'use strict' - -const { assertAsync, illegalKeys } = require('./util') - -let db - -/** - * @param {import('tape')} test - */ -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -/** - * @param {import('tape')} test - */ -exports.args = function (test, testCommon) { - test('test getMany() requires an array argument (callback)', assertAsync.ctx(function (t) { - // Add 1 assertion for every assertAsync() - t.plan(6) - - db.getMany('foo', assertAsync(function (err) { - t.is(err.name, 'TypeError') - t.is(err && err.message, "The first argument 'keys' must be an array") - })) - db.getMany('foo', {}, assertAsync(function (err) { - t.is(err.name, 'TypeError') - t.is(err && err.message, "The first argument 'keys' must be an array") - })) - })) - - test('test getMany() requires an array argument (promise)', function (t) { - t.plan(6) - - db.getMany().catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err && err.message, "The first argument 'keys' must be an array") - }) - db.getMany('foo').catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err && err.message, "The first argument 'keys' must be an array") - }) - db.getMany('foo', {}).catch(function (err) { - t.is(err.name, 'TypeError') - t.is(err && err.message, "The first argument 'keys' must be an array") - }) - }) - - test('test getMany() with illegal keys', assertAsync.ctx(function (t) { - // Add 1 assertion for every assertAsync() - t.plan(illegalKeys.length * 10) - - for (const { name, key } of illegalKeys) { - db.getMany([key], assertAsync(function (err) { - t.ok(err instanceof Error, name + ' - is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (callback)') - })) - - db.getMany(['valid', key], assertAsync(function (err) { - t.ok(err instanceof Error, name + ' - is Error (callback, second key)') - t.is(err && err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (callback, second key)') - })) - - db.getMany([key]).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (promise)') - }) - - db.getMany(['valid', key]).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise, second key)') - t.is(err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (promise, second key)') - }) - } - })) -} - -/** - * @param {import('tape')} test - */ -exports.getMany = function (test, testCommon) { - test('test simple getMany()', function (t) { - db.put('foo', 'bar', function (err) { - t.error(err) - - function verify (err, values) { - t.error(err) - t.ok(Array.isArray(values), 'got an array') - t.is(values.length, 1, 'array has 1 element') - t.is(values[0], 'bar') - } - - db.getMany(['foo'], function (err, values) { - verify(err, values) - - db.getMany(['foo'], {}, function (err, values) { - verify(err, values) - - db.getMany(['foo'], { valueEncoding: 'utf8' }, function (err, values) { - t.error(err) - t.is(values && typeof values[0], 'string', 'should be string if not buffer') - t.same(values, ['bar']) - t.end() - }) - }) - }) - }) - }) - - test('test getMany() with multiple keys', function (t) { - t.plan(5) - - db.put('beep', 'boop', function (err) { - t.ifError(err) - - db.getMany(['foo', 'beep'], { valueEncoding: 'utf8' }, function (err, values) { - t.ifError(err) - t.same(values, ['bar', 'boop']) - }) - - db.getMany(['beep', 'foo'], { valueEncoding: 'utf8' }, function (err, values) { - t.ifError(err) - t.same(values, ['boop', 'bar'], 'maintains order of input keys') - }) - }) - }) - - test('test empty getMany()', assertAsync.ctx(function (t) { - const encodings = Object.keys(db.supports.encodings).filter(k => db.supports.encodings[k]) - t.plan(encodings.length * 3) - - for (const valueEncoding of encodings) { - db.getMany([], { valueEncoding }, assertAsync(function (err, values) { - t.ifError(err) - t.same(values, []) - })) - } - })) - - test('test not-found getMany()', assertAsync.ctx(function (t) { - const encodings = Object.keys(db.supports.encodings).filter(k => db.supports.encodings[k]) - t.plan(encodings.length * 3) - - for (const valueEncoding of encodings) { - db.getMany(['nope', 'another'], { valueEncoding }, assertAsync(function (err, values) { - t.ifError(err) - t.same(values, [undefined, undefined]) - })) - } - })) - - test('test getMany() with promise', async function (t) { - t.same(await db.getMany(['foo'], { valueEncoding: 'utf8' }), ['bar']) - t.same(await db.getMany(['beep'], { valueEncoding: 'utf8' }), ['boop']) - t.same(await db.getMany(['foo', 'beep'], { valueEncoding: 'utf8' }), ['bar', 'boop']) - t.same(await db.getMany(['beep', 'foo'], { valueEncoding: 'utf8' }), ['boop', 'bar']) - t.same(await db.getMany(['beep', 'foo', 'nope'], { valueEncoding: 'utf8' }), ['boop', 'bar', undefined]) - t.same(await db.getMany([], { valueEncoding: 'utf8' }), []) - }) - - test('test simultaneous getMany()', function (t) { - db.put('hello', 'world', function (err) { - t.error(err) - - let completed = 0 - const done = function () { - if (++completed === 20) t.end() - } - - for (let i = 0; i < 10; ++i) { - db.getMany(['hello'], function (err, values) { - t.error(err) - t.is(values.length, 1) - t.is(values[0] && values[0].toString(), 'world') - done() - }) - } - - for (let i = 0; i < 10; ++i) { - db.getMany(['not found'], function (err, values) { - t.error(err) - t.same(values, [undefined]) - done() - }) - } - }) - }) - - test('test getMany() on opening db', assertAsync.ctx(function (t) { - t.plan(2 * 2 * 5) - - // Also test empty array because it has a fast-path - for (const keys of [['foo'], []]) { - // Opening should make no difference, because we call it after getMany() - for (const open of [true, false]) { - const db = testCommon.factory() - - t.is(db.status, 'opening') - - db.getMany(keys, assertAsync(function (err, values) { - t.ifError(err, 'no error') - t.same(values, keys.map(_ => undefined)) - })) - - if (open) { - db.open(t.error.bind(t)) - } else { - t.pass() - } - } - } - })) - - test('test getMany() on closed db', function (t) { - t.plan(2 * 4) - - // Also test empty array because it has a fast-path - for (const keys of [['foo'], []]) { - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err) - - db.close(assertAsync.with(t, function (err) { - t.ifError(err) - - db.getMany(keys, assertAsync(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - })) - })) - }) - } - }) - - test('test getMany() on closing db', function (t) { - t.plan(2 * 4) - - // Also test empty array because it has a fast-path - for (const keys of [['foo'], []]) { - const db = testCommon.factory() - - db.open(assertAsync.with(t, function (err) { - t.ifError(err) - - db.close(function (err) { - t.ifError(err) - }) - - db.getMany(keys, assertAsync(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - })) - })) - } - }) -} - -/** - * @param {import('tape')} test - */ -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -/** - * @param {import('tape')} test - */ -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.getMany(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/get-test.js b/node_modules/abstract-level/test/get-test.js deleted file mode 100644 index 8d746c0..0000000 --- a/node_modules/abstract-level/test/get-test.js +++ /dev/null @@ -1,144 +0,0 @@ -'use strict' - -const isBuffer = require('is-buffer') -const { verifyNotFoundError, illegalKeys, assertAsync } = require('./util') - -let db - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.args = function (test, testCommon) { - test('test get() with illegal keys', assertAsync.ctx(function (t) { - t.plan(illegalKeys.length * 5) - - for (const { name, key } of illegalKeys) { - db.get(key, assertAsync(function (err) { - t.ok(err instanceof Error, name + ' - is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (callback)') - })) - - db.get(key).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (promise)') - }) - } - })) -} - -exports.get = function (test, testCommon) { - test('test simple get()', function (t) { - db.put('foo', 'bar', function (err) { - t.error(err) - db.get('foo', function (err, value) { - t.error(err) - t.is(value, 'bar') - - db.get('foo', {}, function (err, value) { // same but with {} - t.error(err) - t.is(value, 'bar') - - db.get('foo', { valueEncoding: 'utf8' }, function (err, value) { - t.error(err) - t.is(value, 'bar') - - if (!db.supports.encodings.buffer) { - return t.end() - } - - db.get('foo', { valueEncoding: 'buffer' }, function (err, value) { - t.error(err) - t.ok(isBuffer(value), 'should be buffer') - t.is(value.toString(), 'bar') - t.end() - }) - }) - }) - }) - }) - }) - - test('test get() with promise', function (t) { - db.put('promises', 'yes', function (err) { - t.error(err) - - db.get('promises').then(function (value) { - t.is(value, 'yes', 'got value without options') - - db.get('not found').catch(function (err) { - t.ok(err, 'should error') - t.ok(verifyNotFoundError(err), 'correct error') - - if (!db.supports.encodings.buffer) { - return t.end() - } - - db.get('promises', { valueEncoding: 'buffer' }).then(function (value) { - t.ok(isBuffer(value), 'is buffer') - t.is(value.toString(), 'yes', 'correct value') - t.end() - }).catch(t.fail.bind(t)) - }) - }).catch(t.fail.bind(t)) - }) - }) - - test('test simultaneous get()', function (t) { - db.put('hello', 'world', function (err) { - t.error(err) - let completed = 0 - const done = function () { - if (++completed === 20) t.end() - } - - for (let i = 0; i < 10; ++i) { - db.get('hello', function (err, value) { - t.error(err) - t.is(value.toString(), 'world') - done() - }) - } - - for (let i = 0; i < 10; ++i) { - db.get('not found', function (err, value) { - t.ok(err, 'should error') - t.ok(verifyNotFoundError(err), 'correct error') - t.ok(typeof value === 'undefined', 'value is undefined') - done() - }) - } - }) - }) - - test('test get() not found error is asynchronous', function (t) { - t.plan(4) - - let async = false - - db.get('not found', function (err, value) { - t.ok(err, 'should error') - t.ok(verifyNotFoundError(err), 'correct error') - t.ok(typeof value === 'undefined', 'value is undefined') - t.ok(async, 'callback is asynchronous') - }) - - async = true - }) -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.get(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/index.js b/node_modules/abstract-level/test/index.js deleted file mode 100644 index d56b4a8..0000000 --- a/node_modules/abstract-level/test/index.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict' - -const common = require('./common') -const kSublevels = Symbol('sublevels') - -function suite (options) { - const testCommon = common(options) - const test = testCommon.test - - require('./factory-test')(test, testCommon) - require('./manifest-test')(test, testCommon) - require('./open-test').all(test, testCommon) - require('./close-test').all(test, testCommon) - - if (testCommon.supports.createIfMissing) { - require('./open-create-if-missing-test').all(test, testCommon) - } - - if (testCommon.supports.errorIfExists) { - require('./open-error-if-exists-test').all(test, testCommon) - } - - require('./put-test').all(test, testCommon) - require('./get-test').all(test, testCommon) - require('./del-test').all(test, testCommon) - require('./put-get-del-test').all(test, testCommon) - require('./get-many-test').all(test, testCommon) - - require('./batch-test').all(test, testCommon) - require('./chained-batch-test').all(test, testCommon) - - require('./iterator-test').all(test, testCommon) - require('./iterator-range-test').all(test, testCommon) - require('./async-iterator-test').all(test, testCommon) - - require('./deferred-open-test').all(test, testCommon) - require('./encoding-test').all(test, testCommon) - require('./encoding-json-test').all(test, testCommon) - require('./encoding-custom-test').all(test, testCommon) - require('./encoding-buffer-test').all(test, testCommon) - require('./encoding-decode-error-test').all(test, testCommon) - - if (testCommon.supports.seek) { - require('./iterator-seek-test').all(test, testCommon) - } - - if (testCommon.supports.snapshots) { - require('./iterator-snapshot-test').all(test, testCommon) - } else { - require('./iterator-no-snapshot-test').all(test, testCommon) - } - - require('./clear-test').all(test, testCommon) - require('./clear-range-test').all(test, testCommon) - require('./sublevel-test').all(test, testCommon) - - // Run the same suite on a sublevel - if (!testCommon.internals[kSublevels]) { - const factory = testCommon.factory - - suite({ - ...testCommon, - internals: { [kSublevels]: true }, - factory (opts) { - return factory().sublevel('test', opts) - } - }) - } -} - -suite.common = common -module.exports = suite diff --git a/node_modules/abstract-level/test/iterator-no-snapshot-test.js b/node_modules/abstract-level/test/iterator-no-snapshot-test.js deleted file mode 100644 index 1ea5b12..0000000 --- a/node_modules/abstract-level/test/iterator-no-snapshot-test.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict' - -exports.noSnapshot = function (test, testCommon) { - function make (run) { - return function (t) { - const db = testCommon.factory() - const operations = [ - { type: 'put', key: 'a', value: 'a' }, - { type: 'put', key: 'b', value: 'b' }, - { type: 'put', key: 'c', value: 'c' } - ] - - db.open(function (err) { - t.ifError(err, 'no open error') - - db.batch(operations, function (err) { - t.ifError(err, 'no batch error') - - // For this test it is important that we don't read eagerly. - // NOTE: highWaterMarkBytes is not an abstract option, but - // it is supported by classic-level and others. Also set the - // old & equivalent leveldown highWaterMark option for compat. - const it = db.iterator({ highWaterMarkBytes: 0, highWaterMark: 0 }) - - run(db, function (err) { - t.ifError(err, 'no run error') - verify(t, it, db) - }) - }) - }) - } - } - - function verify (t, it, db) { - it.all(function (err, entries) { - t.ifError(err, 'no iterator error') - - const kv = entries.map(function ([key, value]) { - return key.toString() + value.toString() - }) - - if (kv.length === 3) { - t.same(kv, ['aa', 'bb', 'cc'], 'maybe supports snapshots') - } else { - t.same(kv, ['aa', 'cc'], 'ignores keys that have been deleted in the mean time') - } - - db.close(t.end.bind(t)) - }) - } - - test('delete key after creating iterator', make(function (db, done) { - db.del('b', done) - })) - - test('batch delete key after creating iterator', make(function (db, done) { - db.batch([{ type: 'del', key: 'b' }], done) - })) -} - -exports.all = function (test, testCommon) { - exports.noSnapshot(test, testCommon) -} diff --git a/node_modules/abstract-level/test/iterator-range-test.js b/node_modules/abstract-level/test/iterator-range-test.js deleted file mode 100644 index 8ef8ac6..0000000 --- a/node_modules/abstract-level/test/iterator-range-test.js +++ /dev/null @@ -1,287 +0,0 @@ -'use strict' - -let db - -const data = (function () { - const d = [] - let i = 0 - let k - for (; i < 100; i++) { - k = (i < 10 ? '0' : '') + i - d.push({ - key: k, - value: String(Math.random()) - }) - } - return d -}()) - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(function () { - db.batch(data.map(function (d) { - return { - type: 'put', - key: d.key, - value: d.value - } - }), t.end.bind(t)) - }) - }) -} - -exports.range = function (test, testCommon) { - function rangeTest (name, opts, expected) { - opts.keyEncoding = 'utf8' - opts.valueEncoding = 'utf8' - - test(name, function (t) { - db.iterator(opts).all(function (err, entries) { - t.error(err) - t.is(entries.length, expected.length, 'correct number of entries') - t.same(entries, expected.map(o => [o.key, o.value])) - t.end() - }) - }) - - // Test the documented promise that in reverse mode, - // "the returned entries are the same, but in reverse". - if (!opts.reverse && !('limit' in opts)) { - const reverseOpts = Object.assign({}, opts, { reverse: true }) - - rangeTest( - name + ' (flipped)', - reverseOpts, - expected.slice().reverse() - ) - } - } - - rangeTest('test full data collection', {}, data) - - rangeTest('test iterator with reverse=true', { - reverse: true - }, data.slice().reverse()) - - rangeTest('test iterator with gte=00', { - gte: '00' - }, data) - - rangeTest('test iterator with gte=50', { - gte: '50' - }, data.slice(50)) - - rangeTest('test iterator with lte=50 and reverse=true', { - lte: '50', - reverse: true - }, data.slice().reverse().slice(49)) - - rangeTest('test iterator with gte=49.5 (midway)', { - gte: '49.5' - }, data.slice(50)) - - rangeTest('test iterator with gte=49999 (midway)', { - gte: '49999' - }, data.slice(50)) - - rangeTest('test iterator with lte=49.5 (midway) and reverse=true', { - lte: '49.5', - reverse: true - }, data.slice().reverse().slice(50)) - - rangeTest('test iterator with lt=49.5 (midway) and reverse=true', { - lt: '49.5', - reverse: true - }, data.slice().reverse().slice(50)) - - rangeTest('test iterator with lt=50 and reverse=true', { - lt: '50', - reverse: true - }, data.slice().reverse().slice(50)) - - rangeTest('test iterator with lte=50', { - lte: '50' - }, data.slice(0, 51)) - - rangeTest('test iterator with lte=50.5 (midway)', { - lte: '50.5' - }, data.slice(0, 51)) - - rangeTest('test iterator with lte=50555 (midway)', { - lte: '50555' - }, data.slice(0, 51)) - - rangeTest('test iterator with lt=50555 (midway)', { - lt: '50555' - }, data.slice(0, 51)) - - rangeTest('test iterator with gte=50.5 (midway) and reverse=true', { - gte: '50.5', - reverse: true - }, data.slice().reverse().slice(0, 49)) - - rangeTest('test iterator with gt=50.5 (midway) and reverse=true', { - gt: '50.5', - reverse: true - }, data.slice().reverse().slice(0, 49)) - - rangeTest('test iterator with gt=50 and reverse=true', { - gt: '50', - reverse: true - }, data.slice().reverse().slice(0, 49)) - - // first key is actually '00' so it should avoid it - rangeTest('test iterator with lte=0', { - lte: '0' - }, []) - - // first key is actually '00' so it should avoid it - rangeTest('test iterator with lt=0', { - lt: '0' - }, []) - - rangeTest('test iterator with gte=30 and lte=70', { - gte: '30', - lte: '70' - }, data.slice(30, 71)) - - // The gte and lte options should take precedence over gt and lt respectively. - rangeTest('test iterator with gte=30 and lte=70 and gt=40 and lt=60', { - gte: '30', - lte: '70', - gt: '40', - lt: '60' - }, data.slice(30, 71)) - - // Also test the other way around: if gt and lt were to select a bigger range. - rangeTest('test iterator with gte=30 and lte=70 and gt=20 and lt=80', { - gte: '30', - lte: '70', - gt: '20', - lt: '80' - }, data.slice(30, 71)) - - rangeTest('test iterator with gt=29 and lt=71', { - gt: '29', - lt: '71' - }, data.slice(30, 71)) - - rangeTest('test iterator with gte=30 and lte=70 and reverse=true', { - lte: '70', - gte: '30', - reverse: true - }, data.slice().reverse().slice(29, 70)) - - rangeTest('test iterator with gt=29 and lt=71 and reverse=true', { - lt: '71', - gt: '29', - reverse: true - }, data.slice().reverse().slice(29, 70)) - - rangeTest('test iterator with limit=20', { - limit: 20 - }, data.slice(0, 20)) - - rangeTest('test iterator with limit=20 and gte=20', { - limit: 20, - gte: '20' - }, data.slice(20, 40)) - - rangeTest('test iterator with limit=20 and reverse=true', { - limit: 20, - reverse: true - }, data.slice().reverse().slice(0, 20)) - - rangeTest('test iterator with limit=20 and lte=79 and reverse=true', { - limit: 20, - lte: '79', - reverse: true - }, data.slice().reverse().slice(20, 40)) - - // the default limit value from levelup is -1 - rangeTest('test iterator with limit=-1 should iterate over whole database', { - limit: -1 - }, data) - - rangeTest('test iterator with limit=0 should not iterate over anything', { - limit: 0 - }, []) - - rangeTest('test iterator with lte after limit', { - limit: 20, - lte: '50' - }, data.slice(0, 20)) - - rangeTest('test iterator with lte before limit', { - limit: 50, - lte: '19' - }, data.slice(0, 20)) - - rangeTest('test iterator with gte after database end', { - gte: '9a' - }, []) - - rangeTest('test iterator with gt after database end', { - gt: '9a' - }, []) - - rangeTest('test iterator with lte after database end and reverse=true', { - lte: '9a', - reverse: true - }, data.slice().reverse()) - - rangeTest('test iterator with lt after database end', { - lt: 'a' - }, data.slice()) - - rangeTest('test iterator with lt at database end', { - lt: data[data.length - 1].key - }, data.slice(0, -1)) - - rangeTest('test iterator with lte at database end', { - lte: data[data.length - 1].key - }, data.slice()) - - rangeTest('test iterator with lt before database end', { - lt: data[data.length - 2].key - }, data.slice(0, -2)) - - rangeTest('test iterator with lte before database end', { - lte: data[data.length - 2].key - }, data.slice(0, -1)) - - rangeTest('test iterator with lte and gte after database and reverse=true', { - lte: '9b', - gte: '9a', - reverse: true - }, []) - - rangeTest('test iterator with lt and gt after database and reverse=true', { - lt: '9b', - gt: '9a', - reverse: true - }, []) - - rangeTest('gt greater than lt', { - gt: '20', - lt: '10' - }, []) - - rangeTest('gte greater than lte', { - gte: '20', - lte: '10' - }, []) -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.range(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/iterator-seek-test.js b/node_modules/abstract-level/test/iterator-seek-test.js deleted file mode 100644 index 183e7f9..0000000 --- a/node_modules/abstract-level/test/iterator-seek-test.js +++ /dev/null @@ -1,252 +0,0 @@ -'use strict' - -const { Buffer } = require('buffer') -const identity = (v) => v - -exports.all = function (test, testCommon) { - exports.sequence(test, testCommon) - exports.seek(test, testCommon) -} - -exports.sequence = function (test, testCommon) { - for (const deferred of [false, true]) { - for (const mode of ['iterator', 'keys', 'values']) { - test(`${mode}().seek() throws if next() has not completed (deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - if (!deferred) await db.open() - - const it = db[mode]() - const promise = it.next() - - t.throws(() => it.seek('two'), (err) => err.code === 'LEVEL_ITERATOR_BUSY') - - await promise - await db.close() - }) - - test(`${mode}().seek() does not throw after close() (deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - if (!deferred) await db.open() - - const it = db[mode]() - await it.close() - - t.doesNotThrow(() => it.seek('two')) - - await db.close() - }) - } - } -} - -exports.seek = function (test, testCommon) { - const testData = () => [ - { type: 'put', key: 'one', value: '1' }, - { type: 'put', key: 'two', value: '2' }, - { type: 'put', key: 'three', value: '3' } - ] - - for (const mode of ['iterator', 'keys', 'values']) { - const mapEntry = mode === 'iterator' ? e => e : mode === 'keys' ? e => e[0] : e => e[1] - - test(`${mode}().seek() to string target`, async function (t) { - const db = testCommon.factory() - await db.batch(testData()) - const it = db[mode]() - - it.seek('two') - - t.same(await it.next(), mapEntry(['two', '2']), 'match') - t.same(await it.next(), undefined, 'end of iterator') - - return db.close() - }) - - if (testCommon.supports.encodings.buffer) { - // TODO: make this test meaningful, with bytes outside the utf8 range - test(`${mode}().seek() to buffer target`, async function (t) { - const db = testCommon.factory() - await db.batch(testData()) - const it = db[mode]({ keyEncoding: 'buffer' }) - - it.seek(Buffer.from('two')) - - t.same(await it.next(), mapEntry([Buffer.from('two'), '2']), 'match') - t.same(await it.next(), undefined, 'end of iterator') - - return db.close() - }) - } - - test(`${mode}().seek() to target with custom encoding`, async function (t) { - const db = testCommon.factory() - await db.batch(testData()) - const it = db[mode]() - const keyEncoding = { encode: () => 'two', decode: identity, format: 'utf8' } - - it.seek('xyz', { keyEncoding }) - - t.same(await it.next(), mapEntry(['two', '2']), 'match') - t.same(await it.next(), undefined, 'end of iterator') - - return db.close() - }) - - test(`${mode}().seek() on reverse iterator`, async function (t) { - const db = testCommon.factory() - await db.batch(testData()) - const it = db[mode]({ reverse: true, limit: 1 }) - - // Should land on key equal to or smaller than 'three!' which is 'three' - it.seek('three!') - - t.same(await it.next(), mapEntry(['three', '3']), 'match') - t.same(await it.next(), undefined, 'end of iterator') - - return db.close() - }) - - test(`${mode}().seek() to out of range target`, async function (t) { - const db = testCommon.factory() - await db.batch(testData()) - const it = db[mode]() - - it.seek('zzz') - t.same(await it.next(), undefined, 'end of iterator') - - return db.close() - }) - - test(`${mode}().seek() on reverse iterator to out of range target`, async function (t) { - const db = testCommon.factory() - await db.batch(testData()) - const it = db[mode]({ reverse: true }) - - it.seek('zzz') - - t.same(await it.next(), mapEntry(['two', '2']), 'match') - t.same(await it.next(), mapEntry(['three', '3']), 'match') - t.same(await it.next(), mapEntry(['one', '1']), 'match') - t.same(await it.next(), undefined, 'end of iterator') - - return db.close() - }) - - if (testCommon.supports.snapshots) { - for (const reverse of [false, true]) { - for (const deferred of [false, true]) { - test(`${mode}().seek() respects snapshot (reverse: ${reverse}, deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - if (!deferred) await db.open() - - const it = db[mode]({ reverse }) - - // Add entry after having created the iterator (and its snapshot) - await db.put('a', 'a') - - // Seeking should not create a new snapshot, which'd include the new entry - it.seek('a') - t.same(await it.next(), undefined) - - return db.close() - }) - } - } - } - - test(`${mode}().seek() respects range`, function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.error(err, 'no error from open()') - - // Can't use Array.fill() because IE - const ops = [] - - for (let i = 0; i < 10; i++) { - ops.push({ type: 'put', key: String(i), value: String(i) }) - } - - db.batch(ops, function (err) { - t.error(err, 'no error from batch()') - - let pending = 0 - - expect({ gt: '5' }, '4', undefined) - expect({ gt: '5' }, '5', undefined) - expect({ gt: '5' }, '6', '6') - - expect({ gte: '5' }, '4', undefined) - expect({ gte: '5' }, '5', '5') - expect({ gte: '5' }, '6', '6') - - // The gte option should take precedence over gt. - expect({ gte: '5', gt: '7' }, '4', undefined) - expect({ gte: '5', gt: '7' }, '5', '5') - expect({ gte: '5', gt: '7' }, '6', '6') - expect({ gte: '5', gt: '3' }, '4', undefined) - expect({ gte: '5', gt: '3' }, '5', '5') - expect({ gte: '5', gt: '3' }, '6', '6') - - expect({ lt: '5' }, '4', '4') - expect({ lt: '5' }, '5', undefined) - expect({ lt: '5' }, '6', undefined) - - expect({ lte: '5' }, '4', '4') - expect({ lte: '5' }, '5', '5') - expect({ lte: '5' }, '6', undefined) - - // The lte option should take precedence over lt. - expect({ lte: '5', lt: '3' }, '4', '4') - expect({ lte: '5', lt: '3' }, '5', '5') - expect({ lte: '5', lt: '3' }, '6', undefined) - expect({ lte: '5', lt: '7' }, '4', '4') - expect({ lte: '5', lt: '7' }, '5', '5') - expect({ lte: '5', lt: '7' }, '6', undefined) - - expect({ lt: '5', reverse: true }, '4', '4') - expect({ lt: '5', reverse: true }, '5', undefined) - expect({ lt: '5', reverse: true }, '6', undefined) - - expect({ lte: '5', reverse: true }, '4', '4') - expect({ lte: '5', reverse: true }, '5', '5') - expect({ lte: '5', reverse: true }, '6', undefined) - - expect({ gt: '5', reverse: true }, '4', undefined) - expect({ gt: '5', reverse: true }, '5', undefined) - expect({ gt: '5', reverse: true }, '6', '6') - - expect({ gte: '5', reverse: true }, '4', undefined) - expect({ gte: '5', reverse: true }, '5', '5') - expect({ gte: '5', reverse: true }, '6', '6') - - expect({ gt: '7', lt: '8' }, '7', undefined) - expect({ gte: '7', lt: '8' }, '7', '7') - expect({ gte: '7', lt: '8' }, '8', undefined) - expect({ gt: '7', lte: '8' }, '8', '8') - - function expect (range, target, expected) { - pending++ - const ite = db[mode](range) - - ite.seek(target) - ite.next(function (err, item) { - t.error(err, 'no error from next()') - - const json = JSON.stringify(range) - const msg = 'seek(' + target + ') on ' + json + ' yields ' + expected - - // Either a key or value depending on mode - t.is(item, expected, msg) - - ite.close(function (err) { - t.error(err, 'no error from close()') - if (!--pending) db.close(t.end.bind(t)) - }) - }) - } - }) - }) - }) - } -} diff --git a/node_modules/abstract-level/test/iterator-snapshot-test.js b/node_modules/abstract-level/test/iterator-snapshot-test.js deleted file mode 100644 index 3642e05..0000000 --- a/node_modules/abstract-level/test/iterator-snapshot-test.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict' - -exports.snapshot = function (test, testCommon) { - function make (run) { - return function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err, 'no open error') - - db.put('z', 'from snapshot', function (err) { - t.ifError(err, 'no put error') - - // For this test it is important that we don't read eagerly. - // NOTE: highWaterMarkBytes is not an abstract option, but - // it is supported by classic-level and others. Also set the - // old & equivalent leveldown highWaterMark option for compat. - const it = db.iterator({ highWaterMarkBytes: 0, highWaterMark: 0 }) - - run(t, db, it, function end (err) { - t.ifError(err, 'no run error') - - it.close(function (err) { - t.ifError(err, 'no iterator close error') - db.close(t.end.bind(t)) - }) - }) - }) - }) - } - } - - test('delete key after snapshotting', make(function (t, db, it, end) { - db.del('z', function (err) { - t.ifError(err, 'no del error') - - it.next(function (err, key, value) { - t.ifError(err, 'no next error') - t.ok(key, 'got a key') - t.is(key.toString(), 'z', 'correct key') - t.is(value.toString(), 'from snapshot', 'correct value') - - end() - }) - }) - })) - - test('overwrite key after snapshotting', make(function (t, db, it, end) { - db.put('z', 'not from snapshot', function (err) { - t.ifError(err, 'no put error') - - it.next(function (err, key, value) { - t.ifError(err, 'no next error') - t.ok(key, 'got a key') - t.is(key.toString(), 'z', 'correct key') - t.is(value.toString(), 'from snapshot', 'correct value') - - end() - }) - }) - })) - - test('add key after snapshotting that sorts first', make(function (t, db, it, end) { - db.put('a', 'not from snapshot', function (err) { - t.ifError(err, 'no put error') - - it.next(function (err, key, value) { - t.ifError(err, 'no next error') - - t.ok(key, 'got a key') - t.is(key.toString(), 'z', 'correct key') - t.is(value.toString(), 'from snapshot', 'correct value') - - end() - }) - }) - })) - - // NOTE: adapted from memdown - test('delete key after snapshotting, with more entries available', async function (t) { - const db = testCommon.factory() - await db.open() - await Promise.all([db.put('a', 'A'), db.put('b', 'B'), db.put('c', 'C')]) - - const iterator = db.iterator({ gte: 'a' }) - t.same(await iterator.next(), ['a', 'A']) - - await db.del('b') - t.same(await iterator.next(), ['b', 'B']) - t.same(await iterator.next(), ['c', 'C']) - - await iterator.close() - return db.close() - }) -} - -exports.all = function (test, testCommon) { - exports.snapshot(test, testCommon) -} diff --git a/node_modules/abstract-level/test/iterator-test.js b/node_modules/abstract-level/test/iterator-test.js deleted file mode 100644 index 6faa1ea..0000000 --- a/node_modules/abstract-level/test/iterator-test.js +++ /dev/null @@ -1,548 +0,0 @@ -'use strict' - -const { Buffer } = require('buffer') -const identity = (v) => v - -let db - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.args = function (test, testCommon) { - for (const mode of ['iterator', 'keys', 'values']) { - test(`${mode}() has db reference`, async function (t) { - const it = db[mode]() - - // May return iterator of an underlying db, that's okay. - t.ok(it.db === db || it.db === (db.db || db._db || db)) - - await it.close() - }) - - test(`${mode}() has limit and count properties`, async function (t) { - const iterators = [db[mode]()] - t.is(iterators[0].limit, Infinity, 'defaults to infinite') - - for (const limit of [-1, 0, 1, Infinity]) { - const it = db[mode]({ limit }) - iterators.push(it) - t.is(it.limit, limit === -1 ? Infinity : limit, 'has limit property') - } - - t.ok(iterators.every(it => it.count === 0), 'has count property') - await Promise.all(iterators.map(it => it.close())) - }) - - test(`${mode}().nextv() yields error if size is invalid`, async function (t) { - t.plan(4) - - const it = db[mode]() - - for (const args of [[], [NaN], ['1'], [2.5]]) { - try { - await it.nextv(...args) - } catch (err) { - t.is(err.message, "The first argument 'size' must be an integer") - } - } - - await it.close() - }) - } -} - -exports.sequence = function (test, testCommon) { - for (const mode of ['iterator', 'keys', 'values']) { - test(`${mode}().close() is idempotent`, function (t) { - const iterator = db[mode]() - - iterator.close(function () { - let async = false - - iterator.close(function () { - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - }) - - for (const method of ['next', 'nextv', 'all']) { - const requiredArgs = method === 'nextv' ? [1] : [] - - test(`${mode}().${method}() after close() yields error`, function (t) { - const iterator = db[mode]() - iterator.close(function (err) { - t.error(err) - - let async = false - - iterator[method](...requiredArgs, function (err2) { - t.ok(err2, 'returned error') - t.is(err2.code, 'LEVEL_ITERATOR_NOT_OPEN', 'correct message') - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - }) - - for (const otherMethod of ['next', 'nextv', 'all']) { - const otherRequiredArgs = otherMethod === 'nextv' ? [1] : [] - - test(`${mode}().${method}() while busy with ${otherMethod}() yields error`, function (t) { - const iterator = db[mode]() - iterator[otherMethod](...otherRequiredArgs, function (err) { - t.error(err) - iterator.close(function (err) { - t.error(err) - t.end() - }) - }) - - let async = false - - iterator[method](...requiredArgs, function (err) { - t.ok(err, 'returned error') - t.is(err.code, 'LEVEL_ITERATOR_BUSY') - t.ok(async, 'callback is asynchronous') - }) - - async = true - }) - } - } - } - - for (const deferred of [false, true]) { - for (const mode of ['iterator', 'keys', 'values']) { - for (const method of ['next', 'nextv', 'all']) { - const requiredArgs = method === 'nextv' ? [10] : [] - - // NOTE: adapted from leveldown - test(`${mode}().${method}() after db.close() yields error (deferred: ${deferred})`, async function (t) { - t.plan(2) - - const db = testCommon.factory() - if (!deferred) await db.open() - - await db.put('a', 'a') - await db.put('b', 'b') - - const it = db[mode]() - - // The first call *should* succeed, because it was scheduled before close(). However, success - // is not a must. Because nextv() and all() fallback to next*(), they're allowed to fail. An - // implementation can also choose to abort any pending call on close. - let promise = it[method](...requiredArgs).then(() => { - t.pass('Optionally succeeded') - }).catch((err) => { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - - // The second call *must* fail, because it was scheduled after close() - promise = promise.then(() => { - return it[method](...requiredArgs).then(() => { - t.fail('Expected an error') - }).catch((err) => { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - }) - }) - - return Promise.all([db.close(), promise]) - }) - } - } - } -} - -exports.iterator = function (test, testCommon) { - test('test simple iterator()', function (t) { - const data = [ - { type: 'put', key: 'foobatch1', value: 'bar1' }, - { type: 'put', key: 'foobatch2', value: 'bar2' }, - { type: 'put', key: 'foobatch3', value: 'bar3' } - ] - let idx = 0 - - db.batch(data, function (err) { - t.error(err) - const iterator = db.iterator() - const fn = function (err, key, value) { - t.error(err) - if (key && value) { - t.is(key, data[idx].key, 'correct key') - t.is(value, data[idx].value, 'correct value') - db.nextTick(next) - idx++ - } else { // end - t.ok(err == null, 'err argument is nullish') - t.ok(typeof key === 'undefined', 'key argument is undefined') - t.ok(typeof value === 'undefined', 'value argument is undefined') - t.is(idx, data.length, 'correct number of entries') - iterator.close(function () { - t.end() - }) - } - } - const next = function () { - iterator.next(fn) - } - - next() - }) - }) - - // NOTE: adapted from leveldown - test('key-only iterator', function (t) { - const it = db.iterator({ values: false }) - - it.next(function (err, key, value) { - t.ifError(err, 'no next() error') - t.is(key, 'foobatch1') - t.is(value, undefined) - it.close(t.end.bind(t)) - }) - }) - - // NOTE: adapted from leveldown - test('value-only iterator', function (t) { - const it = db.iterator({ keys: false }) - - it.next(function (err, key, value) { - t.ifError(err, 'no next() error') - t.is(key, undefined) - t.is(value, 'bar1') - it.close(t.end.bind(t)) - }) - }) - - test('db.keys().next()', function (t) { - const it = db.keys() - - it.next(function (err, key) { - t.ifError(err, 'no next() error') - t.is(key, 'foobatch1') - it.close(t.end.bind(t)) - }) - }) - - test('db.values().next()', function (t) { - const it = db.values() - - it.next(function (err, value) { - t.ifError(err, 'no next() error') - t.is(value, 'bar1') - it.close(t.end.bind(t)) - }) - }) - - for (const mode of ['iterator', 'keys', 'values']) { - const mapEntry = e => mode === 'iterator' ? e : mode === 'keys' ? e[0] : e[1] - - test(`${mode}().nextv()`, async function (t) { - const it = db[mode]() - - t.same(await it.nextv(1), [['foobatch1', 'bar1']].map(mapEntry)) - t.same(await it.nextv(2, {}), [['foobatch2', 'bar2'], ['foobatch3', 'bar3']].map(mapEntry)) - t.same(await it.nextv(2), []) - - await it.close() - }) - - test(`${mode}().nextv() in reverse`, async function (t) { - const it = db[mode]({ reverse: true }) - - t.same(await it.nextv(1), [['foobatch3', 'bar3']].map(mapEntry)) - t.same(await it.nextv(2, {}), [['foobatch2', 'bar2'], ['foobatch1', 'bar1']].map(mapEntry)) - t.same(await it.nextv(2), []) - - await it.close() - }) - - test(`${mode}().nextv() has soft minimum of 1`, async function (t) { - const it = db[mode]() - - t.same(await it.nextv(0), [['foobatch1', 'bar1']].map(mapEntry)) - t.same(await it.nextv(0), [['foobatch2', 'bar2']].map(mapEntry)) - t.same(await it.nextv(0, {}), [['foobatch3', 'bar3']].map(mapEntry)) - t.same(await it.nextv(0), []) - - await it.close() - }) - - test(`${mode}().nextv() requesting more than available`, async function (t) { - const it = db[mode]() - - t.same(await it.nextv(10), [ - ['foobatch1', 'bar1'], - ['foobatch2', 'bar2'], - ['foobatch3', 'bar3'] - ].map(mapEntry)) - t.same(await it.nextv(10), []) - - await it.close() - }) - - test(`${mode}().nextv() honors limit`, async function (t) { - const it = db[mode]({ limit: 2 }) - - t.same(await it.nextv(10), [['foobatch1', 'bar1'], ['foobatch2', 'bar2']].map(mapEntry)) - t.same(await it.nextv(10), []) - - await it.close() - }) - - test(`${mode}().nextv() honors limit in reverse`, async function (t) { - const it = db[mode]({ limit: 2, reverse: true }) - - t.same(await it.nextv(10), [['foobatch3', 'bar3'], ['foobatch2', 'bar2']].map(mapEntry)) - t.same(await it.nextv(10), []) - - await it.close() - }) - - test(`${mode}().all()`, async function (t) { - t.same(await db[mode]().all(), [ - ['foobatch1', 'bar1'], - ['foobatch2', 'bar2'], - ['foobatch3', 'bar3'] - ].map(mapEntry)) - - t.same(await db[mode]().all({}), [ - ['foobatch1', 'bar1'], - ['foobatch2', 'bar2'], - ['foobatch3', 'bar3'] - ].map(mapEntry)) - }) - - test(`${mode}().all() in reverse`, async function (t) { - t.same(await db[mode]({ reverse: true }).all(), [ - ['foobatch3', 'bar3'], - ['foobatch2', 'bar2'], - ['foobatch1', 'bar1'] - ].map(mapEntry)) - }) - - test(`${mode}().all() honors limit`, async function (t) { - t.same(await db[mode]({ limit: 2 }).all(), [ - ['foobatch1', 'bar1'], - ['foobatch2', 'bar2'] - ].map(mapEntry)) - - const it = db[mode]({ limit: 2 }) - - t.same(await it.next(), mapEntry(['foobatch1', 'bar1'])) - t.same(await it.all(), [['foobatch2', 'bar2']].map(mapEntry)) - }) - - test(`${mode}().all() honors limit in reverse`, async function (t) { - t.same(await db[mode]({ limit: 2, reverse: true }).all(), [ - ['foobatch3', 'bar3'], - ['foobatch2', 'bar2'] - ].map(mapEntry)) - - const it = db[mode]({ limit: 2, reverse: true }) - - t.same(await it.next(), mapEntry(['foobatch3', 'bar3'])) - t.same(await it.all(), [['foobatch2', 'bar2']].map(mapEntry)) - }) - } - - // NOTE: adapted from memdown - test('iterator() sorts lexicographically', async function (t) { - const db = testCommon.factory() - await db.open() - - // Write in unsorted order with multiple operations - await db.put('f', 'F') - await db.put('a', 'A') - await db.put('~', '~') - await db.put('e', 'E') - await db.put('🐄', '🐄') - await db.batch([ - { type: 'put', key: 'd', value: 'D' }, - { type: 'put', key: 'b', value: 'B' }, - { type: 'put', key: 'ff', value: 'FF' }, - { type: 'put', key: 'a🐄', value: 'A🐄' } - ]) - await db.batch([ - { type: 'put', key: '', value: 'empty' }, - { type: 'put', key: '2', value: '2' }, - { type: 'put', key: '12', value: '12' }, - { type: 'put', key: '\t', value: '\t' } - ]) - - t.same(await db.iterator().all(), [ - ['', 'empty'], - ['\t', '\t'], - ['12', '12'], - ['2', '2'], - ['a', 'A'], - ['a🐄', 'A🐄'], - ['b', 'B'], - ['d', 'D'], - ['e', 'E'], - ['f', 'F'], - ['ff', 'FF'], - ['~', '~'], - ['🐄', '🐄'] - ]) - - t.same(await db.iterator({ lte: '' }).all(), [ - ['', 'empty'] - ]) - - return db.close() - }) - - for (const keyEncoding of ['buffer', 'view']) { - if (!testCommon.supports.encodings[keyEncoding]) continue - - test(`test iterator() has byte order (${keyEncoding} encoding)`, function (t) { - const db = testCommon.factory({ keyEncoding }) - - db.open(function (err) { - t.ifError(err, 'no open() error') - - const ctor = keyEncoding === 'buffer' ? Buffer : Uint8Array - const keys = [2, 11, 1].map(b => ctor.from([b])) - - db.batch(keys.map((key) => ({ type: 'put', key, value: 'x' })), function (err) { - t.ifError(err, 'no batch() error') - - db.keys().all(function (err, keys) { - t.ifError(err, 'no all() error') - t.same(keys.map(k => k[0]), [1, 2, 11], 'order is ok') - - db.iterator().all(function (err, entries) { - t.ifError(err, 'no all() error') - t.same(entries.map(e => e[0][0]), [1, 2, 11], 'order is ok') - - db.close(t.end.bind(t)) - }) - }) - }) - }) - }) - - // NOTE: adapted from memdown and level-js - test(`test iterator() with byte range (${keyEncoding} encoding)`, async function (t) { - const db = testCommon.factory({ keyEncoding }) - await db.open() - - await db.put(Uint8Array.from([0x0]), '0') - await db.put(Uint8Array.from([128]), '128') - await db.put(Uint8Array.from([160]), '160') - await db.put(Uint8Array.from([192]), '192') - - const collect = async (range) => { - const entries = await db.iterator(range).all() - t.ok(entries.every(e => e[0] instanceof Uint8Array)) // True for both encodings - t.ok(entries.every(e => e[1] === String(e[0][0]))) - return entries.map(e => e[0][0]) - } - - t.same(await collect({ gt: Uint8Array.from([255]) }), []) - t.same(await collect({ gt: Uint8Array.from([192]) }), []) - t.same(await collect({ gt: Uint8Array.from([160]) }), [192]) - t.same(await collect({ gt: Uint8Array.from([128]) }), [160, 192]) - t.same(await collect({ gt: Uint8Array.from([0x0]) }), [128, 160, 192]) - t.same(await collect({ gt: Uint8Array.from([]) }), [0x0, 128, 160, 192]) - - t.same(await collect({ lt: Uint8Array.from([255]) }), [0x0, 128, 160, 192]) - t.same(await collect({ lt: Uint8Array.from([192]) }), [0x0, 128, 160]) - t.same(await collect({ lt: Uint8Array.from([160]) }), [0x0, 128]) - t.same(await collect({ lt: Uint8Array.from([128]) }), [0x0]) - t.same(await collect({ lt: Uint8Array.from([0x0]) }), []) - t.same(await collect({ lt: Uint8Array.from([]) }), []) - - t.same(await collect({ gte: Uint8Array.from([255]) }), []) - t.same(await collect({ gte: Uint8Array.from([192]) }), [192]) - t.same(await collect({ gte: Uint8Array.from([160]) }), [160, 192]) - t.same(await collect({ gte: Uint8Array.from([128]) }), [128, 160, 192]) - t.same(await collect({ gte: Uint8Array.from([0x0]) }), [0x0, 128, 160, 192]) - t.same(await collect({ gte: Uint8Array.from([]) }), [0x0, 128, 160, 192]) - - t.same(await collect({ lte: Uint8Array.from([255]) }), [0x0, 128, 160, 192]) - t.same(await collect({ lte: Uint8Array.from([192]) }), [0x0, 128, 160, 192]) - t.same(await collect({ lte: Uint8Array.from([160]) }), [0x0, 128, 160]) - t.same(await collect({ lte: Uint8Array.from([128]) }), [0x0, 128]) - t.same(await collect({ lte: Uint8Array.from([0x0]) }), [0x0]) - t.same(await collect({ lte: Uint8Array.from([]) }), []) - - return db.close() - }) - } -} - -exports.decode = function (test, testCommon) { - for (const deferred of [false, true]) { - for (const mode of ['iterator', 'keys', 'values']) { - for (const method of ['next', 'nextv', 'all']) { - const requiredArgs = method === 'nextv' ? [1] : [] - - for (const encodingOption of ['keyEncoding', 'valueEncoding']) { - if (mode === 'keys' && encodingOption === 'valueEncoding') continue - if (mode === 'values' && encodingOption === 'keyEncoding') continue - - // NOTE: adapted from encoding-down - test(`${mode}().${method}() catches decoding error from ${encodingOption} (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const encoding = { - format: 'utf8', - decode: function (x) { - t.is(x, encodingOption === 'keyEncoding' ? 'testKey' : 'testValue') - throw new Error('from encoding') - }, - encode: identity - } - - const db = testCommon.factory() - await db.put('testKey', 'testValue') - - if (deferred) { - await db.close() - db.open(t.ifError.bind(t)) - } else { - t.pass('non-deferred') - } - - const it = db[mode]({ [encodingOption]: encoding }) - - try { - await it[method](...requiredArgs) - } catch (err) { - t.is(err.code, 'LEVEL_DECODE_ERROR') - t.is(err.cause && err.cause.message, 'from encoding') - } - - return db.close() - }) - } - } - } - } -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.sequence(test, testCommon) - exports.iterator(test, testCommon) - exports.decode(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/manifest-test.js b/node_modules/abstract-level/test/manifest-test.js deleted file mode 100644 index 519271b..0000000 --- a/node_modules/abstract-level/test/manifest-test.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' - -const suite = require('level-supports/test') - -module.exports = function (test, testCommon) { - suite(test, testCommon) - - test('manifest has expected properties', function (t) { - const db = testCommon.factory() - - t.is(db.supports.status, true) - t.is(db.supports.promises, true) - t.is(db.supports.clear, true) - t.is(db.supports.getMany, true) - - testCommon.supports = db.supports - t.ok(testCommon.supports, 'can be accessed via testCommon') - - t.ok(db.supports.encodings.utf8, 'supports utf8') - t.ok(db.supports.encodings.json, 'supports json') - - db.close(t.end.bind(t)) - }) -} diff --git a/node_modules/abstract-level/test/open-create-if-missing-test.js b/node_modules/abstract-level/test/open-create-if-missing-test.js deleted file mode 100644 index 3720c82..0000000 --- a/node_modules/abstract-level/test/open-create-if-missing-test.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict' - -exports.createIfMissing = function (test, testCommon) { - test('test database open createIfMissing:false', function (t) { - const db = testCommon.factory() - let async = false - - db.open({ createIfMissing: false }, function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.ok(err && /does not exist/.test(err.cause && err.cause.message), 'error is about dir not existing') - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - - test('test database open createIfMissing:false via constructor', function (t) { - const db = testCommon.factory({ createIfMissing: false }) - let async = false - - db.open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.ok(err && /does not exist/.test(err.cause && err.cause.message), 'error is about dir not existing') - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) -} - -exports.all = function (test, testCommon) { - exports.createIfMissing(test, testCommon) -} diff --git a/node_modules/abstract-level/test/open-error-if-exists-test.js b/node_modules/abstract-level/test/open-error-if-exists-test.js deleted file mode 100644 index 50e530f..0000000 --- a/node_modules/abstract-level/test/open-error-if-exists-test.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict' - -exports.errorIfExists = function (test, testCommon) { - test('test database open errorIfExists:true', function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.error(err) - db.close(function (err) { - t.error(err) - - let async = false - - db.open({ createIfMissing: false, errorIfExists: true }, function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.ok(err && /exists/.test(err.cause && err.cause.message), 'error is about already existing') - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - }) - }) -} - -exports.all = function (test, testCommon) { - exports.errorIfExists(test, testCommon) -} diff --git a/node_modules/abstract-level/test/open-test.js b/node_modules/abstract-level/test/open-test.js deleted file mode 100644 index b29fcba..0000000 --- a/node_modules/abstract-level/test/open-test.js +++ /dev/null @@ -1,297 +0,0 @@ -'use strict' - -const { assertAsync } = require('./util') - -exports.open = function (test, testCommon) { - test('test database open, no options', function (t) { - const db = testCommon.factory() - - t.is(db.status, 'opening') - - // default createIfMissing=true, errorIfExists=false - db.open(function (err) { - t.error(err) - t.is(db.status, 'open') - - db.close(function () { - t.is(db.status, 'closed') - t.end() - }) - }) - - t.is(db.status, 'opening') - }) - - test('test database open, no options, with promise', function (t) { - const db = testCommon.factory() - - t.is(db.status, 'opening') - - // default createIfMissing=true, errorIfExists=false - db.open().then(function () { - t.is(db.status, 'open') - db.close(t.end.bind(t)) - }).catch(t.fail.bind(t)) - - t.is(db.status, 'opening') - }) - - test('test database open, options and callback', function (t) { - const db = testCommon.factory() - - // default createIfMissing=true, errorIfExists=false - db.open({}, function (err) { - t.error(err) - db.close(function () { - t.end() - }) - }) - }) - - test('test database open, options with promise', function (t) { - const db = testCommon.factory() - - // default createIfMissing=true, errorIfExists=false - db.open({}).then(function () { - db.close(t.end.bind(t)) - }) - }) - - test('test database open, close and open', function (t) { - const db = testCommon.factory() - - db.open(function (err) { - t.error(err) - - db.close(function (err) { - t.error(err) - t.is(db.status, 'closed') - - db.open(function (err) { - t.error(err) - t.is(db.status, 'open') - - db.close(t.end.bind(t)) - }) - }) - }) - }) - - test('test database open, close and open with promise', function (t) { - const db = testCommon.factory() - - db.open().then(function () { - db.close(function (err) { - t.error(err) - db.open().then(function () { - db.close(function () { - t.end() - }) - }).catch(t.fail.bind(t)) - }) - }).catch(t.fail.bind(t)) - }) - - test('test database open and close in same tick', assertAsync.ctx(function (t) { - t.plan(10) - - const db = testCommon.factory() - const order = [] - - db.open(assertAsync(function (err) { - order.push('A') - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN', 'got open() error') - t.is(db.status, 'closed', 'is closed') - })) - - t.is(db.status, 'opening', 'is opening') - - // This wins from the open() call - db.close(assertAsync(function (err) { - order.push('B') - t.same(order, ['A', 'closed event', 'B'], 'order is correct') - t.ifError(err, 'no close() error') - t.is(db.status, 'closed', 'is closed') - })) - - // But open() is still in control - t.is(db.status, 'opening', 'is still opening') - - // Should not emit 'open', because close() wins - db.on('open', t.fail.bind(t)) - db.on('closed', assertAsync(() => { order.push('closed event') })) - })) - - test('test database open, close and open in same tick', assertAsync.ctx(function (t) { - t.plan(14) - - const db = testCommon.factory() - const order = [] - - db.open(assertAsync(function (err) { - order.push('A') - t.ifError(err, 'no open() error (1)') - t.is(db.status, 'open', 'is open') - })) - - t.is(db.status, 'opening', 'is opening') - - // This wins from the open() call - db.close(assertAsync(function (err) { - order.push('B') - t.is(err && err.code, 'LEVEL_DATABASE_NOT_CLOSED') - t.is(db.status, 'open', 'is open') - })) - - t.is(db.status, 'opening', 'is still opening') - - // This wins from the close() call - db.open(assertAsync(function (err) { - order.push('C') - t.same(order, ['A', 'B', 'open event', 'C'], 'callback order is the same as call order') - t.ifError(err, 'no open() error (2)') - t.is(db.status, 'open', 'is open') - })) - - // Should not emit 'closed', because open() wins - db.on('closed', t.fail.bind(t)) - db.on('open', assertAsync(() => { order.push('open event') })) - - t.is(db.status, 'opening', 'is still opening') - })) - - test('test database open if already open (sequential)', function (t) { - t.plan(7) - - const db = testCommon.factory() - - db.open(assertAsync(function (err) { - t.ifError(err, 'no open() error (1)') - t.is(db.status, 'open', 'is open') - - db.open(assertAsync(function (err) { - t.ifError(err, 'no open() error (2)') - t.is(db.status, 'open', 'is open') - })) - - t.is(db.status, 'open', 'not reopening') - db.on('open', t.fail.bind(t)) - assertAsync.end(t) - })) - - assertAsync.end(t) - }) - - test('test database open if already opening (parallel)', assertAsync.ctx(function (t) { - t.plan(7) - - const db = testCommon.factory() - - db.open(assertAsync(function (err) { - t.ifError(err, 'no open() error (1)') - t.is(db.status, 'open') - })) - - db.open(assertAsync(function (err) { - t.ifError(err, 'no open() error (2)') - t.is(db.status, 'open') - db.close(t.end.bind(t)) - })) - - t.is(db.status, 'opening') - })) - - test('test database close if already closed', function (t) { - t.plan(8) - - const db = testCommon.factory() - - db.open(function (err) { - t.ifError(err, 'no open() error') - - db.close(assertAsync(function (err) { - t.ifError(err, 'no close() error (1)') - t.is(db.status, 'closed', 'is closed') - - db.close(assertAsync(function (err) { - t.ifError(err, 'no close() error (2)') - t.is(db.status, 'closed', 'is closed') - })) - - t.is(db.status, 'closed', 'is closed', 'not reclosing') - db.on('closed', t.fail.bind(t)) - assertAsync.end(t) - })) - - assertAsync.end(t) - }) - }) - - test('test database close if new', assertAsync.ctx(function (t) { - t.plan(5) - - const db = testCommon.factory() - const expectedStatus = db.supports.deferredOpen ? 'opening' : 'closed' - - t.is(db.status, expectedStatus, 'status ok') - - db.close(assertAsync(function (err) { - t.ifError(err, 'no close() error') - t.is(db.status, 'closed', 'status ok') - })) - - t.is(db.status, expectedStatus, 'status unchanged') - - if (!db.supports.deferredOpen) { - db.on('closed', t.fail.bind(t, 'should not emit closed')) - } - })) - - test('test database close on open event', function (t) { - t.plan(5) - - const db = testCommon.factory() - const order = [] - - db.open(function (err) { - order.push('A') - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN', 'got open() error') - t.is(db.status, 'closed', 'is closed') - }) - - db.on('open', function () { - // This wins from the (still in progress) open() call - db.close(function (err) { - order.push('B') - t.same(order, ['A', 'closed event', 'B'], 'order is correct') - t.ifError(err, 'no close() error') - t.is(db.status, 'closed', 'is closed') - }) - }) - - db.on('closed', () => { order.push('closed event') }) - }) - - test('test passive open()', async function (t) { - t.plan(1) - const db = testCommon.factory() - await db.open({ passive: true }) // OK, already opening - await db.close() - await db.open({ passive: true }).catch(err => { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - }) - await db.open() - await db.open({ passive: true }) // OK, already open - return db.close() - }) - - test('test passive open(): ignored if set in constructor options', async function (t) { - const db = testCommon.factory({ passive: true }) - await new Promise((resolve) => db.once('open', resolve)) - return db.close() - }) -} - -exports.all = function (test, testCommon) { - exports.open(test, testCommon) -} diff --git a/node_modules/abstract-level/test/put-get-del-test.js b/node_modules/abstract-level/test/put-get-del-test.js deleted file mode 100644 index 37da10a..0000000 --- a/node_modules/abstract-level/test/put-get-del-test.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict' - -const { verifyNotFoundError } = require('./util') -const { Buffer } = require('buffer') - -let db - -function makeTest (test, type, key, value, expectedResult) { - const hasExpectedResult = arguments.length === 5 - test('test put()/get()/del() with ' + type, function (t) { - db.put(key, value, function (err) { - t.error(err) - db.get(key, function (err, _value) { - t.error(err, 'no error, has key/value for `' + type + '`') - - let result = _value - - if (hasExpectedResult) { - t.equal(result.toString(), expectedResult) - } else { - if (result != null) { result = _value.toString() } - if (value != null) { value = value.toString() } - t.equals(result, value) - } - db.del(key, function (err) { - t.error(err, 'no error, deleted key/value for `' + type + '`') - - let async = false - - db.get(key, function (err, value) { - t.ok(err, 'entry properly deleted') - t.ok(verifyNotFoundError(err), 'correct error') - t.is(value, undefined, 'value is undefined') - t.ok(async, 'callback is asynchronous') - t.end() - }) - - async = true - }) - }) - }) - }) -} - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.nonErrorKeys = function (test, testCommon) { - // valid falsey keys - makeTest(test, '`0` key', 0, 'foo 0') - makeTest(test, 'empty string key', 0, 'foo') - - // standard String key - makeTest( - test - , 'long String key' - , 'some long string that I\'m using as a key for this unit test, cross your fingers human, we\'re going in!' - , 'foo' - ) - - if (testCommon.supports.encodings.buffer) { - makeTest(test, 'Buffer key', Buffer.from('0080c0ff', 'hex'), 'foo') - makeTest(test, 'empty Buffer key', Buffer.alloc(0), 'foo') - } - - // non-empty Array as a value - makeTest(test, 'Array value', 'foo', [1, 2, 3, 4]) -} - -exports.nonErrorValues = function (test, testCommon) { - // valid falsey values - makeTest(test, '`false` value', 'foo false', false) - makeTest(test, '`0` value', 'foo 0', 0) - makeTest(test, '`NaN` value', 'foo NaN', NaN) - - // all of the following result in an empty-string value: - makeTest(test, 'empty String value', 'foo', '', '') - makeTest(test, 'empty Buffer value', 'foo', Buffer.alloc(0), '') - makeTest(test, 'empty Array value', 'foo', [], '') - - // String value - makeTest( - test - , 'long String value' - , 'foo' - , 'some long string that I\'m using as a key for this unit test, cross your fingers human, we\'re going in!' - ) - - // Buffer value - if (testCommon.supports.encodings.buffer) { - makeTest(test, 'Buffer value', 'foo', Buffer.from('0080c0ff', 'hex')) - } - - // non-empty Array as a key - makeTest(test, 'Array key', [1, 2, 3, 4], 'foo') -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.nonErrorKeys(test, testCommon) - exports.nonErrorValues(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/put-test.js b/node_modules/abstract-level/test/put-test.js deleted file mode 100644 index c4f2bef..0000000 --- a/node_modules/abstract-level/test/put-test.js +++ /dev/null @@ -1,131 +0,0 @@ -'use strict' - -const { assertAsync, illegalKeys, illegalValues } = require('./util') - -let db - -exports.setUp = function (test, testCommon) { - test('setUp db', function (t) { - db = testCommon.factory() - db.open(t.end.bind(t)) - }) -} - -exports.args = function (test, testCommon) { - test('test put() with illegal keys', assertAsync.ctx(function (t) { - t.plan(illegalKeys.length * 5) - - for (const { name, key } of illegalKeys) { - db.put(key, 'value', assertAsync(function (err) { - t.ok(err instanceof Error, name + ' - is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (callback)') - })) - - db.put(key, 'value').catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_KEY', name + ' - correct error code (promise)') - }) - } - })) - - test('test put() with illegal values', assertAsync.ctx(function (t) { - t.plan(illegalValues.length * 5) - - for (const { name, value } of illegalValues) { - db.put('key', value, assertAsync(function (err) { - t.ok(err instanceof Error, name + '- is Error (callback)') - t.is(err && err.code, 'LEVEL_INVALID_VALUE', name + ' - correct error code (callback)') - })) - - db.put('key', value).catch(function (err) { - t.ok(err instanceof Error, name + ' - is Error (promise)') - t.is(err.code, 'LEVEL_INVALID_VALUE', name + ' - correct error code (promise)') - }) - } - })) -} - -exports.put = function (test, testCommon) { - test('test simple put()', assertAsync.ctx(function (t) { - t.plan(7) - - db.put('foo', 'bar', assertAsync(function (err) { - t.ifError(err, 'no put() error') - - db.get('foo', function (err, value) { - t.ifError(err, 'no get() error') - t.is(value, 'bar') - - db.put('foo', 'new', function (err) { - t.ifError(err, 'no put() error') - - db.get('foo', function (err, value) { - t.ifError(err, 'no get() error') - t.is(value, 'new', 'value was overwritten') - }) - }) - }) - })) - })) - - test('test simple put() with promise', async function (t) { - await db.put('foo2', 'bar') - t.is(await db.get('foo2'), 'bar') - }) - - test('test deferred put()', assertAsync.ctx(function (t) { - t.plan(5) - - const db = testCommon.factory() - - db.put('foo', 'bar', assertAsync(function (err) { - t.ifError(err, 'no put() error') - - db.get('foo', { valueEncoding: 'utf8' }, function (err, value) { - t.ifError(err, 'no get() error') - t.is(value, 'bar', 'value is ok') - db.close(t.ifError.bind(t)) - }) - })) - })) - - test('test deferred put() with promise', async function (t) { - const db = testCommon.factory() - await db.put('foo', 'bar') - t.is(await db.get('foo', { valueEncoding: 'utf8' }), 'bar', 'value is ok') - return db.close() - }) -} - -exports.events = function (test, testCommon) { - test('test put() emits put event', async function (t) { - t.plan(3) - - const db = testCommon.factory() - await db.open() - - t.ok(db.supports.events.put) - - db.on('put', function (key, value) { - t.is(key, 123) - t.is(value, 'b') - }) - - await db.put(123, 'b') - await db.close() - }) -} - -exports.tearDown = function (test, testCommon) { - test('tearDown', function (t) { - db.close(t.end.bind(t)) - }) -} - -exports.all = function (test, testCommon) { - exports.setUp(test, testCommon) - exports.args(test, testCommon) - exports.put(test, testCommon) - exports.events(test, testCommon) - exports.tearDown(test, testCommon) -} diff --git a/node_modules/abstract-level/test/self.js b/node_modules/abstract-level/test/self.js deleted file mode 100644 index d4e9761..0000000 --- a/node_modules/abstract-level/test/self.js +++ /dev/null @@ -1,1080 +0,0 @@ -'use strict' - -const test = require('tape') -const sinon = require('sinon') -const isBuffer = require('is-buffer') -const { Buffer } = require('buffer') -const { AbstractLevel, AbstractChainedBatch } = require('..') -const { MinimalLevel } = require('./util') -const getRangeOptions = require('../lib/range-options') - -const testCommon = require('./common')({ - test, - factory () { - return new AbstractLevel({ encodings: { utf8: true } }) - } -}) - -const rangeOptions = ['gt', 'gte', 'lt', 'lte'] - -function implement (ctor, methods) { - class Test extends ctor {} - - for (const k in methods) { - Test.prototype[k] = methods[k] - } - - return Test -} - -// Temporary test for browsers -// Not supported on Safari < 12 and Safari iOS < 12 -test('async generator', async function (t) { - let ended = false - - const end = async () => { - await new Promise((resolve) => setTimeout(resolve, 100)) - ended = true - } - - async function * generator () { - try { - yield 1 - yield 2 - yield 3 - yield 4 - } finally { - // Test that we're always able to cleanup resources - await end() - } - } - - const res = [] - - for await (const x of generator()) { - res.push(x) - if (x === 2) break - } - - t.same(res, [1, 2]) - t.is(ended, true) - - ended = false - - try { - for await (const x of generator()) { - res.push(x) - if (x === 2) throw new Error('userland error') - } - } catch (err) { - t.is(err.message, 'userland error') - } - - t.same(res, [1, 2, 1, 2]) - t.is(ended, true) -}) - -/** - * Extensibility - */ - -test('test core extensibility', function (t) { - const Test = implement(AbstractLevel) - const test = new Test({ encodings: { utf8: true } }) - t.equal(test.status, 'opening', 'status is opening') - t.end() -}) - -test('test open() extensibility when new', function (t) { - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { createIfMissing: true, errorIfExists: false } - const Test = implement(AbstractLevel, { _open: spy }) - const test = new Test({ encodings: { utf8: true } }) - const test2 = new Test({ encodings: { utf8: true } }) - - test.open(expectedCb) - - t.equal(spy.callCount, 1, 'got _open() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _open() was correct') - t.equal(spy.getCall(0).args.length, 2, 'got two arguments') - t.deepEqual(spy.getCall(0).args[0], expectedOptions, 'got default options argument') - - test2.open({ options: 1 }, expectedCb) - - expectedOptions.options = 1 - - t.equal(spy.callCount, 2, 'got _open() call') - t.equal(spy.getCall(1).thisValue, test2, '`this` on _open() was correct') - t.equal(spy.getCall(1).args.length, 2, 'got two arguments') - t.deepEqual(spy.getCall(1).args[0], expectedOptions, 'got expected options argument') - t.end() -}) - -test('test open() extensibility when open', function (t) { - t.plan(3) - - const spy = sinon.spy(function (options, cb) { this.nextTick(cb) }) - const Test = implement(AbstractLevel, { _open: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - t.is(spy.callCount, 1, 'got _open() call') - - test.open(t.ifError.bind(t)) - - t.is(spy.callCount, 1, 'did not get second _open() call') - }) -}) - -test('test opening explicitly gives a chance to capture an error', function (t) { - t.plan(3) - - const spy = sinon.spy(function (options, cb) { this.nextTick(cb, new Error('_open error')) }) - const Test = implement(AbstractLevel, { _open: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.open(function (err) { - t.is(spy.callCount, 1, 'got _open() call') - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause && err.cause.message, '_open error') - }) -}) - -test('test opening explicitly gives a chance to capture an error with promise', async function (t) { - t.plan(3) - - const spy = sinon.spy(function (options, cb) { this.nextTick(cb, new Error('_open error')) }) - const Test = implement(AbstractLevel, { _open: spy }) - const test = new Test({ encodings: { utf8: true } }) - - try { - await test.open() - } catch (err) { - t.is(spy.callCount, 1, 'got _open() call') - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err.cause && err.cause.message, '_open error') - } -}) - -test('test constructor options are forwarded to open()', function (t) { - t.plan(3) - - const spy = sinon.spy(function (options, cb) { this.nextTick(cb) }) - const Test = implement(AbstractLevel, { _open: spy }) - const test = new Test({ encodings: { utf8: true } }, { - passive: true, - keyEncoding: 'json', - valueEncoding: 'json', - createIfMissing: false, - foo: 123 - }) - - test.open(function (err) { - t.ifError(err, 'no open() error') - t.is(spy.callCount, 1, 'got _open() call') - t.same(spy.getCall(0).args[0], { - foo: 123, - createIfMissing: false, - errorIfExists: false - }, 'does not forward passive, keyEncoding and valueEncoding options') - }) -}) - -test('test close() extensibility when open', function (t) { - t.plan(4) - - const spy = sinon.spy(function (cb) { this.nextTick(cb) }) - const Test = implement(AbstractLevel, { _close: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.close(function (err) { - t.ifError(err, 'no close() error') - t.is(spy.callCount, 1, 'got _close() call') - t.is(spy.getCall(0).thisValue, test, '`this` on _close() was correct') - t.is(spy.getCall(0).args.length, 1, 'got one arguments') - }) - }) -}) - -test('test close() extensibility when new', function (t) { - t.plan(3) - - const spy = sinon.spy(function (cb) { this.nextTick(cb) }) - const Test = implement(AbstractLevel, { _close: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.close(function (err) { - t.ifError(err, 'no close() error') - t.is(spy.callCount, 1, 'did get _close() call') - }) - - t.is(spy.callCount, 0, 'did not get _close() call') -}) - -test('test open(), close(), open() with twice failed open', function (t) { - t.plan(8) - - const db = testCommon.factory() - const order = [] - - let opens = 0 - - db.on('open', t.fail.bind(t)) - db.on('closed', t.fail.bind(t)) - - db._open = function (options, callback) { - t.pass('called') - this.nextTick(callback, new Error('test' + (++opens))) - } - - db.open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause && err.cause.message, 'test1') - order.push('A') - }) - - db.close(function (err) { - t.ifError(err) - order.push('B') - }) - - db.open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause && err.cause.message, 'test2') - order.push('C') - t.same(order, ['A', 'B', 'C'], 'order is ok') - }) -}) - -test('test open(), close(), open() with first failed open', function (t) { - t.plan(9) - - const db = testCommon.factory() - const order = [] - - let opens = 0 - - db.on('open', () => { order.push('open event') }) - db.on('closed', t.fail.bind(t)) - - db._open = function (options, callback) { - t.pass('called') - this.nextTick(callback, opens++ ? null : new Error('test')) - } - - db.open(function (err) { - t.ifError(err) - t.is(db.status, 'open') - order.push('A') - }) - - db.close(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_CLOSED') - t.is(db.status, 'open') - order.push('B') - }) - - db.open(function (err) { - t.ifError(err) - t.is(db.status, 'open') - order.push('C') - t.same(order, ['A', 'B', 'open event', 'C'], 'order is ok') - }) -}) - -test('test open(), close(), open() with second failed open', function (t) { - t.plan(10) - - const db = testCommon.factory() - const order = [] - - let opens = 0 - - db.on('open', t.fail.bind(t)) - db.on('closed', t.fail.bind(t)) - - db._open = function (options, callback) { - t.pass('called') - this.nextTick(callback, opens++ ? new Error('test') : null) - } - - db.open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(db.status, 'closed') - order.push('A') - }) - - db.close(function (err) { - t.ifError(err) - t.is(db.status, 'closed') - order.push('B') - }) - - db.open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause.message, 'test') - t.is(db.status, 'closed') - order.push('C') - t.same(order, ['A', 'B', 'C'], 'order is ok') - }) -}) - -test('test get() extensibility', function (t) { - t.plan(12) - - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { keyEncoding: 'utf8', valueEncoding: 'utf8' } - const expectedKey = 'a key' - const Test = implement(AbstractLevel, { _get: spy }) - const test = new Test({ encodings: { utf8: true } }, { keyEncoding: 'utf8' }) - - test.once('open', function () { - test.get(expectedKey, expectedCb) - - t.equal(spy.callCount, 1, 'got _get() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _get() was correct') - t.equal(spy.getCall(0).args.length, 3, 'got three arguments') - t.equal(spy.getCall(0).args[0], expectedKey, 'got expected key argument') - t.deepEqual(spy.getCall(0).args[1], expectedOptions, 'got default options argument') - t.is(typeof spy.getCall(0).args[2], 'function', 'got cb argument') - - test.get(expectedKey, { options: 1 }, expectedCb) - - expectedOptions.options = 1 - - t.equal(spy.callCount, 2, 'got _get() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _get() was correct') - t.equal(spy.getCall(1).args.length, 3, 'got three arguments') - t.equal(spy.getCall(1).args[0], expectedKey, 'got expected key argument') - t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got expected options argument') - t.is(typeof spy.getCall(1).args[2], 'function', 'got cb argument') - }) -}) - -test('test getMany() extensibility', function (t) { - t.plan(12) - - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { keyEncoding: 'utf8', valueEncoding: 'utf8' } - const expectedKey = 'a key' - const Test = implement(AbstractLevel, { _getMany: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.getMany([expectedKey], expectedCb) - - t.equal(spy.callCount, 1, 'got _getMany() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _getMany() was correct') - t.equal(spy.getCall(0).args.length, 3, 'got three arguments') - t.deepEqual(spy.getCall(0).args[0], [expectedKey], 'got expected keys argument') - t.deepEqual(spy.getCall(0).args[1], expectedOptions, 'got default options argument') - t.is(typeof spy.getCall(0).args[2], 'function', 'got cb argument') - - test.getMany([expectedKey], { options: 1 }, expectedCb) - - expectedOptions.options = 1 - - t.equal(spy.callCount, 2, 'got _getMany() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _getMany() was correct') - t.equal(spy.getCall(1).args.length, 3, 'got three arguments') - t.deepEqual(spy.getCall(1).args[0], [expectedKey], 'got expected key argument') - t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got expected options argument') - t.is(typeof spy.getCall(1).args[2], 'function', 'got cb argument') - }) -}) - -test('test del() extensibility', function (t) { - t.plan(12) - - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { options: 1, keyEncoding: 'utf8' } - const expectedKey = 'a key' - const Test = implement(AbstractLevel, { _del: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.del(expectedKey, expectedCb) - - t.equal(spy.callCount, 1, 'got _del() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _del() was correct') - t.equal(spy.getCall(0).args.length, 3, 'got three arguments') - t.equal(spy.getCall(0).args[0], expectedKey, 'got expected key argument') - t.deepEqual(spy.getCall(0).args[1], { keyEncoding: 'utf8' }, 'got blank options argument') - t.equal(typeof spy.getCall(0).args[2], 'function', 'got cb argument') - - test.del(expectedKey, expectedOptions, expectedCb) - - t.equal(spy.callCount, 2, 'got _del() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _del() was correct') - t.equal(spy.getCall(1).args.length, 3, 'got three arguments') - t.equal(spy.getCall(1).args[0], expectedKey, 'got expected key argument') - t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got expected options argument') - t.equal(typeof spy.getCall(1).args[2], 'function', 'got cb argument') - }) -}) - -test('test put() extensibility', function (t) { - t.plan(14) - - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { options: 1, keyEncoding: 'utf8', valueEncoding: 'utf8' } - const expectedKey = 'a key' - const expectedValue = 'a value' - const Test = implement(AbstractLevel, { _put: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.put(expectedKey, expectedValue, expectedCb) - - t.equal(spy.callCount, 1, 'got _put() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _put() was correct') - t.equal(spy.getCall(0).args.length, 4, 'got four arguments') - t.equal(spy.getCall(0).args[0], expectedKey, 'got expected key argument') - t.equal(spy.getCall(0).args[1], expectedValue, 'got expected value argument') - t.deepEqual(spy.getCall(0).args[2], { keyEncoding: 'utf8', valueEncoding: 'utf8' }, 'got default options argument') - t.equal(typeof spy.getCall(0).args[3], 'function', 'got cb argument') - - test.put(expectedKey, expectedValue, expectedOptions, expectedCb) - - t.equal(spy.callCount, 2, 'got _put() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _put() was correct') - t.equal(spy.getCall(1).args.length, 4, 'got four arguments') - t.equal(spy.getCall(1).args[0], expectedKey, 'got expected key argument') - t.equal(spy.getCall(1).args[1], expectedValue, 'got expected value argument') - t.deepEqual(spy.getCall(1).args[2], expectedOptions, 'got expected options argument') - t.equal(typeof spy.getCall(1).args[3], 'function', 'got cb argument') - }) -}) - -test('test batch([]) (array-form) extensibility', function (t) { - t.plan(18) - - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { options: 1 } - const expectedArray = [ - { type: 'put', key: '1', value: '1', keyEncoding: 'utf8', valueEncoding: 'utf8' }, - { type: 'del', key: '2', keyEncoding: 'utf8' } - ] - const Test = implement(AbstractLevel, { _batch: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.batch(expectedArray, expectedCb) - - t.equal(spy.callCount, 1, 'got _batch() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _batch() was correct') - t.equal(spy.getCall(0).args.length, 3, 'got three arguments') - t.deepEqual(spy.getCall(0).args[0], expectedArray, 'got expected array argument') - t.deepEqual(spy.getCall(0).args[1], {}, 'got expected options argument') - t.equal(typeof spy.getCall(0).args[2], 'function', 'got callback argument') - - test.batch(expectedArray, expectedOptions, expectedCb) - - t.equal(spy.callCount, 2, 'got _batch() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _batch() was correct') - t.equal(spy.getCall(1).args.length, 3, 'got three arguments') - t.deepEqual(spy.getCall(1).args[0], expectedArray, 'got expected array argument') - t.deepEqual(spy.getCall(1).args[1], expectedOptions, 'got expected options argument') - t.equal(typeof spy.getCall(1).args[2], 'function', 'got callback argument') - - test.batch(expectedArray, null, expectedCb) - - t.equal(spy.callCount, 3, 'got _batch() call') - t.equal(spy.getCall(2).thisValue, test, '`this` on _batch() was correct') - t.equal(spy.getCall(2).args.length, 3, 'got three arguments') - t.deepEqual(spy.getCall(2).args[0], expectedArray, 'got expected array argument') - t.ok(spy.getCall(2).args[1], 'options should not be null') - t.equal(typeof spy.getCall(2).args[2], 'function', 'got callback argument') - }) -}) - -test('test batch([]) (array-form) with empty array is asynchronous', function (t) { - t.plan(3) - - const spy = sinon.spy() - const Test = implement(AbstractLevel, { _batch: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - let async = false - - test.batch([], function (err) { - t.ifError(err, 'no error') - t.ok(async, 'callback is asynchronous') - - // Assert that asynchronicity is provided by batch() rather than _batch() - t.is(spy.callCount, 0, '_batch() call was bypassed') - }) - - async = true - }) -}) - -test('test chained batch() extensibility', function (t) { - t.plan(16) - - const spy = sinon.spy() - const expectedCb = function () {} - const expectedOptions = { options: 1 } - const Test = implement(AbstractLevel, { _batch: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.batch().put('foo', 'bar').del('bang').write(expectedCb) - - t.equal(spy.callCount, 1, 'got _batch() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _batch() was correct') - t.equal(spy.getCall(0).args.length, 3, 'got three arguments') - t.equal(spy.getCall(0).args[0].length, 2, 'got expected array argument') - t.deepEqual(spy.getCall(0).args[0][0], { keyEncoding: 'utf8', valueEncoding: 'utf8', type: 'put', key: 'foo', value: 'bar' }, 'got expected array argument[0]') - t.deepEqual(spy.getCall(0).args[0][1], { keyEncoding: 'utf8', type: 'del', key: 'bang' }, 'got expected array argument[1]') - t.deepEqual(spy.getCall(0).args[1], {}, 'got expected options argument') - t.is(typeof spy.getCall(0).args[2], 'function', 'got callback argument') - - test.batch().put('foo', 'bar', expectedOptions).del('bang', expectedOptions).write(expectedOptions, expectedCb) - - t.equal(spy.callCount, 2, 'got _batch() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _batch() was correct') - t.equal(spy.getCall(1).args.length, 3, 'got three arguments') - t.equal(spy.getCall(1).args[0].length, 2, 'got expected array argument') - t.deepEqual(spy.getCall(1).args[0][0], { keyEncoding: 'utf8', valueEncoding: 'utf8', type: 'put', key: 'foo', value: 'bar', options: 1 }, 'got expected array argument[0]') - t.deepEqual(spy.getCall(1).args[0][1], { keyEncoding: 'utf8', type: 'del', key: 'bang', options: 1 }, 'got expected array argument[1]') - t.deepEqual(spy.getCall(1).args[1], { options: 1 }, 'got expected options argument') - t.is(typeof spy.getCall(1).args[2], 'function', 'got callback argument') - }) -}) - -test('test chained batch() with no operations is asynchronous', function (t) { - t.plan(2) - - const Test = implement(AbstractLevel, {}) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - let async = false - - test.batch().write(function (err) { - t.ifError(err, 'no error') - t.ok(async, 'callback is asynchronous') - }) - - async = true - }) -}) - -test('test chained batch() (custom _chainedBatch) extensibility', function (t) { - t.plan(4) - - const spy = sinon.spy() - const Test = implement(AbstractLevel, { _chainedBatch: spy }) - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - test.batch() - - t.equal(spy.callCount, 1, 'got _chainedBatch() call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _chainedBatch() was correct') - - test.batch() - - t.equal(spy.callCount, 2, 'got _chainedBatch() call') - t.equal(spy.getCall(1).thisValue, test, '`this` on _chainedBatch() was correct') - }) -}) - -test('test AbstractChainedBatch extensibility', function (t) { - const Batch = implement(AbstractChainedBatch) - const db = testCommon.factory() - const test = new Batch(db) - t.ok(test.db === db, 'instance has db reference') - t.end() -}) - -test('test AbstractChainedBatch expects a db', function (t) { - t.plan(1) - - const Test = implement(AbstractChainedBatch) - - try { - // eslint-disable-next-line no-new - new Test() - } catch (err) { - t.is(err.message, 'The first argument must be an abstract-level database, received undefined') - } -}) - -test('test AbstractChainedBatch#write() extensibility', function (t) { - t.plan(3) - - let batch - - const Test = implement(AbstractChainedBatch, { - _write: function (options, callback) { - t.same(options, {}) - t.is(this, batch, 'thisArg on _write() is correct') - this.nextTick(callback) - } - }) - - const db = testCommon.factory() - - db.once('open', function () { - batch = new Test(db) - - // Without any operations, _write isn't called - batch.put('foo', 'bar') - batch.write(function (err) { - t.ifError(err) - }) - }) -}) - -test('test AbstractChainedBatch#write() extensibility with null options', function (t) { - t.plan(3) - - let batch - - const Test = implement(AbstractChainedBatch, { - _write: function (options, callback) { - t.same(options, {}) - t.is(this, batch, 'thisArg on _write() is correct') - this.nextTick(callback) - } - }) - - const db = testCommon.factory() - - db.once('open', function () { - batch = new Test(db) - - // Without any operations, _write isn't called - batch.put('foo', 'bar') - batch.write(null, function (err) { - t.ifError(err) - }) - }) -}) - -test('test AbstractChainedBatch#write() extensibility with options', function (t) { - t.plan(3) - - let batch - - const Test = implement(AbstractChainedBatch, { - _write: function (options, callback) { - t.same(options, { test: true }) - t.is(this, batch, 'thisArg on _write() is correct') - this.nextTick(callback) - } - }) - - const db = testCommon.factory() - - db.once('open', function () { - batch = new Test(db) - // Without any operations, _write isn't called - batch.put('foo', 'bar') - batch.write({ test: true }, function (err) { - t.ifError(err) - }) - }) -}) - -test('test AbstractChainedBatch#put() extensibility', function (t) { - t.plan(7) - - const spy = sinon.spy() - const expectedKey = 'key' - const expectedValue = 'value' - const Test = implement(AbstractChainedBatch, { _put: spy }) - const db = testCommon.factory() - - db.once('open', function () { - const test = new Test(db) - const returnValue = test.put(expectedKey, expectedValue) - - t.equal(spy.callCount, 1, 'got _put call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _put() was correct') - t.equal(spy.getCall(0).args.length, 3, 'got 3 arguments') - t.equal(spy.getCall(0).args[0], expectedKey, 'got expected key argument') - t.equal(spy.getCall(0).args[1], expectedValue, 'got expected value argument') - t.same(spy.getCall(0).args[2], { keyEncoding: 'utf8', valueEncoding: 'utf8' }, 'got expected options argument') - t.equal(returnValue, test, 'get expected return value') - }) -}) - -test('test AbstractChainedBatch#del() extensibility', function (t) { - t.plan(6) - - const spy = sinon.spy() - const expectedKey = 'key' - const Test = implement(AbstractChainedBatch, { _del: spy }) - const db = testCommon.factory() - - db.once('open', function () { - const test = new Test(db) - const returnValue = test.del(expectedKey) - - t.equal(spy.callCount, 1, 'got _del call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _del() was correct') - t.equal(spy.getCall(0).args.length, 2, 'got 2 arguments') - t.equal(spy.getCall(0).args[0], expectedKey, 'got expected key argument') - t.same(spy.getCall(0).args[1], { keyEncoding: 'utf8' }, 'got expected options argument') - t.equal(returnValue, test, 'get expected return value') - }) -}) - -test('test AbstractChainedBatch#clear() extensibility', function (t) { - t.plan(4) - - const spy = sinon.spy() - const Test = implement(AbstractChainedBatch, { _clear: spy }) - const db = testCommon.factory() - - db.once('open', function () { - const test = new Test(db) - const returnValue = test.clear() - - t.equal(spy.callCount, 1, 'got _clear call') - t.equal(spy.getCall(0).thisValue, test, '`this` on _clear() was correct') - t.equal(spy.getCall(0).args.length, 0, 'got zero arguments') - t.equal(returnValue, test, 'get expected return value') - }) -}) - -test('test clear() extensibility', function (t) { - t.plan((7 * 5) - 4) - - const spy = sinon.spy() - const Test = implement(AbstractLevel, { _clear: spy }) - const db = new Test({ encodings: { utf8: true } }) - const callback = function () {} - - db.once('open', function () { - call([callback], { keyEncoding: 'utf8', reverse: false, limit: -1 }) - call([null, callback], { keyEncoding: 'utf8', reverse: false, limit: -1 }) - call([undefined, callback], { keyEncoding: 'utf8', reverse: false, limit: -1 }) - call([{ custom: 1 }, callback], { custom: 1, keyEncoding: 'utf8', reverse: false, limit: -1 }) - call([{ reverse: true, limit: 0 }, callback], { keyEncoding: 'utf8', reverse: true, limit: 0 }, true) - call([{ reverse: 1 }, callback], { keyEncoding: 'utf8', reverse: true, limit: -1 }) - call([{ reverse: null }, callback], { keyEncoding: 'utf8', reverse: false, limit: -1 }) - - function call (args, expectedOptions, shouldSkipCall) { - db.clear.apply(db, args) - - t.is(spy.callCount, shouldSkipCall ? 0 : 1, 'got _clear() call') - - if (!shouldSkipCall) { - t.is(spy.getCall(0).thisValue, db, '`this` on _clear() was correct') - t.is(spy.getCall(0).args.length, 2, 'got two arguments') - t.same(spy.getCall(0).args[0], expectedOptions, 'got expected options argument') - t.is(typeof spy.getCall(0).args[1], 'function', 'got callback argument') - } - - spy.resetHistory() - } - }) -}) - -// TODO: replace with encoding test -test.skip('test serialization extensibility (batch array is not mutated)', function (t) { - t.plan(7) - - const spy = sinon.spy() - const Test = implement(AbstractLevel, { - _batch: spy, - _serializeKey: function (key) { - t.equal(key, 'no') - return 'foo' - }, - _serializeValue: function (value) { - t.equal(value, 'nope') - return 'bar' - } - }) - - const test = new Test({ encodings: { utf8: true } }) - - test.once('open', function () { - const op = { type: 'put', key: 'no', value: 'nope' } - - test.batch([op], function () {}) - - t.equal(spy.callCount, 1, 'got _batch() call') - t.equal(spy.getCall(0).args[0][0].key, 'foo', 'got expected key') - t.equal(spy.getCall(0).args[0][0].value, 'bar', 'got expected value') - - t.equal(op.key, 'no', 'did not mutate input key') - t.equal(op.value, 'nope', 'did not mutate input value') - }) -}) - -test('clear() does not delete empty or nullish range options', function (t) { - const rangeValues = [Uint8Array.from([]), '', null, undefined] - - t.plan(rangeOptions.length * rangeValues.length) - - rangeValues.forEach(function (value) { - const Test = implement(AbstractLevel, { - _clear: function (options, callback) { - rangeOptions.forEach(function (key) { - t.ok(key in options, key + ' option should not be deleted') - }) - } - }) - - const db = new Test({ encodings: { utf8: true } }) - const options = {} - - rangeOptions.forEach(function (key) { - options[key] = value - }) - - db.once('open', function () { - db.clear(options, function () {}) - }) - }) -}) - -// TODO: some of these are redundant -test('.status', function (t) { - t.plan(5) - - t.test('empty prototype', function (t) { - const Test = implement(AbstractLevel) - const test = new Test({ encodings: { utf8: true } }) - - t.equal(test.status, 'opening') - - test.open(function (err) { - t.error(err) - t.equal(test.status, 'open') - - test.close(function (err) { - t.error(err) - t.equal(test.status, 'closed') - t.end() - }) - }) - - t.equal(test.status, 'opening') - }) - - t.test('open error', function (t) { - const Test = implement(AbstractLevel, { - _open: function (options, cb) { - cb(new Error('_open error')) - } - }) - - const test = new Test({ encodings: { utf8: true } }) - - test.open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause && err.cause.message, '_open error') - t.equal(test.status, 'closed') - t.end() - }) - }) - - t.test('close error', function (t) { - const Test = implement(AbstractLevel, { - _close: function (cb) { - cb(new Error('_close error')) - } - }) - - const test = new Test({ encodings: { utf8: true } }) - test.open(function () { - test.close(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_CLOSED') - t.is(err && err.cause && err.cause.message, '_close error') - t.equal(test.status, 'open') - t.end() - }) - }) - }) - - t.test('open', function (t) { - const Test = implement(AbstractLevel, { - _open: function (options, cb) { - this.nextTick(cb) - } - }) - - const test = new Test({ encodings: { utf8: true } }) - test.open(function (err) { - t.error(err) - t.equal(test.status, 'open') - t.end() - }) - t.equal(test.status, 'opening') - }) - - t.test('close', function (t) { - const Test = implement(AbstractLevel, { - _close: function (cb) { - this.nextTick(cb) - } - }) - - const test = new Test({ encodings: { utf8: true } }) - test.open(function (err) { - t.error(err) - test.close(function (err) { - t.error(err) - t.equal(test.status, 'closed') - t.end() - }) - t.equal(test.status, 'closing') - }) - }) -}) - -test('rangeOptions', function (t) { - const keys = rangeOptions.slice() - const db = new AbstractLevel({ - encodings: { - utf8: true, buffer: true, view: true - } - }) - - function setupOptions (create) { - const options = {} - for (const key of keys) { - options[key] = create() - } - return options - } - - function verifyOptions (t, options) { - for (const key of keys) { - t.ok(key in options, key + ' option should not be deleted') - } - t.end() - } - - t.plan(11) - t.test('setup', async (t) => db.open()) - - t.test('default options', function (t) { - t.same(getRangeOptions(undefined, db.keyEncoding('utf8')), { - reverse: false, - limit: -1 - }, 'correct defaults') - t.end() - }) - - t.test('set options', function (t) { - t.same(getRangeOptions({ reverse: false, limit: 20 }, db.keyEncoding('utf8')), { - reverse: false, - limit: 20 - }, 'options set correctly') - t.end() - }) - - t.test('ignores invalid limit', function (t) { - // Infinity is valid but is normalized to -1 for use in private API - for (const limit of [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, NaN, -2, 5.5]) { - t.same(getRangeOptions({ limit }, db.keyEncoding('utf8')).limit, -1) - } - t.end() - }) - - t.test('ignores not-own property', function (t) { - class Options {} - Options.prototype.limit = 20 - const options = new Options() - - t.is(options.limit, 20) - t.same(getRangeOptions(options, db.keyEncoding('utf8')), { - reverse: false, - limit: -1 - }) - t.end() - }) - - t.test('does not delete empty buffers', function (t) { - const options = setupOptions(() => Buffer.alloc(0)) - keys.forEach(function (key) { - t.is(isBuffer(options[key]), true, 'should be buffer') - t.is(options[key].byteLength, 0, 'should be empty') - }) - verifyOptions(t, getRangeOptions(options, db.keyEncoding('buffer'))) - }) - - t.test('does not delete empty views', function (t) { - const options = setupOptions(() => Uint8Array.from([])) - keys.forEach(function (key) { - t.is(options[key] instanceof Uint8Array, true, 'should be Uint8Array') - t.is(options[key].byteLength, 0, 'should be empty') - }) - verifyOptions(t, getRangeOptions(options, db.keyEncoding('view'))) - }) - - t.test('does not delete empty strings', function (t) { - const options = setupOptions(() => '') - keys.forEach(function (key) { - t.is(typeof options[key], 'string', 'should be string') - t.is(options[key].length, 0, 'should be empty') - }) - verifyOptions(t, getRangeOptions(options, db.keyEncoding('utf8'))) - }) - - t.test('does not delete null', function (t) { - const options = setupOptions(() => null) - keys.forEach(function (key) { - t.is(options[key], null) - }) - verifyOptions(t, getRangeOptions(options, db.keyEncoding('utf8'))) - }) - - t.test('does not delete undefined', function (t) { - const options = setupOptions(() => undefined) - keys.forEach(function (key) { - t.is(options[key], undefined) - }) - verifyOptions(t, getRangeOptions(options, db.keyEncoding('utf8'))) - }) - - t.test('rejects legacy range options', function (t) { - t.plan(2) - - for (const key of ['start', 'end']) { - const options = {} - options[key] = 'x' - - try { - getRangeOptions(options, db.keyEncoding('utf8')) - } catch (err) { - t.is(err.code, 'LEVEL_LEGACY') - } - } - }) -}) - -require('./self/defer-test') -require('./self/attach-resource-test') -require('./self/abstract-iterator-test') -require('./self/iterator-test') -require('./self/deferred-iterator-test') -require('./self/deferred-operations-test') -require('./self/deferred-chained-batch-test') -require('./self/async-iterator-test') -require('./self/encoding-test') -require('./self/sublevel-test') - -// Test the abstract test suite using a minimal implementation -require('./index')({ - test, - factory (options) { - return new MinimalLevel(options) - } -}) diff --git a/node_modules/abstract-level/test/self/abstract-iterator-test.js b/node_modules/abstract-level/test/self/abstract-iterator-test.js deleted file mode 100644 index 6f23aff..0000000 --- a/node_modules/abstract-level/test/self/abstract-iterator-test.js +++ /dev/null @@ -1,263 +0,0 @@ -'use strict' - -const test = require('tape') -const { AbstractLevel, AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('../..') - -const testCommon = require('../common')({ - test, - factory: function () { - return new AbstractLevel({ encodings: { utf8: true } }) - } -}) - -for (const Ctor of [AbstractIterator, AbstractKeyIterator, AbstractValueIterator]) { - test(`test ${Ctor.name} extensibility`, function (t) { - const Test = class TestIterator extends Ctor {} - const db = testCommon.factory() - const test = new Test(db, {}) - t.ok(test.db === db, 'instance has db reference') - t.end() - }) - - test(`${Ctor.name} throws on invalid db argument`, function (t) { - t.plan(4 * 2) - - for (const args of [[], [null], [undefined], 'foo']) { - const hint = args[0] === null ? 'null' : typeof args[0] - - try { - // eslint-disable-next-line no-new - new Ctor(...args) - } catch (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'The first argument must be an abstract-level database, received ' + hint) - } - } - }) - - test(`${Ctor.name} throws on invalid options argument`, function (t) { - t.plan(4 * 2) - - for (const args of [[], [null], [undefined], 'foo']) { - try { - // eslint-disable-next-line no-new - new Ctor({}, ...args) - } catch (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'The second argument must be an options object') - } - } - }) - - test(`${Ctor.name}.next() extensibility`, async function (t) { - t.plan(3) - - class TestIterator extends Ctor { - _next (callback) { - t.is(this, it, 'thisArg on _next() was correct') - t.is(arguments.length, 1, 'got one argument') - t.is(typeof callback, 'function', 'got a callback function') - this.nextTick(callback) - } - } - - const db = testCommon.factory() - await db.open() - const it = new TestIterator(db, {}) - await it.next() - await db.close() - }) - - test(`${Ctor.name}.next() throws on invalid callback argument`, async function (t) { - t.plan(3 * 2) - - const db = testCommon.factory() - await db.open() - - for (const invalid of [{}, null, 'foo']) { - const it = new Ctor(db, {}) - - try { - it.next(invalid) - } catch (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'Callback must be a function') - } - } - }) - - test(`${Ctor.name}.nextv() extensibility`, async function (t) { - t.plan(5 * 2) - - class TestIterator extends Ctor { - _nextv (size, options, callback) { - t.is(this, it, 'thisArg on _nextv() was correct') - t.is(arguments.length, 3, 'got 3 arguments') - t.is(size, 100) - t.same(options, {}, 'empty options') - t.is(typeof callback, 'function', 'got a callback function') - this.nextTick(callback, null, []) - } - } - - const db = testCommon.factory() - await db.open() - const it = new TestIterator(db, {}) - await it.nextv(100) - await it.nextv(100, {}) - await db.close() - }) - - test(`${Ctor.name}.nextv() extensibility (options)`, async function (t) { - t.plan(2) - - class TestIterator extends Ctor { - _nextv (size, options, callback) { - t.is(size, 100) - t.same(options, { foo: 123 }, 'got options') - this.nextTick(callback, null, []) - } - } - - const db = testCommon.factory() - await db.open() - const it = new TestIterator(db, {}) - await it.nextv(100, { foo: 123 }) - await db.close() - }) - - test(`${Ctor.name}.nextv() throws on invalid callback argument`, async function (t) { - t.plan(3 * 2) - - const db = testCommon.factory() - await db.open() - - for (const invalid of [{}, null, 'foo']) { - const it = new Ctor(db, {}) - - try { - it.nextv(100, {}, invalid) - } catch (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'Callback must be a function') - } - } - }) - - test(`${Ctor.name}.all() extensibility`, async function (t) { - t.plan(2 * 4) - - for (const args of [[], [{}]]) { - class TestIterator extends Ctor { - _all (options, callback) { - t.is(this, it, 'thisArg on _all() was correct') - t.is(arguments.length, 2, 'got 2 arguments') - t.same(options, {}, 'empty options') - t.is(typeof callback, 'function', 'got a callback function') - this.nextTick(callback, null, []) - } - } - - const db = testCommon.factory() - await db.open() - const it = new TestIterator(db, {}) - await it.all(...args) - await db.close() - } - }) - - test(`${Ctor.name}.all() extensibility (options)`, async function (t) { - t.plan(1) - - class TestIterator extends Ctor { - _all (options, callback) { - t.same(options, { foo: 123 }, 'got options') - this.nextTick(callback, null, []) - } - } - - const db = testCommon.factory() - await db.open() - const it = new TestIterator(db, {}) - await it.all({ foo: 123 }) - await db.close() - }) - - test(`${Ctor.name}.all() throws on invalid callback argument`, async function (t) { - t.plan(3 * 2) - - const db = testCommon.factory() - await db.open() - - for (const invalid of [{}, null, 'foo']) { - const it = new Ctor(db, {}) - - try { - it.all({}, invalid) - } catch (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'Callback must be a function') - } - } - }) - - test(`${Ctor.name}.close() extensibility`, async function (t) { - t.plan(3) - - class TestIterator extends Ctor { - _close (callback) { - t.is(this, it, 'thisArg on _close() was correct') - t.is(arguments.length, 1, 'got one argument') - t.is(typeof callback, 'function', 'got a callback function') - this.nextTick(callback) - } - } - - const db = testCommon.factory() - await db.open() - const it = new TestIterator(db, {}) - await it.close() - await db.close() - }) - - test(`${Ctor.name}.close() throws on invalid callback argument`, async function (t) { - t.plan(3 * 2) - - const db = testCommon.factory() - await db.open() - - for (const invalid of [{}, null, 'foo']) { - const it = new Ctor(db, {}) - - try { - it.close(invalid) - } catch (err) { - t.is(err.name, 'TypeError') - t.is(err.message, 'Callback must be a function') - } - } - }) -} - -test('AbstractIterator throws when accessing legacy properties', async function (t) { - t.plan(3 * 2) - - const db = testCommon.factory() - await db.open() - const it = new AbstractIterator(db, {}) - - for (const k of ['_ended property', '_nexting property', '_end method']) { - try { - // eslint-disable-next-line no-unused-expressions - it[k.split(' ')[0]] - } catch (err) { - t.is(err.code, 'LEVEL_LEGACY') - } - - try { - it[k.split(' ')[0]] = 123 - } catch (err) { - t.is(err.code, 'LEVEL_LEGACY') - } - } -}) diff --git a/node_modules/abstract-level/test/self/async-iterator-test.js b/node_modules/abstract-level/test/self/async-iterator-test.js deleted file mode 100644 index 4455f62..0000000 --- a/node_modules/abstract-level/test/self/async-iterator-test.js +++ /dev/null @@ -1,213 +0,0 @@ -'use strict' - -const test = require('tape') -const { AbstractLevel, AbstractIterator } = require('../..') -const { DeferredIterator, DeferredKeyIterator, DeferredValueIterator } = require('../../lib/deferred-iterator') - -function withIterator (methods) { - class TestIterator extends AbstractIterator { } - - for (const k in methods) { - TestIterator.prototype[k] = methods[k] - } - - class Test extends AbstractLevel { - _iterator (options) { - return new TestIterator(this, options) - } - } - - return new Test({ encodings: { utf8: true } }) -} - -for (const mode of ['iterator', 'keys', 'values']) { - for (const type of ['explicit', 'deferred']) { - const verify = function (t, db, it) { - t.is(db.status, type === 'explicit' ? 'open' : 'opening') - - if (type === 'explicit') { - t.is( - it.constructor.name, - mode === 'iterator' ? 'TestIterator' : mode === 'keys' ? 'DefaultKeyIterator' : 'DefaultValueIterator' - ) - } else { - t.is( - it.constructor, - mode === 'iterator' ? DeferredIterator : mode === 'keys' ? DeferredKeyIterator : DeferredValueIterator - ) - } - } - - test(`for await...of ${mode}() (${type} open)`, async function (t) { - t.plan(4) - - const input = [{ key: '1', value: '1' }, { key: '2', value: '2' }] - const output = [] - - const db = withIterator({ - _next (callback) { - const { key, value } = input[n++] || [] - this.nextTick(callback, null, key, value) - }, - - _close (callback) { - this.nextTick(function () { - closed = true - callback() - }) - } - }) - - if (type === 'explicit') await db.open() - const it = db[mode]({ keyEncoding: 'utf8', valueEncoding: 'utf8' }) - verify(t, db, it) - - let n = 0 - let closed = false - - for await (const item of it) { - output.push(item) - } - - t.same(output, input.map(x => mode === 'iterator' ? [x.key, x.value] : mode === 'keys' ? x.key : x.value)) - t.ok(closed, 'closed') - }) - - test(`for await...of ${mode}() closes on user error (${type} open)`, async function (t) { - t.plan(4) - - const db = withIterator({ - _next (callback) { - this.nextTick(callback, null, n.toString(), n.toString()) - if (n++ > 10) throw new Error('Infinite loop') - }, - - _close (callback) { - this.nextTick(function () { - closed = true - callback(new Error('close error')) - }) - } - }) - - if (type === 'explicit') await db.open() - const it = db[mode]() - verify(t, db, it) - - let n = 0 - let closed = false - - try { - // eslint-disable-next-line no-unused-vars, no-unreachable-loop - for await (const kv of it) { - throw new Error('user error') - } - } catch (err) { - t.is(err.message, 'user error') - t.ok(closed, 'closed') - } - }) - - test(`for await...of ${mode}() closes on iterator error (${type} open)`, async function (t) { - t.plan(5) - - const db = withIterator({ - _next (callback) { - t.pass('nexted') - this.nextTick(callback, new Error('iterator error')) - }, - - _close (callback) { - this.nextTick(function () { - closed = true - callback() - }) - } - }) - - if (type === 'explicit') await db.open() - const it = db[mode]() - verify(t, db, it) - - let closed = false - - try { - // eslint-disable-next-line no-unused-vars - for await (const kv of it) { - t.fail('should not yield items') - } - } catch (err) { - t.is(err.message, 'iterator error') - t.ok(closed, 'closed') - } - }) - - test(`for await...of ${mode}() closes on user break (${type} open)`, async function (t) { - t.plan(4) - - const db = withIterator({ - _next (callback) { - this.nextTick(callback, null, n.toString(), n.toString()) - if (n++ > 10) throw new Error('Infinite loop') - }, - - _close (callback) { - this.nextTick(function () { - closed = true - callback() - }) - } - }) - - if (type === 'explicit') await db.open() - const it = db[mode]() - verify(t, db, it) - - let n = 0 - let closed = false - - // eslint-disable-next-line no-unused-vars, no-unreachable-loop - for await (const kv of it) { - t.pass('got a chance to break') - break - } - - t.ok(closed, 'closed') - }) - - test(`for await...of ${mode}() closes on user return (${type} open)`, async function (t) { - t.plan(4) - - const db = withIterator({ - _next (callback) { - this.nextTick(callback, null, n.toString(), n.toString()) - if (n++ > 10) throw new Error('Infinite loop') - }, - - _close (callback) { - this.nextTick(function () { - closed = true - callback() - }) - } - }) - - if (type === 'explicit') await db.open() - const it = db[mode]() - verify(t, db, it) - - let n = 0 - let closed = false - - await (async () => { - // eslint-disable-next-line no-unused-vars, no-unreachable-loop - for await (const kv of it) { - t.pass('got a chance to return') - return - } - })() - - t.ok(closed, 'closed') - }) - } -} diff --git a/node_modules/abstract-level/test/self/attach-resource-test.js b/node_modules/abstract-level/test/self/attach-resource-test.js deleted file mode 100644 index 0961fcb..0000000 --- a/node_modules/abstract-level/test/self/attach-resource-test.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict' - -const test = require('tape') -const { mockLevel } = require('../util') -const nextTick = require('../../lib/next-tick') - -test('resource must be an object with a close() method', function (t) { - t.plan(5) - - const db = mockLevel() - - for (const invalid of [null, undefined, {}, { close: 123 }]) { - try { - db.attachResource(invalid) - } catch (err) { - t.is(err && err.message, 'The first argument must be a resource object') - } - } - - db.close(t.ifError.bind(t)) -}) - -test('resource is closed on failed open', function (t) { - t.plan(2) - - const db = mockLevel({ - _open: function (options, callback) { - t.pass('opened') - this.nextTick(callback, new Error('_open error')) - } - }) - - const resource = { - close: function (cb) { - // Note: resource shouldn't care about db.status - t.pass('closed') - nextTick(cb) - } - } - - db.attachResource(resource) -}) - -test('resource is closed on db.close()', function (t) { - t.plan(2) - - const db = mockLevel() - - const resource = { - close: function (cb) { - // Note: resource shouldn't care about db.status - t.pass('closed') - nextTick(cb) - } - } - - db.attachResource(resource) - db.close(t.ifError.bind(t)) -}) - -test('resource is not closed on db.close() if detached', function (t) { - t.plan(1) - - const db = mockLevel() - - const resource = { - close: function (cb) { - t.fail('should not be called') - } - } - - db.attachResource(resource) - db.detachResource(resource) - db.close(t.ifError.bind(t)) -}) diff --git a/node_modules/abstract-level/test/self/defer-test.js b/node_modules/abstract-level/test/self/defer-test.js deleted file mode 100644 index 8b8376a..0000000 --- a/node_modules/abstract-level/test/self/defer-test.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict' - -const test = require('tape') -const { mockLevel } = require('../util') - -test('defer() requires valid function argument', function (t) { - t.plan(7) - - const db = mockLevel() - - for (const invalid of [123, true, false, null, undefined, {}]) { - try { - db.defer(invalid) - } catch (err) { - t.is(err.message, 'The first argument must be a function') - } - } - - db.close(t.ifError.bind(t)) -}) - -test('defer() custom operation', function (t) { - t.plan(6) - - const db = mockLevel({ - custom (arg, callback) { - if (this.status === 'opening') { - t.is(arg, 123) - this.defer(() => this.custom(456, callback)) - } else { - t.is(db.status, 'open') - t.is(arg, 456) - this.nextTick(callback, null, 987) - } - } - }) - - db.custom(123, function (err, result) { - t.ifError(err, 'no custom() error') - t.is(result, 987, 'result ok') - - db.close(t.ifError.bind(t)) - }) -}) - -test('defer() custom operation with failed open', function (t) { - t.plan(4) - - const db = mockLevel({ - _open (options, callback) { - t.pass('opened') - this.nextTick(callback, new Error('_open error')) - }, - custom (arg, callback) { - if (this.status === 'opening') { - this.defer(() => this.custom(arg, callback)) - } else { - t.is(db.status, 'closed') - this.nextTick(callback, new Error('Database is not open (x)')) - } - } - }) - - db.custom(123, function (err, result) { - t.is(err && err.message, 'Database is not open (x)') - t.is(result, undefined, 'result ok') - }) -}) - -test('defer() can drop custom synchronous operation', function (t) { - t.plan(3) - - const db = mockLevel({ - _open (options, callback) { - t.pass('opened') - this.nextTick(callback, new Error('_open error')) - }, - custom (arg) { - if (this.status === 'opening') { - this.defer(() => this.custom(arg * 2)) - } else { - // Handling other states is a userland responsibility - t.is(db.status, 'closed') - t.is(arg, 246) - } - } - }) - - db.custom(123) -}) diff --git a/node_modules/abstract-level/test/self/deferred-chained-batch-test.js b/node_modules/abstract-level/test/self/deferred-chained-batch-test.js deleted file mode 100644 index bbf26ea..0000000 --- a/node_modules/abstract-level/test/self/deferred-chained-batch-test.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict' - -const test = require('tape') -const { mockLevel } = require('../util') -const { DefaultChainedBatch } = require('../../lib/default-chained-batch') -const identity = (v) => v - -// NOTE: adapted from deferred-leveldown -test('deferred chained batch encodes once', function (t) { - t.plan(9) - - let called = false - - const keyEncoding = { - format: 'utf8', - encode (key) { - t.is(called, false, 'not yet called') - t.is(key, 'foo') - return key.toUpperCase() - }, - decode: identity - } - - const valueEncoding = { - format: 'utf8', - encode (value) { - t.is(called, false, 'not yet called') - t.is(value, 'bar') - return value.toUpperCase() - }, - decode: identity - } - - const db = mockLevel({ - _batch: function (array, options, callback) { - called = true - t.is(array[0] && array[0].key, 'FOO') - t.is(array[0] && array[0].value, 'BAR') - this.nextTick(callback) - }, - _open: function (options, callback) { - t.is(called, false, 'not yet called') - this.nextTick(callback) - } - }, { encodings: { utf8: true } }, { - keyEncoding, - valueEncoding - }) - - db.once('open', function () { - t.is(called, true, 'called') - }) - - db.batch().put('foo', 'bar').write(function (err) { - t.ifError(err, 'no write() error') - }) -}) - -test('deferred chained batch is closed upon failed open', function (t) { - t.plan(6) - - const db = mockLevel({ - _open (options, callback) { - t.pass('opening') - this.nextTick(callback, new Error('_open error')) - }, - _batch () { - t.fail('should not be called') - } - }) - - const batch = db.batch() - t.ok(batch instanceof DefaultChainedBatch) - - batch.put('foo', 'bar') - batch.del('123') - - batch.write(function (err) { - t.is(err && err.code, 'LEVEL_BATCH_NOT_OPEN') - - // Should account for userland code that ignores errors - try { - batch.put('beep', 'boop') - } catch (err) { - t.is(err && err.code, 'LEVEL_BATCH_NOT_OPEN') - } - - try { - batch.del('456') - } catch (err) { - t.is(err && err.code, 'LEVEL_BATCH_NOT_OPEN') - } - - batch.write(function (err) { - t.is(err && err.code, 'LEVEL_BATCH_NOT_OPEN') - }) - }) -}) diff --git a/node_modules/abstract-level/test/self/deferred-iterator-test.js b/node_modules/abstract-level/test/self/deferred-iterator-test.js deleted file mode 100644 index c88c561..0000000 --- a/node_modules/abstract-level/test/self/deferred-iterator-test.js +++ /dev/null @@ -1,298 +0,0 @@ -'use strict' - -const test = require('tape') -const { DeferredIterator, DeferredKeyIterator, DeferredValueIterator } = require('../../lib/deferred-iterator') -const { AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('../..') -const { mockLevel } = require('../util') -const noop = () => {} -const identity = (v) => v - -for (const mode of ['iterator', 'keys', 'values']) { - const RealCtor = mode === 'iterator' ? AbstractIterator : mode === 'keys' ? AbstractKeyIterator : AbstractValueIterator - const DeferredCtor = mode === 'iterator' ? DeferredIterator : mode === 'keys' ? DeferredKeyIterator : DeferredValueIterator - const nextArgs = mode === 'iterator' ? ['key', 'value'] : mode === 'keys' ? ['key'] : ['value'] - const privateMethod = '_' + mode - const publicMethod = mode - - // NOTE: adapted from deferred-leveldown - test(`deferred ${mode}()`, function (t) { - t.plan(8) - - const keyEncoding = { - format: 'utf8', - encode (key) { - t.is(key, 'foo', 'encoding got key') - return key.toUpperCase() - }, - decode: identity - } - - class MockIterator extends RealCtor { - _next (cb) { - this.nextTick(cb, null, ...nextArgs) - } - - _close (cb) { - this.nextTick(cb) - } - } - - const db = mockLevel({ - [privateMethod]: function (options) { - t.is(options.gt, 'FOO', 'got encoded range option') - return new MockIterator(this, options) - }, - _open: function (options, callback) { - t.pass('opened') - this.nextTick(callback) - } - }, { encodings: { utf8: true } }, { - keyEncoding - }) - - const it = db[publicMethod]({ gt: 'foo' }) - t.ok(it instanceof DeferredCtor, 'is deferred') - - let nextFirst = false - - it.next(function (err, ...rest) { - nextFirst = true - t.error(err, 'no next() error') - t.same(rest, nextArgs) - }) - - it.close(function (err) { - t.error(err, 'no close() error') - t.ok(nextFirst) - }) - }) - - // NOTE: adapted from deferred-leveldown - test(`deferred ${mode}(): non-deferred operations`, function (t) { - t.plan(6) - - class MockIterator extends RealCtor { - _seek (target) { - t.is(target, '123') - } - - _next (cb) { - this.nextTick(cb, null, ...nextArgs) - } - } - - const db = mockLevel({ - [privateMethod]: function (options) { - return new MockIterator(this, options) - } - }) - - db.open(function (err) { - t.error(err, 'no open() error') - - it.seek(123) - it.next(function (err, ...rest) { - t.error(err, 'no next() error') - t.same(rest, nextArgs) - - it.close(function (err) { - t.error(err, 'no close() error') - }) - }) - }) - - const it = db[publicMethod]({ gt: 'foo' }) - t.ok(it instanceof DeferredCtor) - }) - - // NOTE: adapted from deferred-leveldown - test(`deferred ${mode}(): iterators are created in order`, function (t) { - t.plan(6) - - const order1 = [] - const order2 = [] - - class MockIterator extends RealCtor {} - - function db (order) { - return mockLevel({ - [privateMethod]: function (options) { - order.push('iterator created') - return new MockIterator(this, options) - }, - _put: function (key, value, options, callback) { - order.push('put') - }, - _open: function (options, callback) { - this.nextTick(callback) - } - }) - } - - const db1 = db(order1) - const db2 = db(order2) - - db1.open(function (err) { - t.error(err, 'no error') - t.same(order1, ['iterator created', 'put']) - }) - - db2.open(function (err) { - t.error(err, 'no error') - t.same(order2, ['put', 'iterator created']) - }) - - t.ok(db1[publicMethod]() instanceof DeferredCtor) - db1.put('key', 'value', noop) - - db2.put('key', 'value', noop) - t.ok(db2[publicMethod]() instanceof DeferredCtor) - }) - - for (const method of ['next', 'nextv', 'all']) { - test(`deferred ${mode}(): closed upon failed open, verified by ${method}()`, function (t) { - t.plan(5) - - const db = mockLevel({ - _open (options, callback) { - t.pass('opening') - this.nextTick(callback, new Error('_open error')) - }, - _iterator () { - t.fail('should not be called') - }, - [privateMethod] () { - t.fail('should not be called') - } - }) - - const it = db[publicMethod]() - t.ok(it instanceof DeferredCtor) - - const original = it._close - it._close = function (...args) { - t.pass('closed') - return original.call(this, ...args) - } - - verifyClosed(t, it, method, () => {}) - }) - - test(`deferred ${mode}(): deferred and real iterators are closed on db.close(), verified by ${method}()`, function (t) { - t.plan(10) - - class MockIterator extends RealCtor { - _close (callback) { - t.pass('closed') - this.nextTick(callback) - } - } - - const db = mockLevel({ - [privateMethod] (options) { - return new MockIterator(this, options) - } - }) - - const it = db[publicMethod]() - t.ok(it instanceof DeferredCtor) - - const original = it._close - it._close = function (...args) { - t.pass('closed') - return original.call(this, ...args) - } - - db.close(function (err) { - t.ifError(err, 'no close() error') - - verifyClosed(t, it, method, function () { - db.open(function (err) { - t.ifError(err, 'no open() error') - - // Should still be closed - verifyClosed(t, it, method, function () { - db.close(t.ifError.bind(t)) - }) - }) - }) - }) - }) - } - - test(`deferred ${mode}(): deferred and real iterators are detached on db.close()`, function (t) { - t.plan(4) - - class MockIterator extends RealCtor {} - - let real - const db = mockLevel({ - [privateMethod] (options) { - real = new MockIterator(this, options) - return real - } - }) - - const it = db[publicMethod]() - t.ok(it instanceof DeferredCtor) - - db.close(function (err) { - t.ifError(err, 'no close() error') - - db.open(function (err) { - t.ifError(err, 'no open() error') - - it.close = real.close = it._close = real._close = function () { - t.fail('should not be called') - } - - db.close(t.ifError.bind(t)) - }) - }) - }) - - test(`deferred ${mode}(): defers underlying close()`, function (t) { - t.plan(3) - - class MockIterator extends RealCtor { - _close (callback) { - order.push('_close') - this.nextTick(callback) - } - } - - const order = [] - const db = mockLevel({ - _open (options, callback) { - order.push('_open') - this.nextTick(callback) - }, - [privateMethod] (options) { - order.push(privateMethod) - return new MockIterator(this, options) - } - }) - - const it = db[publicMethod]() - t.ok(it instanceof DeferredCtor) - - it.close(function (err) { - t.ifError(err, 'no close() error') - t.same(order, ['_open', privateMethod, '_close']) - }) - }) - - const verifyClosed = function (t, it, method, cb) { - const requiredArgs = method === 'nextv' ? [10] : [] - - it[method](...requiredArgs, function (err) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN', `correct error on first ${method}()`) - - // Should account for userland code that ignores errors - it[method](...requiredArgs, function (err) { - t.is(err && err.code, 'LEVEL_ITERATOR_NOT_OPEN', `correct error on second ${method}()`) - cb() - }) - }) - } -} diff --git a/node_modules/abstract-level/test/self/deferred-operations-test.js b/node_modules/abstract-level/test/self/deferred-operations-test.js deleted file mode 100644 index e1d0f2b..0000000 --- a/node_modules/abstract-level/test/self/deferred-operations-test.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict' - -const test = require('tape') -const { mockLevel, mockIterator } = require('../util') - -// NOTE: copied from deferred-leveldown -test('deferred operations are called in order', function (t) { - t.plan(15) - - const calls = [] - const db = mockLevel({ - _put: function (key, value, options, callback) { - this.nextTick(callback) - calls.push({ type: 'put', key, value, options }) - }, - _get: function (key, options, callback) { - this.nextTick(callback) - calls.push({ type: 'get', key, options }) - }, - _del: function (key, options, callback) { - this.nextTick(callback) - calls.push({ type: 'del', key, options }) - }, - _batch: function (arr, options, callback) { - this.nextTick(callback) - calls.push({ type: 'batch', keys: arr.map(op => op.key).join(',') }) - }, - _clear: function (options, callback) { - this.nextTick(callback) - calls.push({ ...options, type: 'clear' }) - }, - _iterator (options) { - calls.push({ type: 'iterator' }) - return mockIterator(this, options, { - _next (callback) { - this.nextTick(callback) - calls.push({ type: 'iterator.next' }) - } - }) - }, - _open: function (options, callback) { - this.nextTick(callback) - t.is(calls.length, 0, 'not yet called') - } - }, { - encodings: { - utf8: true, - buffer: true - } - }, { - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }) - - db.open(function (err) { - t.ifError(err, 'no open() error') - t.same(calls, [ - { type: 'put', key: '001', value: 'bar1', options: { keyEncoding: 'utf8', valueEncoding: 'utf8' } }, - { type: 'get', key: '002', options: { keyEncoding: 'utf8', valueEncoding: 'utf8' } }, - { type: 'clear', reverse: false, limit: -1, keyEncoding: 'utf8' }, - { type: 'put', key: '010', value: 'bar2', options: { keyEncoding: 'utf8', valueEncoding: 'utf8' } }, - { type: 'get', key: Buffer.from('011'), options: { keyEncoding: 'buffer', valueEncoding: 'utf8' } }, - { type: 'del', key: '020', options: { customOption: 123, keyEncoding: 'utf8' } }, - { type: 'del', key: '021', options: { keyEncoding: 'utf8' } }, - { type: 'batch', keys: '040,041' }, - { type: 'iterator' }, - { type: 'batch', keys: '050,051' }, - { type: 'iterator.next' }, - { type: 'clear', gt: '060', reverse: false, limit: -1, keyEncoding: 'utf8' } - ], 'calls correctly behaved') - }) - - db.put('001', 'bar1', t.ifError.bind(t)) - db.get('002', t.ifError.bind(t)) - db.clear(t.ifError.bind(t)) - db.put('010', 'bar2', t.ifError.bind(t)) - db.get('011', { keyEncoding: 'buffer' }, t.ifError.bind(t)) - db.del('020', { customOption: 123 }, t.ifError.bind(t)) - db.del('021', t.ifError.bind(t)) - db.batch([ - { type: 'put', key: '040', value: 'a' }, - { type: 'put', key: '041', value: 'b' } - ], t.ifError.bind(t)) - const it = db.iterator() - db.batch() - .put('050', 'c') - .put('051', 'd') - .write(t.ifError.bind(t)) - it.next(t.ifError.bind(t)) - db.clear({ gt: '060' }, t.ifError.bind(t)) - - t.is(calls.length, 0, 'not yet called') -}) diff --git a/node_modules/abstract-level/test/self/encoding-test.js b/node_modules/abstract-level/test/self/encoding-test.js deleted file mode 100644 index dd381f6..0000000 --- a/node_modules/abstract-level/test/self/encoding-test.js +++ /dev/null @@ -1,426 +0,0 @@ -'use strict' - -// TODO: move to per-method test files - -const test = require('tape') -const { Buffer } = require('buffer') -const { mockLevel, mockChainedBatch, nullishEncoding } = require('../util') -const identity = (v) => v - -const utf8Manifest = { encodings: { utf8: true } } -const dualManifest = { encodings: { utf8: true, buffer: true } } -const hasOwnProperty = Object.prototype.hasOwnProperty - -for (const deferred of [false, true]) { - // NOTE: adapted from encoding-down - test(`get() encodes utf8 key (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _get (key, options, callback) { - t.is(key, '8') - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - this.nextTick(callback, null, 'foo') - } - }, utf8Manifest) - - if (!deferred) await db.open() - t.same(await db.get(8), 'foo') - }) - - // NOTE: adapted from encoding-down - test(`get() takes encoding options (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _get (key, options, callback) { - t.is(key, '[1,"2"]') - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - this.nextTick(callback, null, '123') - } - }, utf8Manifest) - - if (!deferred) await db.open() - t.same(await db.get([1, '2'], { keyEncoding: 'json', valueEncoding: 'json' }), 123) - }) - - // NOTE: adapted from encoding-down - test(`get() with custom value encoding that wants a buffer (deferred: ${deferred})`, async function (t) { - t.plan(3) - - const db = mockLevel({ - _get (key, options, callback) { - t.same(key, 'key') - t.same(options, { keyEncoding: 'utf8', valueEncoding: 'buffer' }) - this.nextTick(callback, null, Buffer.alloc(1)) - } - }, dualManifest, { - keyEncoding: 'utf8', - valueEncoding: { encode: identity, decode: identity, format: 'buffer' } - }) - - if (!deferred) await db.open() - t.same(await db.get('key'), Buffer.alloc(1)) - }) - - // NOTE: adapted from encoding-down - test(`get() with custom value encoding that wants a string (deferred: ${deferred})`, async function (t) { - t.plan(3) - - const db = mockLevel({ - _get (key, options, callback) { - t.same(key, Buffer.from('key')) - t.same(options, { keyEncoding: 'buffer', valueEncoding: 'utf8' }) - this.nextTick(callback, null, 'x') - } - }, dualManifest, { - keyEncoding: 'buffer', - valueEncoding: { encode: identity, decode: identity, format: 'utf8' } - }) - - if (!deferred) await db.open() - t.same(await db.get(Buffer.from('key')), 'x') - }) - - // NOTE: adapted from encoding-down - test(`put() encodes utf8 key and value (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _put (key, value, options, callback) { - t.is(key, '8') - t.is(value, '4') - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - this.nextTick(callback) - } - }, utf8Manifest) - - if (!deferred) await db.open() - await db.put(8, 4) - }) - - // NOTE: adapted from encoding-down - test(`put() takes encoding options (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _put (key, value, options, callback) { - t.is(key, '[1,"2"]') - t.is(value, '{"x":3}') - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - this.nextTick(callback) - } - }, utf8Manifest) - - if (!deferred) await db.open() - await db.put([1, '2'], { x: 3 }, { keyEncoding: 'json', valueEncoding: 'json' }) - }) - - // NOTE: adapted from encoding-down - test(`del() encodes utf8 key (deferred: ${deferred})`, async function (t) { - t.plan(2) - - const db = mockLevel({ - _del (key, options, callback) { - t.is(key, '2') - t.is(options.keyEncoding, 'utf8') - this.nextTick(callback) - } - }, utf8Manifest) - - if (!deferred) await db.open() - await db.del(2) - }) - - // NOTE: adapted from encoding-down - test(`del() takes keyEncoding option (deferred: ${deferred})`, async function (t) { - t.plan(2) - - const db = mockLevel({ - _del (key, options, callback) { - t.is(key, '[1,"2"]') - t.is(options.keyEncoding, 'utf8') - this.nextTick(callback) - } - }, utf8Manifest) - - if (!deferred) await db.open() - await db.del([1, '2'], { keyEncoding: 'json' }) - }) - - test(`getMany() encodes utf8 key (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _getMany (keys, options, callback) { - t.same(keys, ['8', '29']) - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - this.nextTick(callback, null, ['foo', 'bar']) - } - }, utf8Manifest) - - if (!deferred) await db.open() - t.same(await db.getMany([8, 29]), ['foo', 'bar']) - }) - - test(`getMany() takes encoding options (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _getMany (keys, options, callback) { - t.same(keys, ['[1,"2"]', '"x"']) - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - this.nextTick(callback, null, ['123', '"hi"']) - } - }, utf8Manifest) - - if (!deferred) await db.open() - t.same(await db.getMany([[1, '2'], 'x'], { keyEncoding: 'json', valueEncoding: 'json' }), [123, 'hi']) - }) - - test(`getMany() with custom value encoding that wants a buffer (deferred: ${deferred})`, async function (t) { - t.plan(3) - - const db = mockLevel({ - _getMany (keys, options, callback) { - t.same(keys, ['key']) - t.same(options, { keyEncoding: 'utf8', valueEncoding: 'buffer' }) - this.nextTick(callback, null, [Buffer.alloc(1)]) - } - }, dualManifest, { - keyEncoding: 'utf8', - valueEncoding: { encode: identity, decode: identity, format: 'buffer' } - }) - - if (!deferred) await db.open() - t.same(await db.getMany(['key']), [Buffer.alloc(1)]) - }) - - test(`getMany() with custom value encoding that wants a string (deferred: ${deferred})`, async function (t) { - t.plan(3) - - const db = mockLevel({ - _getMany (keys, options, callback) { - t.same(keys, [Buffer.from('key')]) - t.same(options, { keyEncoding: 'buffer', valueEncoding: 'utf8' }) - this.nextTick(callback, null, ['x']) - } - }, dualManifest, { - keyEncoding: 'buffer', - valueEncoding: { encode: identity, decode: identity, format: 'utf8' } - }) - - if (!deferred) await db.open() - t.same(await db.getMany([Buffer.from('key')]), ['x']) - }) - - // NOTE: adapted from encoding-down - test(`chainedBatch.put() and del() encode utf8 key and value (deferred: ${deferred})`, async function (t) { - t.plan(deferred ? 2 : 4) - - let db - - if (deferred) { - db = mockLevel({ - _batch (array, options, callback) { - t.same(array, [ - { type: 'put', key: '1', value: '2', keyEncoding: 'utf8', valueEncoding: 'utf8' }, - { type: 'del', key: '3', keyEncoding: 'utf8' } - ]) - t.same(options, {}) - this.nextTick(callback) - } - }, utf8Manifest) - } else { - db = mockLevel({ - _chainedBatch () { - return mockChainedBatch(this, { - _put: function (key, value, options) { - t.same({ key, value }, { key: '1', value: '2' }) - t.same(options, { keyEncoding: 'utf8', valueEncoding: 'utf8' }) - }, - _del: function (key, options) { - t.is(key, '3') - t.same(options, { keyEncoding: 'utf8' }) - } - }) - } - }, utf8Manifest) - } - - if (!deferred) await db.open() - await db.batch().put(1, 2).del(3).write() - }) - - // NOTE: adapted from encoding-down - test(`chainedBatch.put() and del() take encoding options (deferred: ${deferred})`, async function (t) { - t.plan(deferred ? 2 : 4) - - let db - - const putOptions = { keyEncoding: 'json', valueEncoding: 'json' } - const delOptions = { keyEncoding: 'json' } - - if (deferred) { - db = mockLevel({ - _batch (array, options, callback) { - t.same(array, [ - { type: 'put', key: '"1"', value: '{"x":[2]}', keyEncoding: 'utf8', valueEncoding: 'utf8' }, - { type: 'del', key: '"3"', keyEncoding: 'utf8' } - ]) - t.same(options, {}) - this.nextTick(callback) - } - }, utf8Manifest) - } else { - db = mockLevel({ - _chainedBatch () { - return mockChainedBatch(this, { - _put: function (key, value, options) { - t.same({ key, value }, { key: '"1"', value: '{"x":[2]}' }) - t.same(options, { keyEncoding: 'utf8', valueEncoding: 'utf8' }) - }, - _del: function (key, options) { - t.is(key, '"3"') - t.same(options, { keyEncoding: 'utf8' }) - } - }) - } - }, utf8Manifest) - } - - if (!deferred) await db.open() - await db.batch().put('1', { x: [2] }, putOptions).del('3', delOptions).write() - }) - - // NOTE: adapted from encoding-down - test(`clear() receives keyEncoding option (deferred: ${deferred})`, async function (t) { - t.plan(1) - - const db = mockLevel({ - _clear: function (options, callback) { - t.same(options, { keyEncoding: 'utf8', reverse: false, limit: -1 }) - this.nextTick(callback) - } - }, utf8Manifest) - - if (!deferred) await db.open() - await db.clear() - }) - - test(`clear() takes keyEncoding option (deferred: ${deferred})`, async function (t) { - t.plan(1) - - const db = mockLevel({ - _clear: function (options, callback) { - t.same(options, { keyEncoding: 'utf8', gt: '"a"', reverse: false, limit: -1 }) - this.nextTick(callback) - } - }, utf8Manifest) - - if (!deferred) await db.open() - await db.clear({ keyEncoding: 'json', gt: 'a' }) - }) - - // NOTE: adapted from encoding-down - test(`clear() encodes range options (deferred: ${deferred})`, async function (t) { - t.plan(5) - - const keyEncoding = { - format: 'utf8', - encode: function (key) { - return 'encoded_' + key - }, - decode: identity - } - - const db = mockLevel({ - _clear: function (options, callback) { - t.is(options.gt, 'encoded_1') - t.is(options.gte, 'encoded_2') - t.is(options.lt, 'encoded_3') - t.is(options.lte, 'encoded_4') - t.is(options.foo, 5) - this.nextTick(callback) - } - }, utf8Manifest, { keyEncoding }) - - if (!deferred) await db.open() - await db.clear({ gt: 1, gte: 2, lt: 3, lte: 4, foo: 5 }) - }) - - // NOTE: adapted from encoding-down - test(`clear() does not strip nullish range options (deferred: ${deferred})`, async function (t) { - t.plan(12) - - const db1 = mockLevel({ - _clear: function (options, callback) { - t.is(options.gt, '\x00', 'encoded null') - t.is(options.gte, '\x00', 'encoded null') - t.is(options.lt, '\x00', 'encoded null') - t.is(options.lte, '\x00', 'encoded null') - this.nextTick(callback) - } - }, utf8Manifest, { keyEncoding: nullishEncoding, valueEncoding: nullishEncoding }) - - const db2 = mockLevel({ - _clear: function (options, callback) { - t.is(hasOwnProperty.call(options, 'gt'), true) - t.is(hasOwnProperty.call(options, 'gte'), true) - t.is(hasOwnProperty.call(options, 'lt'), true) - t.is(hasOwnProperty.call(options, 'lte'), true) - - t.is(options.gt, '\xff', 'encoded undefined') - t.is(options.gte, '\xff', 'encoded undefined') - t.is(options.lt, '\xff', 'encoded undefined') - t.is(options.lte, '\xff', 'encoded undefined') - - this.nextTick(callback) - } - }, utf8Manifest, { keyEncoding: nullishEncoding, valueEncoding: nullishEncoding }) - - if (!deferred) { - await Promise.all([db1.open(), db2.open()]) - } - - const promise1 = db1.clear({ - gt: null, - gte: null, - lt: null, - lte: null - }) - - const promise2 = db2.clear({ - gt: undefined, - gte: undefined, - lt: undefined, - lte: undefined - }) - - await Promise.all([promise1, promise2]) - }) - - // NOTE: adapted from encoding-down - test(`clear() does not add nullish range options (deferred: ${deferred})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - _clear: function (options, callback) { - t.is(hasOwnProperty.call(options, 'gt'), false) - t.is(hasOwnProperty.call(options, 'gte'), false) - t.is(hasOwnProperty.call(options, 'lt'), false) - t.is(hasOwnProperty.call(options, 'lte'), false) - this.nextTick(callback) - } - }) - - if (!deferred) await db.open() - await db.clear({}) - }) -} diff --git a/node_modules/abstract-level/test/self/iterator-test.js b/node_modules/abstract-level/test/self/iterator-test.js deleted file mode 100644 index 979b005..0000000 --- a/node_modules/abstract-level/test/self/iterator-test.js +++ /dev/null @@ -1,829 +0,0 @@ -'use strict' - -const test = require('tape') -const { Buffer } = require('buffer') -const { AbstractLevel } = require('../..') -const { AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('../..') -const { mockLevel, mockIterator, nullishEncoding } = require('../util') - -const identity = (v) => v -const utf8Manifest = { encodings: { utf8: true } } -const dualManifest = { encodings: { utf8: true, buffer: true } } -const tripleManifest = { encodings: { utf8: true, buffer: true, view: true } } - -for (const deferred of [false, true]) { - // Also test default fallback implementations of keys() and values() - for (const [mode, def] of [['iterator', false], ['keys', false], ['values', false], ['keys', true], ['values', true]]) { - const Ctor = mode === 'iterator' || def ? AbstractIterator : mode === 'keys' ? AbstractKeyIterator : AbstractValueIterator - const privateMethod = def ? '_iterator' : '_' + mode - const publicMethod = mode - - test(`${mode}() (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(4) - - let called = false - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(this, db, 'thisArg is correct') - t.is(arguments.length, 1, 'got one argument') - - const kvOptions = mode === 'iterator' || def - ? { keys: mode !== 'values', values: mode !== 'keys' } - : {} - - t.same(options, { - reverse: false, - limit: -1, - keyEncoding: 'utf8', - valueEncoding: 'utf8', - ...kvOptions - }) - - called = true - return new Ctor(this, options) - } - } - - const db = new MockLevel(tripleManifest) - if (!deferred) await db.open() - - db[publicMethod]() - t.is(called, !deferred) - if (deferred) await db.open() - }) - - test(`${mode}() with custom options (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(3) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.foo, 123) - t.is(options.reverse, true) - t.is(options.limit, 1) - - return new Ctor(this, options) - } - } - - const db = new MockLevel(tripleManifest) - if (!deferred) await db.open() - db[publicMethod]({ foo: 123, reverse: true, limit: 1 }) - if (deferred) await db.open() - }) - - for (const limit of [2, 0]) { - test(`${mode}().next() skips _next() when limit ${limit} is reached (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - let calls = 0 - let yielded = 0 - - class MockIterator extends Ctor { - _next (callback) { - calls++ - - if (mode === 'iterator' || def) { - this.nextTick(callback, null, 'a', 'a') - } else { - this.nextTick(callback, null, 'a') - } - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - const it = db[publicMethod]({ limit }) - - for (let i = 0; i < limit + 2; i++) { - const item = await it.next() - if (item === undefined) break - yielded++ - } - - t.is(it.count, limit, 'final count matches limit') - t.is(calls, limit) - t.is(yielded, limit) - }) - - test(`${mode}().nextv() skips _nextv() when limit ${limit} is reached (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - let calls = 0 - let yielded = 0 - - class MockIterator extends Ctor { - _nextv (size, options, callback) { - calls++ - - if (mode === 'iterator' || def) { - this.nextTick(callback, null, [['a', 'a']]) - } else { - this.nextTick(callback, null, ['a']) - } - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - const it = db[publicMethod]({ limit }) - - for (let i = 0; i < limit + 2; i++) { - const items = await it.nextv(1) - yielded += items.length - if (items.length === 0) break - } - - t.is(it.count, limit, 'final count matches limit') - t.is(calls, limit) - t.is(yielded, limit) - }) - - test(`${mode}().all() skips _all() when limit ${limit} is reached (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - let nextCount = 0 - class MockIterator extends Ctor { - _next (callback) { - if (++nextCount > 10) { - throw new Error('Potential infinite loop') - } else if (mode === 'iterator' || def) { - this.nextTick(callback, null, 'a', 'a') - } else { - this.nextTick(callback, null, 'a') - } - } - - _all (options, callback) { - t.fail('should not be called') - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - const it = db[publicMethod]({ limit }) - - // Use next() because all() auto-closes and thus can't be used twice atm - for (let i = 0; i < limit; i++) await it.next() - - t.same(await it.all(), []) - }) - } - - test(`${mode}().nextv() reduces size for _nextv() when near limit (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _nextv (size, options, callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, Array(size).fill(['a', 'a'])) - } else { - this.nextTick(callback, null, Array(size).fill('a')) - } - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - const it = db[publicMethod]({ limit: 3 }) - - t.is((await it.nextv(2)).length, 2) - t.is((await it.nextv(2)).length, 1) - t.is((await it.nextv(2)).length, 0) - }) - - test(`${mode}().count increments by next(), nextv() and all() (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, 'a', 'a') - } else { - this.nextTick(callback, null, 'a') - } - } - - _nextv (size, options, callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, [['a', 'a'], ['b', 'b']]) - } else { - this.nextTick(callback, null, ['a', 'b']) - } - } - - _all (options, callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, [['c', 'c'], ['d', 'd'], ['e', 'e']]) - } else { - this.nextTick(callback, null, ['c', 'd', 'e']) - } - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - const it = db[publicMethod]() - - for (let i = 0; i < 2; i++) { - t.isNot(await it.next(), undefined) // 2 * 1 = 2 - t.is((await it.nextv(2)).length, 2) // 2 * 2 = 4 - } - - t.is(it.count, 2 + 4) - t.is((await it.all()).length, 3) - t.is(it.count, 2 + 4 + 3) - }) - - test(`${mode}() forwards encoding options (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(3) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'buffer') - - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, '281', Buffer.from('a')) - } else if (mode === 'keys') { - this.nextTick(callback, null, '281') - } else { - this.nextTick(callback, null, Buffer.from('a')) - } - } - } - - const db = new MockLevel(dualManifest) - if (!deferred) await db.open() - - const item = await db[publicMethod]({ keyEncoding: 'json', valueEncoding: 'hex' }).next() - t.same(item, mode === 'iterator' ? [281, '61'] : mode === 'keys' ? 281 : '61') - }) - - // NOTE: adapted from encoding-down - test(`${mode}() with custom encodings that want a buffer (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(5) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.keyEncoding, 'buffer') - t.is(options.valueEncoding, 'buffer') - - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, Buffer.from('a'), Buffer.from('b')) - } else if (mode === 'keys') { - this.nextTick(callback, null, Buffer.from('a')) - } else { - this.nextTick(callback, null, Buffer.from('b')) - } - } - } - - const db = new MockLevel(dualManifest) - const encoding = { encode: spy(identity), decode: spy(identity), format: 'buffer' } - if (!deferred) await db.open() - - const it = db[publicMethod]({ keyEncoding: encoding, valueEncoding: encoding }) - const item = await it.next() - - t.is(encoding.encode.calls, 0, 'did not need to encode anything') - t.is(encoding.decode.calls, mode === 'iterator' ? 2 : 1) - t.same(item, mode === 'iterator' ? [Buffer.from('a'), Buffer.from('b')] : Buffer.from(mode === 'keys' ? 'a' : 'b')) - }) - - // NOTE: adapted from encoding-down - test(`${mode}() with custom encodings that want a string (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(5) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.keyEncoding, 'utf8') - t.is(options.valueEncoding, 'utf8') - - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, 'a', 'b') - } else if (mode === 'keys') { - this.nextTick(callback, null, 'a') - } else { - this.nextTick(callback, null, 'b') - } - } - } - - const db = new MockLevel(dualManifest) - const encoding = { encode: spy(identity), decode: spy(identity), format: 'utf8' } - if (!deferred) await db.open() - - const it = db[publicMethod]({ keyEncoding: encoding, valueEncoding: encoding }) - const item = await it.next() - - t.is(encoding.encode.calls, 0, 'did not need to encode anything') - t.is(encoding.decode.calls, mode === 'iterator' ? 2 : 1) - t.same(item, mode === 'iterator' ? ['a', 'b'] : mode === 'keys' ? 'a' : 'b') - }) - - // NOTE: adapted from encoding-down - test(`${mode}() encodes range options (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(6) - - let calls = 0 - const keyEncoding = { - format: 'utf8', - encode (key) { - calls++ - return 'encoded_' + key - }, - decode: identity - } - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.gt, 'encoded_3') - t.is(options.gte, 'encoded_4') - t.is(options.lt, 'encoded_5') - t.is(options.lte, 'encoded_6') - t.is(options.foo, 7) - return new Ctor(this, options) - } - } - - const db = new MockLevel(utf8Manifest, { keyEncoding }) - if (!deferred) await db.open() - await db[publicMethod]({ gt: 3, gte: 4, lt: 5, lte: 6, foo: 7 }).next() - t.is(calls, 4) - }) - - // NOTE: adapted from encoding-down - test(`${mode}() does not strip nullish range options (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(12) - - const db1 = mockLevel({ - [privateMethod] (options) { - t.is(options.gt, '\x00', 'encoded null') - t.is(options.gte, '\x00', 'encoded null') - t.is(options.lt, '\x00', 'encoded null') - t.is(options.lte, '\x00', 'encoded null') - - return new Ctor(this, options) - } - }, utf8Manifest, { keyEncoding: nullishEncoding, valueEncoding: nullishEncoding }) - - const db2 = mockLevel({ - [privateMethod] (options) { - t.is(hasOwnProperty.call(options, 'gt'), true) - t.is(hasOwnProperty.call(options, 'gte'), true) - t.is(hasOwnProperty.call(options, 'lt'), true) - t.is(hasOwnProperty.call(options, 'lte'), true) - - t.is(options.gt, '\xff', 'encoded undefined') - t.is(options.gte, '\xff', 'encoded undefined') - t.is(options.lt, '\xff', 'encoded undefined') - t.is(options.lte, '\xff', 'encoded undefined') - - return new Ctor(this, options) - } - }, utf8Manifest, { keyEncoding: nullishEncoding, valueEncoding: nullishEncoding }) - - if (!deferred) { - await Promise.all([db1.open(), db2.open()]) - } - - const promise1 = db1[publicMethod]({ - gt: null, - gte: null, - lt: null, - lte: null - }).next() - - const promise2 = db2[publicMethod]({ - gt: undefined, - gte: undefined, - lt: undefined, - lte: undefined - }).next() - - return Promise.all([promise1, promise2]) - }) - - // NOTE: adapted from encoding-down - test(`${mode}() does not add nullish range options (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(4) - - const db = mockLevel({ - [privateMethod] (options) { - t.is(hasOwnProperty.call(options, 'gt'), false) - t.is(hasOwnProperty.call(options, 'gte'), false) - t.is(hasOwnProperty.call(options, 'lt'), false) - t.is(hasOwnProperty.call(options, 'lte'), false) - - return new Ctor(this, options) - } - }) - - if (!deferred) await db.open() - await db[publicMethod]({}).next() - }) - - // NOTE: adapted from encoding-down - test(`${mode}() encodes seek target (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(2) - - const db = mockLevel({ - [privateMethod] (options) { - return new MockIterator(this, options) - } - }, utf8Manifest, { keyEncoding: 'json' }) - - class MockIterator extends Ctor { - _seek (target, options) { - t.is(target, '"a"', 'encoded once') - t.same(options, { keyEncoding: 'utf8' }) - } - } - - if (!deferred) await db.open() - const it = db[publicMethod]() - it.seek('a') - await it.next() - }) - - // NOTE: adapted from encoding-down - test(`${mode}() encodes seek target with custom encoding (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(1) - - const targets = [] - const db = mockLevel({ - [privateMethod] (options) { - return new MockIterator(this, options) - } - }, utf8Manifest) - - class MockIterator extends Ctor { - _seek (target) { - targets.push(target) - } - } - - if (!deferred) await db.open() - - db[publicMethod]().seek('a') - db[publicMethod]({ keyEncoding: 'json' }).seek('a') - db[publicMethod]().seek('b', { keyEncoding: 'json' }) - - await db.open() - t.same(targets, ['a', '"a"', '"b"'], 'encoded targets') - }) - - // NOTE: adapted from encoding-down - test(`${mode}() encodes nullish seek target (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(1) - - const targets = [] - const db = mockLevel({ - [privateMethod] (options) { - return new MockIterator(this, options) - } - }, utf8Manifest, { keyEncoding: { encode: String, decode: identity, format: 'utf8' } }) - - class MockIterator extends Ctor { - _seek (target) { - targets.push(target) - } - } - - if (!deferred) await db.open() - - // Unlike keys, nullish targets should not be rejected; - // assume that the encoding gives these types meaning. - db[publicMethod]().seek(null) - db[publicMethod]().seek(undefined) - - await db.open() - t.same(targets, ['null', 'undefined'], 'encoded') - }) - - test(`${mode}() has default nextv() (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - const sizes = [[1, [0]], [1, [1]], [2, [2]], [3, [3]]] - t.plan(sizes.length * 2) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - let pos = 0 - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, 'k' + pos, 'v' + (pos++)) - } else if (mode === 'keys') { - this.nextTick(callback, null, 'k' + (pos++)) - } else { - this.nextTick(callback, null, 'v' + (pos++)) - } - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - let expectedPos = 0 - const it = db[publicMethod]() - - for (const [size, args] of sizes) { - const actual = await it.nextv(...args) - const expected = [] - - for (let i = 0; i < size; i++) { - const pos = expectedPos++ - if (mode === 'iterator') expected.push(['k' + pos, 'v' + pos]) - else if (mode === 'keys') expected.push('k' + pos) - else expected.push('v' + pos) - } - - t.is(actual.length, size) - t.same(actual, expected) - } - }) - - test(`${mode}() default nextv() forwards next() error (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(2) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _next (callback) { - t.pass('called') - this.nextTick(callback, new Error('test')) - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - try { - await db[publicMethod]().nextv(10) - } catch (err) { - t.is(err.message, 'test') - } - }) - - test(`${mode}() has default all() (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(8) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - let pos = 0 - class MockIterator extends Ctor { - _nextv (size, options, callback) { - t.is(size, 1000) - t.same(options, {}) - - if (pos === 4) { - this.nextTick(callback, null, []) - } else if (mode === 'iterator' || def) { - this.nextTick(callback, null, [[String(pos++), 'a'], [String(pos++), 'b']]) - } else if (mode === 'keys') { - this.nextTick(callback, null, [String(pos++), String(pos++)]) - } else { - pos += 2 - this.nextTick(callback, null, ['a', 'b']) - } - } - - _close (callback) { - t.pass('closed') - this.nextTick(callback) - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - t.same(await db[publicMethod]().all(), [ - ['0', 'a'], - ['1', 'b'], - ['2', 'a'], - ['3', 'b'] - ].map(kv => mode === 'iterator' ? kv : kv[mode === 'keys' ? 0 : 1])) - }) - - test(`${mode}() default all() forwards nextv() error (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(2) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _nextv (size, options, callback) { - t.pass('called') - this.nextTick(callback, new Error('test')) - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - try { - await db[publicMethod]().all() - } catch (err) { - t.is(err.message, 'test') - } - }) - - test(`${mode}() custom all() (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(3) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _all (options, callback) { - t.same(options, {}) - - if (mode === 'iterator' || def) { - this.nextTick(callback, null, [['k0', 'v0'], ['k1', 'v1']]) - } else if (mode === 'keys') { - this.nextTick(callback, null, ['k0', 'k1']) - } else { - this.nextTick(callback, null, ['v0', 'v1']) - } - } - - _close (callback) { - t.pass('closed') - this.nextTick(callback) - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - t.same(await db[publicMethod]().all(), [ - ['k0', 'v0'], - ['k1', 'v1'] - ].map(kv => mode === 'iterator' ? kv : kv[mode === 'keys' ? 0 : 1])) - }) - - test(`${mode}() custom all() forwards error and closes (deferred: ${deferred}, default implementation: ${def})`, async function (t) { - t.plan(3) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _all (options, callback) { - t.pass('_all called') - this.nextTick(callback, new Error('test')) - } - - _close (callback) { - t.pass('closed') - this.nextTick(callback) - } - } - - const db = new MockLevel(utf8Manifest) - if (!deferred) await db.open() - - try { - await db[publicMethod]().all() - } catch (err) { - t.is(err.message, 'test') - } - }) - } -} - -for (const deferred of [false, true]) { - // NOTE: adapted from encoding-down - test(`iterator() skips decoding keys if options.keys is false (deferred: ${deferred})`, async function (t) { - t.plan(3) - - const keyEncoding = { - format: 'utf8', - decode (key) { - t.fail('should not be called') - }, - encode: identity - } - - const db = mockLevel({ - _iterator (options) { - t.is(options.keys, false) - - return mockIterator(this, options, { - _next (callback) { - this.nextTick(callback, null, '', 'value') - } - }) - } - }, utf8Manifest, { keyEncoding }) - - if (!deferred) await db.open() - const [key, value] = await db.iterator({ keys: false }).next() - - t.is(key, undefined, 'normalized key to undefined') - t.is(value, 'value', 'got value') - }) - - // NOTE: adapted from encoding-down - test(`iterator() skips decoding values if options.values is false (deferred: ${deferred})`, async function (t) { - t.plan(3) - - const valueEncoding = { - format: 'utf8', - decode (value) { - t.fail('should not be called') - }, - encode: identity - } - - const db = mockLevel({ - _iterator (options) { - t.is(options.values, false) - - return mockIterator(this, options, { - _next (callback) { - callback(null, 'key', '') - } - }) - } - }, utf8Manifest, { valueEncoding }) - - if (!deferred) await db.open() - const [key, value] = await db.iterator({ values: false }).next() - - t.is(key, 'key', 'got key') - t.is(value, undefined, 'normalized value to undefined') - }) -} - -function spy (fn) { - const wrapped = function (...args) { - wrapped.calls++ - return fn(...args) - } - wrapped.calls = 0 - return wrapped -} diff --git a/node_modules/abstract-level/test/self/sublevel-test.js b/node_modules/abstract-level/test/self/sublevel-test.js deleted file mode 100644 index b6fcbb2..0000000 --- a/node_modules/abstract-level/test/self/sublevel-test.js +++ /dev/null @@ -1,931 +0,0 @@ -'use strict' - -const test = require('tape') -const { Buffer } = require('buffer') -const { AbstractLevel, AbstractSublevel } = require('../..') -const { AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('../..') -const nextTick = AbstractLevel.prototype.nextTick - -class NoopLevel extends AbstractLevel { - constructor (...args) { - super( - { encodings: { utf8: true, buffer: true, view: true } }, - ...args - ) - } -} - -test('sublevel is extensible', function (t) { - t.plan(6) - - class MockLevel extends AbstractLevel { - _sublevel (name, options) { - t.is(name, 'test') - t.same(options, { separator: '!', customOption: 123 }) - - return new MockSublevel(this, name, { - ...options, - manifest: { - encodings: { ignored: true }, - additionalMethods: { test: true }, - events: { foo: true } - } - }) - } - } - - class MockSublevel extends AbstractSublevel { - test () { - this.emit('foo') - } - } - - const db = new MockLevel({ - encodings: { utf8: true }, - additionalMethods: { ignored: true }, - events: { ignored: true } - }) - - const sub = db.sublevel('test', { customOption: 123 }) - - t.is(sub.supports.encodings.ignored, undefined) - t.same(sub.supports.additionalMethods, { test: true }) - t.same(sub.supports.events, { - foo: true, - - // Added by AbstractLevel - opening: true, - open: true, - closing: true, - closed: true, - put: true, - del: true, - batch: true, - clear: true - }) - - sub.on('foo', () => t.pass('emitted')) - sub.test() -}) - -// NOTE: adapted from subleveldown -test('sublevel prefix and options', function (t) { - t.test('empty prefix', function (t) { - const sub = new NoopLevel().sublevel('') - t.is(sub.prefix, '!!') - t.end() - }) - - t.test('prefix without options', function (t) { - const sub = new NoopLevel().sublevel('prefix') - t.is(sub.prefix, '!prefix!') - t.end() - }) - - t.test('prefix and separator option', function (t) { - const sub = new NoopLevel().sublevel('prefix', { separator: '%' }) - t.is(sub.prefix, '%prefix%') - t.end() - }) - - t.test('separator is trimmed from prefix', function (t) { - const sub1 = new NoopLevel().sublevel('!prefix') - t.is(sub1.prefix, '!prefix!') - - const sub2 = new NoopLevel().sublevel('prefix!') - t.is(sub2.prefix, '!prefix!') - - const sub3 = new NoopLevel().sublevel('!!prefix!!') - t.is(sub3.prefix, '!prefix!') - - const sub4 = new NoopLevel().sublevel('@prefix@', { separator: '@' }) - t.is(sub4.prefix, '@prefix@') - - t.end() - }) - - t.test('repeated separator can not result in empty prefix', function (t) { - const sub = new NoopLevel().sublevel('!!!!') - t.is(sub.prefix, '!!') - t.end() - }) - - t.test('invalid sublevel prefix', function (t) { - t.throws(() => new NoopLevel().sublevel('foo\x05'), (err) => err.code === 'LEVEL_INVALID_PREFIX') - t.throws(() => new NoopLevel().sublevel('foo\xff'), (err) => err.code === 'LEVEL_INVALID_PREFIX') - t.throws(() => new NoopLevel().sublevel('foo!', { separator: '@' }), (err) => err.code === 'LEVEL_INVALID_PREFIX') - t.end() - }) - - t.test('legacy sublevel(down) options', function (t) { - t.throws(() => new NoopLevel().sublevel('foo', 'bar'), (err) => err.code === 'LEVEL_LEGACY') - t.throws(() => new NoopLevel().sublevel('foo', { open: () => {} }), (err) => err.code === 'LEVEL_LEGACY') - t.end() - }) - - // See https://github.com/Level/subleveldown/issues/78 - t.test('doubly nested sublevel has correct prefix', async function (t) { - t.plan(1) - - const keys = [] - class MockLevel extends AbstractLevel { - _put (key, value, options, callback) { - keys.push(key) - nextTick(callback) - } - } - - const db = new MockLevel({ encodings: { utf8: true } }) - const sub1 = db.sublevel('1') - const sub2 = sub1.sublevel('2') - const sub3 = sub2.sublevel('3') - - await sub1.put('a', 'value') - await sub2.put('b', 'value') - await sub3.put('c', 'value') - - t.same(keys.sort(), [ - '!1!!2!!3!c', - '!1!!2!b', - '!1!a' - ]) - }) - - t.end() -}) - -test('sublevel.prefixKey()', function (t) { - const db = new AbstractLevel({ encodings: { utf8: true, buffer: true, view: true } }) - const sub = db.sublevel('test') - const textEncoder = new TextEncoder() - - t.same(sub.prefixKey('', 'utf8'), '!test!') - t.same(sub.prefixKey('a', 'utf8'), '!test!a') - - t.same(sub.prefixKey(Buffer.from(''), 'buffer'), Buffer.from('!test!')) - t.same(sub.prefixKey(Buffer.from('a'), 'buffer'), Buffer.from('!test!a')) - - t.same(sub.prefixKey(textEncoder.encode(''), 'view'), textEncoder.encode('!test!')) - t.same(sub.prefixKey(textEncoder.encode('a'), 'view'), textEncoder.encode('!test!a')) - - t.end() -}) - -// NOTE: adapted from subleveldown -test('sublevel manifest and parent db', function (t) { - t.test('sublevel inherits manifest from parent db', function (t) { - const parent = new AbstractLevel({ - encodings: { utf8: true }, - seek: true, - foo: true - }) - const sub = parent.sublevel('') - t.is(sub.supports.foo, true, 'AbstractSublevel inherits from parent') - t.is(sub.supports.seek, true, 'AbstractSublevel inherits from parent') - t.end() - }) - - t.test('sublevel does not support additionalMethods', function (t) { - const parent = new AbstractLevel({ - encodings: { utf8: true }, - additionalMethods: { foo: true } - }) - - // We're expecting that AbstractSublevel removes the additionalMethod - // because it can't automatically prefix any key(-like) arguments - const sub = parent.sublevel('') - t.same(sub.supports.additionalMethods, {}) - t.same(parent.supports.additionalMethods, { foo: true }) - t.is(typeof sub.foo, 'undefined', 'AbstractSublevel does not expose method') - t.end() - }) - - t.test('sublevel.db is set to parent db', function (t) { - const db = new NoopLevel() - const sub = db.sublevel('test') - sub.once('open', function () { - t.ok(sub.db instanceof NoopLevel) - t.end() - }) - }) - - t.end() -}) - -// NOTE: adapted from subleveldown -test('opening & closing sublevel', function (t) { - t.test('error from open() does not bubble up to sublevel', function (t) { - t.plan(5) - - class MockLevel extends AbstractLevel { - _open (opts, cb) { - nextTick(cb, new Error('error from underlying store')) - } - } - - const db = new MockLevel({ encodings: { buffer: true } }) - const sub = db.sublevel('test') - - db.open((err) => { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause && err.cause.message, 'error from underlying store') - }) - - sub.open((err) => { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(err && err.cause && err.cause.code, 'LEVEL_DATABASE_NOT_OPEN') // from db - t.is(err && err.cause && err.cause.cause, undefined) // but does not have underlying error - }) - }) - - t.test('cannot create a sublevel on a closed db', function (t) { - t.plan(4) - - const db = new NoopLevel() - - db.once('open', function () { - db.close(function (err) { - t.error(err, 'no error') - - db.sublevel('test').open(function (err) { - t.is(err && err.code, 'LEVEL_DATABASE_NOT_OPEN', 'sublevel not opened') - - db.open(function (err) { - t.error(err, 'no error') - - db.sublevel('test').on('open', function () { - t.pass('sublevel opened') - }) - }) - }) - }) - }) - }) - - t.test('can close db and sublevel once opened', function (t) { - t.plan(3) - - const db = new NoopLevel() - - db.open(function (err) { - t.ifError(err, 'no open error') - const sub = db.sublevel('test') - - sub.once('open', function () { - db.close(function (err) { - t.ifError(err, 'no close error') - }) - - sub.close(function (err) { - t.ifError(err, 'no close error') - }) - }) - }) - }) - - t.test('sublevel rejects operations if parent db is closed', function (t) { - t.plan(9) - - const db = new NoopLevel() - - db.open(function (err) { - t.ifError(err, 'no open error') - - const sub = db.sublevel('test') - const it = sub.iterator() - - sub.once('open', function () { - db.close(function (err) { - t.ifError(err, 'no close error') - - sub.put('foo', 'bar', verify) - sub.get('foo', verify) - sub.del('foo', verify) - sub.clear(verify) - sub.batch([{ type: 'del', key: 'foo' }], verify) - - it.next(function (err) { - t.is(err.code, 'LEVEL_ITERATOR_NOT_OPEN') - it.close(t.ifError.bind(t)) - }) - - function verify (err) { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - } - }) - }) - }) - }) - - t.test('cannot close db while sublevel is opening', function (t) { - t.plan(5) - - const db = new NoopLevel() - - db.open(function (err) { - t.ifError(err, 'no open error') - const sub = db.sublevel('test') - - sub.open((err) => { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - }) - - db.close(function (err) { - t.ifError(err, 'no close error') - t.is(sub.status, 'closed') - t.is(db.status, 'closed') - }) - }) - }) - - t.test('cannot create sublevel while db is closing', function (t) { - t.plan(5) - - const db = new NoopLevel() - - db.open(function (err) { - t.ifError(err, 'no open error') - - db.close(function (err) { - t.ifError(err, 'no close error') - t.is(db.status, 'closed') - }) - - const sub = db.sublevel('test') - - sub.open((err) => { - t.is(err.code, 'LEVEL_DATABASE_NOT_OPEN') - t.is(sub.status, 'closed') - }) - }) - }) - - t.test('can wrap a sublevel and reopen the wrapped sublevel', function (t) { - const db = new NoopLevel() - const sub1 = db.sublevel('test1') - const sub2 = sub1.sublevel('test2') - - sub2.once('open', function () { - verify() - - sub2.close(function (err) { - t.ifError(err, 'no close error') - - // Prefixes should be the same after closing & reopening - // See https://github.com/Level/subleveldown/issues/78 - sub2.open(function (err) { - t.ifError(err, 'no open error') - verify() - t.end() - }) - }) - }) - - function verify () { - t.is(sub1.prefix, '!test1!', 'sub1 prefix ok') - t.ok(sub1.db instanceof NoopLevel) - t.is(sub2.prefix, '!test1!!test2!', 'sub2 prefix ok') - t.ok(sub2.db instanceof NoopLevel) - } - }) - - // Also test default fallback implementations of keys() and values() - for (const [mode, def] of [['iterator', false], ['keys', false], ['values', false], ['keys', true], ['values', true]]) { - const Ctor = mode === 'iterator' || def ? AbstractIterator : mode === 'keys' ? AbstractKeyIterator : AbstractValueIterator - const privateMethod = def ? '_iterator' : '_' + mode - const publicMethod = mode - - t.test(`error from sublevel.${mode}() bubbles up (default implementation: ${def})`, function (t) { - t.plan(2) - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - class MockIterator extends Ctor { - _next (callback) { - this.nextTick(callback, new Error('next() error from parent database')) - } - } - - const db = new MockLevel({ encodings: { buffer: true } }) - const sub = db.sublevel('test') - const it = sub[publicMethod]() - - it.next(function (err) { - t.is(err.message, 'next() error from parent database') - - it.close(function () { - t.pass('closed') - }) - }) - }) - } - - t.end() -}) - -test('sublevel operations are prefixed', function (t) { - t.test('sublevel.getMany() is prefixed', async function (t) { - t.plan(2) - - class MockLevel extends AbstractLevel { - _getMany (keys, options, callback) { - t.same(keys, ['!test!a', '!test!b']) - t.same(options, { keyEncoding: 'utf8', valueEncoding: 'utf8' }) - nextTick(callback, null, ['1', '2']) - } - } - - const db = new MockLevel({ encodings: { utf8: true } }) - const sub = db.sublevel('test') - - await sub.open() - await sub.getMany(['a', 'b']) - }) - - // Also test default fallback implementations of keys() and values() - for (const [mode, def] of [['iterator', false], ['keys', false], ['values', false], ['keys', true], ['values', true]]) { - const Ctor = mode === 'iterator' || def ? AbstractIterator : mode === 'keys' ? AbstractKeyIterator : AbstractValueIterator - const privateMethod = def ? '_iterator' : '_' + mode - const publicMethod = mode - - for (const deferred of [false, true]) { - t.test(`sublevel ${mode}.seek() target is prefixed (default implementation: ${def}, deferred: ${deferred})`, async function (t) { - t.plan(2) - - class MockIterator extends Ctor { - _seek (target, options) { - t.is(target, '!sub!123') - t.is(options.keyEncoding, 'utf8') - } - } - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - return new MockIterator(this, options) - } - } - - const db = new MockLevel({ encodings: { utf8: true } }) - const sub = db.sublevel('sub', { keyEncoding: 'json' }) - - if (!deferred) await sub.open() - - const it = sub[publicMethod]() - it.seek(123) - - if (deferred) await sub.open() - }) - } - } - - t.test('sublevel.clear() is prefixed', async function (t) { - t.plan(4) - - const calls = [] - class MockLevel extends AbstractLevel { - _clear (options, callback) { - calls.push(options) - nextTick(callback) - } - } - - const db = new MockLevel({ encodings: { utf8: true } }) - const sub = db.sublevel('sub') - - const test = async (options, expected) => { - await sub.clear(options) - t.same(calls.shift(), expected) - } - - await sub.open() - - await test(undefined, { - gte: '!sub!', - lte: '!sub"', - keyEncoding: 'utf8', - reverse: false, - limit: -1 - }) - - await test({ gt: 'a' }, { - gt: '!sub!a', - lte: '!sub"', - keyEncoding: 'utf8', - reverse: false, - limit: -1 - }) - - await test({ gte: 'a', lt: 'x' }, { - gte: '!sub!a', - lt: '!sub!x', - keyEncoding: 'utf8', - reverse: false, - limit: -1 - }) - - await test({ lte: 'x' }, { - gte: '!sub!', - lte: '!sub!x', - keyEncoding: 'utf8', - reverse: false, - limit: -1 - }) - }) - - t.end() -}) - -test('sublevel encodings', function (t) { - // NOTE: adapted from subleveldown - t.test('different sublevels can have different encodings', function (t) { - t.plan(10) - - const puts = [] - const gets = [] - - class MockLevel extends AbstractLevel { - _put (key, value, { keyEncoding, valueEncoding }, callback) { - puts.push({ key, value, keyEncoding, valueEncoding }) - nextTick(callback) - } - - _get (key, { keyEncoding, valueEncoding }, callback) { - gets.push({ key, keyEncoding, valueEncoding }) - nextTick(callback, null, puts.shift().value) - } - } - - const db = new MockLevel({ encodings: { buffer: true, utf8: true } }) - const sub1 = db.sublevel('test1', { valueEncoding: 'json' }) - const sub2 = db.sublevel('test2', { keyEncoding: 'buffer', valueEncoding: 'buffer' }) - - sub1.put('foo', { some: 'json' }, function (err) { - t.error(err, 'no error') - - t.same(puts, [{ - key: '!test1!foo', - value: '{"some":"json"}', - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }]) - - sub1.get('foo', function (err, value) { - t.error(err, 'no error') - t.same(value, { some: 'json' }) - t.same(gets.shift(), { - key: '!test1!foo', - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }) - - sub2.put(Buffer.from([1, 2]), Buffer.from([3]), function (err) { - t.error(err, 'no error') - - t.same(puts, [{ - key: Buffer.from('!test2!\x01\x02'), - value: Buffer.from([3]), - keyEncoding: 'buffer', - valueEncoding: 'buffer' - }]) - - sub2.get(Buffer.from([1, 2]), function (err, value) { - t.error(err, 'no error') - t.same(value, Buffer.from([3])) - t.same(gets.shift(), { - key: Buffer.from('!test2!\x01\x02'), - keyEncoding: 'buffer', - valueEncoding: 'buffer' - }) - }) - }) - }) - }) - }) - - t.test('sublevel indirectly supports transcoded encoding', function (t) { - t.plan(5) - - class MockLevel extends AbstractLevel { - _put (key, value, { keyEncoding, valueEncoding }, callback) { - t.same({ key, value, keyEncoding, valueEncoding }, { - key: Buffer.from('!test!foo'), - value: Buffer.from('{"some":"json"}'), - keyEncoding: 'buffer', - valueEncoding: 'buffer' - }) - nextTick(callback) - } - - _get (key, { keyEncoding, valueEncoding }, callback) { - t.same({ key, keyEncoding, valueEncoding }, { - key: Buffer.from('!test!foo'), - keyEncoding: 'buffer', - valueEncoding: 'buffer' - }) - nextTick(callback, null, Buffer.from('{"some":"json"}')) - } - } - - const db = new MockLevel({ encodings: { buffer: true } }) - const sub = db.sublevel('test', { valueEncoding: 'json' }) - - sub.put('foo', { some: 'json' }, function (err) { - t.error(err, 'no error') - - sub.get('foo', function (err, value) { - t.error(err, 'no error') - t.same(value, { some: 'json' }) - }) - }) - }) - - t.test('concatenating sublevel Buffer keys', function (t) { - t.plan(10) - - const key = Buffer.from('00ff', 'hex') - const prefixedKey = Buffer.concat([Buffer.from('!test!'), key]) - - class MockLevel extends AbstractLevel { - _put (key, value, options, callback) { - t.is(options.keyEncoding, 'buffer') - t.is(options.valueEncoding, 'buffer') - t.same(key, prefixedKey) - t.same(value, Buffer.from('bar')) - nextTick(callback) - } - - _get (key, options, callback) { - t.is(options.keyEncoding, 'buffer') - t.is(options.valueEncoding, 'buffer') - t.same(key, prefixedKey) - nextTick(callback, null, Buffer.from('bar')) - } - } - - const db = new MockLevel({ encodings: { buffer: true } }) - const sub = db.sublevel('test', { keyEncoding: 'buffer' }) - - sub.put(key, 'bar', function (err) { - t.ifError(err) - sub.get(key, function (err, value) { - t.ifError(err) - t.is(value, 'bar') - }) - }) - }) - - t.test('concatenating sublevel Uint8Array keys', function (t) { - t.plan(10) - - const key = new Uint8Array([0, 255]) - const textEncoder = new TextEncoder() - const prefix = textEncoder.encode('!test!') - const prefixedKey = new Uint8Array(prefix.byteLength + key.byteLength) - - prefixedKey.set(prefix, 0) - prefixedKey.set(key, prefix.byteLength) - - class MockLevel extends AbstractLevel { - _put (key, value, options, callback) { - t.is(options.keyEncoding, 'view') - t.is(options.valueEncoding, 'view') - t.same(key, prefixedKey) - t.same(value, textEncoder.encode('bar')) - nextTick(callback) - } - - _get (key, options, callback) { - t.is(options.keyEncoding, 'view') - t.is(options.valueEncoding, 'view') - t.same(key, prefixedKey) - nextTick(callback, null, textEncoder.encode('bar')) - } - } - - const db = new MockLevel({ encodings: { view: true } }) - const sub = db.sublevel('test', { keyEncoding: 'view' }) - - sub.put(key, 'bar', function (err) { - t.ifError(err) - sub.get(key, function (err, value) { - t.ifError(err) - t.is(value, 'bar') - }) - }) - }) - - // Also test default fallback implementations of keys() and values() - for (const [mode, def] of [['iterator', false], ['keys', false], ['values', false], ['keys', true], ['values', true]]) { - const Ctor = mode === 'iterator' || def ? AbstractIterator : mode === 'keys' ? AbstractKeyIterator : AbstractValueIterator - const privateMethod = def ? '_iterator' : '_' + mode - const publicMethod = mode - - t.test(`unfixing sublevel.${mode}() Buffer keys (default implementation: ${def})`, function (t) { - t.plan(4) - - const testKey = Buffer.from('00ff', 'hex') - const prefixedKey = Buffer.concat([Buffer.from('!test!'), testKey]) - - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, prefixedKey, 'bar') - } else if (mode === 'keys') { - this.nextTick(callback, null, prefixedKey) - } else { - this.nextTick(callback, null, 'bar') - } - } - } - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.keyEncoding, 'buffer') - t.is(options.valueEncoding, 'utf8') - return new MockIterator(this, options) - } - } - - const db = new MockLevel({ encodings: { buffer: true, view: true, utf8: true } }) - const sub = db.sublevel('test', { keyEncoding: 'buffer' }) - - sub[publicMethod]().next(function (err, keyOrValue) { - t.ifError(err) - t.same(keyOrValue, mode === 'values' ? 'bar' : testKey) - }) - }) - - t.test(`unfixing sublevel.${mode}() Uint8Array keys (default implementation: ${def})`, function (t) { - t.plan(4) - - const testKey = new Uint8Array([0, 255]) - const textEncoder = new TextEncoder() - const prefix = textEncoder.encode('!test!') - const prefixedKey = new Uint8Array(prefix.byteLength + testKey.byteLength) - - prefixedKey.set(prefix, 0) - prefixedKey.set(testKey, prefix.byteLength) - - class MockIterator extends Ctor { - _next (callback) { - if (mode === 'iterator' || def) { - this.nextTick(callback, null, prefixedKey, 'bar') - } else if (mode === 'keys') { - this.nextTick(callback, null, prefixedKey) - } else { - this.nextTick(callback, null, 'bar') - } - } - } - - class MockLevel extends AbstractLevel { - [privateMethod] (options) { - t.is(options.keyEncoding, 'view') - t.is(options.valueEncoding, 'utf8') - return new MockIterator(this, options) - } - } - - const db = new MockLevel({ encodings: { buffer: true, view: true, utf8: true } }) - const sub = db.sublevel('test', { keyEncoding: 'view' }) - - sub[publicMethod]().next(function (err, keyOrValue) { - t.ifError(err) - t.same(keyOrValue, mode === 'values' ? 'bar' : testKey) - }) - }) - } - - t.end() -}) - -for (const chained of [false, true]) { - for (const deferred of [false, true]) { - test(`batch() with sublevel per operation (chained: ${chained}, deferred: ${deferred})`, async function (t) { - t.plan(6) - - class MockLevel extends AbstractLevel { - _batch (operations, options, callback) { - t.same(operations, [ - { - type: 'put', - sublevel: null, - key: '!1!a', - value: '{"foo":123}', - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }, - { - type: 'put', - sublevel: null, - key: '!2!a-y', - value: '[object Object]', - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }, - { - type: 'put', - sublevel: null, - key: '!1!b', - value: '[object Object]', - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }, - { - type: 'put', - sublevel: null, - key: '!2!b', - value: 'b', - keyEncoding: 'utf8', - valueEncoding: 'utf8' - }, - { - type: 'del', - sublevel: null, - key: '!2!c1', - keyEncoding: 'utf8' - }, - { - type: 'del', - sublevel: null, - key: '!2!c2-y', - keyEncoding: 'utf8' - }, - { - type: 'del', - key: 'd-x', - keyEncoding: 'utf8' - } - ]) - t.same(options, {}) - nextTick(callback) - } - } - - const db = new MockLevel({ encodings: { utf8: true } }, { - keyEncoding: { - encode: (key) => key + '-x', - decode: (key) => key.slice(0, -2), - name: 'x', - format: 'utf8' - } - }) - - const sub1 = db.sublevel('1', { valueEncoding: 'json' }) - const sub2 = db.sublevel('2', { - keyEncoding: { - encode: (key) => key + '-y', - decode: (key) => key.slice(0, -2), - name: 'y', - format: 'utf8' - } - }) - - if (!deferred) await sub1.open() - - t.is(sub1.keyEncoding().name, 'utf8') - t.is(sub1.valueEncoding().name, 'json') - t.is(sub2.keyEncoding().name, 'y') - t.is(sub2.valueEncoding().name, 'utf8') - - if (chained) { - await db.batch() - // keyEncoding: utf8 (sublevel), valueEncoding: json (sublevel) - .put('a', { foo: 123 }, { sublevel: sub1 }) - - // keyEncoding: y (sublevel), valueEncoding: utf8 (sublevel) - .put('a', { foo: 123 }, { sublevel: sub2 }) - - // keyEncoding: utf8 (sublevel), valueEncoding: utf8 (operation) - .put('b', { foo: 123 }, { sublevel: sub1, valueEncoding: 'utf8' }) - - // keyEncoding: utf8 (operation), valueEncoding: utf8 (sublevel) - .put('b', 'b', { sublevel: sub2, keyEncoding: 'utf8' }) - - // keyEncoding: utf8 (operation) - .del('c1', { sublevel: sub2, keyEncoding: 'utf8' }) - - // keyEncoding: y (sublevel) - .del('c2', { sublevel: sub2 }) - - // keyEncoding: x (db). Should not affect sublevels. - .del('d') - .write() - } else { - await db.batch([ - { type: 'put', sublevel: sub1, key: 'a', value: { foo: 123 } }, - { type: 'put', sublevel: sub2, key: 'a', value: { foo: 123 } }, - { type: 'put', sublevel: sub1, key: 'b', value: { foo: 123 }, valueEncoding: 'utf8' }, - { type: 'put', sublevel: sub2, key: 'b', value: 'b', keyEncoding: 'utf8' }, - { type: 'del', key: 'c1', sublevel: sub2, keyEncoding: 'utf8' }, - { type: 'del', key: 'c2', sublevel: sub2 }, - { type: 'del', key: 'd' } - ]) - } - }) - } -} diff --git a/node_modules/abstract-level/test/sublevel-test.js b/node_modules/abstract-level/test/sublevel-test.js deleted file mode 100644 index 38c8dc5..0000000 --- a/node_modules/abstract-level/test/sublevel-test.js +++ /dev/null @@ -1,108 +0,0 @@ -'use strict' - -const { Buffer } = require('buffer') - -exports.all = function (test, testCommon) { - for (const deferred of [false, true]) { - // NOTE: adapted from subleveldown - test(`sublevel.clear() (deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - const sub1 = db.sublevel('1') - const sub2 = db.sublevel('2') - - if (!deferred) await sub1.open() - if (!deferred) await sub2.open() - - await populate([sub1, sub2], ['a', 'b']) - await verify(['!1!a', '!1!b', '!2!a', '!2!b']) - - await clear([sub1], {}) - await verify(['!2!a', '!2!b']) - - await populate([sub1], ['a', 'b']) - await clear([sub2], { lt: 'b' }) - await verify(['!1!a', '!1!b', '!2!b']) - await db.close() - - async function populate (subs, items) { - return Promise.all(subs.map(sub => { - return sub.batch(items.map(function (item) { - return { type: 'put', key: item, value: item } - })) - })) - } - - async function clear (subs, opts) { - return Promise.all(subs.map(sub => { - return sub.clear(opts) - })) - } - - async function verify (expected) { - const keys = await db.keys().all() - t.same(keys, expected) - } - }) - } - - for (const deferred of [false, true]) { - for (const keyEncoding of ['buffer', 'view']) { - if (!testCommon.supports.encodings[keyEncoding]) return - - // NOTE: adapted from subleveldown. See https://github.com/Level/subleveldown/issues/87 - test(`iterate sublevel keys with bytes above 196 (${keyEncoding}, deferred: ${deferred})`, async function (t) { - const db = testCommon.factory() - const sub1 = db.sublevel('a', { keyEncoding }) - const sub2 = db.sublevel('b', { keyEncoding }) - const length = (db) => db.keys().all().then(x => x.length) - - if (!deferred) await sub1.open() - if (!deferred) await sub2.open() - - const batch1 = sub1.batch() - const batch2 = sub2.batch() - const keys = [] - - for (let i = 0; i < 256; i++) { - const key = keyEncoding === 'buffer' ? Buffer.from([i]) : new Uint8Array([i]) - keys.push(key) - batch1.put(key, 'aa') - batch2.put(key, 'bb') - } - - await Promise.all([batch1.write(), batch2.write()]) - - const entries1 = await sub1.iterator().all() - const entries2 = await sub2.iterator().all() - - t.is(entries1.length, 256, 'sub1 yielded all entries') - t.is(entries2.length, 256, 'sub2 yielded all entries') - t.ok(entries1.every(x => x[1] === 'aa')) - t.ok(entries2.every(x => x[1] === 'bb')) - - const many1 = await sub1.getMany(keys) - const many2 = await sub2.getMany(keys) - - t.is(many1.length, 256, 'sub1 yielded all values') - t.is(many2.length, 256, 'sub2 yielded all values') - t.ok(many1.every(x => x === 'aa')) - t.ok(many2.every(x => x === 'bb')) - - const singles1 = await Promise.all(keys.map(k => sub1.get(k))) - const singles2 = await Promise.all(keys.map(k => sub2.get(k))) - - t.is(singles1.length, 256, 'sub1 yielded all values') - t.is(singles2.length, 256, 'sub2 yielded all values') - t.ok(singles1.every(x => x === 'aa')) - t.ok(singles2.every(x => x === 'bb')) - - await sub1.clear() - - t.same(await length(sub1), 0, 'cleared sub1') - t.same(await length(sub2), 256, 'did not clear sub2') - - await db.close() - }) - } - } -} diff --git a/node_modules/abstract-level/test/util.js b/node_modules/abstract-level/test/util.js deleted file mode 100644 index d2ccbb7..0000000 --- a/node_modules/abstract-level/test/util.js +++ /dev/null @@ -1,280 +0,0 @@ -'use strict' - -const ModuleError = require('module-error') -const { AbstractLevel, AbstractChainedBatch } = require('..') -const { AbstractIterator, AbstractKeyIterator, AbstractValueIterator } = require('..') - -const spies = [] - -exports.verifyNotFoundError = function (err) { - return err.code === 'LEVEL_NOT_FOUND' && err.notFound === true && err.status === 404 -} - -exports.illegalKeys = [ - { name: 'null key', key: null }, - { name: 'undefined key', key: undefined } -] - -exports.illegalValues = [ - { name: 'null key', value: null }, - { name: 'undefined value', value: undefined } -] - -/** - * Wrap a callback to check that it's called asynchronously. Must be - * combined with a `ctx()`, `with()` or `end()` call. - * - * @param {function} cb Callback to check. - * @param {string} name Optional callback name to use in assertion messages. - * @returns {function} Wrapped callback. - */ -exports.assertAsync = function (cb, name) { - const spy = { - called: false, - name: name || cb.name || 'anonymous' - } - - spies.push(spy) - - return function (...args) { - spy.called = true - return cb.apply(this, args) - } -} - -/** - * Verify that callbacks wrapped with `assertAsync()` were not yet called. - * @param {import('tape').Test} t Tape test object. - */ -exports.assertAsync.end = function (t) { - for (const { called, name } of spies.splice(0, spies.length)) { - t.is(called, false, `callback (${name}) is asynchronous`) - } -} - -/** - * Wrap a test function to verify `assertAsync()` spies at the end. - * @param {import('tape').TestCase} test Test function to be passed to `tape()`. - * @returns {import('tape').TestCase} Wrapped test function. - */ -exports.assertAsync.ctx = function (test) { - return function (...args) { - const ret = test.call(this, ...args) - exports.assertAsync.end(args[0]) - return ret - } -} - -/** - * Wrap an arbitrary callback to verify `assertAsync()` spies at the end. - * @param {import('tape').Test} t Tape test object. - * @param {function} cb Callback to wrap. - * @returns {function} Wrapped callback. - */ -exports.assertAsync.with = function (t, cb) { - return function (...args) { - const ret = cb.call(this, ...args) - exports.assertAsync.end(t) - return ret - } -} - -exports.mockLevel = function (methods, ...args) { - class TestLevel extends AbstractLevel {} - for (const k in methods) TestLevel.prototype[k] = methods[k] - if (!args.length) args = [{ encodings: { utf8: true } }] - return new TestLevel(...args) -} - -exports.mockIterator = function (db, options, methods, ...args) { - class TestIterator extends AbstractIterator {} - for (const k in methods) TestIterator.prototype[k] = methods[k] - return new TestIterator(db, options, ...args) -} - -exports.mockChainedBatch = function (db, methods, ...args) { - class TestBatch extends AbstractChainedBatch {} - for (const k in methods) TestBatch.prototype[k] = methods[k] - return new TestBatch(db, ...args) -} - -// Mock encoding where null and undefined are significant types -exports.nullishEncoding = { - name: 'nullish', - format: 'utf8', - encode (v) { - return v === null ? '\x00' : v === undefined ? '\xff' : String(v) - }, - decode (v) { - return v === '\x00' ? null : v === '\xff' ? undefined : v - } -} - -const kEntries = Symbol('entries') -const kPosition = Symbol('position') -const kOptions = Symbol('options') - -/** - * A minimal and non-optimized implementation for use in tests. Only supports utf8. - * Don't use this as a reference implementation. - */ -class MinimalLevel extends AbstractLevel { - constructor (options) { - super({ encodings: { utf8: true }, seek: true }, options) - this[kEntries] = new Map() - } - - _put (key, value, options, callback) { - this[kEntries].set(key, value) - this.nextTick(callback) - } - - _get (key, options, callback) { - const value = this[kEntries].get(key) - - if (value === undefined) { - return this.nextTick(callback, new ModuleError(`Key ${key} was not found`, { - code: 'LEVEL_NOT_FOUND' - })) - } - - this.nextTick(callback, null, value) - } - - _getMany (keys, options, callback) { - const values = keys.map(k => this[kEntries].get(k)) - this.nextTick(callback, null, values) - } - - _del (key, options, callback) { - this[kEntries].delete(key) - this.nextTick(callback) - } - - _clear (options, callback) { - for (const [k] of sliceEntries(this[kEntries], options, true)) { - this[kEntries].delete(k) - } - - this.nextTick(callback) - } - - _batch (operations, options, callback) { - const entries = new Map(this[kEntries]) - - for (const op of operations) { - if (op.type === 'put') entries.set(op.key, op.value) - else entries.delete(op.key) - } - - this[kEntries] = entries - this.nextTick(callback) - } - - _iterator (options) { - return new MinimalIterator(this, options) - } - - _keys (options) { - return new MinimalKeyIterator(this, options) - } - - _values (options) { - return new MinimalValueIterator(this, options) - } -} - -class MinimalIterator extends AbstractIterator { - constructor (db, options) { - super(db, options) - this[kEntries] = sliceEntries(db[kEntries], options, false) - this[kOptions] = options - this[kPosition] = 0 - } -} - -class MinimalKeyIterator extends AbstractKeyIterator { - constructor (db, options) { - super(db, options) - this[kEntries] = sliceEntries(db[kEntries], options, false) - this[kOptions] = options - this[kPosition] = 0 - } -} - -class MinimalValueIterator extends AbstractValueIterator { - constructor (db, options) { - super(db, options) - this[kEntries] = sliceEntries(db[kEntries], options, false) - this[kOptions] = options - this[kPosition] = 0 - } -} - -for (const Ctor of [MinimalIterator, MinimalKeyIterator, MinimalValueIterator]) { - const mapEntry = Ctor === MinimalIterator ? e => e : Ctor === MinimalKeyIterator ? e => e[0] : e => e[1] - - Ctor.prototype._next = function (callback) { - const entry = this[kEntries][this[kPosition]++] - if (entry === undefined) return this.nextTick(callback) - if (Ctor === MinimalIterator) this.nextTick(callback, null, entry[0], entry[1]) - else this.nextTick(callback, null, mapEntry(entry)) - } - - Ctor.prototype._nextv = function (size, options, callback) { - const entries = this[kEntries].slice(this[kPosition], this[kPosition] + size) - this[kPosition] += entries.length - this.nextTick(callback, null, entries.map(mapEntry)) - } - - Ctor.prototype._all = function (options, callback) { - const end = this.limit - this.count + this[kPosition] - const entries = this[kEntries].slice(this[kPosition], end) - this[kPosition] = this[kEntries].length - this.nextTick(callback, null, entries.map(mapEntry)) - } - - Ctor.prototype._seek = function (target, options) { - this[kPosition] = this[kEntries].length - - if (!outOfRange(target, this[kOptions])) { - // Don't care about performance here - for (let i = 0; i < this[kPosition]; i++) { - const key = this[kEntries][i][0] - - if (this[kOptions].reverse ? key <= target : key >= target) { - this[kPosition] = i - } - } - } - } -} - -const outOfRange = function (target, options) { - if ('gte' in options) { - if (target < options.gte) return true - } else if ('gt' in options) { - if (target <= options.gt) return true - } - - if ('lte' in options) { - if (target > options.lte) return true - } else if ('lt' in options) { - if (target >= options.lt) return true - } - - return false -} - -const sliceEntries = function (entries, options, applyLimit) { - entries = Array.from(entries) - .filter((e) => !outOfRange(e[0], options)) - .sort((a, b) => a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0) - - if (options.reverse) entries.reverse() - if (applyLimit && options.limit !== -1) entries = entries.slice(0, options.limit) - - return entries -} - -exports.MinimalLevel = MinimalLevel diff --git a/node_modules/abstract-level/types/abstract-chained-batch.d.ts b/node_modules/abstract-level/types/abstract-chained-batch.d.ts deleted file mode 100644 index 0d5e305..0000000 --- a/node_modules/abstract-level/types/abstract-chained-batch.d.ts +++ /dev/null @@ -1,123 +0,0 @@ -import * as Transcoder from 'level-transcoder' -import { AbstractSublevel } from './abstract-sublevel' -import { NodeCallback } from './interfaces' - -export class AbstractChainedBatch { - constructor (db: TDatabase) - - /** - * A reference to the database that created this chained batch. - */ - db: TDatabase - - /** - * The number of queued operations on the current batch. - */ - get length (): number - - /** - * Queue a _put_ operation on this batch, not committed until {@link write} is - * called. - */ - put (key: KDefault, value: VDefault): this - - put ( - key: K, - value: V, - options: AbstractChainedBatchPutOptions - ): this - - /** - * Queue a _del_ operation on this batch, not committed until {@link write} is - * called. - */ - del (key: KDefault): this - del (key: K, options: AbstractChainedBatchDelOptions): this - - /** - * Clear all queued operations on this batch. - */ - clear (): this - - /** - * Commit the queued operations for this batch. All operations will be written - * atomically, that is, they will either all succeed or fail with no partial - * commits. - */ - write (): Promise - write (options: AbstractChainedBatchWriteOptions): Promise - write (callback: NodeCallback): void - write (options: AbstractChainedBatchWriteOptions, callback: NodeCallback): void - - /** - * Free up underlying resources. This should be done even if the chained batch has - * zero queued operations. Automatically called by {@link write} so normally not - * necessary to call, unless the intent is to discard a chained batch without - * committing it. - */ - close (): Promise - close (callback: NodeCallback): void -} - -/** - * Options for the {@link AbstractChainedBatch.put} method. - */ -export interface AbstractChainedBatchPutOptions { - /** - * Custom key encoding for this _put_ operation, used to encode the `key`. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Custom value encoding for this _put_ operation, used to encode the `value`. - */ - valueEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Act as though the _put_ operation is performed on the given sublevel, to similar - * effect as: - * - * ```js - * await sublevel.batch().put(key, value).write() - * ``` - * - * This allows atomically committing data to multiple sublevels. The `key` will be - * prefixed with the `prefix` of the sublevel, and the `key` and `value` will be - * encoded by the sublevel (using the default encodings of the sublevel unless - * {@link keyEncoding} and / or {@link valueEncoding} are provided). - */ - sublevel?: AbstractSublevel | undefined -} - -/** - * Options for the {@link AbstractChainedBatch.del} method. - */ -export interface AbstractChainedBatchDelOptions { - /** - * Custom key encoding for this _del_ operation, used to encode the `key`. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Act as though the _del_ operation is performed on the given sublevel, to similar - * effect as: - * - * ```js - * await sublevel.batch().del(key).write() - * ``` - * - * This allows atomically committing data to multiple sublevels. The `key` will be - * prefixed with the `prefix` of the sublevel, and the `key` will be encoded by the - * sublevel (using the default key encoding of the sublevel unless {@link keyEncoding} - * is provided). - */ - sublevel?: AbstractSublevel | undefined -} - -/** - * Options for the {@link AbstractChainedBatch.write} method. - */ -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface AbstractChainedBatchWriteOptions { - // There are no abstract options but implementations may add theirs. -} diff --git a/node_modules/abstract-level/types/abstract-iterator.d.ts b/node_modules/abstract-level/types/abstract-iterator.d.ts deleted file mode 100644 index 7047da6..0000000 --- a/node_modules/abstract-level/types/abstract-iterator.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -import * as Transcoder from 'level-transcoder' -import { RangeOptions, NodeCallback } from './interfaces' - -export interface AbstractIteratorOptions extends RangeOptions { - /** - * Whether to return the key of each entry. Defaults to `true`. If set to `false`, - * the iterator will yield keys that are `undefined`. - */ - keys?: boolean | undefined - - /** - * Whether to return the value of each entry. Defaults to `true`. If set to - * `false`, the iterator will yield values that are `undefined`. - */ - values?: boolean | undefined - - /** - * Custom key encoding for this iterator, used to encode range options, to encode - * {@link AbstractIterator.seek} targets and to decode keys. - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Custom value encoding for this iterator, used to decode values. - */ - valueEncoding?: string | Transcoder.PartialDecoder | undefined -} - -export interface AbstractKeyIteratorOptions extends RangeOptions { - /** - * Custom key encoding for this iterator, used to encode range options, to encode - * {@link AbstractKeyIterator.seek} targets and to decode keys. - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined -} - -export interface AbstractValueIteratorOptions extends RangeOptions { - /** - * Custom key encoding for this iterator, used to encode range options and - * {@link AbstractValueIterator.seek} targets. - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Custom value encoding for this iterator, used to decode values. - */ - valueEncoding?: string | Transcoder.PartialDecoder | undefined -} - -/** - * @template TDatabase Type of the database that created this iterator. - * @template T Type of items yielded. Items can be entries, keys or values. - */ -declare class CommonIterator { - /** - * A reference to the database that created this iterator. - */ - db: TDatabase - - /** - * Read-only getter that indicates how many items have been yielded so far (by any - * method) excluding calls that errored or yielded `undefined`. - */ - get count (): number - - /** - * Read-only getter that reflects the `limit` that was set in options. Greater than or - * equal to zero. Equals {@link Infinity} if no limit. - */ - get limit (): number - - [Symbol.asyncIterator] (): AsyncGenerator - - /** - * Free up underlying resources. Not necessary to call if [`for await...of`][1] or - * `all()` is used. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - */ - close (): Promise - close (callback: NodeCallback): void -} - -export class AbstractIterator extends CommonIterator { - constructor (db: TDatabase, options: AbstractIteratorOptions) - - /** - * Advance to the next entry and yield that entry. When possible, prefer to use - * [`for await...of`][1] instead. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - */ - next (): Promise<[K, V] | undefined> - next (callback: NextCallback): void - - /** - * Advance repeatedly and get at most {@link size} amount of entries in a single call. - * Can be faster than repeated {@link next()} calls. The natural end of the iterator - * will be signaled by yielding an empty array. - * - * @param size Get at most this many entries. Has a soft minimum of 1. - * @param options Options (none at the moment, reserved for future use). - * @param callback Error-first callback. If none is provided, a promise is returned. - */ - nextv (size: number, options: {}, callback: NodeCallback>): void - nextv (size: number, callback: NodeCallback>): void - nextv (size: number, options: {}): Promise> - nextv (size: number): Promise> - - /** - * Advance repeatedly and get all (remaining) entries as an array, automatically - * closing the iterator. Assumes that those entries fit in memory. If that's not the - * case, instead use {@link next()}, {@link nextv()} or [`for await...of`][1]. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - * - * @param options Options (none at the moment, reserved for future use). - * @param callback Error-first callback. If none is provided, a promise is returned. - */ - all (options: {}, callback: NodeCallback>): void - all (callback: NodeCallback>): void - all (options: {}): Promise> - all (): Promise> - - /** - * Seek to the key closest to {@link target}. Subsequent calls to {@link next()}, - * {@link nextv()} or {@link all()} (including implicit calls in a `for await...of` - * loop) will yield entries with keys equal to or larger than {@link target}, or equal - * to or smaller than {@link target} if the {@link AbstractIteratorOptions.reverse} - * option was true. - */ - seek (target: K): void - seek (target: TTarget, options: AbstractSeekOptions): void -} - -export class AbstractKeyIterator extends CommonIterator { - constructor (db: TDatabase, options: AbstractKeyIteratorOptions) - - /** - * Advance to the next key and yield that key. When possible, prefer to use - * [`for await...of`][1] instead. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - */ - next (): Promise - next (callback: NodeCallback): void - - /** - * Advance repeatedly and get at most {@link size} amount of keys in a single call. Can - * be faster than repeated {@link next()} calls. The natural end of the iterator will - * be signaled by yielding an empty array. - * - * @param size Get at most this many keys. Has a soft minimum of 1. - * @param options Options (none at the moment, reserved for future use). - * @param callback Error-first callback. If none is provided, a promise is returned. - */ - nextv (size: number, options: {}, callback: NodeCallback<[K]>): void - nextv (size: number, callback: NodeCallback<[K]>): void - nextv (size: number, options: {}): Promise<[K]> - nextv (size: number): Promise<[K]> - - /** - * Advance repeatedly and get all (remaining) keys as an array, automatically closing - * the iterator. Assumes that those keys fit in memory. If that's not the case, instead - * use {@link next()}, {@link nextv()} or [`for await...of`][1]. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - * - * @param options Options (none at the moment, reserved for future use). - * @param callback Error-first callback. If none is provided, a promise is returned. - */ - all (options: {}, callback: NodeCallback<[K]>): void - all (callback: NodeCallback<[K]>): void - all (options: {}): Promise<[K]> - all (): Promise<[K]> - - /** - * Seek to the key closest to {@link target}. Subsequent calls to {@link next()}, - * {@link nextv()} or {@link all()} (including implicit calls in a `for await...of` - * loop) will yield keys equal to or larger than {@link target}, or equal to or smaller - * than {@link target} if the {@link AbstractKeyIteratorOptions.reverse} option was - * true. - */ - seek (target: K): void - seek (target: TTarget, options: AbstractSeekOptions): void -} - -export class AbstractValueIterator extends CommonIterator { - constructor (db: TDatabase, options: AbstractValueIteratorOptions) - - /** - * Advance to the next value and yield that value. When possible, prefer - * to use [`for await...of`][1] instead. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - */ - next (): Promise - next (callback: NodeCallback): void - - /** - * Advance repeatedly and get at most {@link size} amount of values in a single call. - * Can be faster than repeated {@link next()} calls. The natural end of the iterator - * will be signaled by yielding an empty array. - * - * @param size Get at most this many values. Has a soft minimum of 1. - * @param options Options (none at the moment, reserved for future use). - * @param callback Error-first callback. If none is provided, a promise is returned. - */ - nextv (size: number, options: {}, callback: NodeCallback<[V]>): void - nextv (size: number, callback: NodeCallback<[V]>): void - nextv (size: number, options: {}): Promise<[V]> - nextv (size: number): Promise<[V]> - - /** - * Advance repeatedly and get all (remaining) values as an array, automatically closing - * the iterator. Assumes that those values fit in memory. If that's not the case, - * instead use {@link next()}, {@link nextv()} or [`for await...of`][1]. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of - * - * @param options Options (none at the moment, reserved for future use). - * @param callback Error-first callback. If none is provided, a promise is returned. - */ - all (options: {}, callback: NodeCallback<[V]>): void - all (callback: NodeCallback<[V]>): void - all (options: {}): Promise<[V]> - all (): Promise<[V]> - - /** - * Seek to the key closest to {@link target}. Subsequent calls to {@link next()}, - * {@link nextv()} or {@link all()} (including implicit calls in a `for await...of` - * loop) will yield the values of keys equal to or larger than {@link target}, or equal - * to or smaller than {@link target} if the {@link AbstractValueIteratorOptions.reverse} - * option was true. - */ - seek (target: K): void - seek (target: TTarget, options: AbstractSeekOptions): void -} - -/** - * Options for the {@link AbstractIterator.seek} method. - */ -export interface AbstractSeekOptions { - /** - * Custom key encoding, used to encode the `target`. By default the keyEncoding option - * of the iterator is used, or (if that wasn't set) the keyEncoding of the database. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined -} - -declare type NextCallback = - (err: Error | undefined | null, key?: K | undefined, value?: V | undefined) => void diff --git a/node_modules/abstract-level/types/abstract-level.d.ts b/node_modules/abstract-level/types/abstract-level.d.ts deleted file mode 100644 index 6a09b05..0000000 --- a/node_modules/abstract-level/types/abstract-level.d.ts +++ /dev/null @@ -1,485 +0,0 @@ -import { IManifest } from 'level-supports' -import * as Transcoder from 'level-transcoder' -import { EventEmitter } from 'events' -import { AbstractChainedBatch } from './abstract-chained-batch' -import { AbstractSublevel, AbstractSublevelOptions } from './abstract-sublevel' - -import { - AbstractIterator, - AbstractIteratorOptions, - AbstractKeyIterator, - AbstractKeyIteratorOptions, - AbstractValueIterator, - AbstractValueIteratorOptions -} from './abstract-iterator' - -import { NodeCallback, RangeOptions } from './interfaces' - -/** - * Abstract class for a lexicographically sorted key-value database. - * - * @template TFormat The type used internally by the database to store data. - * @template KDefault The default type of keys if not overridden on operations. - * @template VDefault The default type of values if not overridden on operations. - */ -declare class AbstractLevel - extends EventEmitter { - /** - * Private database constructor. - * - * @param manifest A [manifest](https://github.com/Level/supports) describing the - * features supported by (the private API of) this database. - * @param options Options, of which some will be forwarded to {@link open}. - */ - constructor ( - manifest: Partial, - options?: AbstractDatabaseOptions | undefined - ) - - /** - * A [manifest](https://github.com/Level/supports) describing the features - * supported by this database. - */ - supports: IManifest - - /** - * Read-only getter that returns a string reflecting the current state of the database: - * - * - `'opening'` - waiting for the database to be opened - * - `'open'` - successfully opened the database - * - `'closing'` - waiting for the database to be closed - * - `'closed'` - successfully closed the database. - */ - get status (): 'opening' | 'open' | 'closing' | 'closed' - - /** - * Open the database. - */ - open (): Promise - open (options: AbstractOpenOptions): Promise - open (callback: NodeCallback): void - open (options: AbstractOpenOptions, callback: NodeCallback): void - - /** - * Close the database. - */ - close (): Promise - close (callback: NodeCallback): void - - /** - * Get a value from the database by {@link key}. - */ - get (key: KDefault): Promise - get (key: KDefault, callback: NodeCallback): void - - get ( - key: K, - options: AbstractGetOptions - ): Promise - - get ( - key: K, - options: AbstractGetOptions, - callback: NodeCallback - ): void - - /** - * Get multiple values from the database by an array of {@link keys}. - */ - getMany (keys: KDefault[]): Promise - getMany (keys: KDefault[], callback: NodeCallback): void - - getMany ( - keys: K[], - options: AbstractGetManyOptions - ): Promise - - getMany ( - keys: K[], - options: AbstractGetManyOptions, - callback: NodeCallback - ): void - - /** - * Add a new entry or overwrite an existing entry. - */ - put (key: KDefault, value: VDefault): Promise - put (key: KDefault, value: VDefault, callback: NodeCallback): void - - put ( - key: K, - value: V, - options: AbstractPutOptions - ): Promise - - put ( - key: K, - value: V, - options: AbstractPutOptions, - callback: NodeCallback - ): void - - /** - * Delete an entry by {@link key}. - */ - del (key: KDefault): Promise - del (key: KDefault, callback: NodeCallback): void - - del ( - key: K, - options: AbstractDelOptions - ): Promise - - del ( - key: K, - options: AbstractDelOptions, - callback: NodeCallback - ): void - - /** - * Perform multiple _put_ and/or _del_ operations in bulk. - */ - batch ( - operations: Array> - ): Promise - - batch ( - operations: Array>, - callback: NodeCallback - ): void - - batch ( - operations: Array>, - options: AbstractBatchOptions - ): Promise - - batch ( - operations: Array>, - options: AbstractBatchOptions, - callback: NodeCallback - ): void - - batch (): AbstractChainedBatch - - /** - * Create an iterator. For example: - * - * ```js - * for await (const [key, value] of db.iterator({ gte: 'a' })) { - * console.log([key, value]) - * } - * ``` - */ - iterator (): AbstractIterator - iterator ( - options: AbstractIteratorOptions - ): AbstractIterator - - /** - * Create a key iterator. For example: - * - * ```js - * for await (const key of db.keys({ gte: 'a' })) { - * console.log(key) - * } - * ``` - */ - keys (): AbstractKeyIterator - keys ( - options: AbstractKeyIteratorOptions - ): AbstractKeyIterator - - /** - * Create a value iterator. For example: - * - * ```js - * for await (const value of db.values({ gte: 'a' })) { - * console.log(value) - * } - * ``` - */ - values (): AbstractValueIterator - values ( - options: AbstractValueIteratorOptions - ): AbstractValueIterator - - /** - * Delete all entries or a range. - */ - clear (): Promise - clear (callback: NodeCallback): void - clear (options: AbstractClearOptions): Promise - clear (options: AbstractClearOptions, callback: NodeCallback): void - - /** - * Create a sublevel. - * @param name Name of the sublevel, used to prefix keys. - */ - sublevel (name: string): AbstractSublevel - sublevel ( - name: string, - options: AbstractSublevelOptions - ): AbstractSublevel - - /** - * Add sublevel prefix to the given {@link key}, which must be already-encoded. If this - * database is not a sublevel, the given {@link key} is returned as-is. - * - * @param key Key to add prefix to. - * @param keyFormat Format of {@link key}. One of `'utf8'`, `'buffer'`, `'view'`. - * If `'utf8'` then {@link key} must be a string and the return value will be a string. - * If `'buffer'` then Buffer, if `'view'` then Uint8Array. - */ - prefixKey (key: string, keyFormat: 'utf8'): string - prefixKey (key: Buffer, keyFormat: 'buffer'): Buffer - prefixKey (key: Uint8Array, keyFormat: 'view'): Uint8Array - - /** - * Returns the given {@link encoding} argument as a normalized encoding object - * that follows the [`level-transcoder`](https://github.com/Level/transcoder) - * encoding interface. - */ - keyEncoding ( - encoding: N - ): Transcoder.KnownEncoding - - keyEncoding ( - encoding: Transcoder.MixedEncoding - ): Transcoder.Encoding - - /** - * Returns the default key encoding of the database as a normalized encoding - * object that follows the [`level-transcoder`](https://github.com/Level/transcoder) - * encoding interface. - */ - keyEncoding (): Transcoder.Encoding - - /** - * Returns the given {@link encoding} argument as a normalized encoding object - * that follows the [`level-transcoder`](https://github.com/Level/transcoder) - * encoding interface. - */ - valueEncoding ( - encoding: N - ): Transcoder.KnownEncoding - - valueEncoding ( - encoding: Transcoder.MixedEncoding - ): Transcoder.Encoding - - /** - * Returns the default value encoding of the database as a normalized encoding - * object that follows the [`level-transcoder`](https://github.com/Level/transcoder) - * encoding interface. - */ - valueEncoding (): Transcoder.Encoding - - /** - * Call the function {@link fn} at a later time when {@link status} changes to - * `'open'` or `'closed'`. - */ - defer (fn: Function): void - - /** - * Schedule the function {@link fn} to be called in a next tick of the JavaScript - * event loop, using a microtask scheduler. It will be called with the provided - * {@link args}. - */ - nextTick (fn: Function, ...args: any[]): void -} - -export { AbstractLevel } - -/** - * Options for the database constructor. - */ -export interface AbstractDatabaseOptions - extends Omit { - /** - * Encoding to use for keys. - * @defaultValue `'utf8'` - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Encoding to use for values. - * @defaultValue `'utf8'` - */ - valueEncoding?: string | Transcoder.PartialEncoding | undefined -} - -/** - * Options for the {@link AbstractLevel.open} method. - */ -export interface AbstractOpenOptions { - /** - * If `true`, create an empty database if one doesn't already exist. If `false` - * and the database doesn't exist, opening will fail. - * - * @defaultValue `true` - */ - createIfMissing?: boolean | undefined - - /** - * If `true` and the database already exists, opening will fail. - * - * @defaultValue `false` - */ - errorIfExists?: boolean | undefined - - /** - * Wait for, but do not initiate, opening of the database. - * - * @defaultValue `false` - */ - passive?: boolean | undefined -} - -/** - * Options for the {@link AbstractLevel.get} method. - */ -export interface AbstractGetOptions { - /** - * Custom key encoding for this operation, used to encode the `key`. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Custom value encoding for this operation, used to decode the value. - */ - valueEncoding?: string | Transcoder.PartialDecoder | undefined -} - -/** - * Options for the {@link AbstractLevel.getMany} method. - */ -export interface AbstractGetManyOptions { - /** - * Custom key encoding for this operation, used to encode the `keys`. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Custom value encoding for this operation, used to decode values. - */ - valueEncoding?: string | Transcoder.PartialDecoder | undefined -} - -/** - * Options for the {@link AbstractLevel.put} method. - */ -export interface AbstractPutOptions { - /** - * Custom key encoding for this operation, used to encode the `key`. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Custom value encoding for this operation, used to encode the `value`. - */ - valueEncoding?: string | Transcoder.PartialEncoder | undefined -} - -/** - * Options for the {@link AbstractLevel.del} method. - */ -export interface AbstractDelOptions { - /** - * Custom key encoding for this operation, used to encode the `key`. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined -} - -/** - * Options for the {@link AbstractLevel.batch} method. - */ -export interface AbstractBatchOptions { - /** - * Custom key encoding for this batch, used to encode keys. - */ - keyEncoding?: string | Transcoder.PartialEncoder | undefined - - /** - * Custom value encoding for this batch, used to encode values. - */ - valueEncoding?: string | Transcoder.PartialEncoder | undefined -} - -/** - * A _put_ or _del_ operation to be committed with the {@link AbstractLevel.batch} - * method. - */ -export type AbstractBatchOperation = - AbstractBatchPutOperation | AbstractBatchDelOperation - -/** - * A _put_ operation to be committed with the {@link AbstractLevel.batch} method. - */ -export interface AbstractBatchPutOperation { - type: 'put' - key: K - value: V - - /** - * Custom key encoding for this _put_ operation, used to encode the {@link key}. - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Custom key encoding for this _put_ operation, used to encode the {@link value}. - */ - valueEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Act as though the _put_ operation is performed on the given sublevel, to similar - * effect as: - * - * ```js - * await sublevel.batch([{ type: 'put', key, value }]) - * ``` - * - * This allows atomically committing data to multiple sublevels. The {@link key} will - * be prefixed with the `prefix` of the sublevel, and the {@link key} and {@link value} - * will be encoded by the sublevel (using the default encodings of the sublevel unless - * {@link keyEncoding} and / or {@link valueEncoding} are provided). - */ - sublevel?: AbstractSublevel | undefined -} - -/** - * A _del_ operation to be committed with the {@link AbstractLevel.batch} method. - */ -export interface AbstractBatchDelOperation { - type: 'del' - key: K - - /** - * Custom key encoding for this _del_ operation, used to encode the {@link key}. - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Act as though the _del_ operation is performed on the given sublevel, to similar - * effect as: - * - * ```js - * await sublevel.batch([{ type: 'del', key }]) - * ``` - * - * This allows atomically committing data to multiple sublevels. The {@link key} will - * be prefixed with the `prefix` of the sublevel, and the {@link key} will be encoded - * by the sublevel (using the default key encoding of the sublevel unless - * {@link keyEncoding} is provided). - */ - sublevel?: AbstractSublevel | undefined -} - -/** - * Options for the {@link AbstractLevel.clear} method. - */ -export interface AbstractClearOptions extends RangeOptions { - /** - * Custom key encoding for this operation, used to encode range options. - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined -} diff --git a/node_modules/abstract-level/types/abstract-sublevel.d.ts b/node_modules/abstract-level/types/abstract-sublevel.d.ts deleted file mode 100644 index 8b26364..0000000 --- a/node_modules/abstract-level/types/abstract-sublevel.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as Transcoder from 'level-transcoder' -import { AbstractLevel } from './abstract-level' - -/** - * @template TDatabase Type of parent database. - * @template TFormat The type used internally by the parent database to store data. - * @template KDefault The default type of keys if not overridden on operations. - * @template VDefault The default type of values if not overridden on operations. - */ -declare class AbstractSublevel - extends AbstractLevel { - /** - * Sublevel constructor. - * - * @param db Parent database. - * @param name Name of the sublevel, used to prefix keys. - */ - constructor ( - db: TDatabase, - name: string, - options?: AbstractSublevelOptions | undefined - ) - - /** - * Prefix of the sublevel. A read-only string property. - */ - get prefix (): string - - /** - * Parent database. A read-only property. - */ - get db (): TDatabase -} - -/** - * Options for the {@link AbstractLevel.sublevel} method. - */ -export interface AbstractSublevelOptions { - /** - * Character for separating sublevel names from user keys and each other. Must sort - * before characters used in `name`. An error will be thrown if that's not the case. - * - * @defaultValue `'!'` - */ - separator?: string | undefined - - /** - * Encoding to use for keys. - * @defaultValue `'utf8'` - */ - keyEncoding?: string | Transcoder.PartialEncoding | undefined - - /** - * Encoding to use for values. - * @defaultValue `'utf8'` - */ - valueEncoding?: string | Transcoder.PartialEncoding | undefined -} diff --git a/node_modules/abstract-level/types/interfaces.d.ts b/node_modules/abstract-level/types/interfaces.d.ts deleted file mode 100644 index 7b15f8c..0000000 --- a/node_modules/abstract-level/types/interfaces.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * An error-first callback in the style of Node.js. - */ -export type NodeCallback = - (err: Error | undefined | null, result?: T | undefined) => void - -export interface RangeOptions { - gt?: K - gte?: K - lt?: K - lte?: K - reverse?: boolean | undefined - limit?: number | undefined -} diff --git a/node_modules/acorn-jsx/LICENSE b/node_modules/acorn-jsx/LICENSE deleted file mode 100644 index 695d4b9..0000000 --- a/node_modules/acorn-jsx/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index 317c3ac..0000000 --- a/node_modules/acorn-jsx/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# 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 deleted file mode 100644 index f37b1df..0000000 --- a/node_modules/acorn-jsx/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 004e080..0000000 --- a/node_modules/acorn-jsx/index.js +++ /dev/null @@ -1,488 +0,0 @@ -'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 deleted file mode 100644 index 6debde9..0000000 --- a/node_modules/acorn-jsx/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "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 deleted file mode 100644 index c152009..0000000 --- a/node_modules/acorn-jsx/xhtml.js +++ /dev/null @@ -1,255 +0,0 @@ -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 deleted file mode 100644 index 3137186..0000000 --- a/node_modules/acorn/CHANGELOG.md +++ /dev/null @@ -1,928 +0,0 @@ -## 8.14.0 (2024-10-27) - -### New features - -Support ES2025 import attributes. - -Support ES2025 RegExp modifiers. - -### Bug fixes - -Support some missing Unicode properties. - -## 8.13.0 (2024-10-16) - -### New features - -Upgrade to Unicode 16.0. - -## 8.12.1 (2024-07-03) - -### Bug fixes - -Fix a regression that caused Acorn to no longer run on Node versions <8.10. - -## 8.12.0 (2024-06-14) - -### New features - -Support ES2025 duplicate capture group names in regular expressions. - -### Bug fixes - -Include `VariableDeclarator` in the `AnyNode` type so that walker objects can refer to it without getting a type error. - -Properly raise a parse error for invalid `for`/`of` statements using `async` as binding name. - -Properly recognize \"use strict\" when preceded by a string with an escaped newline. - -Mark the `Parser` constructor as protected, not private, so plugins can extend it without type errors. - -Fix a bug where some invalid `delete` expressions were let through when the operand was parenthesized and `preserveParens` was enabled. - -Properly normalize line endings in raw strings of invalid template tokens. - -Properly track line numbers for escaped newlines in strings. - -Fix a bug that broke line number accounting after a template literal with invalid escape sequences. - -## 8.11.3 (2023-12-29) - -### Bug fixes - -Add `Function` and `Class` to the `AggregateType` type, so that they can be used in walkers without raising a type error. - -Make sure `onToken` get an `import` keyword token when parsing `import.meta`. - -Fix a bug where `.loc.start` could be undefined for `new.target` `meta` nodes. - -## 8.11.2 (2023-10-27) - -### Bug fixes - -Fix a bug that caused regular expressions after colon tokens to not be properly tokenized in some circumstances. - -## 8.11.1 (2023-10-26) - -### Bug fixes - -Fix a regression where `onToken` would receive 'name' tokens for 'new' keyword tokens. - -## 8.11.0 (2023-10-26) - -### Bug fixes - -Fix an issue where tokenizing (without parsing) an object literal with a property named `class` or `function` could, in some circumstance, put the tokenizer into an invalid state. - -Fix an issue where a slash after a call to a propery named the same as some keywords would be tokenized as a regular expression. - -### New features - -Upgrade to Unicode 15.1. - -Use a set of new, much more precise, TypeScript types. - -## 8.10.0 (2023-07-05) - -### New features - -Add a `checkPrivateFields` option that disables strict checking of private property use. - -## 8.9.0 (2023-06-16) - -### Bug fixes - -Forbid dynamic import after `new`, even when part of a member expression. - -### New features - -Add Unicode properties for ES2023. - -Add support for the `v` flag to regular expressions. - -## 8.8.2 (2023-01-23) - -### Bug fixes - -Fix a bug that caused `allowHashBang` to be set to false when not provided, even with `ecmaVersion >= 14`. - -Fix an exception when passing no option object to `parse` or `new Parser`. - -Fix incorrect parse error on `if (0) let\n[astral identifier char]`. - -## 8.8.1 (2022-10-24) - -### Bug fixes - -Make type for `Comment` compatible with estree types. - -## 8.8.0 (2022-07-21) - -### Bug fixes - -Allow parentheses around spread args in destructuring object assignment. - -Fix an issue where the tree contained `directive` properties in when parsing with a language version that doesn't support them. - -### New features - -Support hashbang comments by default in ECMAScript 2023 and later. - -## 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 deleted file mode 100644 index 9d71cc6..0000000 --- a/node_modules/acorn/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index f7ff966..0000000 --- a/node_modules/acorn/README.md +++ /dev/null @@ -1,282 +0,0 @@ -# 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). - -## 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. Can be a - number, either in year (`2022`) or plain version number (`6`) form, - 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` in modules - 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, if the code starts with the - characters `#!` (as in a shellscript), the first line will be - treated as a comment. Defaults to true when `ecmaVersion` >= 2023. - -- **checkPrivateFields**: By default, the parser will verify that - private properties are only used in places where they are valid and - have been declared. Set this to false to turn such checks off. - -- **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. - -Note that tokenizing JavaScript without parsing it is, in modern -versions of the language, not really possible due to the way syntax is -overloaded in ways that can only be disambiguated by the parse -context. This package applies a bunch of heuristics to try and do a -reasonable job, but you are advised to use `parse` with the `onToken` -option instead of this. - -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 deleted file mode 100755 index 3ef3c12..0000000 --- a/node_modules/acorn/bin/acorn +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env node -"use strict" - -require("../dist/bin.js") diff --git a/node_modules/acorn/dist/acorn.d.mts b/node_modules/acorn/dist/acorn.d.mts deleted file mode 100644 index 81f4e38..0000000 --- a/node_modules/acorn/dist/acorn.d.mts +++ /dev/null @@ -1,866 +0,0 @@ -export interface Node { - start: number - end: number - type: string - range?: [number, number] - loc?: SourceLocation | null -} - -export interface SourceLocation { - source?: string | null - start: Position - end: Position -} - -export interface Position { - /** 1-based */ - line: number - /** 0-based */ - column: number -} - -export interface Identifier extends Node { - type: "Identifier" - name: string -} - -export interface Literal extends Node { - type: "Literal" - value?: string | boolean | null | number | RegExp | bigint - raw?: string - regex?: { - pattern: string - flags: string - } - bigint?: string -} - -export interface Program extends Node { - type: "Program" - body: Array - sourceType: "script" | "module" -} - -export interface Function extends Node { - id?: Identifier | null - params: Array - body: BlockStatement | Expression - generator: boolean - expression: boolean - async: boolean -} - -export interface ExpressionStatement extends Node { - type: "ExpressionStatement" - expression: Expression | Literal - directive?: string -} - -export interface BlockStatement extends Node { - type: "BlockStatement" - body: Array -} - -export interface EmptyStatement extends Node { - type: "EmptyStatement" -} - -export interface DebuggerStatement extends Node { - type: "DebuggerStatement" -} - -export interface WithStatement extends Node { - type: "WithStatement" - object: Expression - body: Statement -} - -export interface ReturnStatement extends Node { - type: "ReturnStatement" - argument?: Expression | null -} - -export interface LabeledStatement extends Node { - type: "LabeledStatement" - label: Identifier - body: Statement -} - -export interface BreakStatement extends Node { - type: "BreakStatement" - label?: Identifier | null -} - -export interface ContinueStatement extends Node { - type: "ContinueStatement" - label?: Identifier | null -} - -export interface IfStatement extends Node { - type: "IfStatement" - test: Expression - consequent: Statement - alternate?: Statement | null -} - -export interface SwitchStatement extends Node { - type: "SwitchStatement" - discriminant: Expression - cases: Array -} - -export interface SwitchCase extends Node { - type: "SwitchCase" - test?: Expression | null - consequent: Array -} - -export interface ThrowStatement extends Node { - type: "ThrowStatement" - argument: Expression -} - -export interface TryStatement extends Node { - type: "TryStatement" - block: BlockStatement - handler?: CatchClause | null - finalizer?: BlockStatement | null -} - -export interface CatchClause extends Node { - type: "CatchClause" - param?: Pattern | null - body: BlockStatement -} - -export interface WhileStatement extends Node { - type: "WhileStatement" - test: Expression - body: Statement -} - -export interface DoWhileStatement extends Node { - type: "DoWhileStatement" - body: Statement - test: Expression -} - -export interface ForStatement extends Node { - type: "ForStatement" - init?: VariableDeclaration | Expression | null - test?: Expression | null - update?: Expression | null - body: Statement -} - -export interface ForInStatement extends Node { - type: "ForInStatement" - left: VariableDeclaration | Pattern - right: Expression - body: Statement -} - -export interface FunctionDeclaration extends Function { - type: "FunctionDeclaration" - id: Identifier - body: BlockStatement -} - -export interface VariableDeclaration extends Node { - type: "VariableDeclaration" - declarations: Array - kind: "var" | "let" | "const" -} - -export interface VariableDeclarator extends Node { - type: "VariableDeclarator" - id: Pattern - init?: Expression | null -} - -export interface ThisExpression extends Node { - type: "ThisExpression" -} - -export interface ArrayExpression extends Node { - type: "ArrayExpression" - elements: Array -} - -export interface ObjectExpression extends Node { - type: "ObjectExpression" - properties: Array -} - -export interface Property extends Node { - type: "Property" - key: Expression - value: Expression - kind: "init" | "get" | "set" - method: boolean - shorthand: boolean - computed: boolean -} - -export interface FunctionExpression extends Function { - type: "FunctionExpression" - body: BlockStatement -} - -export interface UnaryExpression extends Node { - type: "UnaryExpression" - operator: UnaryOperator - prefix: boolean - argument: Expression -} - -export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete" - -export interface UpdateExpression extends Node { - type: "UpdateExpression" - operator: UpdateOperator - argument: Expression - prefix: boolean -} - -export type UpdateOperator = "++" | "--" - -export interface BinaryExpression extends Node { - type: "BinaryExpression" - operator: BinaryOperator - left: Expression | PrivateIdentifier - right: Expression -} - -export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof" | "**" - -export interface AssignmentExpression extends Node { - type: "AssignmentExpression" - operator: AssignmentOperator - left: Pattern - right: Expression -} - -export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "||=" | "&&=" | "??=" - -export interface LogicalExpression extends Node { - type: "LogicalExpression" - operator: LogicalOperator - left: Expression - right: Expression -} - -export type LogicalOperator = "||" | "&&" | "??" - -export interface MemberExpression extends Node { - type: "MemberExpression" - object: Expression | Super - property: Expression | PrivateIdentifier - computed: boolean - optional: boolean -} - -export interface ConditionalExpression extends Node { - type: "ConditionalExpression" - test: Expression - alternate: Expression - consequent: Expression -} - -export interface CallExpression extends Node { - type: "CallExpression" - callee: Expression | Super - arguments: Array - optional: boolean -} - -export interface NewExpression extends Node { - type: "NewExpression" - callee: Expression - arguments: Array -} - -export interface SequenceExpression extends Node { - type: "SequenceExpression" - expressions: Array -} - -export interface ForOfStatement extends Node { - type: "ForOfStatement" - left: VariableDeclaration | Pattern - right: Expression - body: Statement - await: boolean -} - -export interface Super extends Node { - type: "Super" -} - -export interface SpreadElement extends Node { - type: "SpreadElement" - argument: Expression -} - -export interface ArrowFunctionExpression extends Function { - type: "ArrowFunctionExpression" -} - -export interface YieldExpression extends Node { - type: "YieldExpression" - argument?: Expression | null - delegate: boolean -} - -export interface TemplateLiteral extends Node { - type: "TemplateLiteral" - quasis: Array - expressions: Array -} - -export interface TaggedTemplateExpression extends Node { - type: "TaggedTemplateExpression" - tag: Expression - quasi: TemplateLiteral -} - -export interface TemplateElement extends Node { - type: "TemplateElement" - tail: boolean - value: { - cooked?: string | null - raw: string - } -} - -export interface AssignmentProperty extends Node { - type: "Property" - key: Expression - value: Pattern - kind: "init" - method: false - shorthand: boolean - computed: boolean -} - -export interface ObjectPattern extends Node { - type: "ObjectPattern" - properties: Array -} - -export interface ArrayPattern extends Node { - type: "ArrayPattern" - elements: Array -} - -export interface RestElement extends Node { - type: "RestElement" - argument: Pattern -} - -export interface AssignmentPattern extends Node { - type: "AssignmentPattern" - left: Pattern - right: Expression -} - -export interface Class extends Node { - id?: Identifier | null - superClass?: Expression | null - body: ClassBody -} - -export interface ClassBody extends Node { - type: "ClassBody" - body: Array -} - -export interface MethodDefinition extends Node { - type: "MethodDefinition" - key: Expression | PrivateIdentifier - value: FunctionExpression - kind: "constructor" | "method" | "get" | "set" - computed: boolean - static: boolean -} - -export interface ClassDeclaration extends Class { - type: "ClassDeclaration" - id: Identifier -} - -export interface ClassExpression extends Class { - type: "ClassExpression" -} - -export interface MetaProperty extends Node { - type: "MetaProperty" - meta: Identifier - property: Identifier -} - -export interface ImportDeclaration extends Node { - type: "ImportDeclaration" - specifiers: Array - source: Literal - attributes: Array -} - -export interface ImportSpecifier extends Node { - type: "ImportSpecifier" - imported: Identifier | Literal - local: Identifier -} - -export interface ImportDefaultSpecifier extends Node { - type: "ImportDefaultSpecifier" - local: Identifier -} - -export interface ImportNamespaceSpecifier extends Node { - type: "ImportNamespaceSpecifier" - local: Identifier -} - -export interface ImportAttribute extends Node { - type: "ImportAttribute" - key: Identifier | Literal - value: Literal -} - -export interface ExportNamedDeclaration extends Node { - type: "ExportNamedDeclaration" - declaration?: Declaration | null - specifiers: Array - source?: Literal | null - attributes: Array -} - -export interface ExportSpecifier extends Node { - type: "ExportSpecifier" - exported: Identifier | Literal - local: Identifier | Literal -} - -export interface AnonymousFunctionDeclaration extends Function { - type: "FunctionDeclaration" - id: null - body: BlockStatement -} - -export interface AnonymousClassDeclaration extends Class { - type: "ClassDeclaration" - id: null -} - -export interface ExportDefaultDeclaration extends Node { - type: "ExportDefaultDeclaration" - declaration: AnonymousFunctionDeclaration | FunctionDeclaration | AnonymousClassDeclaration | ClassDeclaration | Expression -} - -export interface ExportAllDeclaration extends Node { - type: "ExportAllDeclaration" - source: Literal - exported?: Identifier | Literal | null - attributes: Array -} - -export interface AwaitExpression extends Node { - type: "AwaitExpression" - argument: Expression -} - -export interface ChainExpression extends Node { - type: "ChainExpression" - expression: MemberExpression | CallExpression -} - -export interface ImportExpression extends Node { - type: "ImportExpression" - source: Expression - options: Expression | null -} - -export interface ParenthesizedExpression extends Node { - type: "ParenthesizedExpression" - expression: Expression -} - -export interface PropertyDefinition extends Node { - type: "PropertyDefinition" - key: Expression | PrivateIdentifier - value?: Expression | null - computed: boolean - static: boolean -} - -export interface PrivateIdentifier extends Node { - type: "PrivateIdentifier" - name: string -} - -export interface StaticBlock extends Node { - type: "StaticBlock" - body: Array -} - -export type Statement = -| ExpressionStatement -| BlockStatement -| EmptyStatement -| DebuggerStatement -| WithStatement -| ReturnStatement -| LabeledStatement -| BreakStatement -| ContinueStatement -| IfStatement -| SwitchStatement -| ThrowStatement -| TryStatement -| WhileStatement -| DoWhileStatement -| ForStatement -| ForInStatement -| ForOfStatement -| Declaration - -export type Declaration = -| FunctionDeclaration -| VariableDeclaration -| ClassDeclaration - -export type Expression = -| Identifier -| Literal -| ThisExpression -| ArrayExpression -| ObjectExpression -| FunctionExpression -| UnaryExpression -| UpdateExpression -| BinaryExpression -| AssignmentExpression -| LogicalExpression -| MemberExpression -| ConditionalExpression -| CallExpression -| NewExpression -| SequenceExpression -| ArrowFunctionExpression -| YieldExpression -| TemplateLiteral -| TaggedTemplateExpression -| ClassExpression -| MetaProperty -| AwaitExpression -| ChainExpression -| ImportExpression -| ParenthesizedExpression - -export type Pattern = -| Identifier -| MemberExpression -| ObjectPattern -| ArrayPattern -| RestElement -| AssignmentPattern - -export type ModuleDeclaration = -| ImportDeclaration -| ExportNamedDeclaration -| ExportDefaultDeclaration -| ExportAllDeclaration - -export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportAttribute | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator - -export function parse(input: string, options: Options): Program - -export function parseExpressionAt(input: string, pos: number, options: Options): Expression - -export function tokenizer(input: string, options: Options): { - getToken(): Token - [Symbol.iterator](): Iterator -} - -export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | "latest" - -export interface Options { - /** - * `ecmaVersion` indicates the ECMAScript version to parse. Can be a - * number, either in year (`2022`) or plain version number (`6`) form, - * or `"latest"` (the latest the library supports). This influences - * support for strict mode, the set of reserved words, and support for - * new syntax features. - */ - ecmaVersion: ecmaVersion - - /** - * `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" | "module" - - /** - * a callback that will be called when a semicolon is automatically inserted. - * @param lastTokEnd the position of the comma as an offset - * @param lastTokEndLoc location if {@link locations} is enabled - */ - onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void - - /** - * similar to `onInsertedSemicolon`, but for trailing commas - * @param lastTokEnd the position of the comma as an offset - * @param lastTokEndLoc location if `locations` is enabled - */ - onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void - - /** - * 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?: boolean | "never" - - /** - * When enabled, a return at the top level is not considered an error. - */ - allowReturnOutsideFunction?: boolean - - /** - * 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?: boolean - - /** - * By default, `await` identifiers are allowed to appear at the top-level scope only if {@link 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?: boolean - - /** - * When enabled, super identifiers are not constrained to - * appearing in methods and do not raise an error when they appear elsewhere. - */ - allowSuperOutsideMethod?: boolean - - /** - * When enabled, hashbang directive in the beginning of file is - * allowed and treated as a line comment. Enabled by default when - * {@link ecmaVersion} >= 2023. - */ - allowHashBang?: boolean - - /** - * By default, the parser will verify that private properties are - * only used in places where they are valid and have been declared. - * Set this to false to turn such checks off. - */ - checkPrivateFields?: boolean - - /** - * When `locations` is on, `loc` properties holding objects with - * `start` and `end` properties as {@link Position} objects will be attached to the - * nodes. - */ - locations?: boolean - - /** - * a callback that will cause Acorn to call that export 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?: ((token: Token) => void) | Token[] - - - /** - * This takes a export function or an array. - * - * When a export function is passed, Acorn will call that export 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 {@link locations} option is on, two more parameters are - * passed, the full locations of {@link Position} export type of the start and - * end of the comments. - * - * When a array is passed, each found comment of {@link Comment} export type is pushed to the array. - * - * Note that you are not allowed to call the - * parser from the callback—that will corrupt its internal state. - */ - onComment?: (( - isBlock: boolean, text: string, start: number, end: number, startLoc?: Position, - endLoc?: Position - ) => void) | Comment[] - - /** - * 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`. - */ - ranges?: boolean - - /** - * 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?: Node - - /** - * When {@link locations} is on, you can pass this to record the source - * file in every node's `loc` object. - */ - sourceFile?: string - - /** - * This value, if given, is stored in every node, whether {@link locations} is on or off. - */ - directSourceFile?: string - - /** - * When enabled, parenthesized expressions are represented by - * (non-standard) ParenthesizedExpression nodes - */ - preserveParens?: boolean -} - -export class Parser { - options: Options - input: string - - protected constructor(options: Options, input: string, startPos?: number) - parse(): Program - - static parse(input: string, options: Options): Program - static parseExpressionAt(input: string, pos: number, options: Options): Expression - static tokenizer(input: string, options: Options): { - getToken(): Token - [Symbol.iterator](): Iterator - } - static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser -} - -export const defaultOptions: Options - -export function getLineInfo(input: string, offset: number): Position - -export class TokenType { - label: string - keyword: string | undefined -} - -export 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 -} - -export interface Comment { - type: "Line" | "Block" - value: string - start: number - end: number - loc?: SourceLocation - range?: [number, number] -} - -export class Token { - type: TokenType - start: number - end: number - loc?: SourceLocation - range?: [number, number] -} - -export const version: string diff --git a/node_modules/acorn/dist/acorn.d.ts b/node_modules/acorn/dist/acorn.d.ts deleted file mode 100644 index 81f4e38..0000000 --- a/node_modules/acorn/dist/acorn.d.ts +++ /dev/null @@ -1,866 +0,0 @@ -export interface Node { - start: number - end: number - type: string - range?: [number, number] - loc?: SourceLocation | null -} - -export interface SourceLocation { - source?: string | null - start: Position - end: Position -} - -export interface Position { - /** 1-based */ - line: number - /** 0-based */ - column: number -} - -export interface Identifier extends Node { - type: "Identifier" - name: string -} - -export interface Literal extends Node { - type: "Literal" - value?: string | boolean | null | number | RegExp | bigint - raw?: string - regex?: { - pattern: string - flags: string - } - bigint?: string -} - -export interface Program extends Node { - type: "Program" - body: Array - sourceType: "script" | "module" -} - -export interface Function extends Node { - id?: Identifier | null - params: Array - body: BlockStatement | Expression - generator: boolean - expression: boolean - async: boolean -} - -export interface ExpressionStatement extends Node { - type: "ExpressionStatement" - expression: Expression | Literal - directive?: string -} - -export interface BlockStatement extends Node { - type: "BlockStatement" - body: Array -} - -export interface EmptyStatement extends Node { - type: "EmptyStatement" -} - -export interface DebuggerStatement extends Node { - type: "DebuggerStatement" -} - -export interface WithStatement extends Node { - type: "WithStatement" - object: Expression - body: Statement -} - -export interface ReturnStatement extends Node { - type: "ReturnStatement" - argument?: Expression | null -} - -export interface LabeledStatement extends Node { - type: "LabeledStatement" - label: Identifier - body: Statement -} - -export interface BreakStatement extends Node { - type: "BreakStatement" - label?: Identifier | null -} - -export interface ContinueStatement extends Node { - type: "ContinueStatement" - label?: Identifier | null -} - -export interface IfStatement extends Node { - type: "IfStatement" - test: Expression - consequent: Statement - alternate?: Statement | null -} - -export interface SwitchStatement extends Node { - type: "SwitchStatement" - discriminant: Expression - cases: Array -} - -export interface SwitchCase extends Node { - type: "SwitchCase" - test?: Expression | null - consequent: Array -} - -export interface ThrowStatement extends Node { - type: "ThrowStatement" - argument: Expression -} - -export interface TryStatement extends Node { - type: "TryStatement" - block: BlockStatement - handler?: CatchClause | null - finalizer?: BlockStatement | null -} - -export interface CatchClause extends Node { - type: "CatchClause" - param?: Pattern | null - body: BlockStatement -} - -export interface WhileStatement extends Node { - type: "WhileStatement" - test: Expression - body: Statement -} - -export interface DoWhileStatement extends Node { - type: "DoWhileStatement" - body: Statement - test: Expression -} - -export interface ForStatement extends Node { - type: "ForStatement" - init?: VariableDeclaration | Expression | null - test?: Expression | null - update?: Expression | null - body: Statement -} - -export interface ForInStatement extends Node { - type: "ForInStatement" - left: VariableDeclaration | Pattern - right: Expression - body: Statement -} - -export interface FunctionDeclaration extends Function { - type: "FunctionDeclaration" - id: Identifier - body: BlockStatement -} - -export interface VariableDeclaration extends Node { - type: "VariableDeclaration" - declarations: Array - kind: "var" | "let" | "const" -} - -export interface VariableDeclarator extends Node { - type: "VariableDeclarator" - id: Pattern - init?: Expression | null -} - -export interface ThisExpression extends Node { - type: "ThisExpression" -} - -export interface ArrayExpression extends Node { - type: "ArrayExpression" - elements: Array -} - -export interface ObjectExpression extends Node { - type: "ObjectExpression" - properties: Array -} - -export interface Property extends Node { - type: "Property" - key: Expression - value: Expression - kind: "init" | "get" | "set" - method: boolean - shorthand: boolean - computed: boolean -} - -export interface FunctionExpression extends Function { - type: "FunctionExpression" - body: BlockStatement -} - -export interface UnaryExpression extends Node { - type: "UnaryExpression" - operator: UnaryOperator - prefix: boolean - argument: Expression -} - -export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete" - -export interface UpdateExpression extends Node { - type: "UpdateExpression" - operator: UpdateOperator - argument: Expression - prefix: boolean -} - -export type UpdateOperator = "++" | "--" - -export interface BinaryExpression extends Node { - type: "BinaryExpression" - operator: BinaryOperator - left: Expression | PrivateIdentifier - right: Expression -} - -export type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof" | "**" - -export interface AssignmentExpression extends Node { - type: "AssignmentExpression" - operator: AssignmentOperator - left: Pattern - right: Expression -} - -export type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "**=" | "||=" | "&&=" | "??=" - -export interface LogicalExpression extends Node { - type: "LogicalExpression" - operator: LogicalOperator - left: Expression - right: Expression -} - -export type LogicalOperator = "||" | "&&" | "??" - -export interface MemberExpression extends Node { - type: "MemberExpression" - object: Expression | Super - property: Expression | PrivateIdentifier - computed: boolean - optional: boolean -} - -export interface ConditionalExpression extends Node { - type: "ConditionalExpression" - test: Expression - alternate: Expression - consequent: Expression -} - -export interface CallExpression extends Node { - type: "CallExpression" - callee: Expression | Super - arguments: Array - optional: boolean -} - -export interface NewExpression extends Node { - type: "NewExpression" - callee: Expression - arguments: Array -} - -export interface SequenceExpression extends Node { - type: "SequenceExpression" - expressions: Array -} - -export interface ForOfStatement extends Node { - type: "ForOfStatement" - left: VariableDeclaration | Pattern - right: Expression - body: Statement - await: boolean -} - -export interface Super extends Node { - type: "Super" -} - -export interface SpreadElement extends Node { - type: "SpreadElement" - argument: Expression -} - -export interface ArrowFunctionExpression extends Function { - type: "ArrowFunctionExpression" -} - -export interface YieldExpression extends Node { - type: "YieldExpression" - argument?: Expression | null - delegate: boolean -} - -export interface TemplateLiteral extends Node { - type: "TemplateLiteral" - quasis: Array - expressions: Array -} - -export interface TaggedTemplateExpression extends Node { - type: "TaggedTemplateExpression" - tag: Expression - quasi: TemplateLiteral -} - -export interface TemplateElement extends Node { - type: "TemplateElement" - tail: boolean - value: { - cooked?: string | null - raw: string - } -} - -export interface AssignmentProperty extends Node { - type: "Property" - key: Expression - value: Pattern - kind: "init" - method: false - shorthand: boolean - computed: boolean -} - -export interface ObjectPattern extends Node { - type: "ObjectPattern" - properties: Array -} - -export interface ArrayPattern extends Node { - type: "ArrayPattern" - elements: Array -} - -export interface RestElement extends Node { - type: "RestElement" - argument: Pattern -} - -export interface AssignmentPattern extends Node { - type: "AssignmentPattern" - left: Pattern - right: Expression -} - -export interface Class extends Node { - id?: Identifier | null - superClass?: Expression | null - body: ClassBody -} - -export interface ClassBody extends Node { - type: "ClassBody" - body: Array -} - -export interface MethodDefinition extends Node { - type: "MethodDefinition" - key: Expression | PrivateIdentifier - value: FunctionExpression - kind: "constructor" | "method" | "get" | "set" - computed: boolean - static: boolean -} - -export interface ClassDeclaration extends Class { - type: "ClassDeclaration" - id: Identifier -} - -export interface ClassExpression extends Class { - type: "ClassExpression" -} - -export interface MetaProperty extends Node { - type: "MetaProperty" - meta: Identifier - property: Identifier -} - -export interface ImportDeclaration extends Node { - type: "ImportDeclaration" - specifiers: Array - source: Literal - attributes: Array -} - -export interface ImportSpecifier extends Node { - type: "ImportSpecifier" - imported: Identifier | Literal - local: Identifier -} - -export interface ImportDefaultSpecifier extends Node { - type: "ImportDefaultSpecifier" - local: Identifier -} - -export interface ImportNamespaceSpecifier extends Node { - type: "ImportNamespaceSpecifier" - local: Identifier -} - -export interface ImportAttribute extends Node { - type: "ImportAttribute" - key: Identifier | Literal - value: Literal -} - -export interface ExportNamedDeclaration extends Node { - type: "ExportNamedDeclaration" - declaration?: Declaration | null - specifiers: Array - source?: Literal | null - attributes: Array -} - -export interface ExportSpecifier extends Node { - type: "ExportSpecifier" - exported: Identifier | Literal - local: Identifier | Literal -} - -export interface AnonymousFunctionDeclaration extends Function { - type: "FunctionDeclaration" - id: null - body: BlockStatement -} - -export interface AnonymousClassDeclaration extends Class { - type: "ClassDeclaration" - id: null -} - -export interface ExportDefaultDeclaration extends Node { - type: "ExportDefaultDeclaration" - declaration: AnonymousFunctionDeclaration | FunctionDeclaration | AnonymousClassDeclaration | ClassDeclaration | Expression -} - -export interface ExportAllDeclaration extends Node { - type: "ExportAllDeclaration" - source: Literal - exported?: Identifier | Literal | null - attributes: Array -} - -export interface AwaitExpression extends Node { - type: "AwaitExpression" - argument: Expression -} - -export interface ChainExpression extends Node { - type: "ChainExpression" - expression: MemberExpression | CallExpression -} - -export interface ImportExpression extends Node { - type: "ImportExpression" - source: Expression - options: Expression | null -} - -export interface ParenthesizedExpression extends Node { - type: "ParenthesizedExpression" - expression: Expression -} - -export interface PropertyDefinition extends Node { - type: "PropertyDefinition" - key: Expression | PrivateIdentifier - value?: Expression | null - computed: boolean - static: boolean -} - -export interface PrivateIdentifier extends Node { - type: "PrivateIdentifier" - name: string -} - -export interface StaticBlock extends Node { - type: "StaticBlock" - body: Array -} - -export type Statement = -| ExpressionStatement -| BlockStatement -| EmptyStatement -| DebuggerStatement -| WithStatement -| ReturnStatement -| LabeledStatement -| BreakStatement -| ContinueStatement -| IfStatement -| SwitchStatement -| ThrowStatement -| TryStatement -| WhileStatement -| DoWhileStatement -| ForStatement -| ForInStatement -| ForOfStatement -| Declaration - -export type Declaration = -| FunctionDeclaration -| VariableDeclaration -| ClassDeclaration - -export type Expression = -| Identifier -| Literal -| ThisExpression -| ArrayExpression -| ObjectExpression -| FunctionExpression -| UnaryExpression -| UpdateExpression -| BinaryExpression -| AssignmentExpression -| LogicalExpression -| MemberExpression -| ConditionalExpression -| CallExpression -| NewExpression -| SequenceExpression -| ArrowFunctionExpression -| YieldExpression -| TemplateLiteral -| TaggedTemplateExpression -| ClassExpression -| MetaProperty -| AwaitExpression -| ChainExpression -| ImportExpression -| ParenthesizedExpression - -export type Pattern = -| Identifier -| MemberExpression -| ObjectPattern -| ArrayPattern -| RestElement -| AssignmentPattern - -export type ModuleDeclaration = -| ImportDeclaration -| ExportNamedDeclaration -| ExportDefaultDeclaration -| ExportAllDeclaration - -export type AnyNode = Statement | Expression | Declaration | ModuleDeclaration | Literal | Program | SwitchCase | CatchClause | Property | Super | SpreadElement | TemplateElement | AssignmentProperty | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | ClassBody | MethodDefinition | MetaProperty | ImportAttribute | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier | AnonymousFunctionDeclaration | AnonymousClassDeclaration | PropertyDefinition | PrivateIdentifier | StaticBlock | VariableDeclarator - -export function parse(input: string, options: Options): Program - -export function parseExpressionAt(input: string, pos: number, options: Options): Expression - -export function tokenizer(input: string, options: Options): { - getToken(): Token - [Symbol.iterator](): Iterator -} - -export type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | "latest" - -export interface Options { - /** - * `ecmaVersion` indicates the ECMAScript version to parse. Can be a - * number, either in year (`2022`) or plain version number (`6`) form, - * or `"latest"` (the latest the library supports). This influences - * support for strict mode, the set of reserved words, and support for - * new syntax features. - */ - ecmaVersion: ecmaVersion - - /** - * `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" | "module" - - /** - * a callback that will be called when a semicolon is automatically inserted. - * @param lastTokEnd the position of the comma as an offset - * @param lastTokEndLoc location if {@link locations} is enabled - */ - onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void - - /** - * similar to `onInsertedSemicolon`, but for trailing commas - * @param lastTokEnd the position of the comma as an offset - * @param lastTokEndLoc location if `locations` is enabled - */ - onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void - - /** - * 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?: boolean | "never" - - /** - * When enabled, a return at the top level is not considered an error. - */ - allowReturnOutsideFunction?: boolean - - /** - * 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?: boolean - - /** - * By default, `await` identifiers are allowed to appear at the top-level scope only if {@link 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?: boolean - - /** - * When enabled, super identifiers are not constrained to - * appearing in methods and do not raise an error when they appear elsewhere. - */ - allowSuperOutsideMethod?: boolean - - /** - * When enabled, hashbang directive in the beginning of file is - * allowed and treated as a line comment. Enabled by default when - * {@link ecmaVersion} >= 2023. - */ - allowHashBang?: boolean - - /** - * By default, the parser will verify that private properties are - * only used in places where they are valid and have been declared. - * Set this to false to turn such checks off. - */ - checkPrivateFields?: boolean - - /** - * When `locations` is on, `loc` properties holding objects with - * `start` and `end` properties as {@link Position} objects will be attached to the - * nodes. - */ - locations?: boolean - - /** - * a callback that will cause Acorn to call that export 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?: ((token: Token) => void) | Token[] - - - /** - * This takes a export function or an array. - * - * When a export function is passed, Acorn will call that export 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 {@link locations} option is on, two more parameters are - * passed, the full locations of {@link Position} export type of the start and - * end of the comments. - * - * When a array is passed, each found comment of {@link Comment} export type is pushed to the array. - * - * Note that you are not allowed to call the - * parser from the callback—that will corrupt its internal state. - */ - onComment?: (( - isBlock: boolean, text: string, start: number, end: number, startLoc?: Position, - endLoc?: Position - ) => void) | Comment[] - - /** - * 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`. - */ - ranges?: boolean - - /** - * 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?: Node - - /** - * When {@link locations} is on, you can pass this to record the source - * file in every node's `loc` object. - */ - sourceFile?: string - - /** - * This value, if given, is stored in every node, whether {@link locations} is on or off. - */ - directSourceFile?: string - - /** - * When enabled, parenthesized expressions are represented by - * (non-standard) ParenthesizedExpression nodes - */ - preserveParens?: boolean -} - -export class Parser { - options: Options - input: string - - protected constructor(options: Options, input: string, startPos?: number) - parse(): Program - - static parse(input: string, options: Options): Program - static parseExpressionAt(input: string, pos: number, options: Options): Expression - static tokenizer(input: string, options: Options): { - getToken(): Token - [Symbol.iterator](): Iterator - } - static extend(...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser -} - -export const defaultOptions: Options - -export function getLineInfo(input: string, offset: number): Position - -export class TokenType { - label: string - keyword: string | undefined -} - -export 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 -} - -export interface Comment { - type: "Line" | "Block" - value: string - start: number - end: number - loc?: SourceLocation - range?: [number, number] -} - -export class Token { - type: TokenType - start: number - end: number - loc?: SourceLocation - range?: [number, number] -} - -export const version: string diff --git a/node_modules/acorn/dist/acorn.js b/node_modules/acorn/dist/acorn.js deleted file mode 100644 index 2bfc15b..0000000 --- a/node_modules/acorn/dist/acorn.js +++ /dev/null @@ -1,6174 +0,0 @@ -(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, 7, 9, 32, 4, 318, 1, 80, 3, 71, 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, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 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, 343, 9, 54, 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, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 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, 4, 51, 13, 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, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 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, 20, 1, 64, 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, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 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, 200, 32, 32, 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, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 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, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 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, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191]; - - // 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\u0897-\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\u0cf3\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-\u0ece\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\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\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\uff65"; - - // 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-\u1c8a\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-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\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 - // >0xffff code points that are a valid part of identifiers. The - // offset starts at 0x10000, and each pair of numbers represents an - // offset to the next range, and then a size of the range. - - // 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 } - } - return false - } - - // 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]" - ); }); - - var regexpCache = Object.create(null); - - function wordsRegexp(words) { - return regexpCache[words] || (regexpCache[words] = 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), 14 (2023), 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 inserted semicolon 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. Enabled by default when - // `ecmaVersion` >= 2023. - allowHashBang: false, - // By default, the parser will verify that private properties are - // only used in places where they are valid and have been declared. - // Set this to false to turn such checks off. - checkPrivateFields: true, - // 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. - // When this option has an array as value, objects representing the - // comments are pushed to it. - 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 (!opts || opts.allowHashBang == null) - { options.allowHashBang = options.ecmaVersion >= 14; } - - 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, isAssign ? "Assigning to rvalue" : "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) { return true } // '[', '\' - if (context) { return false } - - if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '{', astral - 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 containsEsc = this.containsEsc; - var refDestructuringErrors = new DestructuringErrors; - var initPos = this.start; - var init = awaitAt > -1 - ? this.parseExprSubscripts(refDestructuringErrors, "await") - : this.parseExpression(true, refDestructuringErrors); - if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { - if (awaitAt > -1) { // implies `ecmaVersion >= 9` (see declaration of awaitAt) - if (this.type === types$1._in) { this.unexpected(awaitAt); } - node.await = true; - } else if (isForOf && this.options.ecmaVersion >= 8) { - if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") { this.unexpected(); } - else if (this.options.ecmaVersion >= 9) { node.await = false; } - } - 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.parseCatchClauseParam = function() { - var param = this.parseBindingAtom(); - var simple = param.type === "Identifier"; - this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); - this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); - this.expect(types$1.parenR); - - return param - }; - - 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.parseCatchClauseParam(); - } 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, allowMissingInitializer) { - this.next(); - this.parseVar(node, false, kind, allowMissingInitializer); - 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, allowMissingInitializer) { - 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 (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) { - this.unexpected(); - } else if (!allowMissingInitializer && 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.raiseRecoverable(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(null, 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; - if (!this.options.checkPrivateFields) { return } - 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.parseExportAllDeclaration = function(node, exports) { - 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(); - if (this.options.ecmaVersion >= 16) - { node.attributes = this.parseWithClause(); } - this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration") - }; - - pp$8.parseExport = function(node, exports) { - this.next(); - // export * from '...' - if (this.eat(types$1.star)) { - return this.parseExportAllDeclaration(node, exports) - } - if (this.eat(types$1._default)) { // export default ... - this.checkExport(exports, "default", this.lastTokStart); - node.declaration = this.parseExportDefaultDeclaration(); - return this.finishNode(node, "ExportDefaultDeclaration") - } - // export var|const|let|function|class ... - if (this.shouldParseExportStatement()) { - node.declaration = this.parseExportDeclaration(node); - 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(); - if (this.options.ecmaVersion >= 16) - { node.attributes = this.parseWithClause(); } - } 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.parseExportDeclaration = function(node) { - return this.parseStatement(null) - }; - - pp$8.parseExportDefaultDeclaration = function() { - var isAsync; - if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { - var fNode = this.startNode(); - this.next(); - if (isAsync) { this.next(); } - return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync) - } else if (this.type === types$1._class) { - var cNode = this.startNode(); - return this.parseClass(cNode, "nullableID") - } else { - var declaration = this.parseMaybeAssign(); - this.semicolon(); - return declaration - } - }; - - 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); } - }; - - 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.parseExportSpecifier = function(exports) { - 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 - ); - - return this.finishNode(node, "ExportSpecifier") - }; - - 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; } - - nodes.push(this.parseExportSpecifier(exports)); - } - 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(); - } - if (this.options.ecmaVersion >= 16) - { node.attributes = this.parseWithClause(); } - this.semicolon(); - return this.finishNode(node, "ImportDeclaration") - }; - - // Parses a comma-separated list of module imports. - - pp$8.parseImportSpecifier = function() { - var node = this.startNode(); - node.imported = this.parseModuleExportName(); - - if (this.eatContextual("as")) { - node.local = this.parseIdent(); - } else { - this.checkUnreserved(node.imported); - node.local = node.imported; - } - this.checkLValSimple(node.local, BIND_LEXICAL); - - return this.finishNode(node, "ImportSpecifier") - }; - - pp$8.parseImportDefaultSpecifier = function() { - // import defaultObj, { x, y as z } from '...' - var node = this.startNode(); - node.local = this.parseIdent(); - this.checkLValSimple(node.local, BIND_LEXICAL); - return this.finishNode(node, "ImportDefaultSpecifier") - }; - - pp$8.parseImportNamespaceSpecifier = function() { - var node = this.startNode(); - this.next(); - this.expectContextual("as"); - node.local = this.parseIdent(); - this.checkLValSimple(node.local, BIND_LEXICAL); - return this.finishNode(node, "ImportNamespaceSpecifier") - }; - - pp$8.parseImportSpecifiers = function() { - var nodes = [], first = true; - if (this.type === types$1.name) { - nodes.push(this.parseImportDefaultSpecifier()); - if (!this.eat(types$1.comma)) { return nodes } - } - if (this.type === types$1.star) { - nodes.push(this.parseImportNamespaceSpecifier()); - 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; } - - nodes.push(this.parseImportSpecifier()); - } - return nodes - }; - - pp$8.parseWithClause = function() { - var nodes = []; - if (!this.eat(types$1._with)) { - return nodes - } - this.expect(types$1.braceL); - var attributeKeys = {}; - var first = true; - while (!this.eat(types$1.braceR)) { - if (!first) { - this.expect(types$1.comma); - if (this.afterTrailingComma(types$1.braceR)) { break } - } else { first = false; } - - var attr = this.parseImportAttribute(); - var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value; - if (hasOwn(attributeKeys, keyName)) - { this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'"); } - attributeKeys[keyName] = true; - nodes.push(attr); - } - return nodes - }; - - pp$8.parseImportAttribute = function() { - var node = this.startNode(); - node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); - this.expect(types$1.colon); - if (this.type !== types$1.string) { - this.unexpected(); - } - node.value = this.parseExprAtom(); - return this.finishNode(node, "ImportAttribute") - }; - - 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 ( - this.options.ecmaVersion >= 5 && - 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, allowModifiers) { - 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.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); } - this.expect(close); - break - } else { - elts.push(this.parseAssignableListItem(allowModifiers)); - } - } - return elts - }; - - pp$7.parseAssignableListItem = function(allowModifiers) { - var elem = this.parseMaybeDefault(this.start, this.startLoc); - this.parseBindingListItem(elem); - return elem - }; - - 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 - // given point in the program is loosely based on sweet.js' approach. - // See https://github.com/mozilla/sweet.js/wiki/design - - - 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 edge cases when token context could not be inferred correctly during tokenization 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.colon.updateContext = function() { - if (this.curContext().token === "function") { this.context.pop(); } - this.exprAllowed = true; - }; - - 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 - // syntactic elements, and recursively calling those, each function - // advancing the input stream and returning an AST node. Precedence - // of constructs (for example, the fact that `!x[1]` means `!(x[1])` - // instead of `(!x)[1]` is handled by the fact that the parser - // function that parses unary prefix operators is called first, and - // in turn calls the function that parses `[]` subscripts — that - // way, it'll receive the node for `x[1]` already parsed, and wraps - // *that* in the unary operator node. - // - // Acorn uses an [operator precedence parser][opp] to handle binary - // operator precedence, because it is much more compact than using - // the technique outlined above, which uses different, nesting - // functions to specify precedence, for all of the ten binary - // precedence levels that JavaScript defines. - // - // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser - - - 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" && isLocalVariableAccess(node.argument)) - { 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.options.checkPrivateFields) { 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 isLocalVariableAccess(node) { - return ( - node.type === "Identifier" || - node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression) - ) - } - - function isPrivateFieldAccess(node) { - return ( - node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || - node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || - node.type === "ParenthesizedExpression" && 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.shouldParseAsyncArrow = function() { - return !this.canInsertSemicolon() && this.eat(types$1.arrow) - }; - - pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit) - }; - - 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.shouldParseAsyncArrow()) { - 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.parseSubscriptAsyncArrow(startPos, startLoc, exprList, 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, forNew) { - // 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(forNew) - } else { - return this.unexpected() - } - - default: - return this.parseExprAtomDefault() - } - }; - - pp$5.parseExprAtomDefault = function() { - this.unexpected(); - }; - - pp$5.parseExprImport = function(forNew) { - 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"); } - this.next(); - - if (this.type === types$1.parenL && !forNew) { - return this.parseDynamicImport(node) - } else if (this.type === types$1.dot) { - var meta = this.startNodeAt(node.start, node.loc && node.loc.start); - meta.name = "import"; - node.meta = this.finishNode(meta, "Identifier"); - return this.parseImportMeta(node) - } else { - this.unexpected(); - } - }; - - pp$5.parseDynamicImport = function(node) { - this.next(); // skip `(` - - // Parse node.source. - node.source = this.parseMaybeAssign(); - - if (this.options.ecmaVersion >= 16) { - if (!this.eat(types$1.parenR)) { - this.expect(types$1.comma); - if (!this.afterTrailingComma(types$1.parenR)) { - node.options = this.parseMaybeAssign(); - if (!this.eat(types$1.parenR)) { - this.expect(types$1.comma); - if (!this.afterTrailingComma(types$1.parenR)) { - this.unexpected(); - } - } - } else { - node.options = null; - } - } else { - node.options = null; - } - } else { - // 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.shouldParseArrow = function(exprList) { - return !this.canInsertSemicolon() - }; - - 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.raiseRecoverable( - 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.shouldParseArrow(exprList) && 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(); - this.next(); - if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) { - var meta = this.startNodeAt(node.start, node.loc && node.loc.start); - meta.name = "new"; - node.meta = this.finishNode(meta, "Identifier"); - this.next(); - 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; - node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false); - 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.replace(/\r\n?/g, "\n"), - 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.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); - } - return this.finishNode(prop, "RestElement") - } - // 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); - } else { - isAsync = false; - } - this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc); - return this.finishNode(prop, "Property") - }; - - pp$5.parseGetterSetter = function(prop) { - 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"); } - } - }; - - 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(); } - this.parseGetterSetter(prop); - } 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) { - var node = this.parseIdentNode(); - 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.parseIdentNode = function() { - 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(); - } - this.type = types$1.name; - } else { - this.unexpected(); - } - 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.options.checkPrivateFields) { - 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 was generated by "bin/generate-unicode-script-values.js". Do not modify manually! - var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz"; - - // 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 ecma14BinaryProperties = ecma13BinaryProperties; - - var unicodeBinaryProperties = { - 9: ecma9BinaryProperties, - 10: ecma10BinaryProperties, - 11: ecma11BinaryProperties, - 12: ecma12BinaryProperties, - 13: ecma13BinaryProperties, - 14: ecma14BinaryProperties - }; - - // #table-binary-unicode-properties-of-strings - var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"; - - var unicodeBinaryPropertiesOfStrings = { - 9: "", - 10: "", - 11: "", - 12: "", - 13: "", - 14: ecma14BinaryPropertiesOfStrings - }; - - // #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 ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode; - - var unicodeScriptValues = { - 9: ecma9ScriptValues, - 10: ecma10ScriptValues, - 11: ecma11ScriptValues, - 12: ecma12ScriptValues, - 13: ecma13ScriptValues, - 14: ecma14ScriptValues - }; - - var data = {}; - function buildUnicodeData(ecmaVersion) { - var d = data[ecmaVersion] = { - binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues), - binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]), - 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, 14]; i < list.length; i += 1) { - var ecmaVersion = list[i]; - - buildUnicodeData(ecmaVersion); - } - - var pp$1 = Parser.prototype; - - // Track disjunction structure to determine whether a duplicate - // capture group name is allowed because it is in a separate branch. - var BranchID = function BranchID(parent, base) { - // Parent disjunction branch - this.parent = parent; - // Identifies this set of sibling branches - this.base = base || this; - }; - - BranchID.prototype.separatedFrom = function separatedFrom (alt) { - // A branch is separate from another branch if they or any of - // their parents are siblings in a given disjunction - for (var self = this; self; self = self.parent) { - for (var other = alt; other; other = other.parent) { - if (self.base === other.base && self !== other) { return true } - } - } - return false - }; - - BranchID.prototype.sibling = function sibling () { - return new BranchID(this.parent, this.base) - }; - - 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" : "") + (parser.options.ecmaVersion >= 15 ? "v" : ""); - this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion]; - this.source = ""; - this.flags = ""; - this.start = 0; - this.switchU = false; - this.switchV = false; - this.switchN = false; - this.pos = 0; - this.lastIntValue = 0; - this.lastStringValue = ""; - this.lastAssertionIsQuantifiable = false; - this.numCapturingParens = 0; - this.maxBackReference = 0; - this.groupNames = Object.create(null); - this.backReferenceNames = []; - this.branchID = null; - }; - - RegExpValidationState.prototype.reset = function reset (start, pattern, flags) { - var unicodeSets = flags.indexOf("v") !== -1; - var unicode = flags.indexOf("u") !== -1; - this.start = start | 0; - this.source = pattern + ""; - this.flags = flags; - if (unicodeSets && this.parser.options.ecmaVersion >= 15) { - this.switchU = true; - this.switchV = true; - this.switchN = true; - } else { - this.switchU = unicode && this.parser.options.ecmaVersion >= 6; - this.switchV = false; - 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 - }; - - RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) { - if ( forceU === void 0 ) forceU = false; - - var pos = this.pos; - for (var i = 0, list = chs; i < list.length; i += 1) { - var ch = list[i]; - - var current = this.at(pos, forceU); - if (current === -1 || current !== ch) { - return false - } - pos = this.nextIndex(pos, forceU); - } - this.pos = pos; - return true - }; - - /** - * 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; - - var u = false; - var v = false; - - 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"); - } - if (flag === "u") { u = true; } - if (flag === "v") { v = true; } - } - if (this.options.ecmaVersion >= 15 && u && v) { - this.raise(state.start, "Invalid regular expression flag"); - } - }; - - function hasProp(obj) { - for (var _ in obj) { return true } - return false - } - - /** - * 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 && hasProp(state.groupNames)) { - 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 = Object.create(null); - state.backReferenceNames.length = 0; - state.branchID = null; - - 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[name]) { - state.raise("Invalid named capture referenced"); - } - } - }; - - // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction - pp$1.regexp_disjunction = function(state) { - var trackDisjunction = this.options.ecmaVersion >= 16; - if (trackDisjunction) { state.branchID = new BranchID(state.branchID, null); } - this.regexp_alternative(state); - while (state.eat(0x7C /* | */)) { - if (trackDisjunction) { state.branchID = state.branchID.sibling(); } - this.regexp_alternative(state); - } - if (trackDisjunction) { state.branchID = state.branchID.parent; } - - // 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 /* ? */)) { - if (this.options.ecmaVersion >= 16) { - var addModifiers = this.regexp_eatModifiers(state); - var hasHyphen = state.eat(0x2D /* - */); - if (addModifiers || hasHyphen) { - for (var i = 0; i < addModifiers.length; i++) { - var modifier = addModifiers.charAt(i); - if (addModifiers.indexOf(modifier, i + 1) > -1) { - state.raise("Duplicate regular expression modifiers"); - } - } - if (hasHyphen) { - var removeModifiers = this.regexp_eatModifiers(state); - if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) { - state.raise("Invalid regular expression modifiers"); - } - for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) { - var modifier$1 = removeModifiers.charAt(i$1); - if ( - removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 || - addModifiers.indexOf(modifier$1) > -1 - ) { - state.raise("Duplicate regular expression modifiers"); - } - } - } - } - } - if (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 - }; - // RegularExpressionModifiers :: - // [empty] - // RegularExpressionModifiers RegularExpressionModifier - pp$1.regexp_eatModifiers = function(state) { - var modifiers = ""; - var ch = 0; - while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) { - modifiers += codePointToString(ch); - state.advance(); - } - return modifiers - }; - // RegularExpressionModifier :: one of - // `i` `m` `s` - function isRegularExpressionModifier(ch) { - return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73 /* s */ - } - - // 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)) { state.raise("Invalid group"); } - var trackDisjunction = this.options.ecmaVersion >= 16; - var known = state.groupNames[state.lastStringValue]; - if (known) { - if (trackDisjunction) { - for (var i = 0, list = known; i < list.length; i += 1) { - var altID = list[i]; - - if (!altID.separatedFrom(state.branchID)) - { state.raise("Duplicate capture group name"); } - } - } else { - state.raise("Duplicate capture group name"); - } - } - if (trackDisjunction) { - (known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID); - } else { - state.groupNames[state.lastStringValue] = true; - } - } - }; - - // 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 - }; - - // Return values used by character set parsing methods, needed to - // forbid negation of sets that can match strings. - var CharSetNone = 0; // Nothing parsed - var CharSetOk = 1; // Construct parsed, cannot contain strings - var CharSetString = 2; // Construct parsed, can contain strings - - // 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 CharSetOk - } - - var negate = false; - if ( - state.switchU && - this.options.ecmaVersion >= 9 && - ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */) - ) { - state.lastIntValue = -1; - state.advance(); - var result; - if ( - state.eat(0x7B /* { */) && - (result = this.regexp_eatUnicodePropertyValueExpression(state)) && - state.eat(0x7D /* } */) - ) { - if (negate && result === CharSetString) { state.raise("Invalid property name"); } - return result - } - state.raise("Invalid property name"); - } - - return CharSetNone - }; - - 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 CharSetOk - } - } - state.pos = start; - - // LoneUnicodePropertyNameOrValue - if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) { - var nameOrValue = state.lastStringValue; - return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue) - } - return CharSetNone - }; - - 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)) { return CharSetOk } - if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString } - 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 /* [ */)) { - var negate = state.eat(0x5E /* ^ */); - var result = this.regexp_classContents(state); - if (!state.eat(0x5D /* ] */)) - { state.raise("Unterminated character class"); } - if (negate && result === CharSetString) - { state.raise("Negated character class may contain strings"); } - return true - } - return false - }; - - // https://tc39.es/ecma262/#prod-ClassContents - // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges - pp$1.regexp_classContents = function(state) { - if (state.current() === 0x5D /* ] */) { return CharSetOk } - if (state.switchV) { return this.regexp_classSetExpression(state) } - this.regexp_nonEmptyClassRanges(state); - return CharSetOk - }; - - // 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_nonEmptyClassRanges = 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://tc39.es/ecma262/#prod-ClassSetExpression - // https://tc39.es/ecma262/#prod-ClassUnion - // https://tc39.es/ecma262/#prod-ClassIntersection - // https://tc39.es/ecma262/#prod-ClassSubtraction - pp$1.regexp_classSetExpression = function(state) { - var result = CharSetOk, subResult; - if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) { - if (subResult === CharSetString) { result = CharSetString; } - // https://tc39.es/ecma262/#prod-ClassIntersection - var start = state.pos; - while (state.eatChars([0x26, 0x26] /* && */)) { - if ( - state.current() !== 0x26 /* & */ && - (subResult = this.regexp_eatClassSetOperand(state)) - ) { - if (subResult !== CharSetString) { result = CharSetOk; } - continue - } - state.raise("Invalid character in character class"); - } - if (start !== state.pos) { return result } - // https://tc39.es/ecma262/#prod-ClassSubtraction - while (state.eatChars([0x2D, 0x2D] /* -- */)) { - if (this.regexp_eatClassSetOperand(state)) { continue } - state.raise("Invalid character in character class"); - } - if (start !== state.pos) { return result } - } else { - state.raise("Invalid character in character class"); - } - // https://tc39.es/ecma262/#prod-ClassUnion - for (;;) { - if (this.regexp_eatClassSetRange(state)) { continue } - subResult = this.regexp_eatClassSetOperand(state); - if (!subResult) { return result } - if (subResult === CharSetString) { result = CharSetString; } - } - }; - - // https://tc39.es/ecma262/#prod-ClassSetRange - pp$1.regexp_eatClassSetRange = function(state) { - var start = state.pos; - if (this.regexp_eatClassSetCharacter(state)) { - var left = state.lastIntValue; - if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) { - var right = state.lastIntValue; - if (left !== -1 && right !== -1 && left > right) { - state.raise("Range out of order in character class"); - } - return true - } - state.pos = start; - } - return false - }; - - // https://tc39.es/ecma262/#prod-ClassSetOperand - pp$1.regexp_eatClassSetOperand = function(state) { - if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk } - return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state) - }; - - // https://tc39.es/ecma262/#prod-NestedClass - pp$1.regexp_eatNestedClass = function(state) { - var start = state.pos; - if (state.eat(0x5B /* [ */)) { - var negate = state.eat(0x5E /* ^ */); - var result = this.regexp_classContents(state); - if (state.eat(0x5D /* ] */)) { - if (negate && result === CharSetString) { - state.raise("Negated character class may contain strings"); - } - return result - } - state.pos = start; - } - if (state.eat(0x5C /* \ */)) { - var result$1 = this.regexp_eatCharacterClassEscape(state); - if (result$1) { - return result$1 - } - state.pos = start; - } - return null - }; - - // https://tc39.es/ecma262/#prod-ClassStringDisjunction - pp$1.regexp_eatClassStringDisjunction = function(state) { - var start = state.pos; - if (state.eatChars([0x5C, 0x71] /* \q */)) { - if (state.eat(0x7B /* { */)) { - var result = this.regexp_classStringDisjunctionContents(state); - if (state.eat(0x7D /* } */)) { - return result - } - } else { - // Make the same message as V8. - state.raise("Invalid escape"); - } - state.pos = start; - } - return null - }; - - // https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents - pp$1.regexp_classStringDisjunctionContents = function(state) { - var result = this.regexp_classString(state); - while (state.eat(0x7C /* | */)) { - if (this.regexp_classString(state) === CharSetString) { result = CharSetString; } - } - return result - }; - - // https://tc39.es/ecma262/#prod-ClassString - // https://tc39.es/ecma262/#prod-NonEmptyClassString - pp$1.regexp_classString = function(state) { - var count = 0; - while (this.regexp_eatClassSetCharacter(state)) { count++; } - return count === 1 ? CharSetOk : CharSetString - }; - - // https://tc39.es/ecma262/#prod-ClassSetCharacter - pp$1.regexp_eatClassSetCharacter = function(state) { - var start = state.pos; - if (state.eat(0x5C /* \ */)) { - if ( - this.regexp_eatCharacterEscape(state) || - this.regexp_eatClassSetReservedPunctuator(state) - ) { - return true - } - if (state.eat(0x62 /* b */)) { - state.lastIntValue = 0x08; /* */ - return true - } - state.pos = start; - return false - } - var ch = state.current(); - if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false } - if (isClassSetSyntaxCharacter(ch)) { return false } - state.advance(); - state.lastIntValue = ch; - return true - }; - - // https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator - function isClassSetReservedDoublePunctuatorCharacter(ch) { - return ( - ch === 0x21 /* ! */ || - ch >= 0x23 /* # */ && ch <= 0x26 /* & */ || - ch >= 0x2A /* * */ && ch <= 0x2C /* , */ || - ch === 0x2E /* . */ || - ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ || - ch === 0x5E /* ^ */ || - ch === 0x60 /* ` */ || - ch === 0x7E /* ~ */ - ) - } - - // https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter - function isClassSetSyntaxCharacter(ch) { - return ( - ch === 0x28 /* ( */ || - ch === 0x29 /* ) */ || - ch === 0x2D /* - */ || - ch === 0x2F /* / */ || - ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ || - ch >= 0x7B /* { */ && ch <= 0x7D /* } */ - ) - } - - // https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator - pp$1.regexp_eatClassSetReservedPunctuator = function(state) { - var ch = state.current(); - if (isClassSetReservedPunctuator(ch)) { - state.lastIntValue = ch; - state.advance(); - return true - } - return false - }; - - // https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator - function isClassSetReservedPunctuator(ch) { - return ( - ch === 0x21 /* ! */ || - ch === 0x23 /* # */ || - ch === 0x25 /* % */ || - ch === 0x26 /* & */ || - ch === 0x2C /* , */ || - ch === 0x2D /* - */ || - ch >= 0x3A /* : */ && ch <= 0x3E /* > */ || - ch === 0x40 /* @ */ || - ch === 0x60 /* ` */ || - ch === 0x7E /* ~ */ - ) - } - - // 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) { - // ` - -All Contributors: 1 - - - - - Codecov Test Coverage - - - Contributor Covenant - - - License: MIT - - - Sponsor: On GitHub - - Style: Prettier - TypeScript: Strict -

- -## Usage - -```shell -npm i are-docs-informative -``` - -```ts -import { areDocsInformative } from "are-docs-informative"; - -areDocsInformative("The user id.", "userId"); // false -areDocsInformative("Retrieved user id.", "userId"); // true -``` - -### Options - -The `areDocsInformative` function can receive a third, optional parameter - -#### `aliases` - -The `aliases` option allows indicating words as synonyms (aliases) of each other. - -For example, with `{ aliases: { emoji: ["smiley", "winkey"] } }`, the following comment would be considered uninformative: - -```js -/** Default smiley/winkey. */ -export const defaultSmiley = "🙂"; -``` - -The default `aliases` option is: - -```json -{ - "a": ["an", "our"] -} -``` - -#### `uselessWords` - -Words that are ignored when searching for one that adds meaning. - -For example, with `{ uselessWords: ["our"] }`, the following comment would be considered uninformative: - -```js -/** Our text. */ -export const text = ":)"; -``` - -The default `uselessWords` option is: - -```json -["a", "an", "i", "in", "of", "s", "the"] -``` - -## Development - -See [`.github/CONTRIBUTING.md`](./.github/CONTRIBUTING.md), then [`.github/DEVELOPMENT.md`](./.github/DEVELOPMENT.md). -Thanks! 💖 - -## Contributors - - - - - - - - - - - -
Josh Goldberg
Josh Goldberg

🔧
- - - - - - - - - -> 💙 This package is based on [@JoshuaKGoldberg](https://github.com/JoshuaKGoldberg)'s [template-typescript-node-package](https://github.com/JoshuaKGoldberg/template-typescript-node-package). diff --git a/node_modules/are-docs-informative/lib/index.cjs b/node_modules/are-docs-informative/lib/index.cjs deleted file mode 100644 index 54c036c..0000000 --- a/node_modules/are-docs-informative/lib/index.cjs +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/index.ts -var src_exports = {}; -__export(src_exports, { - areDocsInformative: () => areDocsInformative -}); -module.exports = __toCommonJS(src_exports); -var defaultAliases = { - a: ["an", "our"] -}; -var defaultUselessWords = ["a", "an", "i", "in", "of", "s", "the"]; -function areDocsInformative(docs, name, { - aliases = defaultAliases, - uselessWords = defaultUselessWords -} = {}) { - const docsWords = new Set(splitTextIntoWords(docs)); - const nameWords = splitTextIntoWords(name); - for (const nameWord of nameWords) { - docsWords.delete(nameWord); - } - for (const uselessWord of uselessWords) { - docsWords.delete(uselessWord); - } - return !!docsWords.size; - function normalizeWord(word) { - const wordLower = word.toLowerCase(); - return aliases[wordLower] ?? wordLower; - } - function splitTextIntoWords(text) { - return (typeof text === "string" ? [text] : text).flatMap((name2) => { - return name2.replace(/\W+/gu, " ").replace(/([a-z])([A-Z])/gu, "$1 $2").trim().split(" "); - }).flatMap(normalizeWord).filter(Boolean); - } -} -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { - areDocsInformative -}); diff --git a/node_modules/are-docs-informative/lib/index.d.cts b/node_modules/are-docs-informative/lib/index.d.cts deleted file mode 100644 index bd66dab..0000000 --- a/node_modules/are-docs-informative/lib/index.d.cts +++ /dev/null @@ -1,57 +0,0 @@ -interface InformativeDocsOptions { - /** - * Words that can be considered synonyms (aliases) of each other. - * - * @default - * ```json - * { - * "a": ["an", "our"] - * } - * ``` - * - * @example - * With `{ aliases: { emoji: ["smiley", "winkey"] } }`, - * the following comment would be considered uninformative: - * ```js - * /** Default smiley/winkey. *\/ - * export const defaultSmiley = "🙂"; - * ``` - */ - aliases?: Record; - /** - * Words that are ignored when searching for one that adds meaning. - * - * @default - * ```json - * ["a", "an", "i", "in", "of", "s", "the"] - * ``` - * - * @example - * With `{ uselessWords: ["our"] }`, the following comment would - * be considered uninformative: - * ```js - * /** Our text. *\/ - * export const text = ":)"; - * ``` - */ - uselessWords?: string[]; -} - -/** - * @param docs - Any amount of docs text, such as from a JSDoc description. - * @param name - Name of the entity the docs text is describing. - * @param options - Additional options to customize informativity checking. - * @returns Whether the docs include at least one word with new information. - * - * @example - * ```js - * areDocsInformative("The user id.", "userId"); // false - * ``` - * @example - * ```js - * areDocsInformative("Retrieved user id.", "userId"); // true - * ``` - */ -declare function areDocsInformative(docs: string | string[], name: string | string[], { aliases, uselessWords, }?: InformativeDocsOptions): boolean; - -export { InformativeDocsOptions, areDocsInformative }; diff --git a/node_modules/are-docs-informative/lib/index.d.ts b/node_modules/are-docs-informative/lib/index.d.ts deleted file mode 100644 index bd66dab..0000000 --- a/node_modules/are-docs-informative/lib/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -interface InformativeDocsOptions { - /** - * Words that can be considered synonyms (aliases) of each other. - * - * @default - * ```json - * { - * "a": ["an", "our"] - * } - * ``` - * - * @example - * With `{ aliases: { emoji: ["smiley", "winkey"] } }`, - * the following comment would be considered uninformative: - * ```js - * /** Default smiley/winkey. *\/ - * export const defaultSmiley = "🙂"; - * ``` - */ - aliases?: Record; - /** - * Words that are ignored when searching for one that adds meaning. - * - * @default - * ```json - * ["a", "an", "i", "in", "of", "s", "the"] - * ``` - * - * @example - * With `{ uselessWords: ["our"] }`, the following comment would - * be considered uninformative: - * ```js - * /** Our text. *\/ - * export const text = ":)"; - * ``` - */ - uselessWords?: string[]; -} - -/** - * @param docs - Any amount of docs text, such as from a JSDoc description. - * @param name - Name of the entity the docs text is describing. - * @param options - Additional options to customize informativity checking. - * @returns Whether the docs include at least one word with new information. - * - * @example - * ```js - * areDocsInformative("The user id.", "userId"); // false - * ``` - * @example - * ```js - * areDocsInformative("Retrieved user id.", "userId"); // true - * ``` - */ -declare function areDocsInformative(docs: string | string[], name: string | string[], { aliases, uselessWords, }?: InformativeDocsOptions): boolean; - -export { InformativeDocsOptions, areDocsInformative }; diff --git a/node_modules/are-docs-informative/lib/index.js b/node_modules/are-docs-informative/lib/index.js deleted file mode 100644 index 41ff25e..0000000 --- a/node_modules/are-docs-informative/lib/index.js +++ /dev/null @@ -1,31 +0,0 @@ -// src/index.ts -var defaultAliases = { - a: ["an", "our"] -}; -var defaultUselessWords = ["a", "an", "i", "in", "of", "s", "the"]; -function areDocsInformative(docs, name, { - aliases = defaultAliases, - uselessWords = defaultUselessWords -} = {}) { - const docsWords = new Set(splitTextIntoWords(docs)); - const nameWords = splitTextIntoWords(name); - for (const nameWord of nameWords) { - docsWords.delete(nameWord); - } - for (const uselessWord of uselessWords) { - docsWords.delete(uselessWord); - } - return !!docsWords.size; - function normalizeWord(word) { - const wordLower = word.toLowerCase(); - return aliases[wordLower] ?? wordLower; - } - function splitTextIntoWords(text) { - return (typeof text === "string" ? [text] : text).flatMap((name2) => { - return name2.replace(/\W+/gu, " ").replace(/([a-z])([A-Z])/gu, "$1 $2").trim().split(" "); - }).flatMap(normalizeWord).filter(Boolean); - } -} -export { - areDocsInformative -}; diff --git a/node_modules/are-docs-informative/package.json b/node_modules/are-docs-informative/package.json deleted file mode 100644 index 87d0a64..0000000 --- a/node_modules/are-docs-informative/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "are-docs-informative", - "version": "0.0.2", - "description": "Checks whether a documentation description introduces any new information.", - "repository": { - "type": "git", - "url": "https://github.com/JoshuaKGoldberg/are-docs-informative" - }, - "license": "MIT", - "author": "Josh Goldberg ", - "type": "module", - "exports": { - ".": { - "types": { - "import": "./lib/index.d.ts", - "require": "./lib/index.d.cts" - }, - "import": "./lib/index.js", - "require": "./lib/index.cjs" - } - }, - "main": "./lib/index.js", - "files": [ - "lib/", - "package.json", - "LICENSE.md", - "README.md" - ], - "scripts": { - "build": "tsc", - "build:full": "tsup src/index.ts --clean --format cjs,esm --outDir lib --dts && cp lib/index.d.ts lib/index.d.cts", - "format": "prettier \"**/*\" --ignore-unknown", - "format:write": "pnpm format --write", - "lint": "eslint . --max-warnings 0 --report-unused-disable-directives", - "lint:knip": "knip", - "lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line", - "lint:package": "npmPkgJsonLint .", - "lint:packages": "pnpm-deduplicate --list", - "lint:spelling": "cspell \"**\" \".github/**/*\"", - "prepare": "husky install", - "should-semantic-release": "should-semantic-release --verbose", - "test": "vitest" - }, - "lint-staged": { - "*": "prettier --ignore-unknown --write" - }, - "devDependencies": { - "@types/eslint": "^8.21.1", - "@typescript-eslint/eslint-plugin": "^5.48.2", - "@typescript-eslint/parser": "^5.48.2", - "@vitest/coverage-istanbul": "^0.29.0", - "cspell": "^6.19.2", - "eslint": "^8.32.0", - "eslint-config-prettier": "^8.6.0", - "eslint-plugin-deprecation": "^1.3.3", - "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-import": "^2.27.5", - "eslint-plugin-jsonc": "^2.6.0", - "eslint-plugin-markdown": "^3.0.0", - "eslint-plugin-no-only-tests": "^3.1.0", - "eslint-plugin-regexp": "^1.12.0", - "eslint-plugin-simple-import-sort": "^10.0.0", - "eslint-plugin-typescript-sort-keys": "^2.1.0", - "eslint-plugin-vitest": "^0.1.0", - "eslint-plugin-yml": "^1.5.0", - "husky": "^8.0.3", - "jsonc-eslint-parser": "^2.1.0", - "knip": "2.8.2", - "lint-staged": "^13.1.0", - "markdownlint": "^0.27.0", - "markdownlint-cli": "^0.33.0", - "npm-package-json-lint": "^6.4.0", - "npm-package-json-lint-config-default": "^5.0.0", - "pnpm-deduplicate": "^0.4.1", - "prettier": "^2.8.3", - "prettier-plugin-packagejson": "^2.4.2", - "release-it": "^15.6.0", - "sentences-per-line": "^0.2.1", - "should-semantic-release": "^0.1.0", - "tsup": "^6.7.0", - "typescript": "^5.0.0", - "vitest": "^0.29.0", - "yaml-eslint-parser": "^1.2.0" - }, - "packageManager": "pnpm@7.31.0", - "engines": { - "node": ">=14" - } -} diff --git a/node_modules/argparse/CHANGELOG.md b/node_modules/argparse/CHANGELOG.md deleted file mode 100644 index dc39ed6..0000000 --- a/node_modules/argparse/CHANGELOG.md +++ /dev/null @@ -1,216 +0,0 @@ -# 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). - - -## [2.0.1] - 2020-08-29 -### Fixed -- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150. - - -## [2.0.0] - 2020-08-14 -### Changed -- Full rewrite. Now port from python 3.9.0 & more precise following. - See [doc](./doc) for difference and migration info. -- node.js 10+ required -- Removed most of local docs in favour of original ones. - - -## [1.0.10] - 2018-02-15 -### Fixed -- Use .concat instead of + for arrays, #122. - - -## [1.0.9] - 2016-09-29 -### Changed -- Rerelease after 1.0.8 - deps cleanup. - - -## [1.0.8] - 2016-09-29 -### Changed -- Maintenance (deps bump, fix node 6.5+ tests, coverage report). - - -## [1.0.7] - 2016-03-17 -### Changed -- Teach `addArgument` to accept string arg names. #97, @tomxtobin. - - -## [1.0.6] - 2016-02-06 -### Changed -- Maintenance: moved to eslint & updated CS. - - -## [1.0.5] - 2016-02-05 -### Changed -- Removed lodash dependency to significantly reduce install size. - Thanks to @mourner. - - -## [1.0.4] - 2016-01-17 -### Changed -- Maintenance: lodash update to 4.0.0. - - -## [1.0.3] - 2015-10-27 -### Fixed -- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple. - - -## [1.0.2] - 2015-03-22 -### Changed -- Relaxed lodash version dependency. - - -## [1.0.1] - 2015-02-20 -### Changed -- Changed dependencies to be compatible with ancient nodejs. - - -## [1.0.0] - 2015-02-19 -### Changed -- Maintenance release. -- Replaced `underscore` with `lodash`. -- Bumped version to 1.0.0 to better reflect semver meaning. -- HISTORY.md -> CHANGELOG.md - - -## [0.1.16] - 2013-12-01 -### Changed -- Maintenance release. Updated dependencies and docs. - - -## [0.1.15] - 2013-05-13 -### Fixed -- Fixed #55, @trebor89 - - -## [0.1.14] - 2013-05-12 -### Fixed -- Fixed #62, @maxtaco - - -## [0.1.13] - 2013-04-08 -### Changed -- Added `.npmignore` to reduce package size - - -## [0.1.12] - 2013-02-10 -### Fixed -- Fixed conflictHandler (#46), @hpaulj - - -## [0.1.11] - 2013-02-07 -### Added -- Added 70+ tests (ported from python), @hpaulj -- Added conflictHandler, @applepicke -- Added fromfilePrefixChar, @hpaulj - -### Fixed -- Multiple bugfixes, @hpaulj - - -## [0.1.10] - 2012-12-30 -### Added -- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion) - support, thanks to @hpaulj - -### Fixed -- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj - - -## [0.1.9] - 2012-12-27 -### Fixed -- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj -- Fixed default value behavior with `*` positionals, thanks to @hpaulj -- Improve `getDefault()` behavior, thanks to @hpaulj -- Improve negative argument parsing, thanks to @hpaulj - - -## [0.1.8] - 2012-12-01 -### Fixed -- Fixed parser parents (issue #19), thanks to @hpaulj -- Fixed negative argument parse (issue #20), thanks to @hpaulj - - -## [0.1.7] - 2012-10-14 -### Fixed -- Fixed 'choices' argument parse (issue #16) -- Fixed stderr output (issue #15) - - -## [0.1.6] - 2012-09-09 -### Fixed -- Fixed check for conflict of options (thanks to @tomxtobin) - - -## [0.1.5] - 2012-09-03 -### Fixed -- Fix parser #setDefaults method (thanks to @tomxtobin) - - -## [0.1.4] - 2012-07-30 -### Fixed -- Fixed pseudo-argument support (thanks to @CGamesPlay) -- Fixed addHelp default (should be true), if not set (thanks to @benblank) - - -## [0.1.3] - 2012-06-27 -### Fixed -- Fixed formatter api name: Formatter -> HelpFormatter - - -## [0.1.2] - 2012-05-29 -### Fixed -- Removed excess whitespace in help -- Fixed error reporting, when parcer with subcommands - called with empty arguments - -### Added -- Added basic tests - - -## [0.1.1] - 2012-05-23 -### Fixed -- Fixed line wrapping in help formatter -- Added better error reporting on invalid arguments - - -## [0.1.0] - 2012-05-16 -### Added -- First release. - - -[2.0.1]: https://github.com/nodeca/argparse/compare/2.0.0...2.0.1 -[2.0.0]: https://github.com/nodeca/argparse/compare/1.0.10...2.0.0 -[1.0.10]: https://github.com/nodeca/argparse/compare/1.0.9...1.0.10 -[1.0.9]: https://github.com/nodeca/argparse/compare/1.0.8...1.0.9 -[1.0.8]: https://github.com/nodeca/argparse/compare/1.0.7...1.0.8 -[1.0.7]: https://github.com/nodeca/argparse/compare/1.0.6...1.0.7 -[1.0.6]: https://github.com/nodeca/argparse/compare/1.0.5...1.0.6 -[1.0.5]: https://github.com/nodeca/argparse/compare/1.0.4...1.0.5 -[1.0.4]: https://github.com/nodeca/argparse/compare/1.0.3...1.0.4 -[1.0.3]: https://github.com/nodeca/argparse/compare/1.0.2...1.0.3 -[1.0.2]: https://github.com/nodeca/argparse/compare/1.0.1...1.0.2 -[1.0.1]: https://github.com/nodeca/argparse/compare/1.0.0...1.0.1 -[1.0.0]: https://github.com/nodeca/argparse/compare/0.1.16...1.0.0 -[0.1.16]: https://github.com/nodeca/argparse/compare/0.1.15...0.1.16 -[0.1.15]: https://github.com/nodeca/argparse/compare/0.1.14...0.1.15 -[0.1.14]: https://github.com/nodeca/argparse/compare/0.1.13...0.1.14 -[0.1.13]: https://github.com/nodeca/argparse/compare/0.1.12...0.1.13 -[0.1.12]: https://github.com/nodeca/argparse/compare/0.1.11...0.1.12 -[0.1.11]: https://github.com/nodeca/argparse/compare/0.1.10...0.1.11 -[0.1.10]: https://github.com/nodeca/argparse/compare/0.1.9...0.1.10 -[0.1.9]: https://github.com/nodeca/argparse/compare/0.1.8...0.1.9 -[0.1.8]: https://github.com/nodeca/argparse/compare/0.1.7...0.1.8 -[0.1.7]: https://github.com/nodeca/argparse/compare/0.1.6...0.1.7 -[0.1.6]: https://github.com/nodeca/argparse/compare/0.1.5...0.1.6 -[0.1.5]: https://github.com/nodeca/argparse/compare/0.1.4...0.1.5 -[0.1.4]: https://github.com/nodeca/argparse/compare/0.1.3...0.1.4 -[0.1.3]: https://github.com/nodeca/argparse/compare/0.1.2...0.1.3 -[0.1.2]: https://github.com/nodeca/argparse/compare/0.1.1...0.1.2 -[0.1.1]: https://github.com/nodeca/argparse/compare/0.1.0...0.1.1 -[0.1.0]: https://github.com/nodeca/argparse/releases/tag/0.1.0 diff --git a/node_modules/argparse/LICENSE b/node_modules/argparse/LICENSE deleted file mode 100644 index 66a3ac8..0000000 --- a/node_modules/argparse/LICENSE +++ /dev/null @@ -1,254 +0,0 @@ -A. HISTORY OF THE SOFTWARE -========================== - -Python was created in the early 1990s by Guido van Rossum at Stichting -Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands -as a successor of a language called ABC. Guido remains Python's -principal author, although it includes many contributions from others. - -In 1995, Guido continued his work on Python at the Corporation for -National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) -in Reston, Virginia where he released several versions of the -software. - -In May 2000, Guido and the Python core development team moved to -BeOpen.com to form the BeOpen PythonLabs team. In October of the same -year, the PythonLabs team moved to Digital Creations, which became -Zope Corporation. In 2001, the Python Software Foundation (PSF, see -https://www.python.org/psf/) was formed, a non-profit organization -created specifically to own Python-related Intellectual Property. -Zope Corporation was a sponsoring member of the PSF. - -All Python releases are Open Source (see http://www.opensource.org for -the Open Source Definition). Historically, most, but not all, Python -releases have also been GPL-compatible; the table below summarizes -the various releases. - - Release Derived Year Owner GPL- - from compatible? (1) - - 0.9.0 thru 1.2 1991-1995 CWI yes - 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes - 1.6 1.5.2 2000 CNRI no - 2.0 1.6 2000 BeOpen.com no - 1.6.1 1.6 2001 CNRI yes (2) - 2.1 2.0+1.6.1 2001 PSF no - 2.0.1 2.0+1.6.1 2001 PSF yes - 2.1.1 2.1+2.0.1 2001 PSF yes - 2.1.2 2.1.1 2002 PSF yes - 2.1.3 2.1.2 2002 PSF yes - 2.2 and above 2.1.1 2001-now PSF yes - -Footnotes: - -(1) GPL-compatible doesn't mean that we're distributing Python under - the GPL. All Python licenses, unlike the GPL, let you distribute - a modified version without making your changes open source. The - GPL-compatible licenses make it possible to combine Python with - other software that is released under the GPL; the others don't. - -(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, - because its license has a choice of law clause. According to - CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 - is "not incompatible" with the GPL. - -Thanks to the many outside volunteers who have worked under Guido's -direction to make these releases possible. - - -B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON -=============================================================== - -PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 --------------------------------------------- - -1. This LICENSE AGREEMENT is between the Python Software Foundation -("PSF"), and the Individual or Organization ("Licensee") accessing and -otherwise using this software ("Python") in source or binary form and -its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, PSF hereby -grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, -analyze, test, perform and/or display publicly, prepare derivative works, -distribute, and otherwise use Python alone or in any derivative version, -provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation; -All Rights Reserved" are retained in Python alone or in any derivative version -prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python. - -4. PSF is making Python available to Licensee on an "AS IS" -basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between PSF and -Licensee. This License Agreement does not grant permission to use PSF -trademarks or trade name in a trademark sense to endorse or promote -products or services of Licensee, or any third party. - -8. By copying, installing or otherwise using Python, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 -------------------------------------------- - -BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - -1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an -office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the -Individual or Organization ("Licensee") accessing and otherwise using -this software in source or binary form and its associated -documentation ("the Software"). - -2. Subject to the terms and conditions of this BeOpen Python License -Agreement, BeOpen hereby grants Licensee a non-exclusive, -royalty-free, world-wide license to reproduce, analyze, test, perform -and/or display publicly, prepare derivative works, distribute, and -otherwise use the Software alone or in any derivative version, -provided, however, that the BeOpen Python License is retained in the -Software, alone or in any derivative version prepared by Licensee. - -3. BeOpen is making the Software available to Licensee on an "AS IS" -basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE -SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -5. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -6. This License Agreement shall be governed by and interpreted in all -respects by the law of the State of California, excluding conflict of -law provisions. Nothing in this License Agreement shall be deemed to -create any relationship of agency, partnership, or joint venture -between BeOpen and Licensee. This License Agreement does not grant -permission to use BeOpen trademarks or trade names in a trademark -sense to endorse or promote products or services of Licensee, or any -third party. As an exception, the "BeOpen Python" logos available at -http://www.pythonlabs.com/logos.html may be used according to the -permissions granted on that web page. - -7. By copying, installing or otherwise using the software, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 ---------------------------------------- - -1. This LICENSE AGREEMENT is between the Corporation for National -Research Initiatives, having an office at 1895 Preston White Drive, -Reston, VA 20191 ("CNRI"), and the Individual or Organization -("Licensee") accessing and otherwise using Python 1.6.1 software in -source or binary form and its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, CNRI -hereby grants Licensee a nonexclusive, royalty-free, world-wide -license to reproduce, analyze, test, perform and/or display publicly, -prepare derivative works, distribute, and otherwise use Python 1.6.1 -alone or in any derivative version, provided, however, that CNRI's -License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) -1995-2001 Corporation for National Research Initiatives; All Rights -Reserved" are retained in Python 1.6.1 alone or in any derivative -version prepared by Licensee. Alternately, in lieu of CNRI's License -Agreement, Licensee may substitute the following text (omitting the -quotes): "Python 1.6.1 is made available subject to the terms and -conditions in CNRI's License Agreement. This Agreement together with -Python 1.6.1 may be located on the Internet using the following -unique, persistent identifier (known as a handle): 1895.22/1013. This -Agreement may also be obtained from a proxy server on the Internet -using the following URL: http://hdl.handle.net/1895.22/1013". - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python 1.6.1 or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python 1.6.1. - -4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" -basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. This License Agreement shall be governed by the federal -intellectual property law of the United States, including without -limitation the federal copyright law, and, to the extent such -U.S. federal law does not apply, by the law of the Commonwealth of -Virginia, excluding Virginia's conflict of law provisions. -Notwithstanding the foregoing, with regard to derivative works based -on Python 1.6.1 that incorporate non-separable material that was -previously distributed under the GNU General Public License (GPL), the -law of the Commonwealth of Virginia shall govern this License -Agreement only as to issues arising under or with respect to -Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this -License Agreement shall be deemed to create any relationship of -agency, partnership, or joint venture between CNRI and Licensee. This -License Agreement does not grant permission to use CNRI trademarks or -trade name in a trademark sense to endorse or promote products or -services of Licensee, or any third party. - -8. By clicking on the "ACCEPT" button where indicated, or by copying, -installing or otherwise using Python 1.6.1, Licensee agrees to be -bound by the terms and conditions of this License Agreement. - - ACCEPT - - -CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 --------------------------------------------------- - -Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, -The Netherlands. All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Stichting Mathematisch -Centrum or CWI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE -FOR ANY SPECIAL, 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/argparse/README.md b/node_modules/argparse/README.md deleted file mode 100644 index 550b5c9..0000000 --- a/node_modules/argparse/README.md +++ /dev/null @@ -1,84 +0,0 @@ -argparse -======== - -[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse) -[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse) - -CLI arguments parser for node.js, with [sub-commands](https://docs.python.org/3.9/library/argparse.html#sub-commands) support. Port of python's [argparse](http://docs.python.org/dev/library/argparse.html) (version [3.9.0](https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py)). - -**Difference with original.** - -- JS has no keyword arguments support. - - Pass options instead: `new ArgumentParser({ description: 'example', add_help: true })`. -- JS has no python's types `int`, `float`, ... - - Use string-typed names: `.add_argument('-b', { type: 'int', help: 'help' })`. -- `%r` format specifier uses `require('util').inspect()`. - -More details in [doc](./doc). - - -Example -------- - -`test.js` file: - -```javascript -#!/usr/bin/env node -'use strict'; - -const { ArgumentParser } = require('argparse'); -const { version } = require('./package.json'); - -const parser = new ArgumentParser({ - description: 'Argparse example' -}); - -parser.add_argument('-v', '--version', { action: 'version', version }); -parser.add_argument('-f', '--foo', { help: 'foo bar' }); -parser.add_argument('-b', '--bar', { help: 'bar foo' }); -parser.add_argument('--baz', { help: 'baz bar' }); - -console.dir(parser.parse_args()); -``` - -Display help: - -``` -$ ./test.js -h -usage: test.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ] - -Argparse example - -optional arguments: - -h, --help show this help message and exit - -v, --version show program's version number and exit - -f FOO, --foo FOO foo bar - -b BAR, --bar BAR bar foo - --baz BAZ baz bar -``` - -Parse arguments: - -``` -$ ./test.js -f=3 --bar=4 --baz 5 -{ foo: '3', bar: '4', baz: '5' } -``` - - -API docs --------- - -Since this is a port with minimal divergence, there's no separate documentation. -Use original one instead, with notes about difference. - -1. [Original doc](https://docs.python.org/3.9/library/argparse.html). -2. [Original tutorial](https://docs.python.org/3.9/howto/argparse.html). -3. [Difference with python](./doc). - - -argparse for enterprise ------------------------ - -Available as part of the Tidelift Subscription - -The maintainers of argparse 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-argparse?utm_source=npm-argparse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) diff --git a/node_modules/argparse/argparse.js b/node_modules/argparse/argparse.js deleted file mode 100644 index 2b8c8c6..0000000 --- a/node_modules/argparse/argparse.js +++ /dev/null @@ -1,3707 +0,0 @@ -// Port of python's argparse module, version 3.9.0: -// https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py - -'use strict' - -// Copyright (C) 2010-2020 Python Software Foundation. -// Copyright (C) 2020 argparse.js authors - -/* - * Command-line parsing library - * - * This module is an optparse-inspired command-line parsing library that: - * - * - handles both optional and positional arguments - * - produces highly informative usage messages - * - supports parsers that dispatch to sub-parsers - * - * The following is a simple usage example that sums integers from the - * command-line and writes the result to a file:: - * - * parser = argparse.ArgumentParser( - * description='sum the integers at the command line') - * parser.add_argument( - * 'integers', metavar='int', nargs='+', type=int, - * help='an integer to be summed') - * parser.add_argument( - * '--log', default=sys.stdout, type=argparse.FileType('w'), - * help='the file where the sum should be written') - * args = parser.parse_args() - * args.log.write('%s' % sum(args.integers)) - * args.log.close() - * - * The module contains the following public classes: - * - * - ArgumentParser -- The main entry point for command-line parsing. As the - * example above shows, the add_argument() method is used to populate - * the parser with actions for optional and positional arguments. Then - * the parse_args() method is invoked to convert the args at the - * command-line into an object with attributes. - * - * - ArgumentError -- The exception raised by ArgumentParser objects when - * there are errors with the parser's actions. Errors raised while - * parsing the command-line are caught by ArgumentParser and emitted - * as command-line messages. - * - * - FileType -- A factory for defining types of files to be created. As the - * example above shows, instances of FileType are typically passed as - * the type= argument of add_argument() calls. - * - * - Action -- The base class for parser actions. Typically actions are - * selected by passing strings like 'store_true' or 'append_const' to - * the action= argument of add_argument(). However, for greater - * customization of ArgumentParser actions, subclasses of Action may - * be defined and passed as the action= argument. - * - * - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, - * ArgumentDefaultsHelpFormatter -- Formatter classes which - * may be passed as the formatter_class= argument to the - * ArgumentParser constructor. HelpFormatter is the default, - * RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser - * not to change the formatting for help text, and - * ArgumentDefaultsHelpFormatter adds information about argument defaults - * to the help. - * - * All other classes in this module are considered implementation details. - * (Also note that HelpFormatter and RawDescriptionHelpFormatter are only - * considered public as object names -- the API of the formatter objects is - * still considered an implementation detail.) - */ - -const SUPPRESS = '==SUPPRESS==' - -const OPTIONAL = '?' -const ZERO_OR_MORE = '*' -const ONE_OR_MORE = '+' -const PARSER = 'A...' -const REMAINDER = '...' -const _UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args' - - -// ================================== -// Utility functions used for porting -// ================================== -const assert = require('assert') -const util = require('util') -const fs = require('fs') -const sub = require('./lib/sub') -const path = require('path') -const repr = util.inspect - -function get_argv() { - // omit first argument (which is assumed to be interpreter - `node`, `coffee`, `ts-node`, etc.) - return process.argv.slice(1) -} - -function get_terminal_size() { - return { - columns: +process.env.COLUMNS || process.stdout.columns || 80 - } -} - -function hasattr(object, name) { - return Object.prototype.hasOwnProperty.call(object, name) -} - -function getattr(object, name, value) { - return hasattr(object, name) ? object[name] : value -} - -function setattr(object, name, value) { - object[name] = value -} - -function setdefault(object, name, value) { - if (!hasattr(object, name)) object[name] = value - return object[name] -} - -function delattr(object, name) { - delete object[name] -} - -function range(from, to, step=1) { - // range(10) is equivalent to range(0, 10) - if (arguments.length === 1) [ to, from ] = [ from, 0 ] - if (typeof from !== 'number' || typeof to !== 'number' || typeof step !== 'number') { - throw new TypeError('argument cannot be interpreted as an integer') - } - if (step === 0) throw new TypeError('range() arg 3 must not be zero') - - let result = [] - if (step > 0) { - for (let i = from; i < to; i += step) result.push(i) - } else { - for (let i = from; i > to; i += step) result.push(i) - } - return result -} - -function splitlines(str, keepends = false) { - let result - if (!keepends) { - result = str.split(/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/) - } else { - result = [] - let parts = str.split(/(\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029])/) - for (let i = 0; i < parts.length; i += 2) { - result.push(parts[i] + (i + 1 < parts.length ? parts[i + 1] : '')) - } - } - if (!result[result.length - 1]) result.pop() - return result -} - -function _string_lstrip(string, prefix_chars) { - let idx = 0 - while (idx < string.length && prefix_chars.includes(string[idx])) idx++ - return idx ? string.slice(idx) : string -} - -function _string_split(string, sep, maxsplit) { - let result = string.split(sep) - if (result.length > maxsplit) { - result = result.slice(0, maxsplit).concat([ result.slice(maxsplit).join(sep) ]) - } - return result -} - -function _array_equal(array1, array2) { - if (array1.length !== array2.length) return false - for (let i = 0; i < array1.length; i++) { - if (array1[i] !== array2[i]) return false - } - return true -} - -function _array_remove(array, item) { - let idx = array.indexOf(item) - if (idx === -1) throw new TypeError(sub('%r not in list', item)) - array.splice(idx, 1) -} - -// normalize choices to array; -// this isn't required in python because `in` and `map` operators work with anything, -// but in js dealing with multiple types here is too clunky -function _choices_to_array(choices) { - if (choices === undefined) { - return [] - } else if (Array.isArray(choices)) { - return choices - } else if (choices !== null && typeof choices[Symbol.iterator] === 'function') { - return Array.from(choices) - } else if (typeof choices === 'object' && choices !== null) { - return Object.keys(choices) - } else { - throw new Error(sub('invalid choices value: %r', choices)) - } -} - -// decorator that allows a class to be called without new -function _callable(cls) { - let result = { // object is needed for inferred class name - [cls.name]: function (...args) { - let this_class = new.target === result || !new.target - return Reflect.construct(cls, args, this_class ? cls : new.target) - } - } - result[cls.name].prototype = cls.prototype - // fix default tag for toString, e.g. [object Action] instead of [object Object] - cls.prototype[Symbol.toStringTag] = cls.name - return result[cls.name] -} - -function _alias(object, from, to) { - try { - let name = object.constructor.name - Object.defineProperty(object, from, { - value: util.deprecate(object[to], sub('%s.%s() is renamed to %s.%s()', - name, from, name, to)), - enumerable: false - }) - } catch {} -} - -// decorator that allows snake_case class methods to be called with camelCase and vice versa -function _camelcase_alias(_class) { - for (let name of Object.getOwnPropertyNames(_class.prototype)) { - let camelcase = name.replace(/\w_[a-z]/g, s => s[0] + s[2].toUpperCase()) - if (camelcase !== name) _alias(_class.prototype, camelcase, name) - } - return _class -} - -function _to_legacy_name(key) { - key = key.replace(/\w_[a-z]/g, s => s[0] + s[2].toUpperCase()) - if (key === 'default') key = 'defaultValue' - if (key === 'const') key = 'constant' - return key -} - -function _to_new_name(key) { - if (key === 'defaultValue') key = 'default' - if (key === 'constant') key = 'const' - key = key.replace(/[A-Z]/g, c => '_' + c.toLowerCase()) - return key -} - -// parse options -let no_default = Symbol('no_default_value') -function _parse_opts(args, descriptor) { - function get_name() { - let stack = new Error().stack.split('\n') - .map(x => x.match(/^ at (.*) \(.*\)$/)) - .filter(Boolean) - .map(m => m[1]) - .map(fn => fn.match(/[^ .]*$/)[0]) - - if (stack.length && stack[0] === get_name.name) stack.shift() - if (stack.length && stack[0] === _parse_opts.name) stack.shift() - return stack.length ? stack[0] : '' - } - - args = Array.from(args) - let kwargs = {} - let result = [] - let last_opt = args.length && args[args.length - 1] - - if (typeof last_opt === 'object' && last_opt !== null && !Array.isArray(last_opt) && - (!last_opt.constructor || last_opt.constructor.name === 'Object')) { - kwargs = Object.assign({}, args.pop()) - } - - // LEGACY (v1 compatibility): camelcase - let renames = [] - for (let key of Object.keys(descriptor)) { - let old_name = _to_legacy_name(key) - if (old_name !== key && (old_name in kwargs)) { - if (key in kwargs) { - // default and defaultValue specified at the same time, happens often in old tests - //throw new TypeError(sub('%s() got multiple values for argument %r', get_name(), key)) - } else { - kwargs[key] = kwargs[old_name] - } - renames.push([ old_name, key ]) - delete kwargs[old_name] - } - } - if (renames.length) { - let name = get_name() - deprecate('camelcase_' + name, sub('%s(): following options are renamed: %s', - name, renames.map(([ a, b ]) => sub('%r -> %r', a, b)))) - } - // end - - let missing_positionals = [] - let positional_count = args.length - - for (let [ key, def ] of Object.entries(descriptor)) { - if (key[0] === '*') { - if (key.length > 0 && key[1] === '*') { - // LEGACY (v1 compatibility): camelcase - let renames = [] - for (let key of Object.keys(kwargs)) { - let new_name = _to_new_name(key) - if (new_name !== key && (key in kwargs)) { - if (new_name in kwargs) { - // default and defaultValue specified at the same time, happens often in old tests - //throw new TypeError(sub('%s() got multiple values for argument %r', get_name(), new_name)) - } else { - kwargs[new_name] = kwargs[key] - } - renames.push([ key, new_name ]) - delete kwargs[key] - } - } - if (renames.length) { - let name = get_name() - deprecate('camelcase_' + name, sub('%s(): following options are renamed: %s', - name, renames.map(([ a, b ]) => sub('%r -> %r', a, b)))) - } - // end - result.push(kwargs) - kwargs = {} - } else { - result.push(args) - args = [] - } - } else if (key in kwargs && args.length > 0) { - throw new TypeError(sub('%s() got multiple values for argument %r', get_name(), key)) - } else if (key in kwargs) { - result.push(kwargs[key]) - delete kwargs[key] - } else if (args.length > 0) { - result.push(args.shift()) - } else if (def !== no_default) { - result.push(def) - } else { - missing_positionals.push(key) - } - } - - if (Object.keys(kwargs).length) { - throw new TypeError(sub('%s() got an unexpected keyword argument %r', - get_name(), Object.keys(kwargs)[0])) - } - - if (args.length) { - let from = Object.entries(descriptor).filter(([ k, v ]) => k[0] !== '*' && v !== no_default).length - let to = Object.entries(descriptor).filter(([ k ]) => k[0] !== '*').length - throw new TypeError(sub('%s() takes %s positional argument%s but %s %s given', - get_name(), - from === to ? sub('from %s to %s', from, to) : to, - from === to && to === 1 ? '' : 's', - positional_count, - positional_count === 1 ? 'was' : 'were')) - } - - if (missing_positionals.length) { - let strs = missing_positionals.map(repr) - if (strs.length > 1) strs[strs.length - 1] = 'and ' + strs[strs.length - 1] - let str_joined = strs.join(strs.length === 2 ? '' : ', ') - throw new TypeError(sub('%s() missing %i required positional argument%s: %s', - get_name(), strs.length, strs.length === 1 ? '' : 's', str_joined)) - } - - return result -} - -let _deprecations = {} -function deprecate(id, string) { - _deprecations[id] = _deprecations[id] || util.deprecate(() => {}, string) - _deprecations[id]() -} - - -// ============================= -// Utility functions and classes -// ============================= -function _AttributeHolder(cls = Object) { - /* - * Abstract base class that provides __repr__. - * - * The __repr__ method returns a string in the format:: - * ClassName(attr=name, attr=name, ...) - * The attributes are determined either by a class-level attribute, - * '_kwarg_names', or by inspecting the instance __dict__. - */ - - return class _AttributeHolder extends cls { - [util.inspect.custom]() { - let type_name = this.constructor.name - let arg_strings = [] - let star_args = {} - for (let arg of this._get_args()) { - arg_strings.push(repr(arg)) - } - for (let [ name, value ] of this._get_kwargs()) { - if (/^[a-z_][a-z0-9_$]*$/i.test(name)) { - arg_strings.push(sub('%s=%r', name, value)) - } else { - star_args[name] = value - } - } - if (Object.keys(star_args).length) { - arg_strings.push(sub('**%s', repr(star_args))) - } - return sub('%s(%s)', type_name, arg_strings.join(', ')) - } - - toString() { - return this[util.inspect.custom]() - } - - _get_kwargs() { - return Object.entries(this) - } - - _get_args() { - return [] - } - } -} - - -function _copy_items(items) { - if (items === undefined) { - return [] - } - return items.slice(0) -} - - -// =============== -// Formatting Help -// =============== -const HelpFormatter = _camelcase_alias(_callable(class HelpFormatter { - /* - * Formatter for generating usage messages and argument help strings. - * - * Only the name of this class is considered a public API. All the methods - * provided by the class are considered an implementation detail. - */ - - constructor() { - let [ - prog, - indent_increment, - max_help_position, - width - ] = _parse_opts(arguments, { - prog: no_default, - indent_increment: 2, - max_help_position: 24, - width: undefined - }) - - // default setting for width - if (width === undefined) { - width = get_terminal_size().columns - width -= 2 - } - - this._prog = prog - this._indent_increment = indent_increment - this._max_help_position = Math.min(max_help_position, - Math.max(width - 20, indent_increment * 2)) - this._width = width - - this._current_indent = 0 - this._level = 0 - this._action_max_length = 0 - - this._root_section = this._Section(this, undefined) - this._current_section = this._root_section - - this._whitespace_matcher = /[ \t\n\r\f\v]+/g // equivalent to python /\s+/ with ASCII flag - this._long_break_matcher = /\n\n\n+/g - } - - // =============================== - // Section and indentation methods - // =============================== - _indent() { - this._current_indent += this._indent_increment - this._level += 1 - } - - _dedent() { - this._current_indent -= this._indent_increment - assert(this._current_indent >= 0, 'Indent decreased below 0.') - this._level -= 1 - } - - _add_item(func, args) { - this._current_section.items.push([ func, args ]) - } - - // ======================== - // Message building methods - // ======================== - start_section(heading) { - this._indent() - let section = this._Section(this, this._current_section, heading) - this._add_item(section.format_help.bind(section), []) - this._current_section = section - } - - end_section() { - this._current_section = this._current_section.parent - this._dedent() - } - - add_text(text) { - if (text !== SUPPRESS && text !== undefined) { - this._add_item(this._format_text.bind(this), [text]) - } - } - - add_usage(usage, actions, groups, prefix = undefined) { - if (usage !== SUPPRESS) { - let args = [ usage, actions, groups, prefix ] - this._add_item(this._format_usage.bind(this), args) - } - } - - add_argument(action) { - if (action.help !== SUPPRESS) { - - // find all invocations - let invocations = [this._format_action_invocation(action)] - for (let subaction of this._iter_indented_subactions(action)) { - invocations.push(this._format_action_invocation(subaction)) - } - - // update the maximum item length - let invocation_length = Math.max(...invocations.map(invocation => invocation.length)) - let action_length = invocation_length + this._current_indent - this._action_max_length = Math.max(this._action_max_length, - action_length) - - // add the item to the list - this._add_item(this._format_action.bind(this), [action]) - } - } - - add_arguments(actions) { - for (let action of actions) { - this.add_argument(action) - } - } - - // ======================= - // Help-formatting methods - // ======================= - format_help() { - let help = this._root_section.format_help() - if (help) { - help = help.replace(this._long_break_matcher, '\n\n') - help = help.replace(/^\n+|\n+$/g, '') + '\n' - } - return help - } - - _join_parts(part_strings) { - return part_strings.filter(part => part && part !== SUPPRESS).join('') - } - - _format_usage(usage, actions, groups, prefix) { - if (prefix === undefined) { - prefix = 'usage: ' - } - - // if usage is specified, use that - if (usage !== undefined) { - usage = sub(usage, { prog: this._prog }) - - // if no optionals or positionals are available, usage is just prog - } else if (usage === undefined && !actions.length) { - usage = sub('%(prog)s', { prog: this._prog }) - - // if optionals and positionals are available, calculate usage - } else if (usage === undefined) { - let prog = sub('%(prog)s', { prog: this._prog }) - - // split optionals from positionals - let optionals = [] - let positionals = [] - for (let action of actions) { - if (action.option_strings.length) { - optionals.push(action) - } else { - positionals.push(action) - } - } - - // build full usage string - let action_usage = this._format_actions_usage([].concat(optionals).concat(positionals), groups) - usage = [ prog, action_usage ].map(String).join(' ') - - // wrap the usage parts if it's too long - let text_width = this._width - this._current_indent - if (prefix.length + usage.length > text_width) { - - // break usage into wrappable parts - let part_regexp = /\(.*?\)+(?=\s|$)|\[.*?\]+(?=\s|$)|\S+/g - let opt_usage = this._format_actions_usage(optionals, groups) - let pos_usage = this._format_actions_usage(positionals, groups) - let opt_parts = opt_usage.match(part_regexp) || [] - let pos_parts = pos_usage.match(part_regexp) || [] - assert(opt_parts.join(' ') === opt_usage) - assert(pos_parts.join(' ') === pos_usage) - - // helper for wrapping lines - let get_lines = (parts, indent, prefix = undefined) => { - let lines = [] - let line = [] - let line_len - if (prefix !== undefined) { - line_len = prefix.length - 1 - } else { - line_len = indent.length - 1 - } - for (let part of parts) { - if (line_len + 1 + part.length > text_width && line) { - lines.push(indent + line.join(' ')) - line = [] - line_len = indent.length - 1 - } - line.push(part) - line_len += part.length + 1 - } - if (line.length) { - lines.push(indent + line.join(' ')) - } - if (prefix !== undefined) { - lines[0] = lines[0].slice(indent.length) - } - return lines - } - - let lines - - // if prog is short, follow it with optionals or positionals - if (prefix.length + prog.length <= 0.75 * text_width) { - let indent = ' '.repeat(prefix.length + prog.length + 1) - if (opt_parts.length) { - lines = get_lines([prog].concat(opt_parts), indent, prefix) - lines = lines.concat(get_lines(pos_parts, indent)) - } else if (pos_parts.length) { - lines = get_lines([prog].concat(pos_parts), indent, prefix) - } else { - lines = [prog] - } - - // if prog is long, put it on its own line - } else { - let indent = ' '.repeat(prefix.length) - let parts = [].concat(opt_parts).concat(pos_parts) - lines = get_lines(parts, indent) - if (lines.length > 1) { - lines = [] - lines = lines.concat(get_lines(opt_parts, indent)) - lines = lines.concat(get_lines(pos_parts, indent)) - } - lines = [prog].concat(lines) - } - - // join lines into usage - usage = lines.join('\n') - } - } - - // prefix with 'usage:' - return sub('%s%s\n\n', prefix, usage) - } - - _format_actions_usage(actions, groups) { - // find group indices and identify actions in groups - let group_actions = new Set() - let inserts = {} - for (let group of groups) { - let start = actions.indexOf(group._group_actions[0]) - if (start === -1) { - continue - } else { - let end = start + group._group_actions.length - if (_array_equal(actions.slice(start, end), group._group_actions)) { - for (let action of group._group_actions) { - group_actions.add(action) - } - if (!group.required) { - if (start in inserts) { - inserts[start] += ' [' - } else { - inserts[start] = '[' - } - if (end in inserts) { - inserts[end] += ']' - } else { - inserts[end] = ']' - } - } else { - if (start in inserts) { - inserts[start] += ' (' - } else { - inserts[start] = '(' - } - if (end in inserts) { - inserts[end] += ')' - } else { - inserts[end] = ')' - } - } - for (let i of range(start + 1, end)) { - inserts[i] = '|' - } - } - } - } - - // collect all actions format strings - let parts = [] - for (let [ i, action ] of Object.entries(actions)) { - - // suppressed arguments are marked with None - // remove | separators for suppressed arguments - if (action.help === SUPPRESS) { - parts.push(undefined) - if (inserts[+i] === '|') { - delete inserts[+i] - } else if (inserts[+i + 1] === '|') { - delete inserts[+i + 1] - } - - // produce all arg strings - } else if (!action.option_strings.length) { - let default_value = this._get_default_metavar_for_positional(action) - let part = this._format_args(action, default_value) - - // if it's in a group, strip the outer [] - if (group_actions.has(action)) { - if (part[0] === '[' && part[part.length - 1] === ']') { - part = part.slice(1, -1) - } - } - - // add the action string to the list - parts.push(part) - - // produce the first way to invoke the option in brackets - } else { - let option_string = action.option_strings[0] - let part - - // if the Optional doesn't take a value, format is: - // -s or --long - if (action.nargs === 0) { - part = action.format_usage() - - // if the Optional takes a value, format is: - // -s ARGS or --long ARGS - } else { - let default_value = this._get_default_metavar_for_optional(action) - let args_string = this._format_args(action, default_value) - part = sub('%s %s', option_string, args_string) - } - - // make it look optional if it's not required or in a group - if (!action.required && !group_actions.has(action)) { - part = sub('[%s]', part) - } - - // add the action string to the list - parts.push(part) - } - } - - // insert things at the necessary indices - for (let i of Object.keys(inserts).map(Number).sort((a, b) => b - a)) { - parts.splice(+i, 0, inserts[+i]) - } - - // join all the action items with spaces - let text = parts.filter(Boolean).join(' ') - - // clean up separators for mutually exclusive groups - text = text.replace(/([\[(]) /g, '$1') - text = text.replace(/ ([\])])/g, '$1') - text = text.replace(/[\[(] *[\])]/g, '') - text = text.replace(/\(([^|]*)\)/g, '$1', text) - text = text.trim() - - // return the text - return text - } - - _format_text(text) { - if (text.includes('%(prog)')) { - text = sub(text, { prog: this._prog }) - } - let text_width = Math.max(this._width - this._current_indent, 11) - let indent = ' '.repeat(this._current_indent) - return this._fill_text(text, text_width, indent) + '\n\n' - } - - _format_action(action) { - // determine the required width and the entry label - let help_position = Math.min(this._action_max_length + 2, - this._max_help_position) - let help_width = Math.max(this._width - help_position, 11) - let action_width = help_position - this._current_indent - 2 - let action_header = this._format_action_invocation(action) - let indent_first - - // no help; start on same line and add a final newline - if (!action.help) { - let tup = [ this._current_indent, '', action_header ] - action_header = sub('%*s%s\n', ...tup) - - // short action name; start on the same line and pad two spaces - } else if (action_header.length <= action_width) { - let tup = [ this._current_indent, '', action_width, action_header ] - action_header = sub('%*s%-*s ', ...tup) - indent_first = 0 - - // long action name; start on the next line - } else { - let tup = [ this._current_indent, '', action_header ] - action_header = sub('%*s%s\n', ...tup) - indent_first = help_position - } - - // collect the pieces of the action help - let parts = [action_header] - - // if there was help for the action, add lines of help text - if (action.help) { - let help_text = this._expand_help(action) - let help_lines = this._split_lines(help_text, help_width) - parts.push(sub('%*s%s\n', indent_first, '', help_lines[0])) - for (let line of help_lines.slice(1)) { - parts.push(sub('%*s%s\n', help_position, '', line)) - } - - // or add a newline if the description doesn't end with one - } else if (!action_header.endsWith('\n')) { - parts.push('\n') - } - - // if there are any sub-actions, add their help as well - for (let subaction of this._iter_indented_subactions(action)) { - parts.push(this._format_action(subaction)) - } - - // return a single string - return this._join_parts(parts) - } - - _format_action_invocation(action) { - if (!action.option_strings.length) { - let default_value = this._get_default_metavar_for_positional(action) - let metavar = this._metavar_formatter(action, default_value)(1)[0] - return metavar - - } else { - let parts = [] - - // if the Optional doesn't take a value, format is: - // -s, --long - if (action.nargs === 0) { - parts = parts.concat(action.option_strings) - - // if the Optional takes a value, format is: - // -s ARGS, --long ARGS - } else { - let default_value = this._get_default_metavar_for_optional(action) - let args_string = this._format_args(action, default_value) - for (let option_string of action.option_strings) { - parts.push(sub('%s %s', option_string, args_string)) - } - } - - return parts.join(', ') - } - } - - _metavar_formatter(action, default_metavar) { - let result - if (action.metavar !== undefined) { - result = action.metavar - } else if (action.choices !== undefined) { - let choice_strs = _choices_to_array(action.choices).map(String) - result = sub('{%s}', choice_strs.join(',')) - } else { - result = default_metavar - } - - function format(tuple_size) { - if (Array.isArray(result)) { - return result - } else { - return Array(tuple_size).fill(result) - } - } - return format - } - - _format_args(action, default_metavar) { - let get_metavar = this._metavar_formatter(action, default_metavar) - let result - if (action.nargs === undefined) { - result = sub('%s', ...get_metavar(1)) - } else if (action.nargs === OPTIONAL) { - result = sub('[%s]', ...get_metavar(1)) - } else if (action.nargs === ZERO_OR_MORE) { - let metavar = get_metavar(1) - if (metavar.length === 2) { - result = sub('[%s [%s ...]]', ...metavar) - } else { - result = sub('[%s ...]', ...metavar) - } - } else if (action.nargs === ONE_OR_MORE) { - result = sub('%s [%s ...]', ...get_metavar(2)) - } else if (action.nargs === REMAINDER) { - result = '...' - } else if (action.nargs === PARSER) { - result = sub('%s ...', ...get_metavar(1)) - } else if (action.nargs === SUPPRESS) { - result = '' - } else { - let formats - try { - formats = range(action.nargs).map(() => '%s') - } catch (err) { - throw new TypeError('invalid nargs value') - } - result = sub(formats.join(' '), ...get_metavar(action.nargs)) - } - return result - } - - _expand_help(action) { - let params = Object.assign({ prog: this._prog }, action) - for (let name of Object.keys(params)) { - if (params[name] === SUPPRESS) { - delete params[name] - } - } - for (let name of Object.keys(params)) { - if (params[name] && params[name].name) { - params[name] = params[name].name - } - } - if (params.choices !== undefined) { - let choices_str = _choices_to_array(params.choices).map(String).join(', ') - params.choices = choices_str - } - // LEGACY (v1 compatibility): camelcase - for (let key of Object.keys(params)) { - let old_name = _to_legacy_name(key) - if (old_name !== key) { - params[old_name] = params[key] - } - } - // end - return sub(this._get_help_string(action), params) - } - - * _iter_indented_subactions(action) { - if (typeof action._get_subactions === 'function') { - this._indent() - yield* action._get_subactions() - this._dedent() - } - } - - _split_lines(text, width) { - text = text.replace(this._whitespace_matcher, ' ').trim() - // The textwrap module is used only for formatting help. - // Delay its import for speeding up the common usage of argparse. - let textwrap = require('./lib/textwrap') - return textwrap.wrap(text, { width }) - } - - _fill_text(text, width, indent) { - text = text.replace(this._whitespace_matcher, ' ').trim() - let textwrap = require('./lib/textwrap') - return textwrap.fill(text, { width, - initial_indent: indent, - subsequent_indent: indent }) - } - - _get_help_string(action) { - return action.help - } - - _get_default_metavar_for_optional(action) { - return action.dest.toUpperCase() - } - - _get_default_metavar_for_positional(action) { - return action.dest - } -})) - -HelpFormatter.prototype._Section = _callable(class _Section { - - constructor(formatter, parent, heading = undefined) { - this.formatter = formatter - this.parent = parent - this.heading = heading - this.items = [] - } - - format_help() { - // format the indented section - if (this.parent !== undefined) { - this.formatter._indent() - } - let item_help = this.formatter._join_parts(this.items.map(([ func, args ]) => func.apply(null, args))) - if (this.parent !== undefined) { - this.formatter._dedent() - } - - // return nothing if the section was empty - if (!item_help) { - return '' - } - - // add the heading if the section was non-empty - let heading - if (this.heading !== SUPPRESS && this.heading !== undefined) { - let current_indent = this.formatter._current_indent - heading = sub('%*s%s:\n', current_indent, '', this.heading) - } else { - heading = '' - } - - // join the section-initial newline, the heading and the help - return this.formatter._join_parts(['\n', heading, item_help, '\n']) - } -}) - - -const RawDescriptionHelpFormatter = _camelcase_alias(_callable(class RawDescriptionHelpFormatter extends HelpFormatter { - /* - * Help message formatter which retains any formatting in descriptions. - * - * Only the name of this class is considered a public API. All the methods - * provided by the class are considered an implementation detail. - */ - - _fill_text(text, width, indent) { - return splitlines(text, true).map(line => indent + line).join('') - } -})) - - -const RawTextHelpFormatter = _camelcase_alias(_callable(class RawTextHelpFormatter extends RawDescriptionHelpFormatter { - /* - * Help message formatter which retains formatting of all help text. - * - * Only the name of this class is considered a public API. All the methods - * provided by the class are considered an implementation detail. - */ - - _split_lines(text/*, width*/) { - return splitlines(text) - } -})) - - -const ArgumentDefaultsHelpFormatter = _camelcase_alias(_callable(class ArgumentDefaultsHelpFormatter extends HelpFormatter { - /* - * Help message formatter which adds default values to argument help. - * - * Only the name of this class is considered a public API. All the methods - * provided by the class are considered an implementation detail. - */ - - _get_help_string(action) { - let help = action.help - // LEGACY (v1 compatibility): additional check for defaultValue needed - if (!action.help.includes('%(default)') && !action.help.includes('%(defaultValue)')) { - if (action.default !== SUPPRESS) { - let defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] - if (action.option_strings.length || defaulting_nargs.includes(action.nargs)) { - help += ' (default: %(default)s)' - } - } - } - return help - } -})) - - -const MetavarTypeHelpFormatter = _camelcase_alias(_callable(class MetavarTypeHelpFormatter extends HelpFormatter { - /* - * Help message formatter which uses the argument 'type' as the default - * metavar value (instead of the argument 'dest') - * - * Only the name of this class is considered a public API. All the methods - * provided by the class are considered an implementation detail. - */ - - _get_default_metavar_for_optional(action) { - return typeof action.type === 'function' ? action.type.name : action.type - } - - _get_default_metavar_for_positional(action) { - return typeof action.type === 'function' ? action.type.name : action.type - } -})) - - -// ===================== -// Options and Arguments -// ===================== -function _get_action_name(argument) { - if (argument === undefined) { - return undefined - } else if (argument.option_strings.length) { - return argument.option_strings.join('/') - } else if (![ undefined, SUPPRESS ].includes(argument.metavar)) { - return argument.metavar - } else if (![ undefined, SUPPRESS ].includes(argument.dest)) { - return argument.dest - } else { - return undefined - } -} - - -const ArgumentError = _callable(class ArgumentError extends Error { - /* - * An error from creating or using an argument (optional or positional). - * - * The string value of this exception is the message, augmented with - * information about the argument that caused it. - */ - - constructor(argument, message) { - super() - this.name = 'ArgumentError' - this._argument_name = _get_action_name(argument) - this._message = message - this.message = this.str() - } - - str() { - let format - if (this._argument_name === undefined) { - format = '%(message)s' - } else { - format = 'argument %(argument_name)s: %(message)s' - } - return sub(format, { message: this._message, - argument_name: this._argument_name }) - } -}) - - -const ArgumentTypeError = _callable(class ArgumentTypeError extends Error { - /* - * An error from trying to convert a command line string to a type. - */ - - constructor(message) { - super(message) - this.name = 'ArgumentTypeError' - } -}) - - -// ============== -// Action classes -// ============== -const Action = _camelcase_alias(_callable(class Action extends _AttributeHolder(Function) { - /* - * Information about how to convert command line strings to Python objects. - * - * Action objects are used by an ArgumentParser to represent the information - * needed to parse a single argument from one or more strings from the - * command line. The keyword arguments to the Action constructor are also - * all attributes of Action instances. - * - * Keyword Arguments: - * - * - option_strings -- A list of command-line option strings which - * should be associated with this action. - * - * - dest -- The name of the attribute to hold the created object(s) - * - * - nargs -- The number of command-line arguments that should be - * consumed. By default, one argument will be consumed and a single - * value will be produced. Other values include: - * - N (an integer) consumes N arguments (and produces a list) - * - '?' consumes zero or one arguments - * - '*' consumes zero or more arguments (and produces a list) - * - '+' consumes one or more arguments (and produces a list) - * Note that the difference between the default and nargs=1 is that - * with the default, a single value will be produced, while with - * nargs=1, a list containing a single value will be produced. - * - * - const -- The value to be produced if the option is specified and the - * option uses an action that takes no values. - * - * - default -- The value to be produced if the option is not specified. - * - * - type -- A callable that accepts a single string argument, and - * returns the converted value. The standard Python types str, int, - * float, and complex are useful examples of such callables. If None, - * str is used. - * - * - choices -- A container of values that should be allowed. If not None, - * after a command-line argument has been converted to the appropriate - * type, an exception will be raised if it is not a member of this - * collection. - * - * - required -- True if the action must always be specified at the - * command line. This is only meaningful for optional command-line - * arguments. - * - * - help -- The help string describing the argument. - * - * - metavar -- The name to be used for the option's argument with the - * help string. If None, the 'dest' value will be used as the name. - */ - - constructor() { - let [ - option_strings, - dest, - nargs, - const_value, - default_value, - type, - choices, - required, - help, - metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - nargs: undefined, - const: undefined, - default: undefined, - type: undefined, - choices: undefined, - required: false, - help: undefined, - metavar: undefined - }) - - // when this class is called as a function, redirect it to .call() method of itself - super('return arguments.callee.call.apply(arguments.callee, arguments)') - - this.option_strings = option_strings - this.dest = dest - this.nargs = nargs - this.const = const_value - this.default = default_value - this.type = type - this.choices = choices - this.required = required - this.help = help - this.metavar = metavar - } - - _get_kwargs() { - let names = [ - 'option_strings', - 'dest', - 'nargs', - 'const', - 'default', - 'type', - 'choices', - 'help', - 'metavar' - ] - return names.map(name => [ name, getattr(this, name) ]) - } - - format_usage() { - return this.option_strings[0] - } - - call(/*parser, namespace, values, option_string = undefined*/) { - throw new Error('.call() not defined') - } -})) - - -const BooleanOptionalAction = _camelcase_alias(_callable(class BooleanOptionalAction extends Action { - - constructor() { - let [ - option_strings, - dest, - default_value, - type, - choices, - required, - help, - metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - default: undefined, - type: undefined, - choices: undefined, - required: false, - help: undefined, - metavar: undefined - }) - - let _option_strings = [] - for (let option_string of option_strings) { - _option_strings.push(option_string) - - if (option_string.startsWith('--')) { - option_string = '--no-' + option_string.slice(2) - _option_strings.push(option_string) - } - } - - if (help !== undefined && default_value !== undefined) { - help += ` (default: ${default_value})` - } - - super({ - option_strings: _option_strings, - dest, - nargs: 0, - default: default_value, - type, - choices, - required, - help, - metavar - }) - } - - call(parser, namespace, values, option_string = undefined) { - if (this.option_strings.includes(option_string)) { - setattr(namespace, this.dest, !option_string.startsWith('--no-')) - } - } - - format_usage() { - return this.option_strings.join(' | ') - } -})) - - -const _StoreAction = _callable(class _StoreAction extends Action { - - constructor() { - let [ - option_strings, - dest, - nargs, - const_value, - default_value, - type, - choices, - required, - help, - metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - nargs: undefined, - const: undefined, - default: undefined, - type: undefined, - choices: undefined, - required: false, - help: undefined, - metavar: undefined - }) - - if (nargs === 0) { - throw new TypeError('nargs for store actions must be != 0; if you ' + - 'have nothing to store, actions such as store ' + - 'true or store const may be more appropriate') - } - if (const_value !== undefined && nargs !== OPTIONAL) { - throw new TypeError(sub('nargs must be %r to supply const', OPTIONAL)) - } - super({ - option_strings, - dest, - nargs, - const: const_value, - default: default_value, - type, - choices, - required, - help, - metavar - }) - } - - call(parser, namespace, values/*, option_string = undefined*/) { - setattr(namespace, this.dest, values) - } -}) - - -const _StoreConstAction = _callable(class _StoreConstAction extends Action { - - constructor() { - let [ - option_strings, - dest, - const_value, - default_value, - required, - help - //, metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - const: no_default, - default: undefined, - required: false, - help: undefined, - metavar: undefined - }) - - super({ - option_strings, - dest, - nargs: 0, - const: const_value, - default: default_value, - required, - help - }) - } - - call(parser, namespace/*, values, option_string = undefined*/) { - setattr(namespace, this.dest, this.const) - } -}) - - -const _StoreTrueAction = _callable(class _StoreTrueAction extends _StoreConstAction { - - constructor() { - let [ - option_strings, - dest, - default_value, - required, - help - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - default: false, - required: false, - help: undefined - }) - - super({ - option_strings, - dest, - const: true, - default: default_value, - required, - help - }) - } -}) - - -const _StoreFalseAction = _callable(class _StoreFalseAction extends _StoreConstAction { - - constructor() { - let [ - option_strings, - dest, - default_value, - required, - help - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - default: true, - required: false, - help: undefined - }) - - super({ - option_strings, - dest, - const: false, - default: default_value, - required, - help - }) - } -}) - - -const _AppendAction = _callable(class _AppendAction extends Action { - - constructor() { - let [ - option_strings, - dest, - nargs, - const_value, - default_value, - type, - choices, - required, - help, - metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - nargs: undefined, - const: undefined, - default: undefined, - type: undefined, - choices: undefined, - required: false, - help: undefined, - metavar: undefined - }) - - if (nargs === 0) { - throw new TypeError('nargs for append actions must be != 0; if arg ' + - 'strings are not supplying the value to append, ' + - 'the append const action may be more appropriate') - } - if (const_value !== undefined && nargs !== OPTIONAL) { - throw new TypeError(sub('nargs must be %r to supply const', OPTIONAL)) - } - super({ - option_strings, - dest, - nargs, - const: const_value, - default: default_value, - type, - choices, - required, - help, - metavar - }) - } - - call(parser, namespace, values/*, option_string = undefined*/) { - let items = getattr(namespace, this.dest, undefined) - items = _copy_items(items) - items.push(values) - setattr(namespace, this.dest, items) - } -}) - - -const _AppendConstAction = _callable(class _AppendConstAction extends Action { - - constructor() { - let [ - option_strings, - dest, - const_value, - default_value, - required, - help, - metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - const: no_default, - default: undefined, - required: false, - help: undefined, - metavar: undefined - }) - - super({ - option_strings, - dest, - nargs: 0, - const: const_value, - default: default_value, - required, - help, - metavar - }) - } - - call(parser, namespace/*, values, option_string = undefined*/) { - let items = getattr(namespace, this.dest, undefined) - items = _copy_items(items) - items.push(this.const) - setattr(namespace, this.dest, items) - } -}) - - -const _CountAction = _callable(class _CountAction extends Action { - - constructor() { - let [ - option_strings, - dest, - default_value, - required, - help - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: no_default, - default: undefined, - required: false, - help: undefined - }) - - super({ - option_strings, - dest, - nargs: 0, - default: default_value, - required, - help - }) - } - - call(parser, namespace/*, values, option_string = undefined*/) { - let count = getattr(namespace, this.dest, undefined) - if (count === undefined) { - count = 0 - } - setattr(namespace, this.dest, count + 1) - } -}) - - -const _HelpAction = _callable(class _HelpAction extends Action { - - constructor() { - let [ - option_strings, - dest, - default_value, - help - ] = _parse_opts(arguments, { - option_strings: no_default, - dest: SUPPRESS, - default: SUPPRESS, - help: undefined - }) - - super({ - option_strings, - dest, - default: default_value, - nargs: 0, - help - }) - } - - call(parser/*, namespace, values, option_string = undefined*/) { - parser.print_help() - parser.exit() - } -}) - - -const _VersionAction = _callable(class _VersionAction extends Action { - - constructor() { - let [ - option_strings, - version, - dest, - default_value, - help - ] = _parse_opts(arguments, { - option_strings: no_default, - version: undefined, - dest: SUPPRESS, - default: SUPPRESS, - help: "show program's version number and exit" - }) - - super({ - option_strings, - dest, - default: default_value, - nargs: 0, - help - }) - this.version = version - } - - call(parser/*, namespace, values, option_string = undefined*/) { - let version = this.version - if (version === undefined) { - version = parser.version - } - let formatter = parser._get_formatter() - formatter.add_text(version) - parser._print_message(formatter.format_help(), process.stdout) - parser.exit() - } -}) - - -const _SubParsersAction = _camelcase_alias(_callable(class _SubParsersAction extends Action { - - constructor() { - let [ - option_strings, - prog, - parser_class, - dest, - required, - help, - metavar - ] = _parse_opts(arguments, { - option_strings: no_default, - prog: no_default, - parser_class: no_default, - dest: SUPPRESS, - required: false, - help: undefined, - metavar: undefined - }) - - let name_parser_map = {} - - super({ - option_strings, - dest, - nargs: PARSER, - choices: name_parser_map, - required, - help, - metavar - }) - - this._prog_prefix = prog - this._parser_class = parser_class - this._name_parser_map = name_parser_map - this._choices_actions = [] - } - - add_parser() { - let [ - name, - kwargs - ] = _parse_opts(arguments, { - name: no_default, - '**kwargs': no_default - }) - - // set prog from the existing prefix - if (kwargs.prog === undefined) { - kwargs.prog = sub('%s %s', this._prog_prefix, name) - } - - let aliases = getattr(kwargs, 'aliases', []) - delete kwargs.aliases - - // create a pseudo-action to hold the choice help - if ('help' in kwargs) { - let help = kwargs.help - delete kwargs.help - let choice_action = this._ChoicesPseudoAction(name, aliases, help) - this._choices_actions.push(choice_action) - } - - // create the parser and add it to the map - let parser = new this._parser_class(kwargs) - this._name_parser_map[name] = parser - - // make parser available under aliases also - for (let alias of aliases) { - this._name_parser_map[alias] = parser - } - - return parser - } - - _get_subactions() { - return this._choices_actions - } - - call(parser, namespace, values/*, option_string = undefined*/) { - let parser_name = values[0] - let arg_strings = values.slice(1) - - // set the parser name if requested - if (this.dest !== SUPPRESS) { - setattr(namespace, this.dest, parser_name) - } - - // select the parser - if (hasattr(this._name_parser_map, parser_name)) { - parser = this._name_parser_map[parser_name] - } else { - let args = {parser_name, - choices: this._name_parser_map.join(', ')} - let msg = sub('unknown parser %(parser_name)r (choices: %(choices)s)', args) - throw new ArgumentError(this, msg) - } - - // parse all the remaining options into the namespace - // store any unrecognized options on the object, so that the top - // level parser can decide what to do with them - - // In case this subparser defines new defaults, we parse them - // in a new namespace object and then update the original - // namespace for the relevant parts. - let subnamespace - [ subnamespace, arg_strings ] = parser.parse_known_args(arg_strings, undefined) - for (let [ key, value ] of Object.entries(subnamespace)) { - setattr(namespace, key, value) - } - - if (arg_strings.length) { - setdefault(namespace, _UNRECOGNIZED_ARGS_ATTR, []) - getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).push(...arg_strings) - } - } -})) - - -_SubParsersAction.prototype._ChoicesPseudoAction = _callable(class _ChoicesPseudoAction extends Action { - constructor(name, aliases, help) { - let metavar = name, dest = name - if (aliases.length) { - metavar += sub(' (%s)', aliases.join(', ')) - } - super({ option_strings: [], dest, help, metavar }) - } -}) - - -const _ExtendAction = _callable(class _ExtendAction extends _AppendAction { - call(parser, namespace, values/*, option_string = undefined*/) { - let items = getattr(namespace, this.dest, undefined) - items = _copy_items(items) - items = items.concat(values) - setattr(namespace, this.dest, items) - } -}) - - -// ============== -// Type classes -// ============== -const FileType = _callable(class FileType extends Function { - /* - * Factory for creating file object types - * - * Instances of FileType are typically passed as type= arguments to the - * ArgumentParser add_argument() method. - * - * Keyword Arguments: - * - mode -- A string indicating how the file is to be opened. Accepts the - * same values as the builtin open() function. - * - bufsize -- The file's desired buffer size. Accepts the same values as - * the builtin open() function. - * - encoding -- The file's encoding. Accepts the same values as the - * builtin open() function. - * - errors -- A string indicating how encoding and decoding errors are to - * be handled. Accepts the same value as the builtin open() function. - */ - - constructor() { - let [ - flags, - encoding, - mode, - autoClose, - emitClose, - start, - end, - highWaterMark, - fs - ] = _parse_opts(arguments, { - flags: 'r', - encoding: undefined, - mode: undefined, // 0o666 - autoClose: undefined, // true - emitClose: undefined, // false - start: undefined, // 0 - end: undefined, // Infinity - highWaterMark: undefined, // 64 * 1024 - fs: undefined - }) - - // when this class is called as a function, redirect it to .call() method of itself - super('return arguments.callee.call.apply(arguments.callee, arguments)') - - Object.defineProperty(this, 'name', { - get() { - return sub('FileType(%r)', flags) - } - }) - this._flags = flags - this._options = {} - if (encoding !== undefined) this._options.encoding = encoding - if (mode !== undefined) this._options.mode = mode - if (autoClose !== undefined) this._options.autoClose = autoClose - if (emitClose !== undefined) this._options.emitClose = emitClose - if (start !== undefined) this._options.start = start - if (end !== undefined) this._options.end = end - if (highWaterMark !== undefined) this._options.highWaterMark = highWaterMark - if (fs !== undefined) this._options.fs = fs - } - - call(string) { - // the special argument "-" means sys.std{in,out} - if (string === '-') { - if (this._flags.includes('r')) { - return process.stdin - } else if (this._flags.includes('w')) { - return process.stdout - } else { - let msg = sub('argument "-" with mode %r', this._flags) - throw new TypeError(msg) - } - } - - // all other arguments are used as file names - let fd - try { - fd = fs.openSync(string, this._flags, this._options.mode) - } catch (e) { - let args = { filename: string, error: e.message } - let message = "can't open '%(filename)s': %(error)s" - throw new ArgumentTypeError(sub(message, args)) - } - - let options = Object.assign({ fd, flags: this._flags }, this._options) - if (this._flags.includes('r')) { - return fs.createReadStream(undefined, options) - } else if (this._flags.includes('w')) { - return fs.createWriteStream(undefined, options) - } else { - let msg = sub('argument "%s" with mode %r', string, this._flags) - throw new TypeError(msg) - } - } - - [util.inspect.custom]() { - let args = [ this._flags ] - let kwargs = Object.entries(this._options).map(([ k, v ]) => { - if (k === 'mode') v = { value: v, [util.inspect.custom]() { return '0o' + this.value.toString(8) } } - return [ k, v ] - }) - let args_str = [] - .concat(args.filter(arg => arg !== -1).map(repr)) - .concat(kwargs.filter(([/*kw*/, arg]) => arg !== undefined) - .map(([kw, arg]) => sub('%s=%r', kw, arg))) - .join(', ') - return sub('%s(%s)', this.constructor.name, args_str) - } - - toString() { - return this[util.inspect.custom]() - } -}) - -// =========================== -// Optional and Positional Parsing -// =========================== -const Namespace = _callable(class Namespace extends _AttributeHolder() { - /* - * Simple object for storing attributes. - * - * Implements equality by attribute names and values, and provides a simple - * string representation. - */ - - constructor(options = {}) { - super() - Object.assign(this, options) - } -}) - -// unset string tag to mimic plain object -Namespace.prototype[Symbol.toStringTag] = undefined - - -const _ActionsContainer = _camelcase_alias(_callable(class _ActionsContainer { - - constructor() { - let [ - description, - prefix_chars, - argument_default, - conflict_handler - ] = _parse_opts(arguments, { - description: no_default, - prefix_chars: no_default, - argument_default: no_default, - conflict_handler: no_default - }) - - this.description = description - this.argument_default = argument_default - this.prefix_chars = prefix_chars - this.conflict_handler = conflict_handler - - // set up registries - this._registries = {} - - // register actions - this.register('action', undefined, _StoreAction) - this.register('action', 'store', _StoreAction) - this.register('action', 'store_const', _StoreConstAction) - this.register('action', 'store_true', _StoreTrueAction) - this.register('action', 'store_false', _StoreFalseAction) - this.register('action', 'append', _AppendAction) - this.register('action', 'append_const', _AppendConstAction) - this.register('action', 'count', _CountAction) - this.register('action', 'help', _HelpAction) - this.register('action', 'version', _VersionAction) - this.register('action', 'parsers', _SubParsersAction) - this.register('action', 'extend', _ExtendAction) - // LEGACY (v1 compatibility): camelcase variants - ;[ 'storeConst', 'storeTrue', 'storeFalse', 'appendConst' ].forEach(old_name => { - let new_name = _to_new_name(old_name) - this.register('action', old_name, util.deprecate(this._registry_get('action', new_name), - sub('{action: "%s"} is renamed to {action: "%s"}', old_name, new_name))) - }) - // end - - // raise an exception if the conflict handler is invalid - this._get_handler() - - // action storage - this._actions = [] - this._option_string_actions = {} - - // groups - this._action_groups = [] - this._mutually_exclusive_groups = [] - - // defaults storage - this._defaults = {} - - // determines whether an "option" looks like a negative number - this._negative_number_matcher = /^-\d+$|^-\d*\.\d+$/ - - // whether or not there are any optionals that look like negative - // numbers -- uses a list so it can be shared and edited - this._has_negative_number_optionals = [] - } - - // ==================== - // Registration methods - // ==================== - register(registry_name, value, object) { - let registry = setdefault(this._registries, registry_name, {}) - registry[value] = object - } - - _registry_get(registry_name, value, default_value = undefined) { - return getattr(this._registries[registry_name], value, default_value) - } - - // ================================== - // Namespace default accessor methods - // ================================== - set_defaults(kwargs) { - Object.assign(this._defaults, kwargs) - - // if these defaults match any existing arguments, replace - // the previous default on the object with the new one - for (let action of this._actions) { - if (action.dest in kwargs) { - action.default = kwargs[action.dest] - } - } - } - - get_default(dest) { - for (let action of this._actions) { - if (action.dest === dest && action.default !== undefined) { - return action.default - } - } - return this._defaults[dest] - } - - - // ======================= - // Adding argument actions - // ======================= - add_argument() { - /* - * add_argument(dest, ..., name=value, ...) - * add_argument(option_string, option_string, ..., name=value, ...) - */ - let [ - args, - kwargs - ] = _parse_opts(arguments, { - '*args': no_default, - '**kwargs': no_default - }) - // LEGACY (v1 compatibility), old-style add_argument([ args ], { options }) - if (args.length === 1 && Array.isArray(args[0])) { - args = args[0] - deprecate('argument-array', - sub('use add_argument(%(args)s, {...}) instead of add_argument([ %(args)s ], { ... })', { - args: args.map(repr).join(', ') - })) - } - // end - - // if no positional args are supplied or only one is supplied and - // it doesn't look like an option string, parse a positional - // argument - let chars = this.prefix_chars - if (!args.length || args.length === 1 && !chars.includes(args[0][0])) { - if (args.length && 'dest' in kwargs) { - throw new TypeError('dest supplied twice for positional argument') - } - kwargs = this._get_positional_kwargs(...args, kwargs) - - // otherwise, we're adding an optional argument - } else { - kwargs = this._get_optional_kwargs(...args, kwargs) - } - - // if no default was supplied, use the parser-level default - if (!('default' in kwargs)) { - let dest = kwargs.dest - if (dest in this._defaults) { - kwargs.default = this._defaults[dest] - } else if (this.argument_default !== undefined) { - kwargs.default = this.argument_default - } - } - - // create the action object, and add it to the parser - let action_class = this._pop_action_class(kwargs) - if (typeof action_class !== 'function') { - throw new TypeError(sub('unknown action "%s"', action_class)) - } - // eslint-disable-next-line new-cap - let action = new action_class(kwargs) - - // raise an error if the action type is not callable - let type_func = this._registry_get('type', action.type, action.type) - if (typeof type_func !== 'function') { - throw new TypeError(sub('%r is not callable', type_func)) - } - - if (type_func === FileType) { - throw new TypeError(sub('%r is a FileType class object, instance of it' + - ' must be passed', type_func)) - } - - // raise an error if the metavar does not match the type - if ('_get_formatter' in this) { - try { - this._get_formatter()._format_args(action, undefined) - } catch (err) { - // check for 'invalid nargs value' is an artifact of TypeError and ValueError in js being the same - if (err instanceof TypeError && err.message !== 'invalid nargs value') { - throw new TypeError('length of metavar tuple does not match nargs') - } else { - throw err - } - } - } - - return this._add_action(action) - } - - add_argument_group() { - let group = _ArgumentGroup(this, ...arguments) - this._action_groups.push(group) - return group - } - - add_mutually_exclusive_group() { - // eslint-disable-next-line no-use-before-define - let group = _MutuallyExclusiveGroup(this, ...arguments) - this._mutually_exclusive_groups.push(group) - return group - } - - _add_action(action) { - // resolve any conflicts - this._check_conflict(action) - - // add to actions list - this._actions.push(action) - action.container = this - - // index the action by any option strings it has - for (let option_string of action.option_strings) { - this._option_string_actions[option_string] = action - } - - // set the flag if any option strings look like negative numbers - for (let option_string of action.option_strings) { - if (this._negative_number_matcher.test(option_string)) { - if (!this._has_negative_number_optionals.length) { - this._has_negative_number_optionals.push(true) - } - } - } - - // return the created action - return action - } - - _remove_action(action) { - _array_remove(this._actions, action) - } - - _add_container_actions(container) { - // collect groups by titles - let title_group_map = {} - for (let group of this._action_groups) { - if (group.title in title_group_map) { - let msg = 'cannot merge actions - two groups are named %r' - throw new TypeError(sub(msg, group.title)) - } - title_group_map[group.title] = group - } - - // map each action to its group - let group_map = new Map() - for (let group of container._action_groups) { - - // if a group with the title exists, use that, otherwise - // create a new group matching the container's group - if (!(group.title in title_group_map)) { - title_group_map[group.title] = this.add_argument_group({ - title: group.title, - description: group.description, - conflict_handler: group.conflict_handler - }) - } - - // map the actions to their new group - for (let action of group._group_actions) { - group_map.set(action, title_group_map[group.title]) - } - } - - // add container's mutually exclusive groups - // NOTE: if add_mutually_exclusive_group ever gains title= and - // description= then this code will need to be expanded as above - for (let group of container._mutually_exclusive_groups) { - let mutex_group = this.add_mutually_exclusive_group({ - required: group.required - }) - - // map the actions to their new mutex group - for (let action of group._group_actions) { - group_map.set(action, mutex_group) - } - } - - // add all actions to this container or their group - for (let action of container._actions) { - group_map.get(action)._add_action(action) - } - } - - _get_positional_kwargs() { - let [ - dest, - kwargs - ] = _parse_opts(arguments, { - dest: no_default, - '**kwargs': no_default - }) - - // make sure required is not specified - if ('required' in kwargs) { - let msg = "'required' is an invalid argument for positionals" - throw new TypeError(msg) - } - - // mark positional arguments as required if at least one is - // always required - if (![OPTIONAL, ZERO_OR_MORE].includes(kwargs.nargs)) { - kwargs.required = true - } - if (kwargs.nargs === ZERO_OR_MORE && !('default' in kwargs)) { - kwargs.required = true - } - - // return the keyword arguments with no option strings - return Object.assign(kwargs, { dest, option_strings: [] }) - } - - _get_optional_kwargs() { - let [ - args, - kwargs - ] = _parse_opts(arguments, { - '*args': no_default, - '**kwargs': no_default - }) - - // determine short and long option strings - let option_strings = [] - let long_option_strings = [] - let option_string - for (option_string of args) { - // error on strings that don't start with an appropriate prefix - if (!this.prefix_chars.includes(option_string[0])) { - let args = {option: option_string, - prefix_chars: this.prefix_chars} - let msg = 'invalid option string %(option)r: ' + - 'must start with a character %(prefix_chars)r' - throw new TypeError(sub(msg, args)) - } - - // strings starting with two prefix characters are long options - option_strings.push(option_string) - if (option_string.length > 1 && this.prefix_chars.includes(option_string[1])) { - long_option_strings.push(option_string) - } - } - - // infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' - let dest = kwargs.dest - delete kwargs.dest - if (dest === undefined) { - let dest_option_string - if (long_option_strings.length) { - dest_option_string = long_option_strings[0] - } else { - dest_option_string = option_strings[0] - } - dest = _string_lstrip(dest_option_string, this.prefix_chars) - if (!dest) { - let msg = 'dest= is required for options like %r' - throw new TypeError(sub(msg, option_string)) - } - dest = dest.replace(/-/g, '_') - } - - // return the updated keyword arguments - return Object.assign(kwargs, { dest, option_strings }) - } - - _pop_action_class(kwargs, default_value = undefined) { - let action = getattr(kwargs, 'action', default_value) - delete kwargs.action - return this._registry_get('action', action, action) - } - - _get_handler() { - // determine function from conflict handler string - let handler_func_name = sub('_handle_conflict_%s', this.conflict_handler) - if (typeof this[handler_func_name] === 'function') { - return this[handler_func_name] - } else { - let msg = 'invalid conflict_resolution value: %r' - throw new TypeError(sub(msg, this.conflict_handler)) - } - } - - _check_conflict(action) { - - // find all options that conflict with this option - let confl_optionals = [] - for (let option_string of action.option_strings) { - if (hasattr(this._option_string_actions, option_string)) { - let confl_optional = this._option_string_actions[option_string] - confl_optionals.push([ option_string, confl_optional ]) - } - } - - // resolve any conflicts - if (confl_optionals.length) { - let conflict_handler = this._get_handler() - conflict_handler.call(this, action, confl_optionals) - } - } - - _handle_conflict_error(action, conflicting_actions) { - let message = conflicting_actions.length === 1 ? - 'conflicting option string: %s' : - 'conflicting option strings: %s' - let conflict_string = conflicting_actions.map(([ option_string/*, action*/ ]) => option_string).join(', ') - throw new ArgumentError(action, sub(message, conflict_string)) - } - - _handle_conflict_resolve(action, conflicting_actions) { - - // remove all conflicting options - for (let [ option_string, action ] of conflicting_actions) { - - // remove the conflicting option - _array_remove(action.option_strings, option_string) - delete this._option_string_actions[option_string] - - // if the option now has no option string, remove it from the - // container holding it - if (!action.option_strings.length) { - action.container._remove_action(action) - } - } - } -})) - - -const _ArgumentGroup = _callable(class _ArgumentGroup extends _ActionsContainer { - - constructor() { - let [ - container, - title, - description, - kwargs - ] = _parse_opts(arguments, { - container: no_default, - title: undefined, - description: undefined, - '**kwargs': no_default - }) - - // add any missing keyword arguments by checking the container - setdefault(kwargs, 'conflict_handler', container.conflict_handler) - setdefault(kwargs, 'prefix_chars', container.prefix_chars) - setdefault(kwargs, 'argument_default', container.argument_default) - super(Object.assign({ description }, kwargs)) - - // group attributes - this.title = title - this._group_actions = [] - - // share most attributes with the container - this._registries = container._registries - this._actions = container._actions - this._option_string_actions = container._option_string_actions - this._defaults = container._defaults - this._has_negative_number_optionals = - container._has_negative_number_optionals - this._mutually_exclusive_groups = container._mutually_exclusive_groups - } - - _add_action(action) { - action = super._add_action(action) - this._group_actions.push(action) - return action - } - - _remove_action(action) { - super._remove_action(action) - _array_remove(this._group_actions, action) - } -}) - - -const _MutuallyExclusiveGroup = _callable(class _MutuallyExclusiveGroup extends _ArgumentGroup { - - constructor() { - let [ - container, - required - ] = _parse_opts(arguments, { - container: no_default, - required: false - }) - - super(container) - this.required = required - this._container = container - } - - _add_action(action) { - if (action.required) { - let msg = 'mutually exclusive arguments must be optional' - throw new TypeError(msg) - } - action = this._container._add_action(action) - this._group_actions.push(action) - return action - } - - _remove_action(action) { - this._container._remove_action(action) - _array_remove(this._group_actions, action) - } -}) - - -const ArgumentParser = _camelcase_alias(_callable(class ArgumentParser extends _AttributeHolder(_ActionsContainer) { - /* - * Object for parsing command line strings into Python objects. - * - * Keyword Arguments: - * - prog -- The name of the program (default: sys.argv[0]) - * - usage -- A usage message (default: auto-generated from arguments) - * - description -- A description of what the program does - * - epilog -- Text following the argument descriptions - * - parents -- Parsers whose arguments should be copied into this one - * - formatter_class -- HelpFormatter class for printing help messages - * - prefix_chars -- Characters that prefix optional arguments - * - fromfile_prefix_chars -- Characters that prefix files containing - * additional arguments - * - argument_default -- The default value for all arguments - * - conflict_handler -- String indicating how to handle conflicts - * - add_help -- Add a -h/-help option - * - allow_abbrev -- Allow long options to be abbreviated unambiguously - * - exit_on_error -- Determines whether or not ArgumentParser exits with - * error info when an error occurs - */ - - constructor() { - let [ - prog, - usage, - description, - epilog, - parents, - formatter_class, - prefix_chars, - fromfile_prefix_chars, - argument_default, - conflict_handler, - add_help, - allow_abbrev, - exit_on_error, - debug, // LEGACY (v1 compatibility), debug mode - version // LEGACY (v1 compatibility), version - ] = _parse_opts(arguments, { - prog: undefined, - usage: undefined, - description: undefined, - epilog: undefined, - parents: [], - formatter_class: HelpFormatter, - prefix_chars: '-', - fromfile_prefix_chars: undefined, - argument_default: undefined, - conflict_handler: 'error', - add_help: true, - allow_abbrev: true, - exit_on_error: true, - debug: undefined, // LEGACY (v1 compatibility), debug mode - version: undefined // LEGACY (v1 compatibility), version - }) - - // LEGACY (v1 compatibility) - if (debug !== undefined) { - deprecate('debug', - 'The "debug" argument to ArgumentParser is deprecated. Please ' + - 'override ArgumentParser.exit function instead.' - ) - } - - if (version !== undefined) { - deprecate('version', - 'The "version" argument to ArgumentParser is deprecated. Please use ' + - "add_argument(..., { action: 'version', version: 'N', ... }) instead." - ) - } - // end - - super({ - description, - prefix_chars, - argument_default, - conflict_handler - }) - - // default setting for prog - if (prog === undefined) { - prog = path.basename(get_argv()[0] || '') - } - - this.prog = prog - this.usage = usage - this.epilog = epilog - this.formatter_class = formatter_class - this.fromfile_prefix_chars = fromfile_prefix_chars - this.add_help = add_help - this.allow_abbrev = allow_abbrev - this.exit_on_error = exit_on_error - // LEGACY (v1 compatibility), debug mode - this.debug = debug - // end - - this._positionals = this.add_argument_group('positional arguments') - this._optionals = this.add_argument_group('optional arguments') - this._subparsers = undefined - - // register types - function identity(string) { - return string - } - this.register('type', undefined, identity) - this.register('type', null, identity) - this.register('type', 'auto', identity) - this.register('type', 'int', function (x) { - let result = Number(x) - if (!Number.isInteger(result)) { - throw new TypeError(sub('could not convert string to int: %r', x)) - } - return result - }) - this.register('type', 'float', function (x) { - let result = Number(x) - if (isNaN(result)) { - throw new TypeError(sub('could not convert string to float: %r', x)) - } - return result - }) - this.register('type', 'str', String) - // LEGACY (v1 compatibility): custom types - this.register('type', 'string', - util.deprecate(String, 'use {type:"str"} or {type:String} instead of {type:"string"}')) - // end - - // add help argument if necessary - // (using explicit default to override global argument_default) - let default_prefix = prefix_chars.includes('-') ? '-' : prefix_chars[0] - if (this.add_help) { - this.add_argument( - default_prefix + 'h', - default_prefix.repeat(2) + 'help', - { - action: 'help', - default: SUPPRESS, - help: 'show this help message and exit' - } - ) - } - // LEGACY (v1 compatibility), version - if (version) { - this.add_argument( - default_prefix + 'v', - default_prefix.repeat(2) + 'version', - { - action: 'version', - default: SUPPRESS, - version: this.version, - help: "show program's version number and exit" - } - ) - } - // end - - // add parent arguments and defaults - for (let parent of parents) { - this._add_container_actions(parent) - Object.assign(this._defaults, parent._defaults) - } - } - - // ======================= - // Pretty __repr__ methods - // ======================= - _get_kwargs() { - let names = [ - 'prog', - 'usage', - 'description', - 'formatter_class', - 'conflict_handler', - 'add_help' - ] - return names.map(name => [ name, getattr(this, name) ]) - } - - // ================================== - // Optional/Positional adding methods - // ================================== - add_subparsers() { - let [ - kwargs - ] = _parse_opts(arguments, { - '**kwargs': no_default - }) - - if (this._subparsers !== undefined) { - this.error('cannot have multiple subparser arguments') - } - - // add the parser class to the arguments if it's not present - setdefault(kwargs, 'parser_class', this.constructor) - - if ('title' in kwargs || 'description' in kwargs) { - let title = getattr(kwargs, 'title', 'subcommands') - let description = getattr(kwargs, 'description', undefined) - delete kwargs.title - delete kwargs.description - this._subparsers = this.add_argument_group(title, description) - } else { - this._subparsers = this._positionals - } - - // prog defaults to the usage message of this parser, skipping - // optional arguments and with no "usage:" prefix - if (kwargs.prog === undefined) { - let formatter = this._get_formatter() - let positionals = this._get_positional_actions() - let groups = this._mutually_exclusive_groups - formatter.add_usage(this.usage, positionals, groups, '') - kwargs.prog = formatter.format_help().trim() - } - - // create the parsers action and add it to the positionals list - let parsers_class = this._pop_action_class(kwargs, 'parsers') - // eslint-disable-next-line new-cap - let action = new parsers_class(Object.assign({ option_strings: [] }, kwargs)) - this._subparsers._add_action(action) - - // return the created parsers action - return action - } - - _add_action(action) { - if (action.option_strings.length) { - this._optionals._add_action(action) - } else { - this._positionals._add_action(action) - } - return action - } - - _get_optional_actions() { - return this._actions.filter(action => action.option_strings.length) - } - - _get_positional_actions() { - return this._actions.filter(action => !action.option_strings.length) - } - - // ===================================== - // Command line argument parsing methods - // ===================================== - parse_args(args = undefined, namespace = undefined) { - let argv - [ args, argv ] = this.parse_known_args(args, namespace) - if (argv && argv.length > 0) { - let msg = 'unrecognized arguments: %s' - this.error(sub(msg, argv.join(' '))) - } - return args - } - - parse_known_args(args = undefined, namespace = undefined) { - if (args === undefined) { - args = get_argv().slice(1) - } - - // default Namespace built from parser defaults - if (namespace === undefined) { - namespace = new Namespace() - } - - // add any action defaults that aren't present - for (let action of this._actions) { - if (action.dest !== SUPPRESS) { - if (!hasattr(namespace, action.dest)) { - if (action.default !== SUPPRESS) { - setattr(namespace, action.dest, action.default) - } - } - } - } - - // add any parser defaults that aren't present - for (let dest of Object.keys(this._defaults)) { - if (!hasattr(namespace, dest)) { - setattr(namespace, dest, this._defaults[dest]) - } - } - - // parse the arguments and exit if there are any errors - if (this.exit_on_error) { - try { - [ namespace, args ] = this._parse_known_args(args, namespace) - } catch (err) { - if (err instanceof ArgumentError) { - this.error(err.message) - } else { - throw err - } - } - } else { - [ namespace, args ] = this._parse_known_args(args, namespace) - } - - if (hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) { - args = args.concat(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) - delattr(namespace, _UNRECOGNIZED_ARGS_ATTR) - } - - return [ namespace, args ] - } - - _parse_known_args(arg_strings, namespace) { - // replace arg strings that are file references - if (this.fromfile_prefix_chars !== undefined) { - arg_strings = this._read_args_from_files(arg_strings) - } - - // map all mutually exclusive arguments to the other arguments - // they can't occur with - let action_conflicts = new Map() - for (let mutex_group of this._mutually_exclusive_groups) { - let group_actions = mutex_group._group_actions - for (let [ i, mutex_action ] of Object.entries(mutex_group._group_actions)) { - let conflicts = action_conflicts.get(mutex_action) || [] - conflicts = conflicts.concat(group_actions.slice(0, +i)) - conflicts = conflicts.concat(group_actions.slice(+i + 1)) - action_conflicts.set(mutex_action, conflicts) - } - } - - // find all option indices, and determine the arg_string_pattern - // which has an 'O' if there is an option at an index, - // an 'A' if there is an argument, or a '-' if there is a '--' - let option_string_indices = {} - let arg_string_pattern_parts = [] - let arg_strings_iter = Object.entries(arg_strings)[Symbol.iterator]() - for (let [ i, arg_string ] of arg_strings_iter) { - - // all args after -- are non-options - if (arg_string === '--') { - arg_string_pattern_parts.push('-') - for ([ i, arg_string ] of arg_strings_iter) { - arg_string_pattern_parts.push('A') - } - - // otherwise, add the arg to the arg strings - // and note the index if it was an option - } else { - let option_tuple = this._parse_optional(arg_string) - let pattern - if (option_tuple === undefined) { - pattern = 'A' - } else { - option_string_indices[i] = option_tuple - pattern = 'O' - } - arg_string_pattern_parts.push(pattern) - } - } - - // join the pieces together to form the pattern - let arg_strings_pattern = arg_string_pattern_parts.join('') - - // converts arg strings to the appropriate and then takes the action - let seen_actions = new Set() - let seen_non_default_actions = new Set() - let extras - - let take_action = (action, argument_strings, option_string = undefined) => { - seen_actions.add(action) - let argument_values = this._get_values(action, argument_strings) - - // error if this argument is not allowed with other previously - // seen arguments, assuming that actions that use the default - // value don't really count as "present" - if (argument_values !== action.default) { - seen_non_default_actions.add(action) - for (let conflict_action of action_conflicts.get(action) || []) { - if (seen_non_default_actions.has(conflict_action)) { - let msg = 'not allowed with argument %s' - let action_name = _get_action_name(conflict_action) - throw new ArgumentError(action, sub(msg, action_name)) - } - } - } - - // take the action if we didn't receive a SUPPRESS value - // (e.g. from a default) - if (argument_values !== SUPPRESS) { - action(this, namespace, argument_values, option_string) - } - } - - // function to convert arg_strings into an optional action - let consume_optional = start_index => { - - // get the optional identified at this index - let option_tuple = option_string_indices[start_index] - let [ action, option_string, explicit_arg ] = option_tuple - - // identify additional optionals in the same arg string - // (e.g. -xyz is the same as -x -y -z if no args are required) - let action_tuples = [] - let stop - for (;;) { - - // if we found no optional action, skip it - if (action === undefined) { - extras.push(arg_strings[start_index]) - return start_index + 1 - } - - // if there is an explicit argument, try to match the - // optional's string arguments to only this - if (explicit_arg !== undefined) { - let arg_count = this._match_argument(action, 'A') - - // if the action is a single-dash option and takes no - // arguments, try to parse more single-dash options out - // of the tail of the option string - let chars = this.prefix_chars - if (arg_count === 0 && !chars.includes(option_string[1])) { - action_tuples.push([ action, [], option_string ]) - let char = option_string[0] - option_string = char + explicit_arg[0] - let new_explicit_arg = explicit_arg.slice(1) || undefined - let optionals_map = this._option_string_actions - if (hasattr(optionals_map, option_string)) { - action = optionals_map[option_string] - explicit_arg = new_explicit_arg - } else { - let msg = 'ignored explicit argument %r' - throw new ArgumentError(action, sub(msg, explicit_arg)) - } - - // if the action expect exactly one argument, we've - // successfully matched the option; exit the loop - } else if (arg_count === 1) { - stop = start_index + 1 - let args = [ explicit_arg ] - action_tuples.push([ action, args, option_string ]) - break - - // error if a double-dash option did not use the - // explicit argument - } else { - let msg = 'ignored explicit argument %r' - throw new ArgumentError(action, sub(msg, explicit_arg)) - } - - // if there is no explicit argument, try to match the - // optional's string arguments with the following strings - // if successful, exit the loop - } else { - let start = start_index + 1 - let selected_patterns = arg_strings_pattern.slice(start) - let arg_count = this._match_argument(action, selected_patterns) - stop = start + arg_count - let args = arg_strings.slice(start, stop) - action_tuples.push([ action, args, option_string ]) - break - } - } - - // add the Optional to the list and return the index at which - // the Optional's string args stopped - assert(action_tuples.length) - for (let [ action, args, option_string ] of action_tuples) { - take_action(action, args, option_string) - } - return stop - } - - // the list of Positionals left to be parsed; this is modified - // by consume_positionals() - let positionals = this._get_positional_actions() - - // function to convert arg_strings into positional actions - let consume_positionals = start_index => { - // match as many Positionals as possible - let selected_pattern = arg_strings_pattern.slice(start_index) - let arg_counts = this._match_arguments_partial(positionals, selected_pattern) - - // slice off the appropriate arg strings for each Positional - // and add the Positional and its args to the list - for (let i = 0; i < positionals.length && i < arg_counts.length; i++) { - let action = positionals[i] - let arg_count = arg_counts[i] - let args = arg_strings.slice(start_index, start_index + arg_count) - start_index += arg_count - take_action(action, args) - } - - // slice off the Positionals that we just parsed and return the - // index at which the Positionals' string args stopped - positionals = positionals.slice(arg_counts.length) - return start_index - } - - // consume Positionals and Optionals alternately, until we have - // passed the last option string - extras = [] - let start_index = 0 - let max_option_string_index = Math.max(-1, ...Object.keys(option_string_indices).map(Number)) - while (start_index <= max_option_string_index) { - - // consume any Positionals preceding the next option - let next_option_string_index = Math.min( - // eslint-disable-next-line no-loop-func - ...Object.keys(option_string_indices).map(Number).filter(index => index >= start_index) - ) - if (start_index !== next_option_string_index) { - let positionals_end_index = consume_positionals(start_index) - - // only try to parse the next optional if we didn't consume - // the option string during the positionals parsing - if (positionals_end_index > start_index) { - start_index = positionals_end_index - continue - } else { - start_index = positionals_end_index - } - } - - // if we consumed all the positionals we could and we're not - // at the index of an option string, there were extra arguments - if (!(start_index in option_string_indices)) { - let strings = arg_strings.slice(start_index, next_option_string_index) - extras = extras.concat(strings) - start_index = next_option_string_index - } - - // consume the next optional and any arguments for it - start_index = consume_optional(start_index) - } - - // consume any positionals following the last Optional - let stop_index = consume_positionals(start_index) - - // if we didn't consume all the argument strings, there were extras - extras = extras.concat(arg_strings.slice(stop_index)) - - // make sure all required actions were present and also convert - // action defaults which were not given as arguments - let required_actions = [] - for (let action of this._actions) { - if (!seen_actions.has(action)) { - if (action.required) { - required_actions.push(_get_action_name(action)) - } else { - // Convert action default now instead of doing it before - // parsing arguments to avoid calling convert functions - // twice (which may fail) if the argument was given, but - // only if it was defined already in the namespace - if (action.default !== undefined && - typeof action.default === 'string' && - hasattr(namespace, action.dest) && - action.default === getattr(namespace, action.dest)) { - setattr(namespace, action.dest, - this._get_value(action, action.default)) - } - } - } - } - - if (required_actions.length) { - this.error(sub('the following arguments are required: %s', - required_actions.join(', '))) - } - - // make sure all required groups had one option present - for (let group of this._mutually_exclusive_groups) { - if (group.required) { - let no_actions_used = true - for (let action of group._group_actions) { - if (seen_non_default_actions.has(action)) { - no_actions_used = false - break - } - } - - // if no actions were used, report the error - if (no_actions_used) { - let names = group._group_actions - .filter(action => action.help !== SUPPRESS) - .map(action => _get_action_name(action)) - let msg = 'one of the arguments %s is required' - this.error(sub(msg, names.join(' '))) - } - } - } - - // return the updated namespace and the extra arguments - return [ namespace, extras ] - } - - _read_args_from_files(arg_strings) { - // expand arguments referencing files - let new_arg_strings = [] - for (let arg_string of arg_strings) { - - // for regular arguments, just add them back into the list - if (!arg_string || !this.fromfile_prefix_chars.includes(arg_string[0])) { - new_arg_strings.push(arg_string) - - // replace arguments referencing files with the file content - } else { - try { - let args_file = fs.readFileSync(arg_string.slice(1), 'utf8') - let arg_strings = [] - for (let arg_line of splitlines(args_file)) { - for (let arg of this.convert_arg_line_to_args(arg_line)) { - arg_strings.push(arg) - } - } - arg_strings = this._read_args_from_files(arg_strings) - new_arg_strings = new_arg_strings.concat(arg_strings) - } catch (err) { - this.error(err.message) - } - } - } - - // return the modified argument list - return new_arg_strings - } - - convert_arg_line_to_args(arg_line) { - return [arg_line] - } - - _match_argument(action, arg_strings_pattern) { - // match the pattern for this action to the arg strings - let nargs_pattern = this._get_nargs_pattern(action) - let match = arg_strings_pattern.match(new RegExp('^' + nargs_pattern)) - - // raise an exception if we weren't able to find a match - if (match === null) { - let nargs_errors = { - undefined: 'expected one argument', - [OPTIONAL]: 'expected at most one argument', - [ONE_OR_MORE]: 'expected at least one argument' - } - let msg = nargs_errors[action.nargs] - if (msg === undefined) { - msg = sub(action.nargs === 1 ? 'expected %s argument' : 'expected %s arguments', action.nargs) - } - throw new ArgumentError(action, msg) - } - - // return the number of arguments matched - return match[1].length - } - - _match_arguments_partial(actions, arg_strings_pattern) { - // progressively shorten the actions list by slicing off the - // final actions until we find a match - let result = [] - for (let i of range(actions.length, 0, -1)) { - let actions_slice = actions.slice(0, i) - let pattern = actions_slice.map(action => this._get_nargs_pattern(action)).join('') - let match = arg_strings_pattern.match(new RegExp('^' + pattern)) - if (match !== null) { - result = result.concat(match.slice(1).map(string => string.length)) - break - } - } - - // return the list of arg string counts - return result - } - - _parse_optional(arg_string) { - // if it's an empty string, it was meant to be a positional - if (!arg_string) { - return undefined - } - - // if it doesn't start with a prefix, it was meant to be positional - if (!this.prefix_chars.includes(arg_string[0])) { - return undefined - } - - // if the option string is present in the parser, return the action - if (arg_string in this._option_string_actions) { - let action = this._option_string_actions[arg_string] - return [ action, arg_string, undefined ] - } - - // if it's just a single character, it was meant to be positional - if (arg_string.length === 1) { - return undefined - } - - // if the option string before the "=" is present, return the action - if (arg_string.includes('=')) { - let [ option_string, explicit_arg ] = _string_split(arg_string, '=', 1) - if (option_string in this._option_string_actions) { - let action = this._option_string_actions[option_string] - return [ action, option_string, explicit_arg ] - } - } - - // search through all possible prefixes of the option string - // and all actions in the parser for possible interpretations - let option_tuples = this._get_option_tuples(arg_string) - - // if multiple actions match, the option string was ambiguous - if (option_tuples.length > 1) { - let options = option_tuples.map(([ /*action*/, option_string/*, explicit_arg*/ ]) => option_string).join(', ') - let args = {option: arg_string, matches: options} - let msg = 'ambiguous option: %(option)s could match %(matches)s' - this.error(sub(msg, args)) - - // if exactly one action matched, this segmentation is good, - // so return the parsed action - } else if (option_tuples.length === 1) { - let [ option_tuple ] = option_tuples - return option_tuple - } - - // if it was not found as an option, but it looks like a negative - // number, it was meant to be positional - // unless there are negative-number-like options - if (this._negative_number_matcher.test(arg_string)) { - if (!this._has_negative_number_optionals.length) { - return undefined - } - } - - // if it contains a space, it was meant to be a positional - if (arg_string.includes(' ')) { - return undefined - } - - // it was meant to be an optional but there is no such option - // in this parser (though it might be a valid option in a subparser) - return [ undefined, arg_string, undefined ] - } - - _get_option_tuples(option_string) { - let result = [] - - // option strings starting with two prefix characters are only - // split at the '=' - let chars = this.prefix_chars - if (chars.includes(option_string[0]) && chars.includes(option_string[1])) { - if (this.allow_abbrev) { - let option_prefix, explicit_arg - if (option_string.includes('=')) { - [ option_prefix, explicit_arg ] = _string_split(option_string, '=', 1) - } else { - option_prefix = option_string - explicit_arg = undefined - } - for (let option_string of Object.keys(this._option_string_actions)) { - if (option_string.startsWith(option_prefix)) { - let action = this._option_string_actions[option_string] - let tup = [ action, option_string, explicit_arg ] - result.push(tup) - } - } - } - - // single character options can be concatenated with their arguments - // but multiple character options always have to have their argument - // separate - } else if (chars.includes(option_string[0]) && !chars.includes(option_string[1])) { - let option_prefix = option_string - let explicit_arg = undefined - let short_option_prefix = option_string.slice(0, 2) - let short_explicit_arg = option_string.slice(2) - - for (let option_string of Object.keys(this._option_string_actions)) { - if (option_string === short_option_prefix) { - let action = this._option_string_actions[option_string] - let tup = [ action, option_string, short_explicit_arg ] - result.push(tup) - } else if (option_string.startsWith(option_prefix)) { - let action = this._option_string_actions[option_string] - let tup = [ action, option_string, explicit_arg ] - result.push(tup) - } - } - - // shouldn't ever get here - } else { - this.error(sub('unexpected option string: %s', option_string)) - } - - // return the collected option tuples - return result - } - - _get_nargs_pattern(action) { - // in all examples below, we have to allow for '--' args - // which are represented as '-' in the pattern - let nargs = action.nargs - let nargs_pattern - - // the default (None) is assumed to be a single argument - if (nargs === undefined) { - nargs_pattern = '(-*A-*)' - - // allow zero or one arguments - } else if (nargs === OPTIONAL) { - nargs_pattern = '(-*A?-*)' - - // allow zero or more arguments - } else if (nargs === ZERO_OR_MORE) { - nargs_pattern = '(-*[A-]*)' - - // allow one or more arguments - } else if (nargs === ONE_OR_MORE) { - nargs_pattern = '(-*A[A-]*)' - - // allow any number of options or arguments - } else if (nargs === REMAINDER) { - nargs_pattern = '([-AO]*)' - - // allow one argument followed by any number of options or arguments - } else if (nargs === PARSER) { - nargs_pattern = '(-*A[-AO]*)' - - // suppress action, like nargs=0 - } else if (nargs === SUPPRESS) { - nargs_pattern = '(-*-*)' - - // all others should be integers - } else { - nargs_pattern = sub('(-*%s-*)', 'A'.repeat(nargs).split('').join('-*')) - } - - // if this is an optional action, -- is not allowed - if (action.option_strings.length) { - nargs_pattern = nargs_pattern.replace(/-\*/g, '') - nargs_pattern = nargs_pattern.replace(/-/g, '') - } - - // return the pattern - return nargs_pattern - } - - // ======================== - // Alt command line argument parsing, allowing free intermix - // ======================== - - parse_intermixed_args(args = undefined, namespace = undefined) { - let argv - [ args, argv ] = this.parse_known_intermixed_args(args, namespace) - if (argv.length) { - let msg = 'unrecognized arguments: %s' - this.error(sub(msg, argv.join(' '))) - } - return args - } - - parse_known_intermixed_args(args = undefined, namespace = undefined) { - // returns a namespace and list of extras - // - // positional can be freely intermixed with optionals. optionals are - // first parsed with all positional arguments deactivated. The 'extras' - // are then parsed. If the parser definition is incompatible with the - // intermixed assumptions (e.g. use of REMAINDER, subparsers) a - // TypeError is raised. - // - // positionals are 'deactivated' by setting nargs and default to - // SUPPRESS. This blocks the addition of that positional to the - // namespace - - let extras - let positionals = this._get_positional_actions() - let a = positionals.filter(action => [ PARSER, REMAINDER ].includes(action.nargs)) - if (a.length) { - throw new TypeError(sub('parse_intermixed_args: positional arg' + - ' with nargs=%s', a[0].nargs)) - } - - for (let group of this._mutually_exclusive_groups) { - for (let action of group._group_actions) { - if (positionals.includes(action)) { - throw new TypeError('parse_intermixed_args: positional in' + - ' mutuallyExclusiveGroup') - } - } - } - - let save_usage - try { - save_usage = this.usage - let remaining_args - try { - if (this.usage === undefined) { - // capture the full usage for use in error messages - this.usage = this.format_usage().slice(7) - } - for (let action of positionals) { - // deactivate positionals - action.save_nargs = action.nargs - // action.nargs = 0 - action.nargs = SUPPRESS - action.save_default = action.default - action.default = SUPPRESS - } - [ namespace, remaining_args ] = this.parse_known_args(args, - namespace) - for (let action of positionals) { - // remove the empty positional values from namespace - let attr = getattr(namespace, action.dest) - if (Array.isArray(attr) && attr.length === 0) { - // eslint-disable-next-line no-console - console.warn(sub('Do not expect %s in %s', action.dest, namespace)) - delattr(namespace, action.dest) - } - } - } finally { - // restore nargs and usage before exiting - for (let action of positionals) { - action.nargs = action.save_nargs - action.default = action.save_default - } - } - let optionals = this._get_optional_actions() - try { - // parse positionals. optionals aren't normally required, but - // they could be, so make sure they aren't. - for (let action of optionals) { - action.save_required = action.required - action.required = false - } - for (let group of this._mutually_exclusive_groups) { - group.save_required = group.required - group.required = false - } - [ namespace, extras ] = this.parse_known_args(remaining_args, - namespace) - } finally { - // restore parser values before exiting - for (let action of optionals) { - action.required = action.save_required - } - for (let group of this._mutually_exclusive_groups) { - group.required = group.save_required - } - } - } finally { - this.usage = save_usage - } - return [ namespace, extras ] - } - - // ======================== - // Value conversion methods - // ======================== - _get_values(action, arg_strings) { - // for everything but PARSER, REMAINDER args, strip out first '--' - if (![PARSER, REMAINDER].includes(action.nargs)) { - try { - _array_remove(arg_strings, '--') - } catch (err) {} - } - - let value - // optional argument produces a default when not present - if (!arg_strings.length && action.nargs === OPTIONAL) { - if (action.option_strings.length) { - value = action.const - } else { - value = action.default - } - if (typeof value === 'string') { - value = this._get_value(action, value) - this._check_value(action, value) - } - - // when nargs='*' on a positional, if there were no command-line - // args, use the default if it is anything other than None - } else if (!arg_strings.length && action.nargs === ZERO_OR_MORE && - !action.option_strings.length) { - if (action.default !== undefined) { - value = action.default - } else { - value = arg_strings - } - this._check_value(action, value) - - // single argument or optional argument produces a single value - } else if (arg_strings.length === 1 && [undefined, OPTIONAL].includes(action.nargs)) { - let arg_string = arg_strings[0] - value = this._get_value(action, arg_string) - this._check_value(action, value) - - // REMAINDER arguments convert all values, checking none - } else if (action.nargs === REMAINDER) { - value = arg_strings.map(v => this._get_value(action, v)) - - // PARSER arguments convert all values, but check only the first - } else if (action.nargs === PARSER) { - value = arg_strings.map(v => this._get_value(action, v)) - this._check_value(action, value[0]) - - // SUPPRESS argument does not put anything in the namespace - } else if (action.nargs === SUPPRESS) { - value = SUPPRESS - - // all other types of nargs produce a list - } else { - value = arg_strings.map(v => this._get_value(action, v)) - for (let v of value) { - this._check_value(action, v) - } - } - - // return the converted value - return value - } - - _get_value(action, arg_string) { - let type_func = this._registry_get('type', action.type, action.type) - if (typeof type_func !== 'function') { - let msg = '%r is not callable' - throw new ArgumentError(action, sub(msg, type_func)) - } - - // convert the value to the appropriate type - let result - try { - try { - result = type_func(arg_string) - } catch (err) { - // Dear TC39, why would you ever consider making es6 classes not callable? - // We had one universal interface, [[Call]], which worked for anything - // (with familiar this-instanceof guard for classes). Now we have two. - if (err instanceof TypeError && - /Class constructor .* cannot be invoked without 'new'/.test(err.message)) { - // eslint-disable-next-line new-cap - result = new type_func(arg_string) - } else { - throw err - } - } - - } catch (err) { - // ArgumentTypeErrors indicate errors - if (err instanceof ArgumentTypeError) { - //let name = getattr(action.type, 'name', repr(action.type)) - let msg = err.message - throw new ArgumentError(action, msg) - - // TypeErrors or ValueErrors also indicate errors - } else if (err instanceof TypeError) { - let name = getattr(action.type, 'name', repr(action.type)) - let args = {type: name, value: arg_string} - let msg = 'invalid %(type)s value: %(value)r' - throw new ArgumentError(action, sub(msg, args)) - } else { - throw err - } - } - - // return the converted value - return result - } - - _check_value(action, value) { - // converted value must be one of the choices (if specified) - if (action.choices !== undefined && !_choices_to_array(action.choices).includes(value)) { - let args = {value, - choices: _choices_to_array(action.choices).map(repr).join(', ')} - let msg = 'invalid choice: %(value)r (choose from %(choices)s)' - throw new ArgumentError(action, sub(msg, args)) - } - } - - // ======================= - // Help-formatting methods - // ======================= - format_usage() { - let formatter = this._get_formatter() - formatter.add_usage(this.usage, this._actions, - this._mutually_exclusive_groups) - return formatter.format_help() - } - - format_help() { - let formatter = this._get_formatter() - - // usage - formatter.add_usage(this.usage, this._actions, - this._mutually_exclusive_groups) - - // description - formatter.add_text(this.description) - - // positionals, optionals and user-defined groups - for (let action_group of this._action_groups) { - formatter.start_section(action_group.title) - formatter.add_text(action_group.description) - formatter.add_arguments(action_group._group_actions) - formatter.end_section() - } - - // epilog - formatter.add_text(this.epilog) - - // determine help from format above - return formatter.format_help() - } - - _get_formatter() { - // eslint-disable-next-line new-cap - return new this.formatter_class({ prog: this.prog }) - } - - // ===================== - // Help-printing methods - // ===================== - print_usage(file = undefined) { - if (file === undefined) file = process.stdout - this._print_message(this.format_usage(), file) - } - - print_help(file = undefined) { - if (file === undefined) file = process.stdout - this._print_message(this.format_help(), file) - } - - _print_message(message, file = undefined) { - if (message) { - if (file === undefined) file = process.stderr - file.write(message) - } - } - - // =============== - // Exiting methods - // =============== - exit(status = 0, message = undefined) { - if (message) { - this._print_message(message, process.stderr) - } - process.exit(status) - } - - error(message) { - /* - * error(message: string) - * - * Prints a usage message incorporating the message to stderr and - * exits. - * - * If you override this in a subclass, it should not return -- it - * should either exit or raise an exception. - */ - - // LEGACY (v1 compatibility), debug mode - if (this.debug === true) throw new Error(message) - // end - this.print_usage(process.stderr) - let args = {prog: this.prog, message: message} - this.exit(2, sub('%(prog)s: error: %(message)s\n', args)) - } -})) - - -module.exports = { - ArgumentParser, - ArgumentError, - ArgumentTypeError, - BooleanOptionalAction, - FileType, - HelpFormatter, - ArgumentDefaultsHelpFormatter, - RawDescriptionHelpFormatter, - RawTextHelpFormatter, - MetavarTypeHelpFormatter, - Namespace, - Action, - ONE_OR_MORE, - OPTIONAL, - PARSER, - REMAINDER, - SUPPRESS, - ZERO_OR_MORE -} - -// LEGACY (v1 compatibility), Const alias -Object.defineProperty(module.exports, 'Const', { - get() { - let result = {} - Object.entries({ ONE_OR_MORE, OPTIONAL, PARSER, REMAINDER, SUPPRESS, ZERO_OR_MORE }).forEach(([ n, v ]) => { - Object.defineProperty(result, n, { - get() { - deprecate(n, sub('use argparse.%s instead of argparse.Const.%s', n, n)) - return v - } - }) - }) - Object.entries({ _UNRECOGNIZED_ARGS_ATTR }).forEach(([ n, v ]) => { - Object.defineProperty(result, n, { - get() { - deprecate(n, sub('argparse.Const.%s is an internal symbol and will no longer be available', n)) - return v - } - }) - }) - return result - }, - enumerable: false -}) -// end diff --git a/node_modules/argparse/lib/sub.js b/node_modules/argparse/lib/sub.js deleted file mode 100644 index e3eb321..0000000 --- a/node_modules/argparse/lib/sub.js +++ /dev/null @@ -1,67 +0,0 @@ -// Limited implementation of python % string operator, supports only %s and %r for now -// (other formats are not used here, but may appear in custom templates) - -'use strict' - -const { inspect } = require('util') - - -module.exports = function sub(pattern, ...values) { - let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g - - let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) { - if (is_literal) return '%' - - let padded_count = 0 - if (is_padded) { - if (values.length === 0) throw new TypeError('not enough arguments for format string') - padded_count = values.shift() - if (!Number.isInteger(padded_count)) throw new TypeError('* wants int') - } - - let str - if (name !== undefined) { - let dict = values[0] - if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping') - if (!(name in dict)) throw new TypeError(`no such key: '${name}'`) - str = dict[name] - } else { - if (values.length === 0) throw new TypeError('not enough arguments for format string') - str = values.shift() - } - - switch (format) { - case 's': - str = String(str) - break - case 'r': - str = inspect(str) - break - case 'd': - case 'i': - if (typeof str !== 'number') { - throw new TypeError(`%${format} format: a number is required, not ${typeof str}`) - } - str = String(str.toFixed(0)) - break - default: - throw new TypeError(`unsupported format character '${format}'`) - } - - if (padded_count > 0) { - return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count) - } else { - return str - } - }) - - if (values.length) { - if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) { - // mapping - } else { - throw new TypeError('not all arguments converted during string formatting') - } - } - - return result -} diff --git a/node_modules/argparse/lib/textwrap.js b/node_modules/argparse/lib/textwrap.js deleted file mode 100644 index 23d51cd..0000000 --- a/node_modules/argparse/lib/textwrap.js +++ /dev/null @@ -1,440 +0,0 @@ -// Partial port of python's argparse module, version 3.9.0 (only wrap and fill functions): -// https://github.com/python/cpython/blob/v3.9.0b4/Lib/textwrap.py - -'use strict' - -/* - * Text wrapping and filling. - */ - -// Copyright (C) 1999-2001 Gregory P. Ward. -// Copyright (C) 2002, 2003 Python Software Foundation. -// Copyright (C) 2020 argparse.js authors -// Originally written by Greg Ward - -// Hardcode the recognized whitespace characters to the US-ASCII -// whitespace characters. The main reason for doing this is that -// some Unicode spaces (like \u00a0) are non-breaking whitespaces. -// -// This less funky little regex just split on recognized spaces. E.g. -// "Hello there -- you goof-ball, use the -b option!" -// splits into -// Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/ -const wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/ - -class TextWrapper { - /* - * Object for wrapping/filling text. The public interface consists of - * the wrap() and fill() methods; the other methods are just there for - * subclasses to override in order to tweak the default behaviour. - * If you want to completely replace the main wrapping algorithm, - * you'll probably have to override _wrap_chunks(). - * - * Several instance attributes control various aspects of wrapping: - * width (default: 70) - * the maximum width of wrapped lines (unless break_long_words - * is false) - * initial_indent (default: "") - * string that will be prepended to the first line of wrapped - * output. Counts towards the line's width. - * subsequent_indent (default: "") - * string that will be prepended to all lines save the first - * of wrapped output; also counts towards each line's width. - * expand_tabs (default: true) - * Expand tabs in input text to spaces before further processing. - * Each tab will become 0 .. 'tabsize' spaces, depending on its position - * in its line. If false, each tab is treated as a single character. - * tabsize (default: 8) - * Expand tabs in input text to 0 .. 'tabsize' spaces, unless - * 'expand_tabs' is false. - * replace_whitespace (default: true) - * Replace all whitespace characters in the input text by spaces - * after tab expansion. Note that if expand_tabs is false and - * replace_whitespace is true, every tab will be converted to a - * single space! - * fix_sentence_endings (default: false) - * Ensure that sentence-ending punctuation is always followed - * by two spaces. Off by default because the algorithm is - * (unavoidably) imperfect. - * break_long_words (default: true) - * Break words longer than 'width'. If false, those words will not - * be broken, and some lines might be longer than 'width'. - * break_on_hyphens (default: true) - * Allow breaking hyphenated words. If true, wrapping will occur - * preferably on whitespaces and right after hyphens part of - * compound words. - * drop_whitespace (default: true) - * Drop leading and trailing whitespace from lines. - * max_lines (default: None) - * Truncate wrapped lines. - * placeholder (default: ' [...]') - * Append to the last line of truncated text. - */ - - constructor(options = {}) { - let { - width = 70, - initial_indent = '', - subsequent_indent = '', - expand_tabs = true, - replace_whitespace = true, - fix_sentence_endings = false, - break_long_words = true, - drop_whitespace = true, - break_on_hyphens = true, - tabsize = 8, - max_lines = undefined, - placeholder=' [...]' - } = options - - this.width = width - this.initial_indent = initial_indent - this.subsequent_indent = subsequent_indent - this.expand_tabs = expand_tabs - this.replace_whitespace = replace_whitespace - this.fix_sentence_endings = fix_sentence_endings - this.break_long_words = break_long_words - this.drop_whitespace = drop_whitespace - this.break_on_hyphens = break_on_hyphens - this.tabsize = tabsize - this.max_lines = max_lines - this.placeholder = placeholder - } - - - // -- Private methods ----------------------------------------------- - // (possibly useful for subclasses to override) - - _munge_whitespace(text) { - /* - * _munge_whitespace(text : string) -> string - * - * Munge whitespace in text: expand tabs and convert all other - * whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz" - * becomes " foo bar baz". - */ - if (this.expand_tabs) { - text = text.replace(/\t/g, ' '.repeat(this.tabsize)) // not strictly correct in js - } - if (this.replace_whitespace) { - text = text.replace(/[\t\n\x0b\x0c\r]/g, ' ') - } - return text - } - - _split(text) { - /* - * _split(text : string) -> [string] - * - * Split the text to wrap into indivisible chunks. Chunks are - * not quite the same as words; see _wrap_chunks() for full - * details. As an example, the text - * Look, goof-ball -- use the -b option! - * breaks into the following chunks: - * 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ', - * 'use', ' ', 'the', ' ', '-b', ' ', 'option!' - * if break_on_hyphens is True, or in: - * 'Look,', ' ', 'goof-ball', ' ', '--', ' ', - * 'use', ' ', 'the', ' ', '-b', ' ', option!' - * otherwise. - */ - let chunks = text.split(wordsep_simple_re) - chunks = chunks.filter(Boolean) - return chunks - } - - _handle_long_word(reversed_chunks, cur_line, cur_len, width) { - /* - * _handle_long_word(chunks : [string], - * cur_line : [string], - * cur_len : int, width : int) - * - * Handle a chunk of text (most likely a word, not whitespace) that - * is too long to fit in any line. - */ - // Figure out when indent is larger than the specified width, and make - // sure at least one character is stripped off on every pass - let space_left - if (width < 1) { - space_left = 1 - } else { - space_left = width - cur_len - } - - // If we're allowed to break long words, then do so: put as much - // of the next chunk onto the current line as will fit. - if (this.break_long_words) { - cur_line.push(reversed_chunks[reversed_chunks.length - 1].slice(0, space_left)) - reversed_chunks[reversed_chunks.length - 1] = reversed_chunks[reversed_chunks.length - 1].slice(space_left) - - // Otherwise, we have to preserve the long word intact. Only add - // it to the current line if there's nothing already there -- - // that minimizes how much we violate the width constraint. - } else if (!cur_line) { - cur_line.push(...reversed_chunks.pop()) - } - - // If we're not allowed to break long words, and there's already - // text on the current line, do nothing. Next time through the - // main loop of _wrap_chunks(), we'll wind up here again, but - // cur_len will be zero, so the next line will be entirely - // devoted to the long word that we can't handle right now. - } - - _wrap_chunks(chunks) { - /* - * _wrap_chunks(chunks : [string]) -> [string] - * - * Wrap a sequence of text chunks and return a list of lines of - * length 'self.width' or less. (If 'break_long_words' is false, - * some lines may be longer than this.) Chunks correspond roughly - * to words and the whitespace between them: each chunk is - * indivisible (modulo 'break_long_words'), but a line break can - * come between any two chunks. Chunks should not have internal - * whitespace; ie. a chunk is either all whitespace or a "word". - * Whitespace chunks will be removed from the beginning and end of - * lines, but apart from that whitespace is preserved. - */ - let lines = [] - let indent - if (this.width <= 0) { - throw Error(`invalid width ${this.width} (must be > 0)`) - } - if (this.max_lines !== undefined) { - if (this.max_lines > 1) { - indent = this.subsequent_indent - } else { - indent = this.initial_indent - } - if (indent.length + this.placeholder.trimStart().length > this.width) { - throw Error('placeholder too large for max width') - } - } - - // Arrange in reverse order so items can be efficiently popped - // from a stack of chucks. - chunks = chunks.reverse() - - while (chunks.length > 0) { - - // Start the list of chunks that will make up the current line. - // cur_len is just the length of all the chunks in cur_line. - let cur_line = [] - let cur_len = 0 - - // Figure out which static string will prefix this line. - let indent - if (lines) { - indent = this.subsequent_indent - } else { - indent = this.initial_indent - } - - // Maximum width for this line. - let width = this.width - indent.length - - // First chunk on line is whitespace -- drop it, unless this - // is the very beginning of the text (ie. no lines started yet). - if (this.drop_whitespace && chunks[chunks.length - 1].trim() === '' && lines.length > 0) { - chunks.pop() - } - - while (chunks.length > 0) { - let l = chunks[chunks.length - 1].length - - // Can at least squeeze this chunk onto the current line. - if (cur_len + l <= width) { - cur_line.push(chunks.pop()) - cur_len += l - - // Nope, this line is full. - } else { - break - } - } - - // The current line is full, and the next chunk is too big to - // fit on *any* line (not just this one). - if (chunks.length && chunks[chunks.length - 1].length > width) { - this._handle_long_word(chunks, cur_line, cur_len, width) - cur_len = cur_line.map(l => l.length).reduce((a, b) => a + b, 0) - } - - // If the last chunk on this line is all whitespace, drop it. - if (this.drop_whitespace && cur_line.length > 0 && cur_line[cur_line.length - 1].trim() === '') { - cur_len -= cur_line[cur_line.length - 1].length - cur_line.pop() - } - - if (cur_line) { - if (this.max_lines === undefined || - lines.length + 1 < this.max_lines || - (chunks.length === 0 || - this.drop_whitespace && - chunks.length === 1 && - !chunks[0].trim()) && cur_len <= width) { - // Convert current line back to a string and store it in - // list of all lines (return value). - lines.push(indent + cur_line.join('')) - } else { - let had_break = false - while (cur_line) { - if (cur_line[cur_line.length - 1].trim() && - cur_len + this.placeholder.length <= width) { - cur_line.push(this.placeholder) - lines.push(indent + cur_line.join('')) - had_break = true - break - } - cur_len -= cur_line[-1].length - cur_line.pop() - } - if (!had_break) { - if (lines) { - let prev_line = lines[lines.length - 1].trimEnd() - if (prev_line.length + this.placeholder.length <= - this.width) { - lines[lines.length - 1] = prev_line + this.placeholder - break - } - } - lines.push(indent + this.placeholder.lstrip()) - } - break - } - } - } - - return lines - } - - _split_chunks(text) { - text = this._munge_whitespace(text) - return this._split(text) - } - - // -- Public interface ---------------------------------------------- - - wrap(text) { - /* - * wrap(text : string) -> [string] - * - * Reformat the single paragraph in 'text' so it fits in lines of - * no more than 'self.width' columns, and return a list of wrapped - * lines. Tabs in 'text' are expanded with string.expandtabs(), - * and all other whitespace characters (including newline) are - * converted to space. - */ - let chunks = this._split_chunks(text) - // not implemented in js - //if (this.fix_sentence_endings) { - // this._fix_sentence_endings(chunks) - //} - return this._wrap_chunks(chunks) - } - - fill(text) { - /* - * fill(text : string) -> string - * - * Reformat the single paragraph in 'text' to fit in lines of no - * more than 'self.width' columns, and return a new string - * containing the entire wrapped paragraph. - */ - return this.wrap(text).join('\n') - } -} - - -// -- Convenience interface --------------------------------------------- - -function wrap(text, options = {}) { - /* - * Wrap a single paragraph of text, returning a list of wrapped lines. - * - * Reformat the single paragraph in 'text' so it fits in lines of no - * more than 'width' columns, and return a list of wrapped lines. By - * default, tabs in 'text' are expanded with string.expandtabs(), and - * all other whitespace characters (including newline) are converted to - * space. See TextWrapper class for available keyword args to customize - * wrapping behaviour. - */ - let { width = 70, ...kwargs } = options - let w = new TextWrapper(Object.assign({ width }, kwargs)) - return w.wrap(text) -} - -function fill(text, options = {}) { - /* - * Fill a single paragraph of text, returning a new string. - * - * Reformat the single paragraph in 'text' to fit in lines of no more - * than 'width' columns, and return a new string containing the entire - * wrapped paragraph. As with wrap(), tabs are expanded and other - * whitespace characters converted to space. See TextWrapper class for - * available keyword args to customize wrapping behaviour. - */ - let { width = 70, ...kwargs } = options - let w = new TextWrapper(Object.assign({ width }, kwargs)) - return w.fill(text) -} - -// -- Loosely related functionality ------------------------------------- - -let _whitespace_only_re = /^[ \t]+$/mg -let _leading_whitespace_re = /(^[ \t]*)(?:[^ \t\n])/mg - -function dedent(text) { - /* - * Remove any common leading whitespace from every line in `text`. - * - * This can be used to make triple-quoted strings line up with the left - * edge of the display, while still presenting them in the source code - * in indented form. - * - * Note that tabs and spaces are both treated as whitespace, but they - * are not equal: the lines " hello" and "\\thello" are - * considered to have no common leading whitespace. - * - * Entirely blank lines are normalized to a newline character. - */ - // Look for the longest leading string of spaces and tabs common to - // all lines. - let margin = undefined - text = text.replace(_whitespace_only_re, '') - let indents = text.match(_leading_whitespace_re) || [] - for (let indent of indents) { - indent = indent.slice(0, -1) - - if (margin === undefined) { - margin = indent - - // Current line more deeply indented than previous winner: - // no change (previous winner is still on top). - } else if (indent.startsWith(margin)) { - // pass - - // Current line consistent with and no deeper than previous winner: - // it's the new winner. - } else if (margin.startsWith(indent)) { - margin = indent - - // Find the largest common whitespace between current line and previous - // winner. - } else { - for (let i = 0; i < margin.length && i < indent.length; i++) { - if (margin[i] !== indent[i]) { - margin = margin.slice(0, i) - break - } - } - } - } - - if (margin) { - text = text.replace(new RegExp('^' + margin, 'mg'), '') - } - return text -} - -module.exports = { wrap, fill, dedent } diff --git a/node_modules/argparse/package.json b/node_modules/argparse/package.json deleted file mode 100644 index 647d2af..0000000 --- a/node_modules/argparse/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "argparse", - "description": "CLI arguments parser. Native port of python's argparse.", - "version": "2.0.1", - "keywords": [ - "cli", - "parser", - "argparse", - "option", - "args" - ], - "main": "argparse.js", - "files": [ - "argparse.js", - "lib/" - ], - "license": "Python-2.0", - "repository": "nodeca/argparse", - "scripts": { - "lint": "eslint .", - "test": "npm run lint && nyc mocha", - "coverage": "npm run test && nyc report --reporter html" - }, - "devDependencies": { - "@babel/eslint-parser": "^7.11.0", - "@babel/plugin-syntax-class-properties": "^7.10.4", - "eslint": "^7.5.0", - "mocha": "^8.0.1", - "nyc": "^15.1.0" - } -} diff --git a/node_modules/arr-diff/LICENSE b/node_modules/arr-diff/LICENSE deleted file mode 100755 index d734237..0000000 --- a/node_modules/arr-diff/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/arr-diff/README.md b/node_modules/arr-diff/README.md deleted file mode 100644 index 961f5c3..0000000 --- a/node_modules/arr-diff/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# arr-diff [![NPM version](https://img.shields.io/npm/v/arr-diff.svg?style=flat)](https://www.npmjs.com/package/arr-diff) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-diff.svg?style=flat)](https://npmjs.org/package/arr-diff) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-diff.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-diff) - -> Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save arr-diff -``` - -Install with [yarn](https://yarnpkg.com): - -```sh -$ yarn add arr-diff -``` - -Install with [bower](https://bower.io/) - -```sh -$ bower install arr-diff --save -``` - -## Usage - -Returns the difference between the first array and additional arrays. - -```js -var diff = require('arr-diff'); - -var a = ['a', 'b', 'c', 'd']; -var b = ['b', 'c']; - -console.log(diff(a, b)) -//=> ['a', 'd'] -``` - -## Benchmarks - -This library versus [array-differ](https://github.com/sindresorhus/array-differ), on April 14, 2017: - -``` -Benchmarking: (4 of 4) - · long-dupes - · long - · med - · short - -# benchmark/fixtures/long-dupes.js (100804 bytes) - arr-diff-3.0.0 x 822 ops/sec ±0.67% (86 runs sampled) - arr-diff-4.0.0 x 2,141 ops/sec ±0.42% (89 runs sampled) - array-differ x 708 ops/sec ±0.70% (89 runs sampled) - - fastest is arr-diff-4.0.0 - -# benchmark/fixtures/long.js (94529 bytes) - arr-diff-3.0.0 x 882 ops/sec ±0.60% (87 runs sampled) - arr-diff-4.0.0 x 2,329 ops/sec ±0.97% (83 runs sampled) - array-differ x 769 ops/sec ±0.61% (90 runs sampled) - - fastest is arr-diff-4.0.0 - -# benchmark/fixtures/med.js (708 bytes) - arr-diff-3.0.0 x 856,150 ops/sec ±0.42% (89 runs sampled) - arr-diff-4.0.0 x 4,665,249 ops/sec ±1.06% (89 runs sampled) - array-differ x 653,888 ops/sec ±1.02% (86 runs sampled) - - fastest is arr-diff-4.0.0 - -# benchmark/fixtures/short.js (60 bytes) - arr-diff-3.0.0 x 3,078,467 ops/sec ±0.77% (93 runs sampled) - arr-diff-4.0.0 x 9,213,296 ops/sec ±0.65% (89 runs sampled) - array-differ x 1,337,051 ops/sec ±0.91% (92 runs sampled) - - fastest is arr-diff-4.0.0 -``` - -## About - -### Related projects - -* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") -* [array-filter](https://www.npmjs.com/package/array-filter): Array#filter for older browsers. | [homepage](https://github.com/juliangruber/array-filter "Array#filter for older browsers.") -* [array-intersection](https://www.npmjs.com/package/array-intersection): Return an array with the unique values present in _all_ given arrays using strict equality… [more](https://github.com/jonschlinkert/array-intersection) | [homepage](https://github.com/jonschlinkert/array-intersection "Return an array with the unique values present in _all_ given arrays using strict equality for comparisons.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 33 | [jonschlinkert](https://github.com/jonschlinkert) | -| 2 | [paulmillr](https://github.com/paulmillr) | - -### 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.5.0, on April 14, 2017._ \ No newline at end of file diff --git a/node_modules/arr-diff/index.js b/node_modules/arr-diff/index.js deleted file mode 100644 index 90f2807..0000000 --- a/node_modules/arr-diff/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * arr-diff - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -module.exports = function diff(arr/*, arrays*/) { - var len = arguments.length; - var idx = 0; - while (++idx < len) { - arr = diffArray(arr, arguments[idx]); - } - return arr; -}; - -function diffArray(one, two) { - if (!Array.isArray(two)) { - return one.slice(); - } - - var tlen = two.length - var olen = one.length; - var idx = -1; - var arr = []; - - while (++idx < olen) { - var ele = one[idx]; - - var hasEle = false; - for (var i = 0; i < tlen; i++) { - var val = two[i]; - - if (ele === val) { - hasEle = true; - break; - } - } - - if (hasEle === false) { - arr.push(ele); - } - } - return arr; -} diff --git a/node_modules/arr-diff/package.json b/node_modules/arr-diff/package.json deleted file mode 100644 index c106813..0000000 --- a/node_modules/arr-diff/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "arr-diff", - "description": "Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.", - "version": "4.0.0", - "homepage": "https://github.com/jonschlinkert/arr-diff", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Paul Miller (paulmillr.com)" - ], - "repository": "jonschlinkert/arr-diff", - "bugs": { - "url": "https://github.com/jonschlinkert/arr-diff/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": {}, - "devDependencies": { - "ansi-bold": "^0.1.1", - "arr-flatten": "^1.0.1", - "array-differ": "^1.0.0", - "benchmarked": "^0.2.4", - "gulp-format-md": "^0.1.9", - "minimist": "^1.2.0", - "mocha": "^2.4.5" - }, - "keywords": [ - "arr", - "array", - "array differ", - "array-differ", - "diff", - "differ", - "difference" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "arr-flatten", - "array-filter", - "array-intersection" - ] - }, - "reflinks": [ - "array-differ", - "verb" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/arr-union/LICENSE b/node_modules/arr-union/LICENSE deleted file mode 100644 index 39245ac..0000000 --- a/node_modules/arr-union/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/arr-union/README.md b/node_modules/arr-union/README.md deleted file mode 100644 index b3cd4f4..0000000 --- a/node_modules/arr-union/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# arr-union [![NPM version](https://img.shields.io/npm/v/arr-union.svg)](https://www.npmjs.com/package/arr-union) [![Build Status](https://img.shields.io/travis/jonschlinkert/arr-union.svg)](https://travis-ci.org/jonschlinkert/arr-union) - -> Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm i arr-union --save -``` - -## Benchmarks - -This library is **10-20 times faster** and more performant than [array-union](https://github.com/sindresorhus/array-union). - -See the [benchmarks](./benchmark). - -```sh -#1: five-arrays - array-union x 511,121 ops/sec ±0.80% (96 runs sampled) - arr-union x 5,716,039 ops/sec ±0.86% (93 runs sampled) - -#2: ten-arrays - array-union x 245,196 ops/sec ±0.69% (94 runs sampled) - arr-union x 1,850,786 ops/sec ±0.84% (97 runs sampled) - -#3: two-arrays - array-union x 563,869 ops/sec ±0.97% (94 runs sampled) - arr-union x 9,602,852 ops/sec ±0.87% (92 runs sampled) -``` - -## Usage - -```js -var union = require('arr-union'); - -union(['a'], ['b', 'c'], ['d', 'e', 'f']); -//=> ['a', 'b', 'c', 'd', 'e', 'f'] -``` - -Returns only unique elements: - -```js -union(['a', 'a'], ['b', 'c']); -//=> ['a', 'b', 'c'] -``` - -## Related projects - -* [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://www.npmjs.com/package/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff) -* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter) -* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) -* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map) -* [arr-pluck](https://www.npmjs.com/package/arr-pluck): Retrieves the value of a specified property from all elements in the collection. | [homepage](https://github.com/jonschlinkert/arr-pluck) -* [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce) -* [array-unique](https://www.npmjs.com/package/array-unique): Return an array free of duplicate values. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique) - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-union/issues/new). - -## Building docs - -Generate readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm i verb && npm run docs -``` - -Or, if [verb](https://github.com/verbose/verb) is installed globally: - -```sh -$ verb -``` - -## Running tests - -Install dev dependencies: - -```sh -$ npm i -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/arr-union/blob/master/LICENSE). - -*** - -_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 23, 2016._ \ No newline at end of file diff --git a/node_modules/arr-union/index.js b/node_modules/arr-union/index.js deleted file mode 100644 index 5ae6c4a..0000000 --- a/node_modules/arr-union/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -module.exports = function union(init) { - if (!Array.isArray(init)) { - throw new TypeError('arr-union expects the first argument to be an array.'); - } - - var len = arguments.length; - var i = 0; - - while (++i < len) { - var arg = arguments[i]; - if (!arg) continue; - - if (!Array.isArray(arg)) { - arg = [arg]; - } - - for (var j = 0; j < arg.length; j++) { - var ele = arg[j]; - - if (init.indexOf(ele) >= 0) { - continue; - } - init.push(ele); - } - } - return init; -}; diff --git a/node_modules/arr-union/package.json b/node_modules/arr-union/package.json deleted file mode 100644 index 5ee87fd..0000000 --- a/node_modules/arr-union/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "arr-union", - "description": "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.", - "version": "3.1.0", - "homepage": "https://github.com/jonschlinkert/arr-union", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/arr-union", - "bugs": { - "url": "https://github.com/jonschlinkert/arr-union/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "ansi-bold": "^0.1.1", - "array-union": "^1.0.1", - "array-unique": "^0.2.1", - "benchmarked": "^0.1.4", - "gulp-format-md": "^0.1.7", - "minimist": "^1.1.1", - "mocha": "*", - "should": "*" - }, - "keywords": [ - "add", - "append", - "array", - "arrays", - "combine", - "concat", - "extend", - "union", - "uniq", - "unique", - "util", - "utility", - "utils" - ], - "verb": { - "run": true, - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "arr-diff", - "arr-flatten", - "arr-filter", - "arr-map", - "arr-pluck", - "arr-reduce", - "array-unique" - ] - }, - "reflinks": [ - "verb", - "array-union" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/array-each/LICENSE b/node_modules/array-each/LICENSE deleted file mode 100644 index ec85897..0000000 --- a/node_modules/array-each/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015, 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/array-each/README.md b/node_modules/array-each/README.md deleted file mode 100644 index e8602a1..0000000 --- a/node_modules/array-each/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# array-each [![NPM version](https://img.shields.io/npm/v/array-each.svg?style=flat)](https://www.npmjs.com/package/array-each) [![NPM monthly downloads](https://img.shields.io/npm/dm/array-each.svg?style=flat)](https://npmjs.org/package/array-each) [![NPM total downloads](https://img.shields.io/npm/dt/array-each.svg?style=flat)](https://npmjs.org/package/array-each) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/array-each.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/array-each) - -> Loop over each item in an array and call the given function on every element. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save array-each -``` - -## Usage - -### [each](index.js#L34) - -Loop over each item in an array and call the given function on every element. - -**Params** - -* `array` **{Array}** -* `fn` **{Function}** -* `thisArg` **{Object}**: (optional) pass a `thisArg` to be used as the context in which to call the function. -* `returns` **{undefined}** - -**Example** - -```js -each(['a', 'b', 'c'], function(ele) { - return ele + ele; -}); -//=> ['aa', 'bb', 'cc'] - -each(['a', 'b', 'c'], function(ele, i) { - return i + ele; -}); -//=> ['0a', '1b', '2c'] -``` - -## About - -### Related projects - -* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.") -* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map "Faster, node.js focused alternative to JavaScript's native array map.") -* [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map "Returns an array of mapped values from an array or object.") - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### 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.4.2, on February 26, 2017._ \ No newline at end of file diff --git a/node_modules/array-each/index.js b/node_modules/array-each/index.js deleted file mode 100644 index 12afef4..0000000 --- a/node_modules/array-each/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/*! - * array-each - * - * Copyright (c) 2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -/** - * Loop over each item in an array and call the given function on every element. - * - * ```js - * each(['a', 'b', 'c'], function(ele) { - * return ele + ele; - * }); - * //=> ['aa', 'bb', 'cc'] - * - * each(['a', 'b', 'c'], function(ele, i) { - * return i + ele; - * }); - * //=> ['0a', '1b', '2c'] - * ``` - * - * @name each - * @alias forEach - * @param {Array} `array` - * @param {Function} `fn` - * @param {Object} `thisArg` (optional) pass a `thisArg` to be used as the context in which to call the function. - * @return {undefined} - * @api public - */ - -module.exports = function each(arr, cb, thisArg) { - if (arr == null) return; - - var len = arr.length; - var idx = -1; - - while (++idx < len) { - var ele = arr[idx]; - if (cb.call(thisArg, ele, idx, arr) === false) { - break; - } - } -}; diff --git a/node_modules/array-each/package.json b/node_modules/array-each/package.json deleted file mode 100644 index 212fb80..0000000 --- a/node_modules/array-each/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "array-each", - "description": "Loop over each item in an array and call the given function on every element.", - "version": "1.0.1", - "homepage": "https://github.com/jonschlinkert/array-each", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/array-each", - "bugs": { - "url": "https://github.com/jonschlinkert/array-each/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^0.1.11", - "mocha": "^3.2.0" - }, - "keywords": [ - "array", - "each" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "collection-map", - "arr-filter", - "arr-map" - ] - }, - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/array-slice/LICENSE b/node_modules/array-slice/LICENSE deleted file mode 100755 index 3f2eca1..0000000 --- a/node_modules/array-slice/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/array-slice/README.md b/node_modules/array-slice/README.md deleted file mode 100755 index e175ca0..0000000 --- a/node_modules/array-slice/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# array-slice [![NPM version](https://img.shields.io/npm/v/array-slice.svg?style=flat)](https://www.npmjs.com/package/array-slice) [![NPM monthly downloads](https://img.shields.io/npm/dm/array-slice.svg?style=flat)](https://npmjs.org/package/array-slice) [![NPM total downloads](https://img.shields.io/npm/dt/array-slice.svg?style=flat)](https://npmjs.org/package/array-slice) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/array-slice.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/array-slice) - -> Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index. - -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 array-slice -``` - -This function is used instead of `Array#slice` to support node lists in IE < 9 and to ensure dense arrays are returned. This is also faster than native slice in some cases. - -## Usage - -```js -var slice = require('array-slice'); -var arr = ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j']; - -slice(arr, 3, 6); -//=> ['e', 'f', 'g'] -``` - -## 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: - -* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays.") -* [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.") -* [array-xor](https://www.npmjs.com/package/array-xor): Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in… [more](https://github.com/jonschlinkert/array-xor) | [homepage](https://github.com/jonschlinkert/array-xor "Returns the symmetric difference (exclusive-or) of an array of elements (elements that are present in all given arrays and not in their intersections).") - -### 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 November 30, 2017._ \ No newline at end of file diff --git a/node_modules/array-slice/index.js b/node_modules/array-slice/index.js deleted file mode 100644 index 15cdb77..0000000 --- a/node_modules/array-slice/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/*! - * array-slice - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -module.exports = function slice(arr, start, end) { - var len = arr.length; - var range = []; - - start = idx(len, start); - end = idx(len, end, len); - - while (start < end) { - range.push(arr[start++]); - } - return range; -}; - -function idx(len, pos, end) { - if (pos == null) { - pos = end || 0; - } else if (pos < 0) { - pos = Math.max(len + pos, 0); - } else { - pos = Math.min(pos, len); - } - - return pos; -} diff --git a/node_modules/array-slice/package.json b/node_modules/array-slice/package.json deleted file mode 100644 index 7fedf0c..0000000 --- a/node_modules/array-slice/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "array-slice", - "description": "Array-slice method. Slices `array` from the `start` index up to, but not including, the `end` index.", - "version": "1.1.0", - "homepage": "https://github.com/jonschlinkert/array-slice", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/array-slice", - "bugs": { - "url": "https://github.com/jonschlinkert/array-slice/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^1.0.0", - "mocha": "^3.5.3" - }, - "keywords": [ - "array", - "javascript", - "js", - "slice", - "util", - "utils" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "arr-flatten", - "array-unique", - "array-xor" - ] - }, - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/assign-symbols/LICENSE b/node_modules/assign-symbols/LICENSE deleted file mode 100644 index 65f90ac..0000000 --- a/node_modules/assign-symbols/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015, 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/assign-symbols/README.md b/node_modules/assign-symbols/README.md deleted file mode 100644 index 422729d..0000000 --- a/node_modules/assign-symbols/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# assign-symbols [![NPM version](https://badge.fury.io/js/assign-symbols.svg)](http://badge.fury.io/js/assign-symbols) - -> Assign the enumerable es6 Symbol properties from an object (or objects) to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method. - -From the [Mozilla Developer docs for Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol): - -> A symbol is a unique and immutable data type and may be used as an identifier for object properties. The symbol object is an implicit object wrapper for the symbol primitive data type. - -## Install - -Install with [npm](https://www.npmjs.com/) - -```sh -$ npm i assign-symbols --save -``` - -## Usage - -```js -var assignSymbols = require('assign-symbols'); -var obj = {}; - -var one = {}; -var symbolOne = Symbol('aaa'); -one[symbolOne] = 'bbb'; - -var two = {}; -var symbolTwo = Symbol('ccc'); -two[symbolTwo] = 'ddd'; - -assignSymbols(obj, one, two); - -console.log(obj[symbolOne]); -//=> 'bbb' -console.log(obj[symbolTwo]); -//=> 'ddd' -``` - -## Similar projects - -* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. | [homepage](https://github.com/jonschlinkert/assign-deep) -* [clone-deep](https://www.npmjs.com/package/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. | [homepage](https://github.com/jonschlinkert/clone-deep) -* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow) -* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) -* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep) - -## Running tests - -Install dev dependencies: - -```sh -$ npm i -d && npm test -``` - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/assign-symbols/issues/new). - -## Author - -**Jon Schlinkert** - -+ [github/jonschlinkert](https://github.com/jonschlinkert) -+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -## License - -Copyright © 2015 Jon Schlinkert -Released under the MIT license. - -*** - -_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 06, 2015._ \ No newline at end of file diff --git a/node_modules/assign-symbols/index.js b/node_modules/assign-symbols/index.js deleted file mode 100644 index c08a232..0000000 --- a/node_modules/assign-symbols/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/*! - * assign-symbols - * - * Copyright (c) 2015, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -module.exports = function(receiver, objects) { - if (receiver === null || typeof receiver === 'undefined') { - throw new TypeError('expected first argument to be an object.'); - } - - if (typeof objects === 'undefined' || typeof Symbol === 'undefined') { - return receiver; - } - - if (typeof Object.getOwnPropertySymbols !== 'function') { - return receiver; - } - - var isEnumerable = Object.prototype.propertyIsEnumerable; - var target = Object(receiver); - var len = arguments.length, i = 0; - - while (++i < len) { - var provider = Object(arguments[i]); - var names = Object.getOwnPropertySymbols(provider); - - for (var j = 0; j < names.length; j++) { - var key = names[j]; - - if (isEnumerable.call(provider, key)) { - target[key] = provider[key]; - } - } - } - return target; -}; diff --git a/node_modules/assign-symbols/package.json b/node_modules/assign-symbols/package.json deleted file mode 100644 index 7f77b58..0000000 --- a/node_modules/assign-symbols/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "assign-symbols", - "description": "Assign the enumerable es6 Symbol properties from an object (or objects) to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method.", - "version": "1.0.0", - "homepage": "https://github.com/jonschlinkert/assign-symbols", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/assign-symbols", - "bugs": { - "url": "https://github.com/jonschlinkert/assign-symbols/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "mocha": "^3.0.0" - }, - "keywords": [ - "assign", - "symbols" - ], - "verb": { - "related": { - "list": [ - "assign-deep", - "mixin-deep", - "merge-deep", - "extend-shallow", - "clone-deep" - ] - } - } -} diff --git a/node_modules/async-done/LICENSE b/node_modules/async-done/LICENSE deleted file mode 100644 index 976e4a8..0000000 --- a/node_modules/async-done/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2019, 2021 Blaine Bublitz and Eric Schoffstall - -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/async-done/README.md b/node_modules/async-done/README.md deleted file mode 100644 index 6ab8df8..0000000 --- a/node_modules/async-done/README.md +++ /dev/null @@ -1,122 +0,0 @@ -

- - - -

- -# async-done - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Allows libraries to handle various caller provided asynchronous functions uniformly. Maps promises, observables, child processes and streams, and callbacks to callback style. - -As async conventions evolve, it is useful to be able to deal with several different _styles_ of async completion uniformly. With this module you can handle completion using a node-style callback, regardless of a return value that's a promise, observable, child process or stream. - -## Usage - -### Successful completion - -```js -var asyncDone = require('async-done'); - -asyncDone( - function (done) { - // do async things - done(null, 2); - }, - function (error, result) { - // `error` will be null on successful execution of the first function. - // `result` will be the result from the first function. - } -); -``` - -### Failed completion - -```js -var asyncDone = require('async-done'); - -asyncDone( - function (done) { - // do async things - done(new Error('Some Error Occurred')); - }, - function (error, result) { - // `error` will be an error from the first function. - // `result` will be undefined on failed execution of the first function. - } -); -``` - -## API - -### `asyncDone(fn, callback)` - -Takes a function to execute (`fn`) and a function to call on completion (`callback`). - -#### `fn([done])` - -Optionally takes a callback to call when async tasks are complete. - -#### Completion and Error Resolution - -- `Callback` (`done`) called - - Completion: called with null error - - Error: called with non-null error -- `Stream` or `EventEmitter` returned - - Completion: [end-of-stream][end-of-stream] module - - Error: [domains][domains] - - **Note:** Only actual streams are supported, not faux-streams; Therefore, modules like [`event-stream`][event-stream] are not supported. -- `Child Process` returned - - Completion [end-of-stream][end-of-stream] module - - Error: [domains][domains] -- `Promise` returned - - Completion: [onFulfilled][promise-onfulfilled] method called - - Error: [onRejected][promise-onrejected] method called -- `Observable` (e.g. from [RxJS v5][rxjs5-observable] or [RxJS v4][rxjs4-observable]) returned - - Completion: [complete][rxjs5-observer-complete] method called - - Error: [error][rxjs5-observer-error] method called - -**Warning:** Sync tasks are **not supported** and your function will never complete if the one of the above strategies is not used to signal completion. However, thrown errors will be caught by the domain. - -#### `callback(error, result)` - -If an error doesn't occur in the execution of the `fn` function, the `callback` method will receive the results as its second argument. Note: Some streams don't received any results. - -If an error occurred in the execution of the `fn` function, The `callback` method will receive an error as its first argument. - -Errors can be caused by: - -- A thrown error -- An error passed to a `done` callback -- An `error` event emitted on a returned `Stream`, `EventEmitter` or `Child Process` -- A rejection of a returned `Promise` - If the `Promise` is not rejected with a value, we generate a new `Error` -- The `onError` handler being called on an `Observable` - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/async-done.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/async-done -[npm-image]: https://img.shields.io/npm/v/async-done.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/async-done/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/async-done/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/async-done -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/async-done/master.svg?style=flat-square - - - -[end-of-stream]: https://www.npmjs.com/package/end-of-stream -[domains]: http://nodejs.org/api/domain.html -[event-stream]: https://github.com/dominictarr/event-stream -[promise-onfulfilled]: http://promisesaplus.com/#point-26 -[promise-onrejected]: http://promisesaplus.com/#point-30 -[rxjs4-observable]: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/observable.md -[rxjs5-observable]: http://reactivex.io/rxjs/class/es6/Observable.js~Observable.html -[rxjs5-observer-complete]: http://reactivex.io/rxjs/class/es6/MiscJSDoc.js~ObserverDoc.html#instance-method-complete -[rxjs5-observer-error]: http://reactivex.io/rxjs/class/es6/MiscJSDoc.js~ObserverDoc.html#instance-method-error - diff --git a/node_modules/async-done/index.d.ts b/node_modules/async-done/index.d.ts deleted file mode 100644 index 195c97a..0000000 --- a/node_modules/async-done/index.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Notes about these type definitions: - * - * - Callbacks returning multiple completion values using multiple arguments are not supported by these types. - * Prefer to use Node's style by grouping your values in a single object or array. - * Support for this kind of callback is blocked by Microsoft/TypeScript#5453 - * - * - For ease of use, `asyncDone` lets you pass callback functions with a result type `T` instead of `T | undefined`. - * This matches Node's types but can lead to unsound code being typechecked. - * - * The following code typechecks but fails at runtime: - * ```typescript - * async function getString(): Promise { - * return "Hello, World!"; - * } - * - * async function evilGetString(): Promise { - * throw new Error("Hello, World!"); - * } - * - * function cb(err: Error | null, result: string): void { - * // This is unsound because `result` is `undefined` when `err` is not `null`. - * console.log(result.toLowerCase()); - * } - * - * asyncDone(getString, cb); // Prints `hello, world!` - * asyncDone(evilGetString, cb); // Runtime error: `TypeError: Cannot read property 'toLowerCase' of undefined` - * ``` - * - * Enforcing stricter callbacks would require developers to use `result?: string` and assert the existence - * of the result either by checking it directly or using the `!` assertion operator after testing for errors. - * ```typescript - * function stricterCb1(err: Error | null, result?: string): void { - * if (err !== null) { - * console.error(err); - * return; - * } - * console.log(result!.toLowerCase()); - * } - * - * function stricterCb2(err: Error | null, result?: string): void { - * if (result === undefined) { - * console.error("Undefined result. Error:); - * console.error(err); - * return; - * } - * console.log(result.toLowerCase()); - * } - * ``` - */ -import { ChildProcess } from 'child_process'; -import { EventEmitter } from 'events'; -import { Stream } from 'stream'; - -declare namespace asyncDone { - /** - * Represents a callback function used to signal the completion of a - * task without any result value. - */ - type VoidCallback = (err: Error | null | void) => void; - - /** - * Represents a callback function used to signal the completion of a - * task with a single result value. - */ - interface Callback { - (err: null, result: T): void; - - // Use `result?: T` or `result: undefined` to require the consumer to assert the existence of the result - // (even in case of success). See comment at the top of the file. - (err: Error, result?: any): void; - } - - /** - * Minimal `Observable` interface compatible with `async-done`. - * - * @see https://github.com/ReactiveX/rxjs/blob/c3c56867eaf93f302ac7cd588034c7d8712f2834/src/internal/Observable.ts#L77 - */ - interface Observable { - subscribe( - next?: (value: T) => void, - error?: (error: any) => void, - complete?: () => void - ): any; - } - - /** - * Represents an async operation. - */ - export type AsyncTask = - | ((done: VoidCallback) => void) - | ((done: Callback) => void) - | (() => - | ChildProcess - | EventEmitter - | Observable - | PromiseLike - | Stream); -} - -/** - * Takes a function to execute (`fn`) and a function to call on completion (`callback`). - * - * @param fn Function to execute. - * @param callback Function to call on completion. - */ -declare function asyncDone( - fn: asyncDone.AsyncTask, - callback: asyncDone.Callback -): void; - -export = asyncDone; diff --git a/node_modules/async-done/index.js b/node_modules/async-done/index.js deleted file mode 100644 index d835622..0000000 --- a/node_modules/async-done/index.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; - -var domain = require('domain'); - -var eos = require('end-of-stream'); -var once = require('once'); -var exhaust = require('stream-exhaust'); - -var eosConfig = {}; - -function rethrowAsync(err) { - process.nextTick(rethrow); - - function rethrow() { - throw err; - } -} - -function tryCatch(fn, args) { - try { - return fn.apply(null, args); - } catch (err) { - rethrowAsync(err); - } -} - -function asyncDone(fn, cb) { - cb = once(cb); - - var d = domain.create(); - d.once('error', onError); - var domainBoundFn = d.bind(fn); - - function done() { - d.removeListener('error', onError); - d.exit(); - return tryCatch(cb, arguments); - } - - function onSuccess(result) { - done(null, result); - } - - function onError(error) { - if (!error) { - error = new Error('Promise rejected without Error'); - } - done(error); - } - - function asyncRunner() { - var result = domainBoundFn(done); - - function onNext(state) { - onNext.state = state; - } - - function onCompleted() { - onSuccess(onNext.state); - } - - if (result && typeof result.on === 'function') { - // Assume node stream - d.add(result); - eos(exhaust(result), eosConfig, done); - return; - } - - if (result && typeof result.subscribe === 'function') { - // Assume RxJS observable - result.subscribe(onNext, onError, onCompleted); - return; - } - - if (result && typeof result.then === 'function') { - // Assume promise - result.then(onSuccess, onError); - return; - } - } - - process.nextTick(asyncRunner); -} - -module.exports = asyncDone; diff --git a/node_modules/async-done/package.json b/node_modules/async-done/package.json deleted file mode 100644 index 5f20a97..0000000 --- a/node_modules/async-done/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "async-done", - "version": "2.0.0", - "description": "Allows libraries to handle various caller provided asynchronous functions uniformly. Maps promises, observables, child processes and streams, and callbacks to callback style.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz ", - "Pawel Kozlowski ", - "Matthew Podwysocki ", - "Charles Samborski " - ], - "repository": "gulpjs/async-done", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "types": "index.d.ts", - "files": [ - "index.js", - "index.d.ts", - "LICENSE" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only", - "test-types": "tsc -p test/types" - }, - "dependencies": { - "end-of-stream": "^1.4.4", - "once": "^1.4.0", - "stream-exhaust": "^1.0.2" - }, - "devDependencies": { - "@types/node": "^16.11.7", - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.3.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "pumpify": "^2.0.1", - "rxjs": "^7.4.0", - "streamx": "^2.12.0", - "through2": "^4.0.2", - "typescript": "^4.4.4" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "promises", - "callbacks", - "observables", - "streams", - "end", - "completion", - "complete", - "finish", - "done", - "async", - "error handling" - ] -} diff --git a/node_modules/async-settle/LICENSE b/node_modules/async-settle/LICENSE deleted file mode 100644 index 3bf4889..0000000 --- a/node_modules/async-settle/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014, 2016-2017, 2022 Blaine Bublitz and Eric Schoffstall - -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/async-settle/README.md b/node_modules/async-settle/README.md deleted file mode 100644 index 63841ed..0000000 --- a/node_modules/async-settle/README.md +++ /dev/null @@ -1,100 +0,0 @@ -

- - - -

- -# async-settle - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Settle an async function. It will always complete successfully with an object of the resulting state. - -Handles completion and errors for callbacks, promises, observables and streams. - -Will run call the function on `nextTick`. This will cause all functions to be async. - -## Usage - -### Successful completion - -```js -var asyncSettle = require('async-settle'); - -asyncSettle( - function (done) { - // do async things - done(null, 2); - }, - function (error, result) { - // `error` will ALWAYS be null on execution of the first function. - // `result` will ALWAYS be a settled object with the result or error of the first function. - } -); -``` - -### Failed completion - -```js -var asyncSettle = require('async-settle'); - -asyncSettle( - function (done) { - // do async things - done(new Error('Some Error Occurred')); - }, - function (error, result) { - // `error` will ALWAYS be null on execution of the first function. - // `result` will ALWAYS be a settled object with the result or error of the first function. - } -); -``` - -## API - -### `asyncSettle(fn, callback)` - -Takes a function to execute (`fn`) and a function to call on completion (`callback`). - -#### `fn([done])` - -Optionally takes a callback (`done`) to call when async tasks are complete. - -Executed in the context of [`async-done`][async-done], with all errors and results being settled. - -Completion is handled by [`async-done` completion and error resolution][completions]. - -#### `callback(error, result)` - -Called on completion of `fn` and recieves a settled object as the `result` argument. - -The `error` argument will always be `null`. - -#### Settled Object - -Settled values have two properties, `state` and `value`. - -`state` has two possible options `'error'` and `'success'`. - -`value` will be the value passed to original callback. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/async-settle.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/async-settle -[npm-image]: https://img.shields.io/npm/v/async-settle.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/async-settle/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/async-settle/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/async-settle -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/async-settle/master.svg?style=flat-square - - - -[async-done]: https://github.com/gulpjs/async-done -[completions]: https://github.com/gulpjs/async-done#completion-and-error-resolution - diff --git a/node_modules/async-settle/index.js b/node_modules/async-settle/index.js deleted file mode 100644 index af4f2ac..0000000 --- a/node_modules/async-settle/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var asyncDone = require('async-done'); - -function settle(fn, done) { - asyncDone(fn, function (error, result) { - var settled = {}; - - if (error != null) { - settled.state = 'error'; - settled.value = error; - } else { - settled.state = 'success'; - settled.value = result; - } - - done(null, settled); - }); -} - -module.exports = settle; diff --git a/node_modules/async-settle/package.json b/node_modules/async-settle/package.json deleted file mode 100644 index 18d8958..0000000 --- a/node_modules/async-settle/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "async-settle", - "version": "2.0.0", - "description": "Settle an async function.", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/async-settle", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "files": [ - "index.js", - "LICENSE" - ], - "scripts": { - "lint": "eslint . ", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "async-done": "^2.0.0" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.4.2", - "mocha": "^8.4.0", - "nyc": "^15.1.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "settle", - "async", - "async-done", - "complete", - "error", - "parallel" - ] -} diff --git a/node_modules/available-typed-arrays/.eslintrc b/node_modules/available-typed-arrays/.eslintrc deleted file mode 100644 index 3b5d9e9..0000000 --- a/node_modules/available-typed-arrays/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", -} diff --git a/node_modules/available-typed-arrays/.github/FUNDING.yml b/node_modules/available-typed-arrays/.github/FUNDING.yml deleted file mode 100644 index 14abc72..0000000 --- a/node_modules/available-typed-arrays/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# 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/available-typed-arrays -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/available-typed-arrays/.nycrc b/node_modules/available-typed-arrays/.nycrc deleted file mode 100644 index bdd626c..0000000 --- a/node_modules/available-typed-arrays/.nycrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "all": true, - "check-coverage": false, - "reporter": ["text-summary", "text", "html", "json"], - "exclude": [ - "coverage", - "test" - ] -} diff --git a/node_modules/available-typed-arrays/CHANGELOG.md b/node_modules/available-typed-arrays/CHANGELOG.md deleted file mode 100644 index f5ade9a..0000000 --- a/node_modules/available-typed-arrays/CHANGELOG.md +++ /dev/null @@ -1,100 +0,0 @@ -# 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/available-typed-arrays/compare/v1.0.6...v1.0.7) - 2024-02-19 - -### Commits - -- [Refactor] use `possible-typed-array-names` [`ac86abf`](https://github.com/inspect-js/available-typed-arrays/commit/ac86abfd64c4b633fd6523cc4193f1913fd22666) - -## [v1.0.6](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.5...v1.0.6) - 2024-01-31 - -### Commits - -- [actions] reuse common workflows [`1850353`](https://github.com/inspect-js/available-typed-arrays/commit/1850353ded0ceb4d02d9d05649da5b7f3a28c89f) -- [meta] use `npmignore` to autogenerate an npmignore file [`5c7de12`](https://github.com/inspect-js/available-typed-arrays/commit/5c7de120d22a5c35f703ba3f0b5287e5c5f38af6) -- [patch] add types [`fcfb0ea`](https://github.com/inspect-js/available-typed-arrays/commit/fcfb0ea21c9dc8459d68f8bb26679abb0bec71ca) -- [actions] update codecov uploader [`d844945`](https://github.com/inspect-js/available-typed-arrays/commit/d84494596881a298aabde9bd87e538ce10c6cd01) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `array.prototype.every`, `safe-publish-latest`, `tape` [`a2be6f4`](https://github.com/inspect-js/available-typed-arrays/commit/a2be6f482010e920692d8f65fe1f193dbb73004d) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`b283a3e`](https://github.com/inspect-js/available-typed-arrays/commit/b283a3e2176fbe8e431a27e20df21c831f216d5a) -- [actions] update rebase action to use reusable workflow [`0ad1f2d`](https://github.com/inspect-js/available-typed-arrays/commit/0ad1f2d82b11713ee48d9b37cb73fcc891bd9f4a) -- [Dev Deps] update `@ljharb/eslint-config`, `array.prototype.every`, `aud`, `tape` [`cd36e81`](https://github.com/inspect-js/available-typed-arrays/commit/cd36e8131076dd4e67a88b259f829067fa56c139) -- [meta] simplify "exports" [`f696e5f`](https://github.com/inspect-js/available-typed-arrays/commit/f696e5ff9ded838e192ade4e8550a890c4f35eb0) -- [Dev Deps] update `aud`, `npmignore`, `tape` [`bf20080`](https://github.com/inspect-js/available-typed-arrays/commit/bf200809aea3107b31fc8817122c693e099be30e) - -## [v1.0.5](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.4...v1.0.5) - 2021-08-30 - -### Fixed - -- [Refactor] use `globalThis` if available [`#12`](https://github.com/inspect-js/available-typed-arrays/issues/12) - -### Commits - -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`1199790`](https://github.com/inspect-js/available-typed-arrays/commit/1199790ab5841517ad04827fab3f135d2dc5cfb7) - -## [v1.0.4](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.3...v1.0.4) - 2021-05-25 - -### Commits - -- [Refactor] Remove `array.prototype.filter` dependency [`f39c90e`](https://github.com/inspect-js/available-typed-arrays/commit/f39c90ecb1907de28ee2d3577b7da37ae12aac56) -- [Dev Deps] update `eslint`, `auto-changelog` [`b2e3a03`](https://github.com/inspect-js/available-typed-arrays/commit/b2e3a035e8cd3ddfd7b565249e1651c6419a34d0) -- [meta] create `FUNDING.yml` [`8c0e758`](https://github.com/inspect-js/available-typed-arrays/commit/8c0e758c6ec80adbb3770554653cdc3aa16beb55) -- [Tests] fix harmony test matrix [`ef96549`](https://github.com/inspect-js/available-typed-arrays/commit/ef96549df171776267529413240a2219cb59d5ce) -- [meta] add `sideEffects` flag [`288cca0`](https://github.com/inspect-js/available-typed-arrays/commit/288cca0fbd214bec706447851bb8bccc4b899a48) - -## [v1.0.3](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.2...v1.0.3) - 2021-05-19 - -### Commits - -- [Tests] migrate tests to Github Actions [`3ef082c`](https://github.com/inspect-js/available-typed-arrays/commit/3ef082caaa153b49f4c37c85bbd5c4b13fe4f638) -- [meta] do not publish github action workflow files [`fd95ffd`](https://github.com/inspect-js/available-typed-arrays/commit/fd95ffdaca759eca81cb4c5d5772ee863dfea501) -- [actions] use `node/install` instead of `node/run`; use `codecov` action [`eb6bd65`](https://github.com/inspect-js/available-typed-arrays/commit/eb6bd659a31c92a6a178c71a89fe0d5261413e6c) -- [Tests] run `nyc` on all tests [`636c946`](https://github.com/inspect-js/available-typed-arrays/commit/636c94657b532599ef90a214aaa12639d11b0161) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`70a3b61`](https://github.com/inspect-js/available-typed-arrays/commit/70a3b61367b318fb883c2f35b8f2d539849a23b6) -- [actions] add "Allow Edits" workflow [`bd09c45`](https://github.com/inspect-js/available-typed-arrays/commit/bd09c45299e396fa5bbd5be4c58b1aedcb372a82) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `array.prototype.every`, `aud`, `tape` [`8f97523`](https://github.com/inspect-js/available-typed-arrays/commit/8f9752308390a79068cd431436bbfd77bca15647) -- [readme] fix URLs [`75418e2`](https://github.com/inspect-js/available-typed-arrays/commit/75418e20b57f4ad5e65d8c2e1864efd14eaa2e65) -- [readme] add actions and codecov badges [`4a8bc30`](https://github.com/inspect-js/available-typed-arrays/commit/4a8bc30af2ce1f48e2b28ab3db5be9589bd6f2d0) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`65198ac`](https://github.com/inspect-js/available-typed-arrays/commit/65198ace335a013ef49b6bd722bc80bbbc6be784) -- [actions] update workflows [`7f816eb`](https://github.com/inspect-js/available-typed-arrays/commit/7f816eb231131e53ced2572ba6c6c6a00f975789) -- [Refactor] use `array.prototype.filter` instead of `array-filter` [`2dd1038`](https://github.com/inspect-js/available-typed-arrays/commit/2dd1038d71ce48b5650687691cf8fe09795a6d30) -- [actions] switch Automatic Rease workflow to `pull_request_target` event [`9b45e91`](https://github.com/inspect-js/available-typed-arrays/commit/9b45e914fcb08bdaaaa0166b41716e51f400d1c6) -- [Dev Deps] update `auto-changelog`, `tape` [`0003a5b`](https://github.com/inspect-js/available-typed-arrays/commit/0003a5b122a0724db5499c114104eeeb396b2f67) -- [meta] use `prepublishOnly` script for npm 7+ [`d884dd1`](https://github.com/inspect-js/available-typed-arrays/commit/d884dd1c1117411f35d9fbc07f513a1a85ccdead) -- [readme] remove travis badge [`9da2b3c`](https://github.com/inspect-js/available-typed-arrays/commit/9da2b3c29706340fada995137aba12cfae4d6f37) -- [Dev Deps] update `auto-changelog`; add `aud` [`41b1336`](https://github.com/inspect-js/available-typed-arrays/commit/41b13369c71b0e3e57b9de0f4fb1e4d67950d74a) -- [Tests] only audit prod deps [`2571826`](https://github.com/inspect-js/available-typed-arrays/commit/2571826a5d121eeeeccf4c711e3f9e4616685d50) - -## [v1.0.2](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.1...v1.0.2) - 2020-01-26 - -### Commits - -- [actions] add automatic rebasing / merge commit blocking [`3229a74`](https://github.com/inspect-js/available-typed-arrays/commit/3229a74bda60f24e2257efc40ddff9a3ce98de76) -- [Dev Deps] update `@ljharb/eslint-config` [`9579abe`](https://github.com/inspect-js/available-typed-arrays/commit/9579abecc196088561d3aedf27cad45b56f8e18b) -- [Fix] remove `require` condition to avoid experimental warning [`2cade6b`](https://github.com/inspect-js/available-typed-arrays/commit/2cade6b56d6a508a950c7da27d038bee496e716b) - -## [v1.0.1](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.0...v1.0.1) - 2020-01-24 - -### Commits - -- [meta] add "exports" [`5942917`](https://github.com/inspect-js/available-typed-arrays/commit/5942917aafb56c6bce80f01b7ae6a9b46bc72c69) - -## v1.0.0 - 2020-01-24 - -### Commits - -- Initial commit [`2bc5144`](https://github.com/inspect-js/available-typed-arrays/commit/2bc514459c9f65756adfbd9964abf433183d78f6) -- readme [`31e4796`](https://github.com/inspect-js/available-typed-arrays/commit/31e4796379eba4a16d3c6a8e9baf6eb3f39e33d1) -- npm init [`9194266`](https://github.com/inspect-js/available-typed-arrays/commit/9194266b471a2a2dd5e6969bc40358ceb346e21e) -- Tests [`b539830`](https://github.com/inspect-js/available-typed-arrays/commit/b539830c3213f90de42b4d6e62803f52daf61a6d) -- Implementation [`6577df2`](https://github.com/inspect-js/available-typed-arrays/commit/6577df244ea146ef5ec16858044c8955e0fc445c) -- [meta] add `auto-changelog` [`7b43310`](https://github.com/inspect-js/available-typed-arrays/commit/7b43310be76f00fe60b74a2fd6d0e46ac1d01f3e) -- [Tests] add `npm run lint` [`dedfbc1`](https://github.com/inspect-js/available-typed-arrays/commit/dedfbc1592f86ac1636267d3965f2345df43815b) -- [Tests] use shared travis-ci configs [`c459d78`](https://github.com/inspect-js/available-typed-arrays/commit/c459d78bf2efa9d777f88599ae71a796dbfcb70f) -- Only apps should have lockfiles [`d294668`](https://github.com/inspect-js/available-typed-arrays/commit/d294668422cf35f5e7716a85bfd204e62b01c056) -- [meta] add `funding` field [`6e70bc1`](https://github.com/inspect-js/available-typed-arrays/commit/6e70bc1fb199c7898165aaf05c25bb49f4062e53) -- [meta] add `safe-publish-latest` [`dd89ca2`](https://github.com/inspect-js/available-typed-arrays/commit/dd89ca2c6842f0f3e82958df2b2bd0fc0c929c51) diff --git a/node_modules/available-typed-arrays/LICENSE b/node_modules/available-typed-arrays/LICENSE deleted file mode 100644 index 707437b..0000000 --- a/node_modules/available-typed-arrays/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/available-typed-arrays/README.md b/node_modules/available-typed-arrays/README.md deleted file mode 100644 index df6f586..0000000 --- a/node_modules/available-typed-arrays/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# available-typed-arrays [![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] - -Returns an array of Typed Array names that are available in the current environment. - -## Example - -```js -var availableTypedArrays = require('available-typed-arrays'); -var assert = require('assert'); - -assert.deepStrictEqual( - availableTypedArrays().sort(), - [ - 'Int8Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array', - 'BigInt64Array', - 'BigUint64Array' - ].sort() -); -``` - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/available-typed-arrays -[2]: https://versionbadg.es/inspect-js/available-typed-arrays.svg -[5]: https://david-dm.org/inspect-js/available-typed-arrays.svg -[6]: https://david-dm.org/inspect-js/available-typed-arrays -[7]: https://david-dm.org/inspect-js/available-typed-arrays/dev-status.svg -[8]: https://david-dm.org/inspect-js/available-typed-arrays#info=devDependencies -[11]: https://nodei.co/npm/available-typed-arrays.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/available-typed-arrays.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/available-typed-arrays.svg -[downloads-url]: https://npm-stat.com/charts.html?package=available-typed-arrays -[codecov-image]: https://codecov.io/gh/inspect-js/available-typed-arrays/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/inspect-js/available-typed-arrays/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/available-typed-arrays -[actions-url]: https://github.com/inspect-js/available-typed-arrays/actions diff --git a/node_modules/available-typed-arrays/index.d.ts b/node_modules/available-typed-arrays/index.d.ts deleted file mode 100644 index c21e1c4..0000000 --- a/node_modules/available-typed-arrays/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -type AllPossibleTypedArrays = typeof import('possible-typed-array-names'); - -declare function availableTypedArrays(): - | [] - | AllPossibleTypedArrays - | Omit; - -export = availableTypedArrays; diff --git a/node_modules/available-typed-arrays/index.js b/node_modules/available-typed-arrays/index.js deleted file mode 100644 index 125f000..0000000 --- a/node_modules/available-typed-arrays/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -var possibleNames = require('possible-typed-array-names'); - -var g = typeof globalThis === 'undefined' ? global : globalThis; - -/** @type {import('.')} */ -module.exports = function availableTypedArrays() { - var /** @type {ReturnType} */ out = []; - for (var i = 0; i < possibleNames.length; i++) { - if (typeof g[possibleNames[i]] === 'function') { - // @ts-expect-error - out[out.length] = possibleNames[i]; - } - } - return out; -}; diff --git a/node_modules/available-typed-arrays/package.json b/node_modules/available-typed-arrays/package.json deleted file mode 100644 index 9b4e245..0000000 --- a/node_modules/available-typed-arrays/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "available-typed-arrays", - "version": "1.0.7", - "description": "Returns an array of Typed Array names that are available in the current environment", - "main": "index.js", - "type": "commonjs", - "exports": { - ".": "./index.js", - "./package.json": "./package.json" - }, - "types": "./index.d.ts", - "sideEffects": false, - "scripts": { - "prepack": "npmignore --auto --commentLines=autogenerated", - "prepublish": "not-in-publish || npm run prepublishOnly", - "prepublishOnly": "safe-publish-latest", - "prelint": "evalmd README.md", - "lint": "eslint --ext=js,mjs .", - "postlint": "tsc -p .", - "pretest": "npm run lint", - "tests-only": "nyc tape 'test/**/*.js'", - "test:harmony": "nyc node --harmony --es-staging test", - "test": "npm run tests-only && npm run test:harmony", - "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/available-typed-arrays.git" - }, - "keywords": [ - "typed", - "arrays", - "Float32Array", - "Float64Array", - "Int8Array", - "Int16Array", - "Int32Array", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "Uint32Array", - "BigInt64Array", - "BigUint64Array" - ], - "author": "Jordan Harband ", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/inspect-js/available-typed-arrays/issues" - }, - "homepage": "https://github.com/inspect-js/available-typed-arrays#readme", - "engines": { - "node": ">= 0.4" - }, - "devDependencies": { - "@ljharb/eslint-config": "^21.1.0", - "@types/array.prototype.every": "^1.1.1", - "@types/isarray": "^2.0.2", - "@types/tape": "^5.6.4", - "array.prototype.every": "^1.1.5", - "aud": "^2.0.4", - "auto-changelog": "^2.4.0", - "eslint": "=8.8.0", - "evalmd": "^0.0.19", - "in-publish": "^2.0.1", - "isarray": "^2.0.5", - "npmignore": "^0.3.1", - "nyc": "^10.3.2", - "safe-publish-latest": "^2.0.0", - "tape": "^5.7.4", - "typescript": "^5.4.0-dev.20240131" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - }, - "dependencies": { - "possible-typed-array-names": "^1.0.0" - } -} diff --git a/node_modules/available-typed-arrays/test/index.js b/node_modules/available-typed-arrays/test/index.js deleted file mode 100644 index 21c986d..0000000 --- a/node_modules/available-typed-arrays/test/index.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var test = require('tape'); -var isArray = require('isarray'); -var every = require('array.prototype.every'); - -var availableTypedArrays = require('../'); - -test('available typed arrays', function (t) { - t.equal(typeof availableTypedArrays, 'function', 'is a function'); - - var arrays = availableTypedArrays(); - t.equal(isArray(arrays), true, 'returns an array'); - - t.equal(every(arrays, function (array) { return typeof array === 'string'; }), true, 'contains only strings'); - - t.end(); -}); diff --git a/node_modules/available-typed-arrays/tsconfig.json b/node_modules/available-typed-arrays/tsconfig.json deleted file mode 100644 index fdab34f..0000000 --- a/node_modules/available-typed-arrays/tsconfig.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - - /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ - "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - - /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - "declarationMap": true, /* Create sourcemaps for d.ts files. */ - "noEmit": true, /* Disable emitting files from a compilation. */ - - /* Interop Constraints */ - "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Completeness */ - //"skipLibCheck": true /* Skip type checking all .d.ts files. */ - }, - "exclude": [ - "coverage" - ] -} diff --git a/node_modules/bach/LICENSE b/node_modules/bach/LICENSE deleted file mode 100644 index e5a307a..0000000 --- a/node_modules/bach/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014, 2016-2018, 2022 Blaine Bublitz and Eric Schoffstall . - -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/bach/README.md b/node_modules/bach/README.md deleted file mode 100644 index 561ed00..0000000 --- a/node_modules/bach/README.md +++ /dev/null @@ -1,261 +0,0 @@ -

- - - -

- -# bach - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Compose your async functions with elegance. - -## Usage - -With `bach`, it is very easy to compose async functions to run in series or parallel. - -```js -var bach = require('bach'); - -function fn1(cb) { - cb(null, 1); -} - -function fn2(cb) { - cb(null, 2); -} - -function fn3(cb) { - cb(null, 3); -} - -var seriesFn = bach.series(fn1, fn2, fn3); -// fn1, fn2, and fn3 will be run in series -seriesFn(function (err, res) { - if (err) { - // in this example, err is undefined - // handle error - } - // handle results - // in this example, res is [1, 2, 3] -}); - -var parallelFn = bach.parallel(fn1, fn2, fn3); -// fn1, fn2, and fn3 will be run in parallel -parallelFn(function (err, res) { - if (err) { - // in this example, err is undefined - // handle error - } - // handle results - // in this example, res is [1, 2, 3] -}); -``` - -Since the composer functions return a function, you can combine them. - -```js -var combinedFn = bach.series(fn1, bach.parallel(fn2, fn3)); -// fn1 will be executed before fn2 and fn3 are run in parallel -combinedFn(function (err, res) { - if (err) { - // in this example, err is undefined - // handle error - } - // handle results - // in this example, res is [1, [2, 3]] -}); -``` - -Functions are called with [async-done], so you can return a stream, promise, observable or child process. See [`async-done` completion and error resolution][completions] for more detail. - -```js -// streams -var fs = require('fs'); - -function streamFn1() { - return fs - .createReadStream('./example') - .pipe(fs.createWriteStream('./example')); -} - -function streamFn2() { - return fs - .createReadStream('./example') - .pipe(fs.createWriteStream('./example')); -} - -var parallelStreams = bach.parallel(streamFn1, streamFn2); -parallelStreams(function (err) { - if (err) { - // in this example, err is undefined - // handle error - } - // all streams have emitted an 'end' or 'close' event -}); -``` - -```js -// promises -function promiseFn1() { - return Promise.resolve(1); -} - -function promiseFn2() { - return Promise.resolve(2); -} - -var parallelPromises = bach.parallel(promiseFn1, promiseFn2); -parallelPromises(function (err, res) { - if (err) { - // in this example, err is undefined - // handle error - } - // handle results - // in this example, res is [1, 2] -}); -``` - -All errors are caught in a [domain] and passed to the final callback as the first argument. - -```js -function success(cb) { - setTimeout(function () { - cb(null, 1); - }, 500); -} - -function error() { - throw new Error('Thrown Error'); -} - -var errorThrownFn = bach.parallel(error, success); -errorThrownFn(function (err, res) { - if (err) { - // handle error - // in this example, err is an error caught by the domain - } - // handle results - // in this example, res is [undefined] -}); -``` - -When an error happens in a parallel composition, the callback will be called as soon as the error happens. -If you want to continue on error and wait until all functions have finished before calling the callback, use `settleSeries` or `settleParallel`. - -```js -function success(cb) { - setTimeout(function () { - cb(null, 1); - }, 500); -} - -function error(cb) { - cb(new Error('Async Error')); -} - -var parallelSettlingFn = bach.settleParallel(success, error); -parallelSettlingFn(function (err, res) { - // all functions have finished executing - if (err) { - // handle error - // in this example, err is an error passed to the callback - } - // handle results - // in this example, res is [1] -}); -``` - -## API - -### `series(fns..., [options])` - -Takes a variable amount of functions (`fns`) to be called in series when the returned function is -called. Optionally, takes an [options](#options) object as the last argument. - -Returns an `invoker(cb)` function to be called to start the serial execution. The invoker function takes a callback (`cb`) with the `function(error, results)` signature. - -If all functions complete successfully, the callback function will be called with all `results` as the second argument. - -If an error occurs, execution will stop and the error will be passed to the callback function as the first parameter. The error parameter will always be a single error. - -### `parallel(fns..., [options])` - -Takes a variable amount of functions (`fns`) to be called in parallel when the returned function is -called. Optionally, takes an [options](#options) object as the last argument. - -Returns an `invoker(cb)` function to be called to start the parallel execution. The invoker function takes a callback (`cb`) with the `function(error, results)` signature. - -If all functions complete successfully, the callback function will be called with all `results` as the second argument. - -If an error occurs, the callback function will be called with the error as the first parameter. Any async functions that have not completed, will still complete, but their results will **not** be available. The error parameter will always be a single error. - -### `settleSeries(fns..., [options])` - -Takes a variable amount of functions (`fns`) to be called in series when the returned function is -called. Optionally, takes an [options](#options) object as the last argument. - -Returns an `invoker(cb)` function to be called to start the serial execution. The invoker function takes a callback (`cb`) with the `function(error, results)` signature. - -All functions will always be called and the callback will receive all settled errors and results. If any errors occur, the error parameter will be an array of errors. - -### `settleParallel(fns..., [options])` - -Takes a variable amount of functions (`fns`) to be called in parallel when the returned function is -called. Optionally, takes an [options](#options) object as the last argument. - -Returns an `invoker(cb)` function to be called to start the parallel execution. The invoker function takes a callback (`cb`) with the `function(error, results)` signature. - -All functions will always be called and the callback will receive all settled errors and results. If any errors occur, the error parameter will be an array of errors. - -### `options` - -The `options` object is primarily used for specifying functions that give insight into the lifecycle of each function call. The possible extension points are `create`, `before`, `after` and `error`. If an extension point is not specified, it defaults to a no-op function. - -The `options` object for `parallel` and `settleParallel` also allows specifying `concurrency` in which to run your functions. By default, your functions will run at maximum concurrency. - -##### `options.concurrency` - -Limits the amount of functions allowed to run at a given time. - -##### `options.create(fn, index)` - -Called at the very beginning of each function call with the function (`fn`) being executed and the `index` from the array/arguments. If `create` returns a value (`storage`), it is passed to the `before`, `after` and `error` extension points. - -If a value is not returned, an empty object is used as `storage` for each other extension point. - -This is useful for tracking information across an iteration. - -##### `options.before(storage)` - -Called immediately before each function call with the `storage` value returned from the `create` extension point. - -##### `options.after(result, storage)` - -Called immediately after each function call with the `result` of the function and the `storage` value returned from the `create` extension point. - -##### `options.error(error, storage)` - -Called immediately after a failed function call with the `error` of the function and the `storage` value returned from the `create` extension point. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/bach.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/bach -[npm-image]: https://img.shields.io/npm/v/bach.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/bach/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/bach/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/bach -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/bach.svg?style=flat-square - - - -[domain]: https://nodejs.org/api/domain.html -[async-done]: https://github.com/gulpjs/async-done -[completions]: https://github.com/gulpjs/async-done#completion-and-error-resolution - diff --git a/node_modules/bach/index.js b/node_modules/bach/index.js deleted file mode 100644 index 1a4848e..0000000 --- a/node_modules/bach/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -module.exports = { - series: require('./lib/series'), - parallel: require('./lib/parallel'), - settleSeries: require('./lib/settleSeries'), - settleParallel: require('./lib/settleParallel'), -}; diff --git a/node_modules/bach/lib/helpers.js b/node_modules/bach/lib/helpers.js deleted file mode 100644 index d2a14d7..0000000 --- a/node_modules/bach/lib/helpers.js +++ /dev/null @@ -1,94 +0,0 @@ -'use strict'; - -function noop() {} - -function getOptions(args) { - // TODO: use `.at(-1)` when the API is available - var lastArg = args.slice(-1)[0]; - - if (typeof lastArg !== 'function') { - return lastArg; - } -} - -function filterSuccess(elem) { - return elem.state === 'success'; -} - -function filterError(elem) { - return elem.state === 'error'; -} - -function pluckValue(elem) { - return elem.value; -} - -function buildOnSettled(done) { - if (typeof done !== 'function') { - done = noop; - } - - function onSettled(error, result) { - if (error) { - return done(error, null); - } - - if (!Array.isArray(result)) { - result = []; - } - - var settledErrors = result.filter(filterError); - var settledResults = result.filter(filterSuccess); - - var errors = null; - if (settledErrors.length) { - errors = settledErrors.map(pluckValue); - } - - var results = null; - if (settledResults.length) { - results = settledResults.map(pluckValue); - } - - done(errors, results); - } - - return onSettled; -} - -function verifyArguments(args) { - args = Array.prototype.concat.apply([], args); - - if (!args.length) { - throw new Error('A set of functions to combine is required'); - } - - args.forEach(verifyEachArg); - - return args; -} - -function verifyEachArg(arg, argIdx, args) { - var isFunction = typeof arg === 'function'; - if (isFunction) { - return; - } - - if (argIdx === args.length - 1) { - // Last arg can be an object of extension points - return; - } - - var msg = - 'Only functions can be combined, got ' + - typeof arg + - ' for argument ' + - argIdx; - throw new Error(msg); -} - -module.exports = { - getOptions: getOptions, - onSettled: buildOnSettled, - verifyArguments: verifyArguments, -}; diff --git a/node_modules/bach/lib/parallel.js b/node_modules/bach/lib/parallel.js deleted file mode 100644 index f85c12c..0000000 --- a/node_modules/bach/lib/parallel.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var asyncDone = require('async-done'); -var nowAndLater = require('now-and-later'); - -var helpers = require('./helpers'); - -function iterator(fn, key, cb) { - return asyncDone(fn, cb); -} - -function buildParallel() { - var args = helpers.verifyArguments(arguments); - - var options = helpers.getOptions(args); - - if (options) { - args = args.slice(0, -1); - } - - function parallel(done) { - nowAndLater.map(args, iterator, options, done); - } - - return parallel; -} - -module.exports = buildParallel; diff --git a/node_modules/bach/lib/series.js b/node_modules/bach/lib/series.js deleted file mode 100644 index 1ba8ad9..0000000 --- a/node_modules/bach/lib/series.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var asyncDone = require('async-done'); -var nowAndLater = require('now-and-later'); - -var helpers = require('./helpers'); - -function iterator(fn, key, cb) { - return asyncDone(fn, cb); -} - -function buildSeries() { - var args = helpers.verifyArguments(arguments); - - var options = helpers.getOptions(args); - - if (options) { - args = args.slice(0, -1); - } - - function series(done) { - nowAndLater.mapSeries(args, iterator, options, done); - } - - return series; -} - -module.exports = buildSeries; diff --git a/node_modules/bach/lib/settleParallel.js b/node_modules/bach/lib/settleParallel.js deleted file mode 100644 index 7a44c27..0000000 --- a/node_modules/bach/lib/settleParallel.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var asyncSettle = require('async-settle'); -var nowAndLater = require('now-and-later'); - -var helpers = require('./helpers'); - -function iterator(fn, key, cb) { - return asyncSettle(fn, cb); -} - -function buildSettleParallel() { - var args = helpers.verifyArguments(arguments); - - var options = helpers.getOptions(args); - - if (options) { - args = args.slice(0, -1); - } - - function settleParallel(done) { - var onSettled = helpers.onSettled(done); - nowAndLater.map(args, iterator, options, onSettled); - } - - return settleParallel; -} - -module.exports = buildSettleParallel; diff --git a/node_modules/bach/lib/settleSeries.js b/node_modules/bach/lib/settleSeries.js deleted file mode 100644 index ecdb78e..0000000 --- a/node_modules/bach/lib/settleSeries.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -var asyncSettle = require('async-settle'); -var nowAndLater = require('now-and-later'); - -var helpers = require('./helpers'); - -function iterator(fn, key, cb) { - return asyncSettle(fn, cb); -} - -function buildSettleSeries() { - var args = helpers.verifyArguments(arguments); - - var options = helpers.getOptions(args); - - if (options) { - args = args.slice(0, -1); - } - - function settleSeries(done) { - var onSettled = helpers.onSettled(done); - nowAndLater.mapSeries(args, iterator, options, onSettled); - } - - return settleSeries; -} - -module.exports = buildSettleSeries; diff --git a/node_modules/bach/package.json b/node_modules/bach/package.json deleted file mode 100644 index 7cdd599..0000000 --- a/node_modules/bach/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "bach", - "version": "2.0.1", - "description": "Compose your async functions with elegance.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz ", - "Pawel Kozlowski ", - "Benjamin Tan " - ], - "repository": "gulpjs/bach", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "index.js", - "lib", - "LICENSE" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "async-done": "^2.0.0", - "async-settle": "^2.0.0", - "now-and-later": "^3.0.0" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "expect": "^27.5.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "compose", - "fluent", - "composing", - "continuation", - "function composition", - "functional", - "async", - "map", - "series", - "parallel", - "extension", - "tracing", - "debug", - "timing", - "aop", - "settle", - "promises", - "callbacks", - "observables", - "streams", - "end", - "completion", - "complete", - "finish", - "done", - "error handling" - ] -} diff --git a/node_modules/balanced-match/.github/FUNDING.yml b/node_modules/balanced-match/.github/FUNDING.yml deleted file mode 100644 index cea8b16..0000000 --- a/node_modules/balanced-match/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -tidelift: "npm/balanced-match" -patreon: juliangruber diff --git a/node_modules/balanced-match/LICENSE.md b/node_modules/balanced-match/LICENSE.md deleted file mode 100644 index 2cdc8e4..0000000 --- a/node_modules/balanced-match/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/balanced-match/README.md b/node_modules/balanced-match/README.md deleted file mode 100644 index d2a48b6..0000000 --- a/node_modules/balanced-match/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# balanced-match - -Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! - -[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) -[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) - -[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) - -## Example - -Get the first matching pair of braces: - -```js -var balanced = require('balanced-match'); - -console.log(balanced('{', '}', 'pre{in{nested}}post')); -console.log(balanced('{', '}', 'pre{first}between{second}post')); -console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); -``` - -The matches are: - -```bash -$ node example.js -{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } -{ start: 3, - end: 9, - pre: 'pre', - body: 'first', - post: 'between{second}post' } -{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } -``` - -## API - -### var m = balanced(a, b, str) - -For the first non-nested matching pair of `a` and `b` in `str`, return an -object with those keys: - -* **start** the index of the first match of `a` -* **end** the index of the matching `b` -* **pre** the preamble, `a` and `b` not included -* **body** the match, `a` and `b` not included -* **post** the postscript, `a` and `b` not included - -If there's no match, `undefined` will be returned. - -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. - -### var r = balanced.range(a, b, str) - -For the first non-nested matching pair of `a` and `b` in `str`, return an -array with indexes: `[ , ]`. - -If there's no match, `undefined` will be returned. - -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. - -## Installation - -With [npm](https://npmjs.org) do: - -```bash -npm install balanced-match -``` - -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/balanced-match/index.js b/node_modules/balanced-match/index.js deleted file mode 100644 index c67a646..0000000 --- a/node_modules/balanced-match/index.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; -module.exports = balanced; -function balanced(a, b, str) { - if (a instanceof RegExp) a = maybeMatch(a, str); - if (b instanceof RegExp) b = maybeMatch(b, str); - - var r = range(a, b, str); - - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + a.length, r[1]), - post: str.slice(r[1] + b.length) - }; -} - -function maybeMatch(reg, str) { - var m = str.match(reg); - return m ? m[0] : null; -} - -balanced.range = range; -function range(a, b, str) { - var begs, beg, left, right, result; - var ai = str.indexOf(a); - var bi = str.indexOf(b, ai + 1); - var i = ai; - - if (ai >= 0 && bi > 0) { - if(a===b) { - return [ai, bi]; - } - begs = []; - left = str.length; - - while (i >= 0 && !result) { - if (i == ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length == 1) { - result = [ begs.pop(), bi ]; - } else { - beg = begs.pop(); - if (beg < left) { - left = beg; - right = bi; - } - - bi = str.indexOf(b, i + 1); - } - - i = ai < bi && ai >= 0 ? ai : bi; - } - - if (begs.length) { - result = [ left, right ]; - } - } - - return result; -} diff --git a/node_modules/balanced-match/package.json b/node_modules/balanced-match/package.json deleted file mode 100644 index ce6073e..0000000 --- a/node_modules/balanced-match/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "balanced-match", - "description": "Match balanced character pairs, like \"{\" and \"}\"", - "version": "1.0.2", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/balanced-match.git" - }, - "homepage": "https://github.com/juliangruber/balanced-match", - "main": "index.js", - "scripts": { - "test": "tape test/test.js", - "bench": "matcha test/bench.js" - }, - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "keywords": [ - "match", - "regexp", - "test", - "balanced", - "parse" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/20..latest", - "firefox/nightly", - "chrome/25..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/node_modules/bare-events/LICENSE b/node_modules/bare-events/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/bare-events/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/bare-events/README.md b/node_modules/bare-events/README.md deleted file mode 100644 index f6529aa..0000000 --- a/node_modules/bare-events/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# bare-events - -Event emitters for JavaScript. - -``` -npm install bare-events -``` - -## Usage - -``` js -const EventEmitter = require('bare-events') - -const e = new EventEmitter() - -e.on('hello', function (data) { - console.log(data) -}) - -e.emit('hello', 'world') -``` - -## License - -Apache-2.0 diff --git a/node_modules/bare-events/index.js b/node_modules/bare-events/index.js deleted file mode 100644 index 2f7cb0a..0000000 --- a/node_modules/bare-events/index.js +++ /dev/null @@ -1,336 +0,0 @@ -const errors = require('./lib/errors') - -class EventListener { - constructor () { - this.list = [] - this.count = 0 - } - - append (ctx, name, fn, once) { - this.count++ - ctx.emit('newListener', name, fn) // Emit BEFORE adding - this.list.push([fn, once]) - } - - prepend (ctx, name, fn, once) { - this.count++ - ctx.emit('newListener', name, fn) // Emit BEFORE adding - this.list.unshift([fn, once]) - } - - remove (ctx, name, fn) { - for (let i = 0, n = this.list.length; i < n; i++) { - const l = this.list[i] - - if (l[0] === fn) { - this.list.splice(i, 1) - - if (this.count === 1) delete ctx._events[name] - - ctx.emit('removeListener', name, fn) // Emit AFTER removing - - this.count-- - return - } - } - } - - removeAll (ctx, name) { - const list = [...this.list] - this.list = [] - - if (this.count === list.length) delete ctx._events[name] - - for (let i = list.length - 1; i >= 0; i--) { - ctx.emit('removeListener', name, list[i][0]) // Emit AFTER removing - } - - this.count -= list.length - } - - emit (ctx, name, ...args) { - const list = [...this.list] - - for (let i = 0, n = list.length; i < n; i++) { - const l = list[i] - - if (l[1] === true) this.remove(ctx, name, l[0]) - - l[0].call(ctx, ...args) - } - - return list.length > 0 - } -} - -function appendListener (ctx, name, fn, once) { - const e = ctx._events[name] || (ctx._events[name] = new EventListener()) - e.append(ctx, name, fn, once) - return ctx -} - -function prependListener (ctx, name, fn, once) { - const e = ctx._events[name] || (ctx._events[name] = new EventListener()) - e.prepend(ctx, name, fn, once) - return ctx -} - -function removeListener (ctx, name, fn) { - const e = ctx._events[name] - if (e !== undefined) e.remove(ctx, name, fn) - return ctx -} - -function throwUnhandledError (...args) { - let err - - if (args.length > 0) err = args[0] - - if (err instanceof Error === false) err = errors.UNHANDLED_ERROR(err) - - if (Error.captureStackTrace) { - Error.captureStackTrace(err, exports.prototype.emit) - } - - queueMicrotask(() => { throw err }) -} - -module.exports = exports = class EventEmitter { - constructor () { - this._events = Object.create(null) - } - - addListener (name, fn) { - return appendListener(this, name, fn, false) - } - - addOnceListener (name, fn) { - return appendListener(this, name, fn, true) - } - - prependListener (name, fn) { - return prependListener(this, name, fn, false) - } - - prependOnceListener (name, fn) { - return prependListener(this, name, fn, true) - } - - removeListener (name, fn) { - return removeListener(this, name, fn) - } - - on (name, fn) { - return appendListener(this, name, fn, false) - } - - once (name, fn) { - return appendListener(this, name, fn, true) - } - - off (name, fn) { - return removeListener(this, name, fn) - } - - emit (name, ...args) { - if (name === 'error' && this._events.error === undefined) throwUnhandledError(...args) - const e = this._events[name] - return e === undefined ? false : e.emit(this, name, ...args) - } - - listeners (name) { - const e = this._events[name] - return e === undefined ? [] : [...e.list] - } - - listenerCount (name) { - const e = this._events[name] - return e === undefined ? 0 : e.list.length - } - - getMaxListeners () { - return EventEmitter.defaultMaxListeners - } - - setMaxListeners (n) {} - - removeAllListeners (name) { - if (arguments.length === 0) { - for (const key of Reflect.ownKeys(this._events)) { - if (key === 'removeListener') continue - this.removeAllListeners(key) - } - this.removeAllListeners('removeListener') - } else { - const e = this._events[name] - if (e !== undefined) e.removeAll(this, name) - } - return this - } -} - -exports.EventEmitter = exports - -exports.errors = errors - -exports.defaultMaxListeners = 10 - -exports.on = function on (emitter, name, opts = {}) { - const { - signal - } = opts - - if (signal && signal.aborted) { - throw errors.OPERATION_ABORTED(signal.reason) - } - - let error = null - let done = false - - const events = [] - const promises = [] - - emitter.on(name, onevent) - - if (name !== 'error') emitter.on('error', onerror) - - if (signal) signal.addEventListener('abort', onabort) - - return { - next () { - if (events.length) { - return Promise.resolve({ value: events.shift(), done: false }) - } - - if (error) { - const err = error - - error = null - - return Promise.reject(err) - } - - if (done) return onclose() - - return new Promise((resolve, reject) => - promises.push({ resolve, reject }) - ) - }, - - return () { - return onclose() - }, - - throw (err) { - return onerror(err) - }, - - [Symbol.asyncIterator] () { - return this - } - } - - function onevent (...args) { - if (promises.length) { - promises.shift().resolve({ value: args, done: false }) - } else { - events.push(args) - } - } - - function onerror (err) { - if (promises.length) { - promises.shift().reject(err) - } else { - error = err - } - - return Promise.resolve({ done: true }) - } - - function onabort () { - onerror(errors.OPERATION_ABORTED(signal.reason)) - } - - function onclose () { - emitter.off(name, onevent) - - if (name !== 'error') emitter.off('error', onerror) - - if (signal) signal.removeEventListener('abort', onabort) - - done = true - - if (promises.length) promises.shift().resolve({ done: true }) - - return Promise.resolve({ done: true }) - } -} - -exports.once = function once (emitter, name, opts = {}) { - const { - signal - } = opts - - if (signal && signal.aborted) { - throw errors.OPERATION_ABORTED(signal.reason) - } - - return new Promise((resolve, reject) => { - if (name !== 'error') emitter.on('error', onerror) - - if (signal) signal.addEventListener('abort', onabort) - - emitter.once(name, (...args) => { - if (name !== 'error') emitter.off('error', onerror) - - if (signal) signal.removeEventListener('abort', onabort) - - resolve(args) - }) - - function onerror (err) { - emitter.off('error', onerror) - - reject(err) - } - - function onabort () { - signal.removeEventListener('abort', onabort) - - onerror(errors.OPERATION_ABORTED(signal.reason)) - } - }) -} - -exports.forward = function forward (from, to, names, opts = {}) { - if (typeof names === 'string') names = [names] - - const { - emit = to.emit.bind(to) - } = opts - - const listeners = names.map((name) => function onevent (...args) { - emit(name, ...args) - }) - - to - .on('newListener', (name) => { - const i = names.indexOf(name) - - if (i !== -1 && to.listenerCount(name) === 0) { - from.on(name, listeners[i]) - } - }) - .on('removeListener', (name) => { - const i = names.indexOf(name) - - if (i !== -1 && to.listenerCount(name) === 0) { - from.off(name, listeners[i]) - } - }) -} - -exports.listenerCount = function listenerCount (emitter, name) { - return emitter.listenerCount(name) -} diff --git a/node_modules/bare-events/lib/errors.js b/node_modules/bare-events/lib/errors.js deleted file mode 100644 index 2b79115..0000000 --- a/node_modules/bare-events/lib/errors.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = class EventEmitterError extends Error { - constructor (msg, code, fn = EventEmitterError, opts) { - super(`${code}: ${msg}`, opts) - this.code = code - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, fn) - } - } - - get name () { - return 'EventEmitterError' - } - - static OPERATION_ABORTED (cause, msg = 'Operation aborted') { - return new EventEmitterError(msg, 'OPERATION_ABORTED', EventEmitterError.OPERATION_ABORTED, { cause }) - } - - static UNHANDLED_ERROR (cause, msg = 'Unhandled error') { - return new EventEmitterError(msg, 'UNHANDLED_ERROR', EventEmitterError.UNHANDLED_ERROR, { cause }) - } -} diff --git a/node_modules/bare-events/package.json b/node_modules/bare-events/package.json deleted file mode 100644 index 95d22d9..0000000 --- a/node_modules/bare-events/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "bare-events", - "version": "2.5.0", - "description": "Event emitters for JavaScript", - "exports": { - ".": "./index.js", - "./package": "./package.json", - "./errors": "./lib/errors.js" - }, - "files": [ - "index.js", - "lib" - ], - "scripts": { - "test": "npm run lint && npm run test:bare && npm run test:node", - "test:bare": "bare test.js", - "test:node": "node test.js", - "lint": "standard" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/holepunchto/bare-events.git" - }, - "author": "Holepunch", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/holepunchto/bare-events/issues" - }, - "homepage": "https://github.com/holepunchto/bare-events#readme", - "devDependencies": { - "brittle": "^3.3.2", - "standard": "^17.0.0" - } -} diff --git a/node_modules/base64-js/LICENSE b/node_modules/base64-js/LICENSE deleted file mode 100644 index 6d52b8a..0000000 --- a/node_modules/base64-js/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Jameson Little - -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/base64-js/README.md b/node_modules/base64-js/README.md deleted file mode 100644 index b42a48f..0000000 --- a/node_modules/base64-js/README.md +++ /dev/null @@ -1,34 +0,0 @@ -base64-js -========= - -`base64-js` does basic base64 encoding/decoding in pure JS. - -[![build status](https://secure.travis-ci.org/beatgammit/base64-js.png)](http://travis-ci.org/beatgammit/base64-js) - -Many browsers already have base64 encoding/decoding functionality, but it is for text data, not all-purpose binary data. - -Sometimes encoding/decoding binary data in the browser is useful, and that is what this module does. - -## install - -With [npm](https://npmjs.org) do: - -`npm install base64-js` and `var base64js = require('base64-js')` - -For use in web browsers do: - -`` - -[Get supported base64-js with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-base64-js?utm_source=npm-base64-js&utm_medium=referral&utm_campaign=readme) - -## methods - -`base64js` has three exposed functions, `byteLength`, `toByteArray` and `fromByteArray`, which both take a single argument. - -* `byteLength` - Takes a base64 string and returns length of byte array -* `toByteArray` - Takes a base64 string and returns a byte array -* `fromByteArray` - Takes a byte array and returns a base64 string - -## license - -MIT diff --git a/node_modules/base64-js/base64js.min.js b/node_modules/base64-js/base64js.min.js deleted file mode 100644 index 908ac83..0000000 --- a/node_modules/base64-js/base64js.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?this:self:global:window,b.base64js=a()}})(function(){return function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c>16,j[k++]=255&b>>8,j[k++]=255&b;return 2===h&&(b=l[a.charCodeAt(c)]<<2|l[a.charCodeAt(c+1)]>>4,j[k++]=255&b),1===h&&(b=l[a.charCodeAt(c)]<<10|l[a.charCodeAt(c+1)]<<4|l[a.charCodeAt(c+2)]>>2,j[k++]=255&b>>8,j[k++]=255&b),j}function g(a){return k[63&a>>18]+k[63&a>>12]+k[63&a>>6]+k[63&a]}function h(a,b,c){for(var d,e=[],f=b;fj?j:g+f));return 1===d?(b=a[c-1],e.push(k[b>>2]+k[63&b<<4]+"==")):2===d&&(b=(a[c-2]<<8)+a[c-1],e.push(k[b>>10]+k[63&b>>4]+k[63&b<<2]+"=")),e.join("")}c.byteLength=function(a){var b=d(a),c=b[0],e=b[1];return 3*(c+e)/4-e},c.toByteArray=f,c.fromByteArray=j;for(var k=[],l=[],m="undefined"==typeof Uint8Array?Array:Uint8Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,p=n.length;o 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} diff --git a/node_modules/base64-js/package.json b/node_modules/base64-js/package.json deleted file mode 100644 index c3972e3..0000000 --- a/node_modules/base64-js/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "base64-js", - "description": "Base64 encoding/decoding in pure JS", - "version": "1.5.1", - "author": "T. Jameson Little ", - "typings": "index.d.ts", - "bugs": { - "url": "https://github.com/beatgammit/base64-js/issues" - }, - "devDependencies": { - "babel-minify": "^0.5.1", - "benchmark": "^2.1.4", - "browserify": "^16.3.0", - "standard": "*", - "tape": "4.x" - }, - "homepage": "https://github.com/beatgammit/base64-js", - "keywords": [ - "base64" - ], - "license": "MIT", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/beatgammit/base64-js.git" - }, - "scripts": { - "build": "browserify -s base64js -r ./ | minify > base64js.min.js", - "lint": "standard", - "test": "npm run lint && npm run unit", - "unit": "tape test/*.js" - }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] -} diff --git a/node_modules/binary-extensions/binary-extensions.json b/node_modules/binary-extensions/binary-extensions.json deleted file mode 100644 index ac08048..0000000 --- a/node_modules/binary-extensions/binary-extensions.json +++ /dev/null @@ -1,263 +0,0 @@ -[ - "3dm", - "3ds", - "3g2", - "3gp", - "7z", - "a", - "aac", - "adp", - "afdesign", - "afphoto", - "afpub", - "ai", - "aif", - "aiff", - "alz", - "ape", - "apk", - "appimage", - "ar", - "arj", - "asf", - "au", - "avi", - "bak", - "baml", - "bh", - "bin", - "bk", - "bmp", - "btif", - "bz2", - "bzip2", - "cab", - "caf", - "cgm", - "class", - "cmx", - "cpio", - "cr2", - "cur", - "dat", - "dcm", - "deb", - "dex", - "djvu", - "dll", - "dmg", - "dng", - "doc", - "docm", - "docx", - "dot", - "dotm", - "dra", - "DS_Store", - "dsk", - "dts", - "dtshd", - "dvb", - "dwg", - "dxf", - "ecelp4800", - "ecelp7470", - "ecelp9600", - "egg", - "eol", - "eot", - "epub", - "exe", - "f4v", - "fbs", - "fh", - "fla", - "flac", - "flatpak", - "fli", - "flv", - "fpx", - "fst", - "fvt", - "g3", - "gh", - "gif", - "graffle", - "gz", - "gzip", - "h261", - "h263", - "h264", - "icns", - "ico", - "ief", - "img", - "ipa", - "iso", - "jar", - "jpeg", - "jpg", - "jpgv", - "jpm", - "jxr", - "key", - "ktx", - "lha", - "lib", - "lvp", - "lz", - "lzh", - "lzma", - "lzo", - "m3u", - "m4a", - "m4v", - "mar", - "mdi", - "mht", - "mid", - "midi", - "mj2", - "mka", - "mkv", - "mmr", - "mng", - "mobi", - "mov", - "movie", - "mp3", - "mp4", - "mp4a", - "mpeg", - "mpg", - "mpga", - "mxu", - "nef", - "npx", - "numbers", - "nupkg", - "o", - "odp", - "ods", - "odt", - "oga", - "ogg", - "ogv", - "otf", - "ott", - "pages", - "pbm", - "pcx", - "pdb", - "pdf", - "pea", - "pgm", - "pic", - "png", - "pnm", - "pot", - "potm", - "potx", - "ppa", - "ppam", - "ppm", - "pps", - "ppsm", - "ppsx", - "ppt", - "pptm", - "pptx", - "psd", - "pya", - "pyc", - "pyo", - "pyv", - "qt", - "rar", - "ras", - "raw", - "resources", - "rgb", - "rip", - "rlc", - "rmf", - "rmvb", - "rpm", - "rtf", - "rz", - "s3m", - "s7z", - "scpt", - "sgi", - "shar", - "snap", - "sil", - "sketch", - "slk", - "smv", - "snk", - "so", - "stl", - "suo", - "sub", - "swf", - "tar", - "tbz", - "tbz2", - "tga", - "tgz", - "thmx", - "tif", - "tiff", - "tlz", - "ttc", - "ttf", - "txz", - "udf", - "uvh", - "uvi", - "uvm", - "uvp", - "uvs", - "uvu", - "viv", - "vob", - "war", - "wav", - "wax", - "wbmp", - "wdp", - "weba", - "webm", - "webp", - "whl", - "wim", - "wm", - "wma", - "wmv", - "wmx", - "woff", - "woff2", - "wrm", - "wvx", - "xbm", - "xif", - "xla", - "xlam", - "xls", - "xlsb", - "xlsm", - "xlsx", - "xlt", - "xltm", - "xltx", - "xm", - "xmind", - "xpi", - "xpm", - "xwd", - "xz", - "z", - "zip", - "zipx" -] diff --git a/node_modules/binary-extensions/binary-extensions.json.d.ts b/node_modules/binary-extensions/binary-extensions.json.d.ts deleted file mode 100644 index 94a248c..0000000 --- a/node_modules/binary-extensions/binary-extensions.json.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare const binaryExtensionsJson: readonly string[]; - -export = binaryExtensionsJson; diff --git a/node_modules/binary-extensions/index.d.ts b/node_modules/binary-extensions/index.d.ts deleted file mode 100644 index f469ac5..0000000 --- a/node_modules/binary-extensions/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** -List of binary file extensions. - -@example -``` -import binaryExtensions = require('binary-extensions'); - -console.log(binaryExtensions); -//=> ['3ds', '3g2', …] -``` -*/ -declare const binaryExtensions: readonly string[]; - -export = binaryExtensions; diff --git a/node_modules/binary-extensions/index.js b/node_modules/binary-extensions/index.js deleted file mode 100644 index d46e468..0000000 --- a/node_modules/binary-extensions/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./binary-extensions.json'); diff --git a/node_modules/binary-extensions/license b/node_modules/binary-extensions/license deleted file mode 100644 index 5493a1a..0000000 --- a/node_modules/binary-extensions/license +++ /dev/null @@ -1,10 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) -Copyright (c) Paul Miller (https://paulmillr.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/binary-extensions/package.json b/node_modules/binary-extensions/package.json deleted file mode 100644 index 4710c33..0000000 --- a/node_modules/binary-extensions/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "binary-extensions", - "version": "2.3.0", - "description": "List of binary file extensions", - "license": "MIT", - "repository": "sindresorhus/binary-extensions", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "sideEffects": false, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts", - "binary-extensions.json", - "binary-extensions.json.d.ts" - ], - "keywords": [ - "binary", - "extensions", - "extension", - "file", - "json", - "list", - "array" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/binary-extensions/readme.md b/node_modules/binary-extensions/readme.md deleted file mode 100644 index 88519b3..0000000 --- a/node_modules/binary-extensions/readme.md +++ /dev/null @@ -1,25 +0,0 @@ -# binary-extensions - -> List of binary file extensions - -The list is just a [JSON file](binary-extensions.json) and can be used anywhere. - -## Install - -```sh -npm install binary-extensions -``` - -## Usage - -```js -const binaryExtensions = require('binary-extensions'); - -console.log(binaryExtensions); -//=> ['3ds', '3g2', …] -``` - -## Related - -- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file -- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions diff --git a/node_modules/bl/.github/dependabot.yml b/node_modules/bl/.github/dependabot.yml deleted file mode 100644 index f468993..0000000 --- a/node_modules/bl/.github/dependabot.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: 2 -updates: - - package-ecosystem: 'github-actions' - directory: '/' - schedule: - interval: 'daily' - commit-message: - prefix: 'chore' - include: 'scope' - - package-ecosystem: 'npm' - directory: '/' - schedule: - interval: 'daily' - commit-message: - prefix: 'chore' - include: 'scope' diff --git a/node_modules/bl/.github/workflows/test-and-release.yml b/node_modules/bl/.github/workflows/test-and-release.yml deleted file mode 100644 index 65887a0..0000000 --- a/node_modules/bl/.github/workflows/test-and-release.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Test & Maybe Release -on: [push, pull_request] -jobs: - test: - strategy: - fail-fast: false - matrix: - node: [14.x, 16.x, 18.x, lts/*, current] - os: [macos-latest, ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node }} - uses: actions/setup-node@v3.5.1 - with: - node-version: ${{ matrix.node }} - - name: Install Dependencies - run: | - npm install --no-progress - - name: Run tests - run: | - npm config set script-shell bash - npm run test:ci - release: - name: Release - needs: test - runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/master' - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup Node.js - uses: actions/setup-node@v3.5.1 - with: - node-version: 14 - - name: Install dependencies - run: | - npm install --no-progress --no-package-lock --no-save - - name: Build - run: | - npm run build - - name: Install plugins - run: | - npm install \ - @semantic-release/commit-analyzer \ - conventional-changelog-conventionalcommits \ - @semantic-release/release-notes-generator \ - @semantic-release/npm \ - @semantic-release/github \ - @semantic-release/git \ - @semantic-release/changelog \ - --no-progress --no-package-lock --no-save - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release - diff --git a/node_modules/bl/BufferList.d.ts b/node_modules/bl/BufferList.d.ts deleted file mode 100644 index 1561583..0000000 --- a/node_modules/bl/BufferList.d.ts +++ /dev/null @@ -1,382 +0,0 @@ -export type BufferListAcceptedTypes = - | Buffer - | BufferList - | Uint8Array - | BufferListAcceptedTypes[] - | string - | number; - -export interface BufferListConstructor { - new (initData?: BufferListAcceptedTypes): BufferList; - (initData?: BufferListAcceptedTypes): BufferList; - - /** - * Determines if the passed object is a BufferList. It will return true - * if the passed object is an instance of BufferList or BufferListStream - * and false otherwise. - * - * N.B. this won't return true for BufferList or BufferListStream instances - * created by versions of this library before this static method was added. - * - * @param other - */ - - isBufferList(other: unknown): boolean; -} - -interface BufferList { - prototype: Object - - /** - * Get the length of the list in bytes. This is the sum of the lengths - * of all of the buffers contained in the list, minus any initial offset - * for a semi-consumed buffer at the beginning. Should accurately - * represent the total number of bytes that can be read from the list. - */ - - length: number; - - /** - * Adds an additional buffer or BufferList to the internal list. - * this is returned so it can be chained. - * - * @param buffer - */ - - append(buffer: BufferListAcceptedTypes): this; - - /** - * Will return the byte at the specified index. - * @param index - */ - - get(index: number): number; - - /** - * Returns a new Buffer object containing the bytes within the - * range specified. Both start and end are optional and will - * default to the beginning and end of the list respectively. - * - * If the requested range spans a single internal buffer then a - * slice of that buffer will be returned which shares the original - * memory range of that Buffer. If the range spans multiple buffers - * then copy operations will likely occur to give you a uniform Buffer. - * - * @param start - * @param end - */ - - slice(start?: number, end?: number): Buffer; - - /** - * Returns a new BufferList object containing the bytes within the - * range specified. Both start and end are optional and will default - * to the beginning and end of the list respectively. - * - * No copies will be performed. All buffers in the result share - * memory with the original list. - * - * @param start - * @param end - */ - - shallowSlice(start?: number, end?: number): this; - - /** - * Copies the content of the list in the `dest` buffer, starting from - * `destStart` and containing the bytes within the range specified - * with `srcStart` to `srcEnd`. - * - * `destStart`, `start` and `end` are optional and will default to the - * beginning of the dest buffer, and the beginning and end of the - * list respectively. - * - * @param dest - * @param destStart - * @param srcStart - * @param srcEnd - */ - - copy( - dest: Buffer, - destStart?: number, - srcStart?: number, - srcEnd?: number - ): Buffer; - - /** - * Performs a shallow-copy of the list. The internal Buffers remains the - * same, so if you change the underlying Buffers, the change will be - * reflected in both the original and the duplicate. - * - * This method is needed if you want to call consume() or pipe() and - * still keep the original list. - * - * @example - * - * ```js - * var bl = new BufferListStream(); - * bl.append('hello'); - * bl.append(' world'); - * bl.append('\n'); - * bl.duplicate().pipe(process.stdout, { end: false }); - * - * console.log(bl.toString()) - * ``` - */ - - duplicate(): this; - - /** - * Will shift bytes off the start of the list. The number of bytes - * consumed don't need to line up with the sizes of the internal - * Buffers—initial offsets will be calculated accordingly in order - * to give you a consistent view of the data. - * - * @param bytes - */ - - consume(bytes?: number): void; - - /** - * Will return a string representation of the buffer. The optional - * `start` and `end` arguments are passed on to `slice()`, while - * the encoding is passed on to `toString()` of the resulting Buffer. - * - * See the [`Buffer#toString()`](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) - * documentation for more information. - * - * @param encoding - * @param start - * @param end - */ - - toString(encoding?: string, start?: number, end?: number): string; - - /** - * Will return the byte at the specified index. indexOf() method - * returns the first index at which a given element can be found - * in the BufferList, or -1 if it is not present. - * - * @param value - * @param byteOffset - * @param encoding - */ - - indexOf( - value: string | number | Uint8Array | BufferList | Buffer, - byteOffset?: number, - encoding?: string - ): number; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readDoubleBE: Buffer['readDoubleBE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readDoubleLE: Buffer['readDoubleLE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readFloatBE: Buffer['readFloatBE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readFloatLE: Buffer['readFloatLE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readInt32BE: Buffer['readInt32BE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readInt32LE: Buffer['readInt32LE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readUInt32BE: Buffer['readUInt32BE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readUInt32LE: Buffer['readUInt32LE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are implemented and will operate across internal Buffer boundaries transparently. - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - * - * @param offset - */ - - readInt16BE: Buffer['readInt16BE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readInt16LE: Buffer['readInt16LE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readUInt16BE: Buffer['readUInt16BE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readUInt16LE: Buffer['readUInt16LE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readInt8: Buffer['readInt8']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readUInt8: Buffer['readUInt8']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readIntBE: Buffer['readIntBE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readIntLE: Buffer['readIntLE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readUIntBE: Buffer['readUIntBE']; - - /** - * All of the standard byte-reading methods of the Buffer interface are - * implemented and will operate across internal Buffer boundaries transparently. - * - * See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) - * documentation for how these work. - * - * @param offset - */ - - readUIntLE: Buffer['readUIntLE']; -} - -/** - * No arguments are required for the constructor, but you can initialise - * the list by passing in a single Buffer object or an array of Buffer - * objects. - * - * `new` is not strictly required, if you don't instantiate a new object, - * it will be done automatically for you so you can create a new instance - * simply with: - * - * ```js - * const { BufferList } = require('bl') - * const bl = BufferList() - * - * // equivalent to: - * - * const { BufferList } = require('bl') - * const bl = new BufferList() - * ``` - */ - -declare const BufferList: BufferListConstructor; diff --git a/node_modules/bl/BufferList.js b/node_modules/bl/BufferList.js deleted file mode 100644 index 471ee77..0000000 --- a/node_modules/bl/BufferList.js +++ /dev/null @@ -1,396 +0,0 @@ -'use strict' - -const { Buffer } = require('buffer') -const symbol = Symbol.for('BufferList') - -function BufferList (buf) { - if (!(this instanceof BufferList)) { - return new BufferList(buf) - } - - BufferList._init.call(this, buf) -} - -BufferList._init = function _init (buf) { - Object.defineProperty(this, symbol, { value: true }) - - this._bufs = [] - this.length = 0 - - if (buf) { - this.append(buf) - } -} - -BufferList.prototype._new = function _new (buf) { - return new BufferList(buf) -} - -BufferList.prototype._offset = function _offset (offset) { - if (offset === 0) { - return [0, 0] - } - - let tot = 0 - - for (let i = 0; i < this._bufs.length; i++) { - const _t = tot + this._bufs[i].length - if (offset < _t || i === this._bufs.length - 1) { - return [i, offset - tot] - } - tot = _t - } -} - -BufferList.prototype._reverseOffset = function (blOffset) { - const bufferId = blOffset[0] - let offset = blOffset[1] - - for (let i = 0; i < bufferId; i++) { - offset += this._bufs[i].length - } - - return offset -} - -BufferList.prototype.get = function get (index) { - if (index > this.length || index < 0) { - return undefined - } - - const offset = this._offset(index) - - return this._bufs[offset[0]][offset[1]] -} - -BufferList.prototype.slice = function slice (start, end) { - if (typeof start === 'number' && start < 0) { - start += this.length - } - - if (typeof end === 'number' && end < 0) { - end += this.length - } - - return this.copy(null, 0, start, end) -} - -BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) { - if (typeof srcStart !== 'number' || srcStart < 0) { - srcStart = 0 - } - - if (typeof srcEnd !== 'number' || srcEnd > this.length) { - srcEnd = this.length - } - - if (srcStart >= this.length) { - return dst || Buffer.alloc(0) - } - - if (srcEnd <= 0) { - return dst || Buffer.alloc(0) - } - - const copy = !!dst - const off = this._offset(srcStart) - const len = srcEnd - srcStart - let bytes = len - let bufoff = (copy && dstStart) || 0 - let start = off[1] - - // copy/slice everything - if (srcStart === 0 && srcEnd === this.length) { - if (!copy) { - // slice, but full concat if multiple buffers - return this._bufs.length === 1 - ? this._bufs[0] - : Buffer.concat(this._bufs, this.length) - } - - // copy, need to copy individual buffers - for (let i = 0; i < this._bufs.length; i++) { - this._bufs[i].copy(dst, bufoff) - bufoff += this._bufs[i].length - } - - return dst - } - - // easy, cheap case where it's a subset of one of the buffers - if (bytes <= this._bufs[off[0]].length - start) { - return copy - ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) - : this._bufs[off[0]].slice(start, start + bytes) - } - - if (!copy) { - // a slice, we need something to copy in to - dst = Buffer.allocUnsafe(len) - } - - for (let i = off[0]; i < this._bufs.length; i++) { - const l = this._bufs[i].length - start - - if (bytes > l) { - this._bufs[i].copy(dst, bufoff, start) - bufoff += l - } else { - this._bufs[i].copy(dst, bufoff, start, start + bytes) - bufoff += l - break - } - - bytes -= l - - if (start) { - start = 0 - } - } - - // safeguard so that we don't return uninitialized memory - if (dst.length > bufoff) return dst.slice(0, bufoff) - - return dst -} - -BufferList.prototype.shallowSlice = function shallowSlice (start, end) { - start = start || 0 - end = typeof end !== 'number' ? this.length : end - - if (start < 0) { - start += this.length - } - - if (end < 0) { - end += this.length - } - - if (start === end) { - return this._new() - } - - const startOffset = this._offset(start) - const endOffset = this._offset(end) - const buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1) - - if (endOffset[1] === 0) { - buffers.pop() - } else { - buffers[buffers.length - 1] = buffers[buffers.length - 1].slice(0, endOffset[1]) - } - - if (startOffset[1] !== 0) { - buffers[0] = buffers[0].slice(startOffset[1]) - } - - return this._new(buffers) -} - -BufferList.prototype.toString = function toString (encoding, start, end) { - return this.slice(start, end).toString(encoding) -} - -BufferList.prototype.consume = function consume (bytes) { - // first, normalize the argument, in accordance with how Buffer does it - bytes = Math.trunc(bytes) - // do nothing if not a positive number - if (Number.isNaN(bytes) || bytes <= 0) return this - - while (this._bufs.length) { - if (bytes >= this._bufs[0].length) { - bytes -= this._bufs[0].length - this.length -= this._bufs[0].length - this._bufs.shift() - } else { - this._bufs[0] = this._bufs[0].slice(bytes) - this.length -= bytes - break - } - } - - return this -} - -BufferList.prototype.duplicate = function duplicate () { - const copy = this._new() - - for (let i = 0; i < this._bufs.length; i++) { - copy.append(this._bufs[i]) - } - - return copy -} - -BufferList.prototype.append = function append (buf) { - if (buf == null) { - return this - } - - if (buf.buffer) { - // append a view of the underlying ArrayBuffer - this._appendBuffer(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)) - } else if (Array.isArray(buf)) { - for (let i = 0; i < buf.length; i++) { - this.append(buf[i]) - } - } else if (this._isBufferList(buf)) { - // unwrap argument into individual BufferLists - for (let i = 0; i < buf._bufs.length; i++) { - this.append(buf._bufs[i]) - } - } else { - // coerce number arguments to strings, since Buffer(number) does - // uninitialized memory allocation - if (typeof buf === 'number') { - buf = buf.toString() - } - - this._appendBuffer(Buffer.from(buf)) - } - - return this -} - -BufferList.prototype._appendBuffer = function appendBuffer (buf) { - this._bufs.push(buf) - this.length += buf.length -} - -BufferList.prototype.indexOf = function (search, offset, encoding) { - if (encoding === undefined && typeof offset === 'string') { - encoding = offset - offset = undefined - } - - if (typeof search === 'function' || Array.isArray(search)) { - throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.') - } else if (typeof search === 'number') { - search = Buffer.from([search]) - } else if (typeof search === 'string') { - search = Buffer.from(search, encoding) - } else if (this._isBufferList(search)) { - search = search.slice() - } else if (Array.isArray(search.buffer)) { - search = Buffer.from(search.buffer, search.byteOffset, search.byteLength) - } else if (!Buffer.isBuffer(search)) { - search = Buffer.from(search) - } - - offset = Number(offset || 0) - - if (isNaN(offset)) { - offset = 0 - } - - if (offset < 0) { - offset = this.length + offset - } - - if (offset < 0) { - offset = 0 - } - - if (search.length === 0) { - return offset > this.length ? this.length : offset - } - - const blOffset = this._offset(offset) - let blIndex = blOffset[0] // index of which internal buffer we're working on - let buffOffset = blOffset[1] // offset of the internal buffer we're working on - - // scan over each buffer - for (; blIndex < this._bufs.length; blIndex++) { - const buff = this._bufs[blIndex] - - while (buffOffset < buff.length) { - const availableWindow = buff.length - buffOffset - - if (availableWindow >= search.length) { - const nativeSearchResult = buff.indexOf(search, buffOffset) - - if (nativeSearchResult !== -1) { - return this._reverseOffset([blIndex, nativeSearchResult]) - } - - buffOffset = buff.length - search.length + 1 // end of native search window - } else { - const revOffset = this._reverseOffset([blIndex, buffOffset]) - - if (this._match(revOffset, search)) { - return revOffset - } - - buffOffset++ - } - } - - buffOffset = 0 - } - - return -1 -} - -BufferList.prototype._match = function (offset, search) { - if (this.length - offset < search.length) { - return false - } - - for (let searchOffset = 0; searchOffset < search.length; searchOffset++) { - if (this.get(offset + searchOffset) !== search[searchOffset]) { - return false - } - } - return true -} - -;(function () { - const methods = { - readDoubleBE: 8, - readDoubleLE: 8, - readFloatBE: 4, - readFloatLE: 4, - readInt32BE: 4, - readInt32LE: 4, - readUInt32BE: 4, - readUInt32LE: 4, - readInt16BE: 2, - readInt16LE: 2, - readUInt16BE: 2, - readUInt16LE: 2, - readInt8: 1, - readUInt8: 1, - readIntBE: null, - readIntLE: null, - readUIntBE: null, - readUIntLE: null - } - - for (const m in methods) { - (function (m) { - if (methods[m] === null) { - BufferList.prototype[m] = function (offset, byteLength) { - return this.slice(offset, offset + byteLength)[m](0, byteLength) - } - } else { - BufferList.prototype[m] = function (offset = 0) { - return this.slice(offset, offset + methods[m])[m](0) - } - } - }(m)) - } -}()) - -// Used internally by the class and also as an indicator of this object being -// a `BufferList`. It's not possible to use `instanceof BufferList` in a browser -// environment because there could be multiple different copies of the -// BufferList class and some `BufferList`s might be `BufferList`s. -BufferList.prototype._isBufferList = function _isBufferList (b) { - return b instanceof BufferList || BufferList.isBufferList(b) -} - -BufferList.isBufferList = function isBufferList (b) { - return b != null && b[symbol] -} - -module.exports = BufferList diff --git a/node_modules/bl/CHANGELOG.md b/node_modules/bl/CHANGELOG.md deleted file mode 100644 index a6156dc..0000000 --- a/node_modules/bl/CHANGELOG.md +++ /dev/null @@ -1,17 +0,0 @@ -## [5.1.0](https://github.com/rvagg/bl/compare/v5.0.0...v5.1.0) (2022-10-18) - - -### Features - -* added integrated TypeScript typings ([#108](https://github.com/rvagg/bl/issues/108)) ([433ff89](https://github.com/rvagg/bl/commit/433ff8942f47fab8a5c9d13b2c00989ccf8d0710)) - - -### Bug Fixes - -* windows support in tests ([387dfaf](https://github.com/rvagg/bl/commit/387dfaf9b2bca7849f12785436ceb01e42adac2c)) - - -### Trivial Changes - -* GH Actions, Dependabot, auto-release, remove Travis ([997f058](https://github.com/rvagg/bl/commit/997f058357de8f2a7f66998e80a72b491835573f)) -* **no-release:** bump standard from 16.0.4 to 17.0.0 ([#112](https://github.com/rvagg/bl/issues/112)) ([078bfe3](https://github.com/rvagg/bl/commit/078bfe33390d125297b1c946e5989c4aa9228961)) diff --git a/node_modules/bl/LICENSE.md b/node_modules/bl/LICENSE.md deleted file mode 100644 index ecbe516..0000000 --- a/node_modules/bl/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2013-2019 bl contributors ----------------------------------- - -*bl contributors listed at * - -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/bl/README.md b/node_modules/bl/README.md deleted file mode 100644 index 9680b1d..0000000 --- a/node_modules/bl/README.md +++ /dev/null @@ -1,247 +0,0 @@ -# bl *(BufferList)* - -[![Build Status](https://api.travis-ci.com/rvagg/bl.svg?branch=master)](https://travis-ci.com/rvagg/bl/) - -**A Node.js Buffer list collector, reader and streamer thingy.** - -[![NPM](https://nodei.co/npm/bl.svg)](https://nodei.co/npm/bl/) - -**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them! - -The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently. - -```js -const { BufferList } = require('bl') - -const bl = new BufferList() -bl.append(Buffer.from('abcd')) -bl.append(Buffer.from('efg')) -bl.append('hi') // bl will also accept & convert Strings -bl.append(Buffer.from('j')) -bl.append(Buffer.from([ 0x3, 0x4 ])) - -console.log(bl.length) // 12 - -console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij' -console.log(bl.slice(3, 10).toString('ascii')) // 'defghij' -console.log(bl.slice(3, 6).toString('ascii')) // 'def' -console.log(bl.slice(3, 8).toString('ascii')) // 'defgh' -console.log(bl.slice(5, 10).toString('ascii')) // 'fghij' - -console.log(bl.indexOf('def')) // 3 -console.log(bl.indexOf('asdf')) // -1 - -// or just use toString! -console.log(bl.toString()) // 'abcdefghij\u0003\u0004' -console.log(bl.toString('ascii', 3, 8)) // 'defgh' -console.log(bl.toString('ascii', 5, 10)) // 'fghij' - -// other standard Buffer readables -console.log(bl.readUInt16BE(10)) // 0x0304 -console.log(bl.readUInt16LE(10)) // 0x0403 -``` - -Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**: - -```js -const { BufferListStream } = require('bl') -const fs = require('fs') - -fs.createReadStream('README.md') - .pipe(BufferListStream((err, data) => { // note 'new' isn't strictly required - // `data` is a complete Buffer object containing the full data - console.log(data.toString()) - })) -``` - -Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream. - -Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!): - -```js -const hyperquest = require('hyperquest') -const { BufferListStream } = require('bl') - -const url = 'https://raw.github.com/rvagg/bl/master/README.md' - -hyperquest(url).pipe(BufferListStream((err, data) => { - console.log(data.toString()) -})) -``` - -Or, use it as a readable stream to recompose a list of Buffers to an output source: - -```js -const { BufferListStream } = require('bl') -const fs = require('fs') - -var bl = new BufferListStream() -bl.append(Buffer.from('abcd')) -bl.append(Buffer.from('efg')) -bl.append(Buffer.from('hi')) -bl.append(Buffer.from('j')) - -bl.pipe(fs.createWriteStream('gibberish.txt')) -``` - -## API - - * new BufferList([ buf ]) - * BufferList.isBufferList(obj) - * bl.length - * bl.append(buffer) - * bl.get(index) - * bl.indexOf(value[, byteOffset][, encoding]) - * bl.slice([ start[, end ] ]) - * bl.shallowSlice([ start[, end ] ]) - * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) - * bl.duplicate() - * bl.consume(bytes) - * bl.toString([encoding, [ start, [ end ]]]) - * bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() - * new BufferListStream([ callback ]) - --------------------------------------------------------- - -### new BufferList([ Buffer | Buffer array | BufferList | BufferList array | String ]) -No arguments are _required_ for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` objects. - -`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: - -```js -const { BufferList } = require('bl') -const bl = BufferList() - -// equivalent to: - -const { BufferList } = require('bl') -const bl = new BufferList() -``` - --------------------------------------------------------- - -### BufferList.isBufferList(obj) -Determines if the passed object is a `BufferList`. It will return `true` if the passed object is an instance of `BufferList` **or** `BufferListStream` and `false` otherwise. - -N.B. this won't return `true` for `BufferList` or `BufferListStream` instances created by versions of this library before this static method was added. - --------------------------------------------------------- - -### bl.length -Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list. - --------------------------------------------------------- - -### bl.append(Buffer | Buffer array | BufferList | BufferList array | String) -`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained. - --------------------------------------------------------- - -### bl.get(index) -`get()` will return the byte at the specified index. - --------------------------------------------------------- - -### bl.indexOf(value[, byteOffset][, encoding]) -`get()` will return the byte at the specified index. -`indexOf()` method returns the first index at which a given element can be found in the BufferList, or -1 if it is not present. - --------------------------------------------------------- - -### bl.slice([ start, [ end ] ]) -`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively. - -If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer. - --------------------------------------------------------- - -### bl.shallowSlice([ start, [ end ] ]) -`shallowSlice()` returns a new `BufferList` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively. - -No copies will be performed. All buffers in the result share memory with the original list. - --------------------------------------------------------- - -### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) -`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively. - --------------------------------------------------------- - -### bl.duplicate() -`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example: - -```js -var bl = new BufferListStream() - -bl.append('hello') -bl.append(' world') -bl.append('\n') - -bl.duplicate().pipe(process.stdout, { end: false }) - -console.log(bl.toString()) -``` - --------------------------------------------------------- - -### bl.consume(bytes) -`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data. - --------------------------------------------------------- - -### bl.toString([encoding, [ start, [ end ]]]) -`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information. - --------------------------------------------------------- - -### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() - -All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently. - -See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - --------------------------------------------------------- - -### new BufferListStream([ callback | Buffer | Buffer array | BufferList | BufferList array | String ]) -**BufferListStream** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **BufferListStream** instance. - -The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream. - -Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object. - -`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: - -```js -const { BufferListStream } = require('bl') -const bl = BufferListStream() - -// equivalent to: - -const { BufferListStream } = require('bl') -const bl = new BufferListStream() -``` - -N.B. For backwards compatibility reasons, `BufferListStream` is the **default** export when you `require('bl')`: - -```js -const { BufferListStream } = require('bl') -// equivalent to: -const BufferListStream = require('bl') -``` - --------------------------------------------------------- - -## Contributors - -**bl** is brought to you by the following hackers: - - * [Rod Vagg](https://github.com/rvagg) - * [Matteo Collina](https://github.com/mcollina) - * [Jarett Cruger](https://github.com/jcrugzz) - - -## License & copyright - -Copyright (c) 2013-2019 bl contributors (listed above). - -bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. diff --git a/node_modules/bl/bl.js b/node_modules/bl/bl.js deleted file mode 100644 index 40228f8..0000000 --- a/node_modules/bl/bl.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict' - -const DuplexStream = require('readable-stream').Duplex -const inherits = require('inherits') -const BufferList = require('./BufferList') - -function BufferListStream (callback) { - if (!(this instanceof BufferListStream)) { - return new BufferListStream(callback) - } - - if (typeof callback === 'function') { - this._callback = callback - - const piper = function piper (err) { - if (this._callback) { - this._callback(err) - this._callback = null - } - }.bind(this) - - this.on('pipe', function onPipe (src) { - src.on('error', piper) - }) - this.on('unpipe', function onUnpipe (src) { - src.removeListener('error', piper) - }) - - callback = null - } - - BufferList._init.call(this, callback) - DuplexStream.call(this) -} - -inherits(BufferListStream, DuplexStream) -Object.assign(BufferListStream.prototype, BufferList.prototype) - -BufferListStream.prototype._new = function _new (callback) { - return new BufferListStream(callback) -} - -BufferListStream.prototype._write = function _write (buf, encoding, callback) { - this._appendBuffer(buf) - - if (typeof callback === 'function') { - callback() - } -} - -BufferListStream.prototype._read = function _read (size) { - if (!this.length) { - return this.push(null) - } - - size = Math.min(size, this.length) - this.push(this.slice(0, size)) - this.consume(size) -} - -BufferListStream.prototype.end = function end (chunk) { - DuplexStream.prototype.end.call(this, chunk) - - if (this._callback) { - this._callback(null, this.slice()) - this._callback = null - } -} - -BufferListStream.prototype._destroy = function _destroy (err, cb) { - this._bufs.length = 0 - this.length = 0 - cb(err) -} - -BufferListStream.prototype._isBufferList = function _isBufferList (b) { - return b instanceof BufferListStream || b instanceof BufferList || BufferListStream.isBufferList(b) -} - -BufferListStream.isBufferList = BufferList.isBufferList - -module.exports = BufferListStream -module.exports.BufferListStream = BufferListStream -module.exports.BufferList = BufferList diff --git a/node_modules/bl/index.d.ts b/node_modules/bl/index.d.ts deleted file mode 100644 index 07a8ee3..0000000 --- a/node_modules/bl/index.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { Duplex } from "readable-stream"; -import { - BufferList as BL, - BufferListConstructor, - BufferListAcceptedTypes, -} from "./BufferList"; - -type BufferListStreamInit = - | ((err: Error, buffer: Buffer) => void) - | BufferListAcceptedTypes; - -interface BufferListStreamConstructor { - new (initData?: BufferListStreamInit): BufferListStream; - (callback?: BufferListStreamInit): BufferListStream; - - /** - * Determines if the passed object is a BufferList. It will return true - * if the passed object is an instance of BufferList or BufferListStream - * and false otherwise. - * - * N.B. this won't return true for BufferList or BufferListStream instances - * created by versions of this library before this static method was added. - * - * @param other - */ - - isBufferList(other: unknown): boolean; - - /** - * Rexporting BufferList and BufferListStream to fix - * issue with require/commonjs import and "export = " below. - */ - - BufferList: BufferListConstructor; - BufferListStream: BufferListStreamConstructor; -} - -interface BufferListStream extends Duplex, BL { - prototype: BufferListStream & BL; -} - -/** - * BufferListStream is a Node Duplex Stream, so it can be read from - * and written to like a standard Node stream. You can also pipe() - * to and from a BufferListStream instance. - * - * The constructor takes an optional callback, if supplied, the - * callback will be called with an error argument followed by a - * reference to the bl instance, when bl.end() is called - * (i.e. from a piped stream). - * - * This is a convenient method of collecting the entire contents of - * a stream, particularly when the stream is chunky, such as a network - * stream. - * - * Normally, no arguments are required for the constructor, but you can - * initialise the list by passing in a single Buffer object or an array - * of Buffer object. - * - * `new` is not strictly required, if you don't instantiate a new object, - * it will be done automatically for you so you can create a new instance - * simply with: - * - * ```js - * const { BufferListStream } = require('bl'); - * const bl = BufferListStream(); - * - * // equivalent to: - * - * const { BufferListStream } = require('bl'); - * const bl = new BufferListStream(); - * ``` - * - * N.B. For backwards compatibility reasons, BufferListStream is the default - * export when you `require('bl')`: - * - * ```js - * const { BufferListStream } = require('bl') - * - * // equivalent to: - * - * const BufferListStream = require('bl') - * ``` - */ - -declare const BufferListStream: BufferListStreamConstructor; - -export = BufferListStream; diff --git a/node_modules/bl/package.json b/node_modules/bl/package.json deleted file mode 100644 index 92a08e3..0000000 --- a/node_modules/bl/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "bl", - "version": "5.1.0", - "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!", - "license": "MIT", - "main": "bl.js", - "scripts": { - "lint": "standard *.js test/*.js", - "test": "npm run lint && npm run test:types && node test/test.js | faucet", - "test:ci": "npm run lint && node test/test.js && npm run test:types", - "test:types": "tsc --allowJs --noEmit test/test.js", - "build": "true" - }, - "repository": { - "type": "git", - "url": "https://github.com/rvagg/bl.git" - }, - "homepage": "https://github.com/rvagg/bl", - "authors": [ - "Rod Vagg (https://github.com/rvagg)", - "Matteo Collina (https://github.com/mcollina)", - "Jarett Cruger (https://github.com/jcrugzz)" - ], - "keywords": [ - "buffer", - "buffers", - "stream", - "awesomesauce" - ], - "dependencies": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - }, - "devDependencies": { - "@types/readable-stream": "^2.3.13", - "faucet": "~0.0.1", - "standard": "^17.0.0", - "tape": "^5.2.2", - "typescript": "~4.7.3" - }, - "release": { - "branches": [ - "master" - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "releaseRules": [ - { - "breaking": true, - "release": "major" - }, - { - "revert": true, - "release": "patch" - }, - { - "type": "feat", - "release": "minor" - }, - { - "type": "fix", - "release": "patch" - }, - { - "type": "chore", - "release": "patch" - }, - { - "type": "docs", - "release": "patch" - }, - { - "type": "test", - "release": "patch" - }, - { - "scope": "no-release", - "release": false - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { - "type": "feat", - "section": "Features" - }, - { - "type": "fix", - "section": "Bug Fixes" - }, - { - "type": "chore", - "section": "Trivial Changes" - }, - { - "type": "docs", - "section": "Trivial Changes" - }, - { - "type": "test", - "section": "Tests" - } - ] - } - } - ], - "@semantic-release/changelog", - "@semantic-release/npm", - "@semantic-release/github", - "@semantic-release/git" - ] - } -} diff --git a/node_modules/bl/test/convert.js b/node_modules/bl/test/convert.js deleted file mode 100644 index 9f3e235..0000000 --- a/node_modules/bl/test/convert.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict' - -const tape = require('tape') -const { BufferList, BufferListStream } = require('../') -const { Buffer } = require('buffer') - -tape('convert from BufferList to BufferListStream', (t) => { - const data = Buffer.from(`TEST-${Date.now()}`) - const bl = new BufferList(data) - const bls = new BufferListStream(bl) - t.ok(bl.slice().equals(bls.slice())) - t.end() -}) - -tape('convert from BufferListStream to BufferList', (t) => { - const data = Buffer.from(`TEST-${Date.now()}`) - const bls = new BufferListStream(data) - const bl = new BufferList(bls) - t.ok(bl.slice().equals(bls.slice())) - t.end() -}) diff --git a/node_modules/bl/test/indexOf.js b/node_modules/bl/test/indexOf.js deleted file mode 100644 index 62dcb01..0000000 --- a/node_modules/bl/test/indexOf.js +++ /dev/null @@ -1,492 +0,0 @@ -'use strict' - -const tape = require('tape') -const BufferList = require('../') -const { Buffer } = require('buffer') - -tape('indexOf single byte needle', (t) => { - const bl = new BufferList(['abcdefg', 'abcdefg', '12345']) - - t.equal(bl.indexOf('e'), 4) - t.equal(bl.indexOf('e', 5), 11) - t.equal(bl.indexOf('e', 12), -1) - t.equal(bl.indexOf('5'), 18) - - t.end() -}) - -tape('indexOf multiple byte needle', (t) => { - const bl = new BufferList(['abcdefg', 'abcdefg']) - - t.equal(bl.indexOf('ef'), 4) - t.equal(bl.indexOf('ef', 5), 11) - - t.end() -}) - -tape('indexOf multiple byte needles across buffer boundaries', (t) => { - const bl = new BufferList(['abcdefg', 'abcdefg']) - - t.equal(bl.indexOf('fgabc'), 5) - - t.end() -}) - -tape('indexOf takes a Uint8Array search', (t) => { - const bl = new BufferList(['abcdefg', 'abcdefg']) - const search = new Uint8Array([102, 103, 97, 98, 99]) // fgabc - - t.equal(bl.indexOf(search), 5) - - t.end() -}) - -tape('indexOf takes a buffer list search', (t) => { - const bl = new BufferList(['abcdefg', 'abcdefg']) - const search = new BufferList('fgabc') - - t.equal(bl.indexOf(search), 5) - - t.end() -}) - -tape('indexOf a zero byte needle', (t) => { - const b = new BufferList('abcdef') - const bufEmpty = Buffer.from('') - - t.equal(b.indexOf(''), 0) - t.equal(b.indexOf('', 1), 1) - t.equal(b.indexOf('', b.length + 1), b.length) - t.equal(b.indexOf('', Infinity), b.length) - t.equal(b.indexOf(bufEmpty), 0) - t.equal(b.indexOf(bufEmpty, 1), 1) - t.equal(b.indexOf(bufEmpty, b.length + 1), b.length) - t.equal(b.indexOf(bufEmpty, Infinity), b.length) - - t.end() -}) - -tape('indexOf buffers smaller and larger than the needle', (t) => { - const bl = new BufferList(['abcdefg', 'a', 'bcdefg', 'a', 'bcfgab']) - - t.equal(bl.indexOf('fgabc'), 5) - t.equal(bl.indexOf('fgabc', 6), 12) - t.equal(bl.indexOf('fgabc', 13), -1) - - t.end() -}) - -// only present in node 6+ -;(process.version.substr(1).split('.')[0] >= 6) && tape('indexOf latin1 and binary encoding', (t) => { - const b = new BufferList('abcdef') - - // test latin1 encoding - t.equal( - new BufferList(Buffer.from(b.toString('latin1'), 'latin1')) - .indexOf('d', 0, 'latin1'), - 3 - ) - t.equal( - new BufferList(Buffer.from(b.toString('latin1'), 'latin1')) - .indexOf(Buffer.from('d', 'latin1'), 0, 'latin1'), - 3 - ) - t.equal( - new BufferList(Buffer.from('aa\u00e8aa', 'latin1')) - .indexOf('\u00e8', 'latin1'), - 2 - ) - t.equal( - new BufferList(Buffer.from('\u00e8', 'latin1')) - .indexOf('\u00e8', 'latin1'), - 0 - ) - t.equal( - new BufferList(Buffer.from('\u00e8', 'latin1')) - .indexOf(Buffer.from('\u00e8', 'latin1'), 'latin1'), - 0 - ) - - // test binary encoding - t.equal( - new BufferList(Buffer.from(b.toString('binary'), 'binary')) - .indexOf('d', 0, 'binary'), - 3 - ) - t.equal( - new BufferList(Buffer.from(b.toString('binary'), 'binary')) - .indexOf(Buffer.from('d', 'binary'), 0, 'binary'), - 3 - ) - t.equal( - new BufferList(Buffer.from('aa\u00e8aa', 'binary')) - .indexOf('\u00e8', 'binary'), - 2 - ) - t.equal( - new BufferList(Buffer.from('\u00e8', 'binary')) - .indexOf('\u00e8', 'binary'), - 0 - ) - t.equal( - new BufferList(Buffer.from('\u00e8', 'binary')) - .indexOf(Buffer.from('\u00e8', 'binary'), 'binary'), - 0 - ) - - t.end() -}) - -tape('indexOf the entire nodejs10 buffer test suite', (t) => { - const b = new BufferList('abcdef') - const bufA = Buffer.from('a') - const bufBc = Buffer.from('bc') - const bufF = Buffer.from('f') - const bufZ = Buffer.from('z') - - const stringComparison = 'abcdef' - - t.equal(b.indexOf('a'), 0) - t.equal(b.indexOf('a', 1), -1) - t.equal(b.indexOf('a', -1), -1) - t.equal(b.indexOf('a', -4), -1) - t.equal(b.indexOf('a', -b.length), 0) - t.equal(b.indexOf('a', NaN), 0) - t.equal(b.indexOf('a', -Infinity), 0) - t.equal(b.indexOf('a', Infinity), -1) - t.equal(b.indexOf('bc'), 1) - t.equal(b.indexOf('bc', 2), -1) - t.equal(b.indexOf('bc', -1), -1) - t.equal(b.indexOf('bc', -3), -1) - t.equal(b.indexOf('bc', -5), 1) - t.equal(b.indexOf('bc', NaN), 1) - t.equal(b.indexOf('bc', -Infinity), 1) - t.equal(b.indexOf('bc', Infinity), -1) - t.equal(b.indexOf('f'), b.length - 1) - t.equal(b.indexOf('z'), -1) - - // empty search tests - t.equal(b.indexOf(bufA), 0) - t.equal(b.indexOf(bufA, 1), -1) - t.equal(b.indexOf(bufA, -1), -1) - t.equal(b.indexOf(bufA, -4), -1) - t.equal(b.indexOf(bufA, -b.length), 0) - t.equal(b.indexOf(bufA, NaN), 0) - t.equal(b.indexOf(bufA, -Infinity), 0) - t.equal(b.indexOf(bufA, Infinity), -1) - t.equal(b.indexOf(bufBc), 1) - t.equal(b.indexOf(bufBc, 2), -1) - t.equal(b.indexOf(bufBc, -1), -1) - t.equal(b.indexOf(bufBc, -3), -1) - t.equal(b.indexOf(bufBc, -5), 1) - t.equal(b.indexOf(bufBc, NaN), 1) - t.equal(b.indexOf(bufBc, -Infinity), 1) - t.equal(b.indexOf(bufBc, Infinity), -1) - t.equal(b.indexOf(bufF), b.length - 1) - t.equal(b.indexOf(bufZ), -1) - t.equal(b.indexOf(0x61), 0) - t.equal(b.indexOf(0x61, 1), -1) - t.equal(b.indexOf(0x61, -1), -1) - t.equal(b.indexOf(0x61, -4), -1) - t.equal(b.indexOf(0x61, -b.length), 0) - t.equal(b.indexOf(0x61, NaN), 0) - t.equal(b.indexOf(0x61, -Infinity), 0) - t.equal(b.indexOf(0x61, Infinity), -1) - t.equal(b.indexOf(0x0), -1) - - // test offsets - t.equal(b.indexOf('d', 2), 3) - t.equal(b.indexOf('f', 5), 5) - t.equal(b.indexOf('f', -1), 5) - t.equal(b.indexOf('f', 6), -1) - - t.equal(b.indexOf(Buffer.from('d'), 2), 3) - t.equal(b.indexOf(Buffer.from('f'), 5), 5) - t.equal(b.indexOf(Buffer.from('f'), -1), 5) - t.equal(b.indexOf(Buffer.from('f'), 6), -1) - - t.equal(Buffer.from('ff').indexOf(Buffer.from('f'), 1, 'ucs2'), -1) - - // test invalid and uppercase encoding - t.equal(b.indexOf('b', 'utf8'), 1) - t.equal(b.indexOf('b', 'UTF8'), 1) - t.equal(b.indexOf('62', 'HEX'), 1) - t.throws(() => b.indexOf('bad', 'enc'), TypeError) - - // test hex encoding - t.equal( - Buffer.from(b.toString('hex'), 'hex') - .indexOf('64', 0, 'hex'), - 3 - ) - t.equal( - Buffer.from(b.toString('hex'), 'hex') - .indexOf(Buffer.from('64', 'hex'), 0, 'hex'), - 3 - ) - - // test base64 encoding - t.equal( - Buffer.from(b.toString('base64'), 'base64') - .indexOf('ZA==', 0, 'base64'), - 3 - ) - t.equal( - Buffer.from(b.toString('base64'), 'base64') - .indexOf(Buffer.from('ZA==', 'base64'), 0, 'base64'), - 3 - ) - - // test ascii encoding - t.equal( - Buffer.from(b.toString('ascii'), 'ascii') - .indexOf('d', 0, 'ascii'), - 3 - ) - t.equal( - Buffer.from(b.toString('ascii'), 'ascii') - .indexOf(Buffer.from('d', 'ascii'), 0, 'ascii'), - 3 - ) - - // test optional offset with passed encoding - t.equal(Buffer.from('aaaa0').indexOf('30', 'hex'), 4) - t.equal(Buffer.from('aaaa00a').indexOf('3030', 'hex'), 4) - - { - // test usc2 encoding - const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2') - - t.equal(8, twoByteString.indexOf('\u0395', 4, 'ucs2')) - t.equal(6, twoByteString.indexOf('\u03a3', -4, 'ucs2')) - t.equal(4, twoByteString.indexOf('\u03a3', -6, 'ucs2')) - t.equal(4, twoByteString.indexOf( - Buffer.from('\u03a3', 'ucs2'), -6, 'ucs2')) - t.equal(-1, twoByteString.indexOf('\u03a3', -2, 'ucs2')) - } - - const mixedByteStringUcs2 = - Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395', 'ucs2') - - t.equal(6, mixedByteStringUcs2.indexOf('bc', 0, 'ucs2')) - t.equal(10, mixedByteStringUcs2.indexOf('\u03a3', 0, 'ucs2')) - t.equal(-1, mixedByteStringUcs2.indexOf('\u0396', 0, 'ucs2')) - - t.equal( - 6, mixedByteStringUcs2.indexOf(Buffer.from('bc', 'ucs2'), 0, 'ucs2')) - t.equal( - 10, mixedByteStringUcs2.indexOf(Buffer.from('\u03a3', 'ucs2'), 0, 'ucs2')) - t.equal( - -1, mixedByteStringUcs2.indexOf(Buffer.from('\u0396', 'ucs2'), 0, 'ucs2')) - - { - const twoByteString = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'ucs2') - - // Test single char pattern - t.equal(0, twoByteString.indexOf('\u039a', 0, 'ucs2')) - let index = twoByteString.indexOf('\u0391', 0, 'ucs2') - t.equal(2, index, `Alpha - at index ${index}`) - index = twoByteString.indexOf('\u03a3', 0, 'ucs2') - t.equal(4, index, `First Sigma - at index ${index}`) - index = twoByteString.indexOf('\u03a3', 6, 'ucs2') - t.equal(6, index, `Second Sigma - at index ${index}`) - index = twoByteString.indexOf('\u0395', 0, 'ucs2') - t.equal(8, index, `Epsilon - at index ${index}`) - index = twoByteString.indexOf('\u0392', 0, 'ucs2') - t.equal(-1, index, `Not beta - at index ${index}`) - - // Test multi-char pattern - index = twoByteString.indexOf('\u039a\u0391', 0, 'ucs2') - t.equal(0, index, `Lambda Alpha - at index ${index}`) - index = twoByteString.indexOf('\u0391\u03a3', 0, 'ucs2') - t.equal(2, index, `Alpha Sigma - at index ${index}`) - index = twoByteString.indexOf('\u03a3\u03a3', 0, 'ucs2') - t.equal(4, index, `Sigma Sigma - at index ${index}`) - index = twoByteString.indexOf('\u03a3\u0395', 0, 'ucs2') - t.equal(6, index, `Sigma Epsilon - at index ${index}`) - } - - const mixedByteStringUtf8 = Buffer.from('\u039a\u0391abc\u03a3\u03a3\u0395') - - t.equal(5, mixedByteStringUtf8.indexOf('bc')) - t.equal(5, mixedByteStringUtf8.indexOf('bc', 5)) - t.equal(5, mixedByteStringUtf8.indexOf('bc', -8)) - t.equal(7, mixedByteStringUtf8.indexOf('\u03a3')) - t.equal(-1, mixedByteStringUtf8.indexOf('\u0396')) - - // Test complex string indexOf algorithms. Only trigger for long strings. - // Long string that isn't a simple repeat of a shorter string. - let longString = 'A' - for (let i = 66; i < 76; i++) { // from 'B' to 'K' - longString = longString + String.fromCharCode(i) + longString - } - - const longBufferString = Buffer.from(longString) - - // pattern of 15 chars, repeated every 16 chars in long - let pattern = 'ABACABADABACABA' - for (let i = 0; i < longBufferString.length - pattern.length; i += 7) { - const index = longBufferString.indexOf(pattern, i) - t.equal((i + 15) & ~0xf, index, - `Long ABACABA...-string at index ${i}`) - } - - let index = longBufferString.indexOf('AJABACA') - t.equal(510, index, `Long AJABACA, First J - at index ${index}`) - index = longBufferString.indexOf('AJABACA', 511) - t.equal(1534, index, `Long AJABACA, Second J - at index ${index}`) - - pattern = 'JABACABADABACABA' - index = longBufferString.indexOf(pattern) - t.equal(511, index, `Long JABACABA..., First J - at index ${index}`) - index = longBufferString.indexOf(pattern, 512) - t.equal( - 1535, index, `Long JABACABA..., Second J - at index ${index}`) - - // Search for a non-ASCII string in a pure ASCII string. - const asciiString = Buffer.from( - 'somethingnotatallsinisterwhichalsoworks') - t.equal(-1, asciiString.indexOf('\x2061')) - t.equal(3, asciiString.indexOf('eth', 0)) - - // Search in string containing many non-ASCII chars. - const allCodePoints = [] - for (let i = 0; i < 65536; i++) { - allCodePoints[i] = i - } - - const allCharsString = String.fromCharCode.apply(String, allCodePoints) - const allCharsBufferUtf8 = Buffer.from(allCharsString) - const allCharsBufferUcs2 = Buffer.from(allCharsString, 'ucs2') - - // Search for string long enough to trigger complex search with ASCII pattern - // and UC16 subject. - t.equal(-1, allCharsBufferUtf8.indexOf('notfound')) - t.equal(-1, allCharsBufferUcs2.indexOf('notfound')) - - // Needle is longer than haystack, but only because it's encoded as UTF-16 - t.equal(Buffer.from('aaaa').indexOf('a'.repeat(4), 'ucs2'), -1) - - t.equal(Buffer.from('aaaa').indexOf('a'.repeat(4), 'utf8'), 0) - t.equal(Buffer.from('aaaa').indexOf('你好', 'ucs2'), -1) - - // Haystack has odd length, but the needle is UCS2. - t.equal(Buffer.from('aaaaa').indexOf('b', 'ucs2'), -1) - - { - // Find substrings in Utf8. - const lengths = [1, 3, 15] // Single char, simple and complex. - const indices = [0x5, 0x60, 0x400, 0x680, 0x7ee, 0xFF02, 0x16610, 0x2f77b] - for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { - for (let i = 0; i < indices.length; i++) { - const index = indices[i] - let length = lengths[lengthIndex] - - if (index + length > 0x7F) { - length = 2 * length - } - - if (index + length > 0x7FF) { - length = 3 * length - } - - if (index + length > 0xFFFF) { - length = 4 * length - } - - const patternBufferUtf8 = allCharsBufferUtf8.slice(index, index + length) - t.equal(index, allCharsBufferUtf8.indexOf(patternBufferUtf8)) - - const patternStringUtf8 = patternBufferUtf8.toString() - t.equal(index, allCharsBufferUtf8.indexOf(patternStringUtf8)) - } - } - } - - { - // Find substrings in Usc2. - const lengths = [2, 4, 16] // Single char, simple and complex. - const indices = [0x5, 0x65, 0x105, 0x205, 0x285, 0x2005, 0x2085, 0xfff0] - - for (let lengthIndex = 0; lengthIndex < lengths.length; lengthIndex++) { - for (let i = 0; i < indices.length; i++) { - const index = indices[i] * 2 - const length = lengths[lengthIndex] - - const patternBufferUcs2 = - allCharsBufferUcs2.slice(index, index + length) - t.equal( - index, allCharsBufferUcs2.indexOf(patternBufferUcs2, 0, 'ucs2')) - - const patternStringUcs2 = patternBufferUcs2.toString('ucs2') - t.equal( - index, allCharsBufferUcs2.indexOf(patternStringUcs2, 0, 'ucs2')) - } - } - } - - [ - () => {}, - {}, - [] - ].forEach((val) => { - t.throws(() => b.indexOf(val), TypeError, `"${JSON.stringify(val)}" should throw`) - }) - - // Test weird offset arguments. - // The following offsets coerce to NaN or 0, searching the whole Buffer - t.equal(b.indexOf('b', undefined), 1) - t.equal(b.indexOf('b', {}), 1) - t.equal(b.indexOf('b', 0), 1) - t.equal(b.indexOf('b', null), 1) - t.equal(b.indexOf('b', []), 1) - - // The following offset coerces to 2, in other words +[2] === 2 - t.equal(b.indexOf('b', [2]), -1) - - // Behavior should match String.indexOf() - t.equal( - b.indexOf('b', undefined), - stringComparison.indexOf('b', undefined)) - t.equal( - b.indexOf('b', {}), - stringComparison.indexOf('b', {})) - t.equal( - b.indexOf('b', 0), - stringComparison.indexOf('b', 0)) - t.equal( - b.indexOf('b', null), - stringComparison.indexOf('b', null)) - t.equal( - b.indexOf('b', []), - stringComparison.indexOf('b', [])) - t.equal( - b.indexOf('b', [2]), - stringComparison.indexOf('b', [2])) - - // test truncation of Number arguments to uint8 - { - const buf = Buffer.from('this is a test') - - t.equal(buf.indexOf(0x6973), 3) - t.equal(buf.indexOf(0x697320), 4) - t.equal(buf.indexOf(0x69732069), 2) - t.equal(buf.indexOf(0x697374657374), 0) - t.equal(buf.indexOf(0x69737374), 0) - t.equal(buf.indexOf(0x69737465), 11) - t.equal(buf.indexOf(0x69737465), 11) - t.equal(buf.indexOf(-140), 0) - t.equal(buf.indexOf(-152), 1) - t.equal(buf.indexOf(0xff), -1) - t.equal(buf.indexOf(0xffff), -1) - } - - // Test that Uint8Array arguments are okay. - { - const needle = new Uint8Array([0x66, 0x6f, 0x6f]) - const haystack = new BufferList(Buffer.from('a foo b foo')) - t.equal(haystack.indexOf(needle), 2) - } - - t.end() -}) diff --git a/node_modules/bl/test/isBufferList.js b/node_modules/bl/test/isBufferList.js deleted file mode 100644 index 9d895d5..0000000 --- a/node_modules/bl/test/isBufferList.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict' - -const tape = require('tape') -const { BufferList, BufferListStream } = require('../') -const { Buffer } = require('buffer') - -tape('isBufferList positives', (t) => { - t.ok(BufferList.isBufferList(new BufferList())) - t.ok(BufferList.isBufferList(new BufferListStream())) - - t.end() -}) - -tape('isBufferList negatives', (t) => { - const types = [ - null, - undefined, - NaN, - true, - false, - {}, - [], - Buffer.alloc(0), - [Buffer.alloc(0)] - ] - - for (const obj of types) { - t.notOk(BufferList.isBufferList(obj)) - } - - t.end() -}) diff --git a/node_modules/bl/test/test.js b/node_modules/bl/test/test.js deleted file mode 100644 index 668dc17..0000000 --- a/node_modules/bl/test/test.js +++ /dev/null @@ -1,914 +0,0 @@ -// @ts-check -'use strict' - -const tape = require('tape') -const crypto = require('crypto') -const fs = require('fs') -const path = require('path') -const os = require('os') -const BufferListStream = require('../') -const { Buffer } = require('buffer') - -/** - * This typedef allows us to add _bufs to the API without declaring it publicly on types. - * @typedef { BufferListStream & { _bufs?: Buffer[] }} BufferListStreamWithPrivate - */ - -/** - * Just for typechecking in js - * @type { NodeJS.Process & { browser?: boolean }} - */ - -const process = globalThis.process - -/** @type {BufferEncoding[]} */ -const encodings = ['ascii', 'utf8', 'utf-8', 'hex', 'binary', 'base64'] - -if (process.browser) { - encodings.push( - 'ucs2', - 'ucs-2', - 'utf16le', - /** - * This alias is not in typescript typings for BufferEncoding. Still have to fix - * @see https://nodejs.org/api/buffer.html#buffers-and-character-encodings - */ - // @ts-ignore - 'utf-16le' - ) -} - -require('./indexOf') -require('./isBufferList') -require('./convert') - -tape('single bytes from single buffer', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abcd')) - - t.equal(bl.length, 4) - t.equal(bl.get(-1), undefined) - t.equal(bl.get(0), 97) - t.equal(bl.get(1), 98) - t.equal(bl.get(2), 99) - t.equal(bl.get(3), 100) - t.equal(bl.get(4), undefined) - - t.end() -}) - -tape('single bytes from multiple buffers', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abcd')) - bl.append(Buffer.from('efg')) - bl.append(Buffer.from('hi')) - bl.append(Buffer.from('j')) - - t.equal(bl.length, 10) - - t.equal(bl.get(0), 97) - t.equal(bl.get(1), 98) - t.equal(bl.get(2), 99) - t.equal(bl.get(3), 100) - t.equal(bl.get(4), 101) - t.equal(bl.get(5), 102) - t.equal(bl.get(6), 103) - t.equal(bl.get(7), 104) - t.equal(bl.get(8), 105) - t.equal(bl.get(9), 106) - - t.end() -}) - -tape('multi bytes from single buffer', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abcd')) - - t.equal(bl.length, 4) - - t.equal(bl.slice(0, 4).toString('ascii'), 'abcd') - t.equal(bl.slice(0, 3).toString('ascii'), 'abc') - t.equal(bl.slice(1, 4).toString('ascii'), 'bcd') - t.equal(bl.slice(-4, -1).toString('ascii'), 'abc') - - t.end() -}) - -tape('multi bytes from single buffer (negative indexes)', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('buffer')) - - t.equal(bl.length, 6) - - t.equal(bl.slice(-6, -1).toString('ascii'), 'buffe') - t.equal(bl.slice(-6, -2).toString('ascii'), 'buff') - t.equal(bl.slice(-5, -2).toString('ascii'), 'uff') - - t.end() -}) - -tape('multiple bytes from multiple buffers', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abcd')) - bl.append(Buffer.from('efg')) - bl.append(Buffer.from('hi')) - bl.append(Buffer.from('j')) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - t.equal(bl.slice(-7, -4).toString('ascii'), 'def') - - t.end() -}) - -tape('multiple bytes from multiple buffer lists', function (t) { - const bl = new BufferListStream() - - bl.append(new BufferListStream([Buffer.from('abcd'), Buffer.from('efg')])) - bl.append(new BufferListStream([Buffer.from('hi'), Buffer.from('j')])) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - - t.end() -}) - -// same data as previous test, just using nested constructors -tape('multiple bytes from crazy nested buffer lists', function (t) { - const bl = new BufferListStream() - - bl.append( - new BufferListStream([ - new BufferListStream([ - new BufferListStream(Buffer.from('abc')), - Buffer.from('d'), - new BufferListStream(Buffer.from('efg')) - ]), - new BufferListStream([Buffer.from('hi')]), - new BufferListStream(Buffer.from('j')) - ]) - ) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - - t.end() -}) - -tape('append accepts arrays of Buffers', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abc')) - bl.append([Buffer.from('def')]) - bl.append([Buffer.from('ghi'), Buffer.from('jkl')]) - bl.append([Buffer.from('mnop'), Buffer.from('qrstu'), Buffer.from('vwxyz')]) - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - - t.end() -}) - -tape('append accepts arrays of Uint8Arrays', function (t) { - const bl = new BufferListStream() - - bl.append(new Uint8Array([97, 98, 99])) - bl.append([Uint8Array.from([100, 101, 102])]) - bl.append([new Uint8Array([103, 104, 105]), new Uint8Array([106, 107, 108])]) - bl.append([new Uint8Array([109, 110, 111, 112]), new Uint8Array([113, 114, 115, 116, 117]), new Uint8Array([118, 119, 120, 121, 122])]) - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - - t.end() -}) - -tape('append accepts arrays of BufferLists', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abc')) - bl.append([new BufferListStream('def')]) - bl.append( - new BufferListStream([Buffer.from('ghi'), new BufferListStream('jkl')]) - ) - bl.append([ - Buffer.from('mnop'), - new BufferListStream([Buffer.from('qrstu'), Buffer.from('vwxyz')]) - ]) - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - - t.end() -}) - -tape('append chainable', function (t) { - const bl = new BufferListStream() - - t.ok(bl.append(Buffer.from('abcd')) === bl) - t.ok(bl.append([Buffer.from('abcd')]) === bl) - t.ok(bl.append(new BufferListStream(Buffer.from('abcd'))) === bl) - t.ok(bl.append([new BufferListStream(Buffer.from('abcd'))]) === bl) - - t.end() -}) - -tape('append chainable (test results)', function (t) { - const bl = new BufferListStream('abc') - .append([new BufferListStream('def')]) - .append( - new BufferListStream([Buffer.from('ghi'), new BufferListStream('jkl')]) - ) - .append([ - Buffer.from('mnop'), - new BufferListStream([Buffer.from('qrstu'), Buffer.from('vwxyz')]) - ]) - - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - - t.end() -}) - -tape('consuming from multiple buffers', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abcd')) - bl.append(Buffer.from('efg')) - bl.append(Buffer.from('hi')) - bl.append(Buffer.from('j')) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - bl.consume(3) - t.equal(bl.length, 7) - t.equal(bl.slice(0, 7).toString('ascii'), 'defghij') - - bl.consume(2) - t.equal(bl.length, 5) - t.equal(bl.slice(0, 5).toString('ascii'), 'fghij') - - bl.consume(1) - t.equal(bl.length, 4) - t.equal(bl.slice(0, 4).toString('ascii'), 'ghij') - - bl.consume(1) - t.equal(bl.length, 3) - t.equal(bl.slice(0, 3).toString('ascii'), 'hij') - - bl.consume(2) - t.equal(bl.length, 1) - t.equal(bl.slice(0, 1).toString('ascii'), 'j') - - t.end() -}) - -tape('complete consumption', function (t) { - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream() - - bl.append(Buffer.from('a')) - bl.append(Buffer.from('b')) - - bl.consume(2) - - t.equal(bl.length, 0) - t.equal(bl._bufs.length, 0) - - t.end() -}) - -tape('test readUInt8 / readInt8', function (t) { - const buf1 = Buffer.alloc(1) - const buf2 = Buffer.alloc(3) - const buf3 = Buffer.alloc(3) - const bl = new BufferListStream() - - buf1[0] = 0x1 - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt8(), 0x1) - t.equal(bl.readUInt8(2), 0x3) - t.equal(bl.readInt8(2), 0x3) - t.equal(bl.readUInt8(3), 0x4) - t.equal(bl.readInt8(3), 0x4) - t.equal(bl.readUInt8(4), 0x23) - t.equal(bl.readInt8(4), 0x23) - t.equal(bl.readUInt8(5), 0x42) - t.equal(bl.readInt8(5), 0x42) - - t.end() -}) - -tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) { - const buf1 = Buffer.alloc(1) - const buf2 = Buffer.alloc(3) - const buf3 = Buffer.alloc(3) - const bl = new BufferListStream() - - buf1[0] = 0x1 - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt16BE(), 0x0100) - t.equal(bl.readUInt16LE(), 0x0001) - t.equal(bl.readUInt16BE(2), 0x0304) - t.equal(bl.readUInt16LE(2), 0x0403) - t.equal(bl.readInt16BE(2), 0x0304) - t.equal(bl.readInt16LE(2), 0x0403) - t.equal(bl.readUInt16BE(3), 0x0423) - t.equal(bl.readUInt16LE(3), 0x2304) - t.equal(bl.readInt16BE(3), 0x0423) - t.equal(bl.readInt16LE(3), 0x2304) - t.equal(bl.readUInt16BE(4), 0x2342) - t.equal(bl.readUInt16LE(4), 0x4223) - t.equal(bl.readInt16BE(4), 0x2342) - t.equal(bl.readInt16LE(4), 0x4223) - - t.end() -}) - -tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) { - const buf1 = Buffer.alloc(1) - const buf2 = Buffer.alloc(3) - const buf3 = Buffer.alloc(3) - const bl = new BufferListStream() - - buf1[0] = 0x1 - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt32BE(), 0x01000304) - t.equal(bl.readUInt32LE(), 0x04030001) - t.equal(bl.readUInt32BE(2), 0x03042342) - t.equal(bl.readUInt32LE(2), 0x42230403) - t.equal(bl.readInt32BE(2), 0x03042342) - t.equal(bl.readInt32LE(2), 0x42230403) - - t.end() -}) - -tape('test readUIntLE / readUIntBE / readIntLE / readIntBE', function (t) { - const buf1 = Buffer.alloc(1) - const buf2 = Buffer.alloc(3) - const buf3 = Buffer.alloc(3) - const bl = new BufferListStream() - - buf2[0] = 0x2 - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - buf3[2] = 0x61 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUIntBE(1, 1), 0x02) - t.equal(bl.readUIntBE(1, 2), 0x0203) - t.equal(bl.readUIntBE(1, 3), 0x020304) - t.equal(bl.readUIntBE(1, 4), 0x02030423) - t.equal(bl.readUIntBE(1, 5), 0x0203042342) - t.equal(bl.readUIntBE(1, 6), 0x020304234261) - t.equal(bl.readUIntLE(1, 1), 0x02) - t.equal(bl.readUIntLE(1, 2), 0x0302) - t.equal(bl.readUIntLE(1, 3), 0x040302) - t.equal(bl.readUIntLE(1, 4), 0x23040302) - t.equal(bl.readUIntLE(1, 5), 0x4223040302) - t.equal(bl.readUIntLE(1, 6), 0x614223040302) - t.equal(bl.readIntBE(1, 1), 0x02) - t.equal(bl.readIntBE(1, 2), 0x0203) - t.equal(bl.readIntBE(1, 3), 0x020304) - t.equal(bl.readIntBE(1, 4), 0x02030423) - t.equal(bl.readIntBE(1, 5), 0x0203042342) - t.equal(bl.readIntBE(1, 6), 0x020304234261) - t.equal(bl.readIntLE(1, 1), 0x02) - t.equal(bl.readIntLE(1, 2), 0x0302) - t.equal(bl.readIntLE(1, 3), 0x040302) - t.equal(bl.readIntLE(1, 4), 0x23040302) - t.equal(bl.readIntLE(1, 5), 0x4223040302) - t.equal(bl.readIntLE(1, 6), 0x614223040302) - - t.end() -}) - -tape('test readFloatLE / readFloatBE', function (t) { - const buf1 = Buffer.alloc(1) - const buf2 = Buffer.alloc(3) - const buf3 = Buffer.alloc(3) - const bl = new BufferListStream() - - buf1[0] = 0x01 - buf2[1] = 0x00 - buf2[2] = 0x00 - buf3[0] = 0x80 - buf3[1] = 0x3f - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - const canonical = Buffer.concat([buf1, buf2, buf3]) - t.equal(bl.readFloatLE(), canonical.readFloatLE()) - t.equal(bl.readFloatBE(), canonical.readFloatBE()) - t.equal(bl.readFloatLE(2), canonical.readFloatLE(2)) - t.equal(bl.readFloatBE(2), canonical.readFloatBE(2)) - - t.end() -}) - -tape('test readDoubleLE / readDoubleBE', function (t) { - const buf1 = Buffer.alloc(1) - const buf2 = Buffer.alloc(3) - const buf3 = Buffer.alloc(10) - const bl = new BufferListStream() - - buf1[0] = 0x01 - buf2[1] = 0x55 - buf2[2] = 0x55 - buf3[0] = 0x55 - buf3[1] = 0x55 - buf3[2] = 0x55 - buf3[3] = 0x55 - buf3[4] = 0xd5 - buf3[5] = 0x3f - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - const canonical = Buffer.concat([buf1, buf2, buf3]) - t.equal(bl.readDoubleBE(), canonical.readDoubleBE()) - t.equal(bl.readDoubleLE(), canonical.readDoubleLE()) - t.equal(bl.readDoubleBE(2), canonical.readDoubleBE(2)) - t.equal(bl.readDoubleLE(2), canonical.readDoubleLE(2)) - - t.end() -}) - -tape('test toString', function (t) { - const bl = new BufferListStream() - - bl.append(Buffer.from('abcd')) - bl.append(Buffer.from('efg')) - bl.append(Buffer.from('hi')) - bl.append(Buffer.from('j')) - - t.equal(bl.toString('ascii', 0, 10), 'abcdefghij') - t.equal(bl.toString('ascii', 3, 10), 'defghij') - t.equal(bl.toString('ascii', 3, 6), 'def') - t.equal(bl.toString('ascii', 3, 8), 'defgh') - t.equal(bl.toString('ascii', 5, 10), 'fghij') - - t.end() -}) - -tape('test toString encoding', function (t) { - const bl = new BufferListStream() - const b = Buffer.from('abcdefghij\xff\x00') - - bl.append(Buffer.from('abcd')) - bl.append(Buffer.from('efg')) - bl.append(Buffer.from('hi')) - bl.append(Buffer.from('j')) - bl.append(Buffer.from('\xff\x00')) - - encodings.forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc), enc) - }) - - t.end() -}) - -tape('uninitialized memory', function (t) { - const secret = crypto.randomBytes(256) - for (let i = 0; i < 1e6; i++) { - const clone = Buffer.from(secret) - const bl = new BufferListStream() - bl.append(Buffer.from('a')) - bl.consume(-1024) - const buf = bl.slice(1) - if (buf.indexOf(clone) !== -1) { - t.fail(`Match (at ${i})`) - break - } - } - t.end() -}) - -!process.browser && tape('test stream', function (t) { - const random = crypto.randomBytes(65534) - - const bl = new BufferListStream((err, buf) => { - t.ok(Buffer.isBuffer(buf)) - t.ok(err === null) - t.ok(random.equals(bl.slice())) - t.ok(random.equals(buf.slice())) - - bl.pipe(fs.createWriteStream(path.join(os.tmpdir(), 'bl_test_rnd_out.dat'))) - .on('close', function () { - const rndhash = crypto.createHash('md5').update(random).digest('hex') - const md5sum = crypto.createHash('md5') - const s = fs.createReadStream(path.join(os.tmpdir(), 'bl_test_rnd_out.dat')) - - s.on('data', md5sum.update.bind(md5sum)) - s.on('end', function () { - t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!') - t.end() - }) - }) - }) - - fs.writeFileSync(path.join(os.tmpdir(), 'bl_test_rnd.dat'), random) - fs.createReadStream(path.join(os.tmpdir(), 'bl_test_rnd.dat')).pipe(bl) -}) - -tape('instantiation with Buffer', function (t) { - const buf = crypto.randomBytes(1024) - const buf2 = crypto.randomBytes(1024) - let b = BufferListStream(buf) - - t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer') - b = BufferListStream([buf, buf2]) - t.equal(b.slice().toString('hex'), Buffer.concat([buf, buf2]).toString('hex'), 'same buffer') - - t.end() -}) - -tape('test String appendage', function (t) { - const bl = new BufferListStream() - const b = Buffer.from('abcdefghij\xff\x00') - - bl.append('abcd') - bl.append('efg') - bl.append('hi') - bl.append('j') - bl.append('\xff\x00') - - encodings.forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc)) - }) - - t.end() -}) - -tape('test Number appendage', function (t) { - const bl = new BufferListStream() - const b = Buffer.from('1234567890') - - bl.append(1234) - bl.append(567) - bl.append(89) - bl.append(0) - - encodings.forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc)) - }) - - t.end() -}) - -tape('write nothing, should get empty buffer', function (t) { - t.plan(3) - BufferListStream(function (err, data) { - t.notOk(err, 'no error') - t.ok(Buffer.isBuffer(data), 'got a buffer') - t.equal(0, data.length, 'got a zero-length buffer') - t.end() - }).end() -}) - -tape('unicode string', function (t) { - t.plan(2) - - const inp1 = '\u2600' - const inp2 = '\u2603' - const exp = inp1 + ' and ' + inp2 - const bl = BufferListStream() - - bl.write(inp1) - bl.write(' and ') - bl.write(inp2) - t.equal(exp, bl.toString()) - t.equal(Buffer.from(exp).toString('hex'), bl.toString('hex')) -}) - -tape('should emit finish', function (t) { - const source = BufferListStream() - const dest = BufferListStream() - - source.write('hello') - source.pipe(dest) - - dest.on('finish', function () { - t.equal(dest.toString('utf8'), 'hello') - t.end() - }) -}) - -tape('basic copy', function (t) { - const buf = crypto.randomBytes(1024) - const buf2 = Buffer.alloc(1024) - const b = BufferListStream(buf) - - b.copy(buf2) - t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer') - - t.end() -}) - -tape('copy after many appends', function (t) { - const buf = crypto.randomBytes(512) - const buf2 = Buffer.alloc(1024) - const b = BufferListStream(buf) - - b.append(buf) - b.copy(buf2) - t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer') - - t.end() -}) - -tape('copy at a precise position', function (t) { - const buf = crypto.randomBytes(1004) - const buf2 = Buffer.alloc(1024) - const b = BufferListStream(buf) - - b.copy(buf2, 20) - t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer') - - t.end() -}) - -tape('copy starting from a precise location', function (t) { - const buf = crypto.randomBytes(10) - const buf2 = Buffer.alloc(5) - const b = BufferListStream(buf) - - b.copy(buf2, 0, 5) - t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer') - - t.end() -}) - -tape('copy in an interval', function (t) { - const rnd = crypto.randomBytes(10) - const b = BufferListStream(rnd) // put the random bytes there - const actual = Buffer.alloc(3) - const expected = Buffer.alloc(3) - - rnd.copy(expected, 0, 5, 8) - b.copy(actual, 0, 5, 8) - - t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer') - - t.end() -}) - -tape('copy an interval between two buffers', function (t) { - const buf = crypto.randomBytes(10) - const buf2 = Buffer.alloc(10) - const b = BufferListStream(buf) - - b.append(buf) - b.copy(buf2, 0, 5, 15) - - t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer') - - t.end() -}) - -tape('shallow slice across buffer boundaries', function (t) { - const bl = new BufferListStream(['First', 'Second', 'Third']) - - t.equal(bl.shallowSlice(3, 13).toString(), 'stSecondTh') - - t.end() -}) - -tape('shallow slice within single buffer', function (t) { - t.plan(2) - - const bl = new BufferListStream(['First', 'Second', 'Third']) - - t.equal(bl.shallowSlice(5, 10).toString(), 'Secon') - t.equal(bl.shallowSlice(7, 10).toString(), 'con') - - t.end() -}) - -tape('shallow slice single buffer', function (t) { - t.plan(3) - - const bl = new BufferListStream(['First', 'Second', 'Third']) - - t.equal(bl.shallowSlice(0, 5).toString(), 'First') - t.equal(bl.shallowSlice(5, 11).toString(), 'Second') - t.equal(bl.shallowSlice(11, 16).toString(), 'Third') -}) - -tape('shallow slice with negative or omitted indices', function (t) { - t.plan(4) - - const bl = new BufferListStream(['First', 'Second', 'Third']) - - t.equal(bl.shallowSlice().toString(), 'FirstSecondThird') - t.equal(bl.shallowSlice(5).toString(), 'SecondThird') - t.equal(bl.shallowSlice(5, -3).toString(), 'SecondTh') - t.equal(bl.shallowSlice(-8).toString(), 'ondThird') -}) - -tape('shallow slice does not make a copy', function (t) { - t.plan(1) - - const buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')] - const bl = new BufferListStream(buffers).shallowSlice(5, -3) - - buffers[1].fill('h') - buffers[2].fill('h') - - t.equal(bl.toString(), 'hhhhhhhh') -}) - -tape('shallow slice with 0 length', function (t) { - t.plan(1) - - const buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')] - const bl = (new BufferListStream(buffers)).shallowSlice(0, 0) - - t.equal(bl.length, 0) -}) - -tape('shallow slice with 0 length from middle', function (t) { - t.plan(1) - - const buffers = [Buffer.from('First'), Buffer.from('Second'), Buffer.from('Third')] - const bl = (new BufferListStream(buffers)).shallowSlice(10, 10) - - t.equal(bl.length, 0) -}) - -tape('duplicate', function (t) { - t.plan(2) - - const bl = new BufferListStream('abcdefghij\xff\x00') - const dup = bl.duplicate() - - t.equal(bl.prototype, dup.prototype) - t.equal(bl.toString('hex'), dup.toString('hex')) -}) - -tape('destroy no pipe', function (t) { - t.plan(2) - - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream('alsdkfja;lsdkfja;lsdk') - - bl.destroy() - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) -}) - -tape('destroy with error', function (t) { - t.plan(3) - - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream('alsdkfja;lsdkfja;lsdk') - const err = new Error('kaboom') - - bl.destroy(err) - bl.on('error', function (_err) { - t.equal(_err, err) - }) - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) -}) - -!process.browser && tape('destroy with pipe before read end', function (t) { - t.plan(2) - - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream() - fs.createReadStream(path.join(__dirname, '/test.js')) - .pipe(bl) - - bl.destroy() - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) -}) - -!process.browser && tape('destroy with pipe before read end with race', function (t) { - t.plan(2) - - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream() - - fs.createReadStream(path.join(__dirname, '/test.js')) - .pipe(bl) - - setTimeout(function () { - bl.destroy() - setTimeout(function () { - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) - }, 500) - }, 500) -}) - -!process.browser && tape('destroy with pipe after read end', function (t) { - t.plan(2) - - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream() - fs.createReadStream(path.join(__dirname, '/test.js')) - .on('end', onEnd) - .pipe(bl) - - function onEnd () { - bl.destroy() - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) - } -}) - -!process.browser && tape('destroy with pipe while writing to a destination', function (t) { - t.plan(4) - - /** @type {BufferListStreamWithPrivate} */ - const bl = new BufferListStream() - const ds = new BufferListStream() - - fs.createReadStream(path.join(__dirname, '/test.js')) - .on('end', onEnd) - .pipe(bl) - - function onEnd () { - bl.pipe(ds) - - setTimeout(function () { - bl.destroy() - - t.equals(bl._bufs.length, 0) - t.equals(bl.length, 0) - - ds.destroy() - - t.equals(bl._bufs.length, 0) - t.equals(bl.length, 0) - }, 100) - } -}) - -!process.browser && tape('handle error', function (t) { - t.plan(2) - - fs.createReadStream('/does/not/exist').pipe(BufferListStream(function (err, data) { - t.ok(err instanceof Error, 'has error') - t.notOk(data, 'no data') - })) -}) diff --git a/node_modules/brace-expansion/LICENSE b/node_modules/brace-expansion/LICENSE deleted file mode 100644 index de32266..0000000 --- a/node_modules/brace-expansion/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2013 Julian Gruber - -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/brace-expansion/README.md b/node_modules/brace-expansion/README.md deleted file mode 100644 index 6b4e0e1..0000000 --- a/node_modules/brace-expansion/README.md +++ /dev/null @@ -1,129 +0,0 @@ -# brace-expansion - -[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), -as known from sh/bash, in JavaScript. - -[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) -[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) -[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) - -[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) - -## Example - -```js -var expand = require('brace-expansion'); - -expand('file-{a,b,c}.jpg') -// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] - -expand('-v{,,}') -// => ['-v', '-v', '-v'] - -expand('file{0..2}.jpg') -// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] - -expand('file-{a..c}.jpg') -// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] - -expand('file{2..0}.jpg') -// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] - -expand('file{0..4..2}.jpg') -// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] - -expand('file-{a..e..2}.jpg') -// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] - -expand('file{00..10..5}.jpg') -// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] - -expand('{{A..C},{a..c}}') -// => ['A', 'B', 'C', 'a', 'b', 'c'] - -expand('ppp{,config,oe{,conf}}') -// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] -``` - -## API - -```js -var expand = require('brace-expansion'); -``` - -### var expanded = expand(str) - -Return an array of all possible and valid expansions of `str`. If none are -found, `[str]` is returned. - -Valid expansions are: - -```js -/^(.*,)+(.+)?$/ -// {a,b,...} -``` - -A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. - -```js -/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ -// {x..y[..incr]} -``` - -A numeric sequence from `x` to `y` inclusive, with optional increment. -If `x` or `y` start with a leading `0`, all the numbers will be padded -to have equal length. Negative numbers and backwards iteration work too. - -```js -/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ -// {x..y[..incr]} -``` - -An alphabetic sequence from `x` to `y` inclusive, with optional increment. -`x` and `y` must be exactly one character, and if given, `incr` must be a -number. - -For compatibility reasons, the string `${` is not eligible for brace expansion. - -## Installation - -With [npm](https://npmjs.org) do: - -```bash -npm install brace-expansion -``` - -## Contributors - -- [Julian Gruber](https://github.com/juliangruber) -- [Isaac Z. Schlueter](https://github.com/isaacs) - -## Sponsors - -This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! - -Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/brace-expansion/index.js b/node_modules/brace-expansion/index.js deleted file mode 100644 index 0478be8..0000000 --- a/node_modules/brace-expansion/index.js +++ /dev/null @@ -1,201 +0,0 @@ -var concatMap = require('concat-map'); -var balanced = require('balanced-match'); - -module.exports = expandTop; - -var escSlash = '\0SLASH'+Math.random()+'\0'; -var escOpen = '\0OPEN'+Math.random()+'\0'; -var escClose = '\0CLOSE'+Math.random()+'\0'; -var escComma = '\0COMMA'+Math.random()+'\0'; -var escPeriod = '\0PERIOD'+Math.random()+'\0'; - -function numeric(str) { - return parseInt(str, 10) == str - ? parseInt(str, 10) - : str.charCodeAt(0); -} - -function escapeBraces(str) { - return str.split('\\\\').join(escSlash) - .split('\\{').join(escOpen) - .split('\\}').join(escClose) - .split('\\,').join(escComma) - .split('\\.').join(escPeriod); -} - -function unescapeBraces(str) { - return str.split(escSlash).join('\\') - .split(escOpen).join('{') - .split(escClose).join('}') - .split(escComma).join(',') - .split(escPeriod).join('.'); -} - - -// Basically just str.split(","), but handling cases -// where we have nested braced sections, which should be -// treated as individual members, like {a,{b,c},d} -function parseCommaParts(str) { - if (!str) - return ['']; - - var parts = []; - var m = balanced('{', '}', str); - - if (!m) - return str.split(','); - - var pre = m.pre; - var body = m.body; - var post = m.post; - var p = pre.split(','); - - p[p.length-1] += '{' + body + '}'; - var postParts = parseCommaParts(post); - if (post.length) { - p[p.length-1] += postParts.shift(); - p.push.apply(p, postParts); - } - - parts.push.apply(parts, p); - - return parts; -} - -function expandTop(str) { - if (!str) - return []; - - // I don't know why Bash 4.3 does this, but it does. - // Anything starting with {} will have the first two bytes preserved - // but *only* at the top level, so {},a}b will not expand to anything, - // but a{},b}c will be expanded to [a}c,abc]. - // One could argue that this is a bug in Bash, but since the goal of - // this module is to match Bash's rules, we escape a leading {} - if (str.substr(0, 2) === '{}') { - str = '\\{\\}' + str.substr(2); - } - - return expand(escapeBraces(str), true).map(unescapeBraces); -} - -function identity(e) { - return e; -} - -function embrace(str) { - return '{' + str + '}'; -} -function isPadded(el) { - return /^-?0\d/.test(el); -} - -function lte(i, y) { - return i <= y; -} -function gte(i, y) { - return i >= y; -} - -function expand(str, isTop) { - var expansions = []; - - var m = balanced('{', '}', str); - if (!m || /\$$/.test(m.pre)) return [str]; - - var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = m.body.indexOf(',') >= 0; - if (!isSequence && !isOptions) { - // {a},b} - if (m.post.match(/,.*\}/)) { - str = m.pre + '{' + m.body + escClose + m.post; - return expand(str); - } - return [str]; - } - - var n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts(m.body); - if (n.length === 1) { - // x{{a,b}}y ==> x{a}y x{b}y - n = expand(n[0], false).map(embrace); - if (n.length === 1) { - var post = m.post.length - ? expand(m.post, false) - : ['']; - return post.map(function(p) { - return m.pre + n[0] + p; - }); - } - } - } - - // at this point, n is the parts, and we know it's not a comma set - // with a single entry. - - // no need to expand pre, since it is guaranteed to be free of brace-sets - var pre = m.pre; - var post = m.post.length - ? expand(m.post, false) - : ['']; - - var N; - - if (isSequence) { - var x = numeric(n[0]); - var y = numeric(n[1]); - var width = Math.max(n[0].length, n[1].length) - var incr = n.length == 3 - ? Math.abs(numeric(n[2])) - : 1; - var test = lte; - var reverse = y < x; - if (reverse) { - incr *= -1; - test = gte; - } - var pad = n.some(isPadded); - - N = []; - - for (var i = x; test(i, y); i += incr) { - var c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === '\\') - c = ''; - } else { - c = String(i); - if (pad) { - var need = width - c.length; - if (need > 0) { - var z = new Array(need + 1).join('0'); - if (i < 0) - c = '-' + z + c.slice(1); - else - c = z + c; - } - } - } - N.push(c); - } - } else { - N = concatMap(n, function(el) { return expand(el, false) }); - } - - for (var j = 0; j < N.length; j++) { - for (var k = 0; k < post.length; k++) { - var expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) - expansions.push(expansion); - } - } - - return expansions; -} - diff --git a/node_modules/brace-expansion/package.json b/node_modules/brace-expansion/package.json deleted file mode 100644 index a18faa8..0000000 --- a/node_modules/brace-expansion/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "brace-expansion", - "description": "Brace expansion as known from sh/bash", - "version": "1.1.11", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/brace-expansion.git" - }, - "homepage": "https://github.com/juliangruber/brace-expansion", - "main": "index.js", - "scripts": { - "test": "tape test/*.js", - "gentest": "bash test/generate.sh", - "bench": "matcha test/perf/bench.js" - }, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - }, - "devDependencies": { - "matcha": "^0.7.0", - "tape": "^4.6.0" - }, - "keywords": [], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/8..latest", - "firefox/20..latest", - "firefox/nightly", - "chrome/25..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - } -} diff --git a/node_modules/braces/LICENSE b/node_modules/braces/LICENSE deleted file mode 100644 index 9af4a67..0000000 --- a/node_modules/braces/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-present, 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/braces/README.md b/node_modules/braces/README.md deleted file mode 100644 index f59dd60..0000000 --- a/node_modules/braces/README.md +++ /dev/null @@ -1,586 +0,0 @@ -# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) - -> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. - -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 braces -``` - -## v3.0.0 Released!! - -See the [changelog](CHANGELOG.md) for details. - -## Why use braces? - -Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters. - -- **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests) -- **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity. -- **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up. -- **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written). -- **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)). -- [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']` -- [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']` -- [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']` -- [Supports escaping](#escaping) - To prevent evaluation of special characters. - -## Usage - -The main export is a function that takes one or more brace `patterns` and `options`. - -```js -const braces = require('braces'); -// braces(patterns[, options]); - -console.log(braces(['{01..05}', '{a..e}'])); -//=> ['(0[1-5])', '([a-e])'] - -console.log(braces(['{01..05}', '{a..e}'], { expand: true })); -//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e'] -``` - -### Brace Expansion vs. Compilation - -By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching. - -**Compiled** - -```js -console.log(braces('a/{x,y,z}/b')); -//=> ['a/(x|y|z)/b'] -console.log(braces(['a/{01..20}/b', 'a/{1..5}/b'])); -//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ] -``` - -**Expanded** - -Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)): - -```js -console.log(braces('a/{x,y,z}/b', { expand: true })); -//=> ['a/x/b', 'a/y/b', 'a/z/b'] - -console.log(braces.expand('{01..10}')); -//=> ['01','02','03','04','05','06','07','08','09','10'] -``` - -### Lists - -Expand lists (like Bash "sets"): - -```js -console.log(braces('a/{foo,bar,baz}/*.js')); -//=> ['a/(foo|bar|baz)/*.js'] - -console.log(braces.expand('a/{foo,bar,baz}/*.js')); -//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js'] -``` - -### Sequences - -Expand ranges of characters (like Bash "sequences"): - -```js -console.log(braces.expand('{1..3}')); // ['1', '2', '3'] -console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b'] -console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c'] -console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c'] - -// supports zero-padded ranges -console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b'] -console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b'] -``` - -See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options. - -### Steppped ranges - -Steps, or increments, may be used with ranges: - -```js -console.log(braces.expand('{2..10..2}')); -//=> ['2', '4', '6', '8', '10'] - -console.log(braces('{2..10..2}')); -//=> ['(2|4|6|8|10)'] -``` - -When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion. - -### Nesting - -Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved. - -**"Expanded" braces** - -```js -console.log(braces.expand('a{b,c,/{x,y}}/e')); -//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e'] - -console.log(braces.expand('a/{x,{1..5},y}/c')); -//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c'] -``` - -**"Optimized" braces** - -```js -console.log(braces('a{b,c,/{x,y}}/e')); -//=> ['a(b|c|/(x|y))/e'] - -console.log(braces('a/{x,{1..5},y}/c')); -//=> ['a/(x|([1-5])|y)/c'] -``` - -### Escaping - -**Escaping braces** - -A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_: - -```js -console.log(braces.expand('a\\{d,c,b}e')); -//=> ['a{d,c,b}e'] - -console.log(braces.expand('a{d,c,b\\}e')); -//=> ['a{d,c,b}e'] -``` - -**Escaping commas** - -Commas inside braces may also be escaped: - -```js -console.log(braces.expand('a{b\\,c}d')); -//=> ['a{b,c}d'] - -console.log(braces.expand('a{d\\,c,b}e')); -//=> ['ad,ce', 'abe'] -``` - -**Single items** - -Following bash conventions, a brace pattern is also not expanded when it contains a single character: - -```js -console.log(braces.expand('a{b}c')); -//=> ['a{b}c'] -``` - -## Options - -### options.maxLength - -**Type**: `Number` - -**Default**: `10,000` - -**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera. - -```js -console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error -``` - -### options.expand - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing). - -```js -console.log(braces('a/{b,c}/d', { expand: true })); -//=> [ 'a/b/d', 'a/c/d' ] -``` - -### options.nodupes - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Remove duplicates from the returned array. - -### options.rangeLimit - -**Type**: `Number` - -**Default**: `1000` - -**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`. - -You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether. - -**Examples** - -```js -// pattern exceeds the "rangeLimit", so it's optimized automatically -console.log(braces.expand('{1..1000}')); -//=> ['([1-9]|[1-9][0-9]{1,2}|1000)'] - -// pattern does not exceed "rangeLimit", so it's NOT optimized -console.log(braces.expand('{1..100}')); -//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100'] -``` - -### options.transform - -**Type**: `Function` - -**Default**: `undefined` - -**Description**: Customize range expansion. - -**Example: Transforming non-numeric values** - -```js -const alpha = braces.expand('x/{a..e}/y', { - transform(value, index) { - // When non-numeric values are passed, "value" is a character code. - return 'foo/' + String.fromCharCode(value) + '-' + index; - }, -}); -console.log(alpha); -//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ] -``` - -**Example: Transforming numeric values** - -```js -const numeric = braces.expand('{1..5}', { - transform(value) { - // when numeric values are passed, "value" is a number - return 'foo/' + value * 2; - }, -}); -console.log(numeric); -//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ] -``` - -### options.quantifiers - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. - -Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) - -The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists. - -**Examples** - -```js -const braces = require('braces'); -console.log(braces('a/b{1,3}/{x,y,z}')); -//=> [ 'a/b(1|3)/(x|y|z)' ] -console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true })); -//=> [ 'a/b{1,3}/(x|y|z)' ] -console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true, expand: true })); -//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] -``` - -### options.keepEscaping - -**Type**: `Boolean` - -**Default**: `undefined` - -**Description**: Do not strip backslashes that were used for escaping from the result. - -## What is "brace expansion"? - -Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs). - -In addition to "expansion", braces are also used for matching. In other words: - -- [brace expansion](#brace-expansion) is for generating new lists -- [brace matching](#brace-matching) is for filtering existing lists - -
-More about brace expansion (click to expand) - -There are two main types of brace expansion: - -1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}` -2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges". - -Here are some example brace patterns to illustrate how they work: - -**Sets** - -``` -{a,b,c} => a b c -{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2 -``` - -**Sequences** - -``` -{1..9} => 1 2 3 4 5 6 7 8 9 -{4..-4} => 4 3 2 1 0 -1 -2 -3 -4 -{1..20..3} => 1 4 7 10 13 16 19 -{a..j} => a b c d e f g h i j -{j..a} => j i h g f e d c b a -{a..z..3} => a d g j m p s v y -``` - -**Combination** - -Sets and sequences can be mixed together or used along with any other strings. - -``` -{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3 -foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar -``` - -The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases. - -## Brace matching - -In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching. - -For example, the pattern `foo/{1..3}/bar` would match any of following strings: - -``` -foo/1/bar -foo/2/bar -foo/3/bar -``` - -But not: - -``` -baz/1/qux -baz/2/qux -baz/3/qux -``` - -Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings: - -``` -foo/1/bar -foo/2/bar -foo/3/bar -baz/1/qux -baz/2/qux -baz/3/qux -``` - -## Brace matching pitfalls - -Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of. - -### tldr - -**"brace bombs"** - -- brace expansion can eat up a huge amount of processing resources -- as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially -- users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!) - -For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section. - -### The solution - -Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries. - -### Geometric complexity - -At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`. - -For example, the following sets demonstrate quadratic (`O(n^2)`) complexity: - -``` -{1,2}{3,4} => (2X2) => 13 14 23 24 -{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246 -``` - -But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity: - -``` -{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248 - 249 257 258 259 267 268 269 347 348 349 357 - 358 359 367 368 369 -``` - -Now, imagine how this complexity grows given that each element is a n-tuple: - -``` -{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB) -{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB) -``` - -Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control. - -**More information** - -Interested in learning more about brace expansion? - -- [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion) -- [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion) -- [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) - -
- -## Performance - -Braces is not only screaming fast, it's also more accurate the other brace expansion libraries. - -### Better algorithms - -Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_. - -Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently. - -**The proof is in the numbers** - -Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively. - -| **Pattern** | **braces** | **[minimatch][]** | -| --------------------------- | ------------------- | ---------------------------- | -| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs) | N/A (freezes) | -| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) | -| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) | -| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) | -| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) | -| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) | -| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) | -| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) | -| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) | -| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) | -| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) | -| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) | -| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) | -| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) | -| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) | -| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) | -| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) | - -### Faster algorithms - -When you need expansion, braces is still much faster. - -_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_ - -| **Pattern** | **braces** | **[minimatch][]** | -| --------------- | --------------------------- | ---------------------------- | -| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) | -| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) | -| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) | -| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) | -| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) | -| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) | -| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) | -| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) | - -If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js). - -## Benchmarks - -### Running benchmarks - -Install dev dependencies: - -```bash -npm i -d && npm benchmark -``` - -### Latest results - -Braces is more accurate, without sacrificing performance. - -```bash -● expand - range (expanded) - braces x 53,167 ops/sec ±0.12% (102 runs sampled) - minimatch x 11,378 ops/sec ±0.10% (102 runs sampled) -● expand - range (optimized for regex) - braces x 373,442 ops/sec ±0.04% (100 runs sampled) - minimatch x 3,262 ops/sec ±0.18% (100 runs sampled) -● expand - nested ranges (expanded) - braces x 33,921 ops/sec ±0.09% (99 runs sampled) - minimatch x 10,855 ops/sec ±0.28% (100 runs sampled) -● expand - nested ranges (optimized for regex) - braces x 287,479 ops/sec ±0.52% (98 runs sampled) - minimatch x 3,219 ops/sec ±0.28% (101 runs sampled) -● expand - set (expanded) - braces x 238,243 ops/sec ±0.19% (97 runs sampled) - minimatch x 538,268 ops/sec ±0.31% (96 runs sampled) -● expand - set (optimized for regex) - braces x 321,844 ops/sec ±0.10% (97 runs sampled) - minimatch x 140,600 ops/sec ±0.15% (100 runs sampled) -● expand - nested sets (expanded) - braces x 165,371 ops/sec ±0.42% (96 runs sampled) - minimatch x 337,720 ops/sec ±0.28% (100 runs sampled) -● expand - nested sets (optimized for regex) - braces x 242,948 ops/sec ±0.12% (99 runs sampled) - minimatch x 87,403 ops/sec ±0.79% (96 runs sampled) -``` - -## 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 -``` - -
- -### Contributors - -| **Commits** | **Contributor** | -| ----------- | ------------------------------------------------------------- | -| 197 | [jonschlinkert](https://github.com/jonschlinkert) | -| 4 | [doowb](https://github.com/doowb) | -| 1 | [es128](https://github.com/es128) | -| 1 | [eush77](https://github.com/eush77) | -| 1 | [hemanth](https://github.com/hemanth) | -| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | - -### 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 April 08, 2019._ diff --git a/node_modules/braces/index.js b/node_modules/braces/index.js deleted file mode 100644 index d222c13..0000000 --- a/node_modules/braces/index.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -const stringify = require('./lib/stringify'); -const compile = require('./lib/compile'); -const expand = require('./lib/expand'); -const parse = require('./lib/parse'); - -/** - * Expand the given pattern or create a regex-compatible string. - * - * ```js - * const braces = require('braces'); - * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] - * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {String} - * @api public - */ - -const braces = (input, options = {}) => { - let output = []; - - if (Array.isArray(input)) { - for (const pattern of input) { - const result = braces.create(pattern, options); - if (Array.isArray(result)) { - output.push(...result); - } else { - output.push(result); - } - } - } else { - output = [].concat(braces.create(input, options)); - } - - if (options && options.expand === true && options.nodupes === true) { - output = [...new Set(output)]; - } - return output; -}; - -/** - * Parse the given `str` with the given `options`. - * - * ```js - * // braces.parse(pattern, [, options]); - * const ast = braces.parse('a/{b,c}/d'); - * console.log(ast); - * ``` - * @param {String} pattern Brace pattern to parse - * @param {Object} options - * @return {Object} Returns an AST - * @api public - */ - -braces.parse = (input, options = {}) => parse(input, options); - -/** - * Creates a braces string from an AST, or an AST node. - * - * ```js - * const braces = require('braces'); - * let ast = braces.parse('foo/{a,b}/bar'); - * console.log(stringify(ast.nodes[2])); //=> '{a,b}' - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.stringify = (input, options = {}) => { - if (typeof input === 'string') { - return stringify(braces.parse(input, options), options); - } - return stringify(input, options); -}; - -/** - * Compiles a brace pattern into a regex-compatible, optimized string. - * This method is called by the main [braces](#braces) function by default. - * - * ```js - * const braces = require('braces'); - * console.log(braces.compile('a/{b,c}/d')); - * //=> ['a/(b|c)/d'] - * ``` - * @param {String} `input` Brace pattern or AST. - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.compile = (input, options = {}) => { - if (typeof input === 'string') { - input = braces.parse(input, options); - } - return compile(input, options); -}; - -/** - * Expands a brace pattern into an array. This method is called by the - * main [braces](#braces) function when `options.expand` is true. Before - * using this method it's recommended that you read the [performance notes](#performance)) - * and advantages of using [.compile](#compile) instead. - * - * ```js - * const braces = require('braces'); - * console.log(braces.expand('a/{b,c}/d')); - * //=> ['a/b/d', 'a/c/d']; - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.expand = (input, options = {}) => { - if (typeof input === 'string') { - input = braces.parse(input, options); - } - - let result = expand(input, options); - - // filter out empty strings if specified - if (options.noempty === true) { - result = result.filter(Boolean); - } - - // filter out duplicates if specified - if (options.nodupes === true) { - result = [...new Set(result)]; - } - - return result; -}; - -/** - * Processes a brace pattern and returns either an expanded array - * (if `options.expand` is true), a highly optimized regex-compatible string. - * This method is called by the main [braces](#braces) function. - * - * ```js - * const braces = require('braces'); - * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) - * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' - * ``` - * @param {String} `pattern` Brace pattern - * @param {Object} `options` - * @return {Array} Returns an array of expanded values. - * @api public - */ - -braces.create = (input, options = {}) => { - if (input === '' || input.length < 3) { - return [input]; - } - - return options.expand !== true - ? braces.compile(input, options) - : braces.expand(input, options); -}; - -/** - * Expose "braces" - */ - -module.exports = braces; diff --git a/node_modules/braces/lib/compile.js b/node_modules/braces/lib/compile.js deleted file mode 100644 index dce69be..0000000 --- a/node_modules/braces/lib/compile.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -const fill = require('fill-range'); -const utils = require('./utils'); - -const compile = (ast, options = {}) => { - const walk = (node, parent = {}) => { - const invalidBlock = utils.isInvalidBrace(parent); - const invalidNode = node.invalid === true && options.escapeInvalid === true; - const invalid = invalidBlock === true || invalidNode === true; - const prefix = options.escapeInvalid === true ? '\\' : ''; - let output = ''; - - if (node.isOpen === true) { - return prefix + node.value; - } - - if (node.isClose === true) { - console.log('node.isClose', prefix, node.value); - return prefix + node.value; - } - - if (node.type === 'open') { - return invalid ? prefix + node.value : '('; - } - - if (node.type === 'close') { - return invalid ? prefix + node.value : ')'; - } - - if (node.type === 'comma') { - return node.prev.type === 'comma' ? '' : invalid ? node.value : '|'; - } - - if (node.value) { - return node.value; - } - - if (node.nodes && node.ranges > 0) { - const args = utils.reduce(node.nodes); - const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true }); - - if (range.length !== 0) { - return args.length > 1 && range.length > 1 ? `(${range})` : range; - } - } - - if (node.nodes) { - for (const child of node.nodes) { - output += walk(child, node); - } - } - - return output; - }; - - return walk(ast); -}; - -module.exports = compile; diff --git a/node_modules/braces/lib/constants.js b/node_modules/braces/lib/constants.js deleted file mode 100644 index 2bb3b88..0000000 --- a/node_modules/braces/lib/constants.js +++ /dev/null @@ -1,57 +0,0 @@ -'use strict'; - -module.exports = { - MAX_LENGTH: 10000, - - // Digits - CHAR_0: '0', /* 0 */ - CHAR_9: '9', /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 'A', /* A */ - CHAR_LOWERCASE_A: 'a', /* a */ - CHAR_UPPERCASE_Z: 'Z', /* Z */ - CHAR_LOWERCASE_Z: 'z', /* z */ - - CHAR_LEFT_PARENTHESES: '(', /* ( */ - CHAR_RIGHT_PARENTHESES: ')', /* ) */ - - CHAR_ASTERISK: '*', /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: '&', /* & */ - CHAR_AT: '@', /* @ */ - CHAR_BACKSLASH: '\\', /* \ */ - CHAR_BACKTICK: '`', /* ` */ - CHAR_CARRIAGE_RETURN: '\r', /* \r */ - CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ - CHAR_COLON: ':', /* : */ - CHAR_COMMA: ',', /* , */ - CHAR_DOLLAR: '$', /* . */ - CHAR_DOT: '.', /* . */ - CHAR_DOUBLE_QUOTE: '"', /* " */ - CHAR_EQUAL: '=', /* = */ - CHAR_EXCLAMATION_MARK: '!', /* ! */ - CHAR_FORM_FEED: '\f', /* \f */ - CHAR_FORWARD_SLASH: '/', /* / */ - CHAR_HASH: '#', /* # */ - CHAR_HYPHEN_MINUS: '-', /* - */ - CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ - CHAR_LEFT_CURLY_BRACE: '{', /* { */ - CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ - CHAR_LINE_FEED: '\n', /* \n */ - CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ - CHAR_PERCENT: '%', /* % */ - CHAR_PLUS: '+', /* + */ - CHAR_QUESTION_MARK: '?', /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ - CHAR_RIGHT_CURLY_BRACE: '}', /* } */ - CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ - CHAR_SEMICOLON: ';', /* ; */ - CHAR_SINGLE_QUOTE: '\'', /* ' */ - CHAR_SPACE: ' ', /* */ - CHAR_TAB: '\t', /* \t */ - CHAR_UNDERSCORE: '_', /* _ */ - CHAR_VERTICAL_LINE: '|', /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ -}; diff --git a/node_modules/braces/lib/expand.js b/node_modules/braces/lib/expand.js deleted file mode 100644 index 35b2c41..0000000 --- a/node_modules/braces/lib/expand.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict'; - -const fill = require('fill-range'); -const stringify = require('./stringify'); -const utils = require('./utils'); - -const append = (queue = '', stash = '', enclose = false) => { - const result = []; - - queue = [].concat(queue); - stash = [].concat(stash); - - if (!stash.length) return queue; - if (!queue.length) { - return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; - } - - for (const item of queue) { - if (Array.isArray(item)) { - for (const value of item) { - result.push(append(value, stash, enclose)); - } - } else { - for (let ele of stash) { - if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; - result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); - } - } - } - return utils.flatten(result); -}; - -const expand = (ast, options = {}) => { - const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit; - - const walk = (node, parent = {}) => { - node.queue = []; - - let p = parent; - let q = parent.queue; - - while (p.type !== 'brace' && p.type !== 'root' && p.parent) { - p = p.parent; - q = p.queue; - } - - if (node.invalid || node.dollar) { - q.push(append(q.pop(), stringify(node, options))); - return; - } - - if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { - q.push(append(q.pop(), ['{}'])); - return; - } - - if (node.nodes && node.ranges > 0) { - const args = utils.reduce(node.nodes); - - if (utils.exceedsLimit(...args, options.step, rangeLimit)) { - throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); - } - - let range = fill(...args, options); - if (range.length === 0) { - range = stringify(node, options); - } - - q.push(append(q.pop(), range)); - node.nodes = []; - return; - } - - const enclose = utils.encloseBrace(node); - let queue = node.queue; - let block = node; - - while (block.type !== 'brace' && block.type !== 'root' && block.parent) { - block = block.parent; - queue = block.queue; - } - - for (let i = 0; i < node.nodes.length; i++) { - const child = node.nodes[i]; - - if (child.type === 'comma' && node.type === 'brace') { - if (i === 1) queue.push(''); - queue.push(''); - continue; - } - - if (child.type === 'close') { - q.push(append(q.pop(), queue, enclose)); - continue; - } - - if (child.value && child.type !== 'open') { - queue.push(append(queue.pop(), child.value)); - continue; - } - - if (child.nodes) { - walk(child, node); - } - } - - return queue; - }; - - return utils.flatten(walk(ast)); -}; - -module.exports = expand; diff --git a/node_modules/braces/lib/parse.js b/node_modules/braces/lib/parse.js deleted file mode 100644 index 3a6988e..0000000 --- a/node_modules/braces/lib/parse.js +++ /dev/null @@ -1,331 +0,0 @@ -'use strict'; - -const stringify = require('./stringify'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - CHAR_BACKSLASH, /* \ */ - CHAR_BACKTICK, /* ` */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_RIGHT_SQUARE_BRACKET, /* ] */ - CHAR_DOUBLE_QUOTE, /* " */ - CHAR_SINGLE_QUOTE, /* ' */ - CHAR_NO_BREAK_SPACE, - CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = require('./constants'); - -/** - * parse - */ - -const parse = (input, options = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - const opts = options || {}; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - if (input.length > max) { - throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); - } - - const ast = { type: 'root', input, nodes: [] }; - const stack = [ast]; - let block = ast; - let prev = ast; - let brackets = 0; - const length = input.length; - let index = 0; - let depth = 0; - let value; - - /** - * Helpers - */ - - const advance = () => input[index++]; - const push = node => { - if (node.type === 'text' && prev.type === 'dot') { - prev.type = 'text'; - } - - if (prev && prev.type === 'text' && node.type === 'text') { - prev.value += node.value; - return; - } - - block.nodes.push(node); - node.parent = block; - node.prev = prev; - prev = node; - return node; - }; - - push({ type: 'bos' }); - - while (index < length) { - block = stack[stack.length - 1]; - value = advance(); - - /** - * Invalid chars - */ - - if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { - continue; - } - - /** - * Escaped chars - */ - - if (value === CHAR_BACKSLASH) { - push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); - continue; - } - - /** - * Right square bracket (literal): ']' - */ - - if (value === CHAR_RIGHT_SQUARE_BRACKET) { - push({ type: 'text', value: '\\' + value }); - continue; - } - - /** - * Left square bracket: '[' - */ - - if (value === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - - let next; - - while (index < length && (next = advance())) { - value += next; - - if (next === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - continue; - } - - if (next === CHAR_BACKSLASH) { - value += advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - brackets--; - - if (brackets === 0) { - break; - } - } - } - - push({ type: 'text', value }); - continue; - } - - /** - * Parentheses - */ - - if (value === CHAR_LEFT_PARENTHESES) { - block = push({ type: 'paren', nodes: [] }); - stack.push(block); - push({ type: 'text', value }); - continue; - } - - if (value === CHAR_RIGHT_PARENTHESES) { - if (block.type !== 'paren') { - push({ type: 'text', value }); - continue; - } - block = stack.pop(); - push({ type: 'text', value }); - block = stack[stack.length - 1]; - continue; - } - - /** - * Quotes: '|"|` - */ - - if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { - const open = value; - let next; - - if (options.keepQuotes !== true) { - value = ''; - } - - while (index < length && (next = advance())) { - if (next === CHAR_BACKSLASH) { - value += next + advance(); - continue; - } - - if (next === open) { - if (options.keepQuotes === true) value += next; - break; - } - - value += next; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Left curly brace: '{' - */ - - if (value === CHAR_LEFT_CURLY_BRACE) { - depth++; - - const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; - const brace = { - type: 'brace', - open: true, - close: false, - dollar, - depth, - commas: 0, - ranges: 0, - nodes: [] - }; - - block = push(brace); - stack.push(block); - push({ type: 'open', value }); - continue; - } - - /** - * Right curly brace: '}' - */ - - if (value === CHAR_RIGHT_CURLY_BRACE) { - if (block.type !== 'brace') { - push({ type: 'text', value }); - continue; - } - - const type = 'close'; - block = stack.pop(); - block.close = true; - - push({ type, value }); - depth--; - - block = stack[stack.length - 1]; - continue; - } - - /** - * Comma: ',' - */ - - if (value === CHAR_COMMA && depth > 0) { - if (block.ranges > 0) { - block.ranges = 0; - const open = block.nodes.shift(); - block.nodes = [open, { type: 'text', value: stringify(block) }]; - } - - push({ type: 'comma', value }); - block.commas++; - continue; - } - - /** - * Dot: '.' - */ - - if (value === CHAR_DOT && depth > 0 && block.commas === 0) { - const siblings = block.nodes; - - if (depth === 0 || siblings.length === 0) { - push({ type: 'text', value }); - continue; - } - - if (prev.type === 'dot') { - block.range = []; - prev.value += value; - prev.type = 'range'; - - if (block.nodes.length !== 3 && block.nodes.length !== 5) { - block.invalid = true; - block.ranges = 0; - prev.type = 'text'; - continue; - } - - block.ranges++; - block.args = []; - continue; - } - - if (prev.type === 'range') { - siblings.pop(); - - const before = siblings[siblings.length - 1]; - before.value += prev.value + value; - prev = before; - block.ranges--; - continue; - } - - push({ type: 'dot', value }); - continue; - } - - /** - * Text - */ - - push({ type: 'text', value }); - } - - // Mark imbalanced braces and brackets as invalid - do { - block = stack.pop(); - - if (block.type !== 'root') { - block.nodes.forEach(node => { - if (!node.nodes) { - if (node.type === 'open') node.isOpen = true; - if (node.type === 'close') node.isClose = true; - if (!node.nodes) node.type = 'text'; - node.invalid = true; - } - }); - - // get the location of the block on parent.nodes (block's siblings) - const parent = stack[stack.length - 1]; - const index = parent.nodes.indexOf(block); - // replace the (invalid) block with it's nodes - parent.nodes.splice(index, 1, ...block.nodes); - } - } while (stack.length > 0); - - push({ type: 'eos' }); - return ast; -}; - -module.exports = parse; diff --git a/node_modules/braces/lib/stringify.js b/node_modules/braces/lib/stringify.js deleted file mode 100644 index 8bcf872..0000000 --- a/node_modules/braces/lib/stringify.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const utils = require('./utils'); - -module.exports = (ast, options = {}) => { - const stringify = (node, parent = {}) => { - const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); - const invalidNode = node.invalid === true && options.escapeInvalid === true; - let output = ''; - - if (node.value) { - if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { - return '\\' + node.value; - } - return node.value; - } - - if (node.value) { - return node.value; - } - - if (node.nodes) { - for (const child of node.nodes) { - output += stringify(child); - } - } - return output; - }; - - return stringify(ast); -}; - diff --git a/node_modules/braces/lib/utils.js b/node_modules/braces/lib/utils.js deleted file mode 100644 index d19311f..0000000 --- a/node_modules/braces/lib/utils.js +++ /dev/null @@ -1,122 +0,0 @@ -'use strict'; - -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); - } - return false; -}; - -/** - * Find a node of the given type - */ - -exports.find = (node, type) => node.nodes.find(node => node.type === type); - -/** - * Find a node of the given type - */ - -exports.exceedsLimit = (min, max, step = 1, limit) => { - if (limit === false) return false; - if (!exports.isInteger(min) || !exports.isInteger(max)) return false; - return ((Number(max) - Number(min)) / Number(step)) >= limit; -}; - -/** - * Escape the given node with '\\' before node.value - */ - -exports.escapeNode = (block, n = 0, type) => { - const node = block.nodes[n]; - if (!node) return; - - if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { - if (node.escaped !== true) { - node.value = '\\' + node.value; - node.escaped = true; - } - } -}; - -/** - * Returns true if the given brace node should be enclosed in literal braces - */ - -exports.encloseBrace = node => { - if (node.type !== 'brace') return false; - if ((node.commas >> 0 + node.ranges >> 0) === 0) { - node.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a brace node is invalid. - */ - -exports.isInvalidBrace = block => { - if (block.type !== 'brace') return false; - if (block.invalid === true || block.dollar) return true; - if ((block.commas >> 0 + block.ranges >> 0) === 0) { - block.invalid = true; - return true; - } - if (block.open !== true || block.close !== true) { - block.invalid = true; - return true; - } - return false; -}; - -/** - * Returns true if a node is an open or close node - */ - -exports.isOpenOrClose = node => { - if (node.type === 'open' || node.type === 'close') { - return true; - } - return node.open === true || node.close === true; -}; - -/** - * Reduce an array of text nodes. - */ - -exports.reduce = nodes => nodes.reduce((acc, node) => { - if (node.type === 'text') acc.push(node.value); - if (node.type === 'range') node.type = 'text'; - return acc; -}, []); - -/** - * Flatten an array - */ - -exports.flatten = (...args) => { - const result = []; - - const flat = arr => { - for (let i = 0; i < arr.length; i++) { - const ele = arr[i]; - - if (Array.isArray(ele)) { - flat(ele); - continue; - } - - if (ele !== undefined) { - result.push(ele); - } - } - return result; - }; - - flat(args); - return result; -}; diff --git a/node_modules/braces/package.json b/node_modules/braces/package.json deleted file mode 100644 index c3c056e..0000000 --- a/node_modules/braces/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "braces", - "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.", - "version": "3.0.3", - "homepage": "https://github.com/micromatch/braces", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Brian Woodward (https://twitter.com/doowb)", - "Elan Shanker (https://github.com/es128)", - "Eugene Sharygin (https://github.com/eush77)", - "hemanth.hm (http://h3manth.com)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "micromatch/braces", - "bugs": { - "url": "https://github.com/micromatch/braces/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "mocha", - "benchmark": "node benchmark" - }, - "dependencies": { - "fill-range": "^7.1.1" - }, - "devDependencies": { - "ansi-colors": "^3.2.4", - "bash-path": "^2.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.1.1" - }, - "keywords": [ - "alpha", - "alphabetical", - "bash", - "brace", - "braces", - "expand", - "expansion", - "filepath", - "fill", - "fs", - "glob", - "globbing", - "letter", - "match", - "matches", - "matching", - "number", - "numerical", - "path", - "range", - "ranges", - "sh" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "lint": { - "reflinks": true - }, - "plugins": [ - "gulp-format-md" - ] - } -} diff --git a/node_modules/buffer/AUTHORS.md b/node_modules/buffer/AUTHORS.md deleted file mode 100644 index 468aa19..0000000 --- a/node_modules/buffer/AUTHORS.md +++ /dev/null @@ -1,73 +0,0 @@ -# Authors - -#### Ordered by first contribution. - -- Romain Beauxis (toots@rastageeks.org) -- Tobias Koppers (tobias.koppers@googlemail.com) -- Janus (ysangkok@gmail.com) -- Rainer Dreyer (rdrey1@gmail.com) -- Tõnis Tiigi (tonistiigi@gmail.com) -- James Halliday (mail@substack.net) -- Michael Williamson (mike@zwobble.org) -- elliottcable (github@elliottcable.name) -- rafael (rvalle@livelens.net) -- Andrew Kelley (superjoe30@gmail.com) -- Andreas Madsen (amwebdk@gmail.com) -- Mike Brevoort (mike.brevoort@pearson.com) -- Brian White (mscdex@mscdex.net) -- Feross Aboukhadijeh (feross@feross.org) -- Ruben Verborgh (ruben@verborgh.org) -- eliang (eliang.cs@gmail.com) -- Jesse Tane (jesse.tane@gmail.com) -- Alfonso Boza (alfonso@cloud.com) -- Mathias Buus (mathiasbuus@gmail.com) -- Devon Govett (devongovett@gmail.com) -- Daniel Cousens (github@dcousens.com) -- Joseph Dykstra (josephdykstra@gmail.com) -- Parsha Pourkhomami (parshap+git@gmail.com) -- Damjan Košir (damjan.kosir@gmail.com) -- daverayment (dave.rayment@gmail.com) -- kawanet (u-suke@kawa.net) -- Linus Unnebäck (linus@folkdatorn.se) -- Nolan Lawson (nolan.lawson@gmail.com) -- Calvin Metcalf (calvin.metcalf@gmail.com) -- Koki Takahashi (hakatasiloving@gmail.com) -- Guy Bedford (guybedford@gmail.com) -- Jan Schär (jscissr@gmail.com) -- RaulTsc (tomescu.raul@gmail.com) -- Matthieu Monsch (monsch@alum.mit.edu) -- Dan Ehrenberg (littledan@chromium.org) -- Kirill Fomichev (fanatid@ya.ru) -- Yusuke Kawasaki (u-suke@kawa.net) -- DC (dcposch@dcpos.ch) -- John-David Dalton (john.david.dalton@gmail.com) -- adventure-yunfei (adventure030@gmail.com) -- Emil Bay (github@tixz.dk) -- Sam Sudar (sudar.sam@gmail.com) -- Volker Mische (volker.mische@gmail.com) -- David Walton (support@geekstocks.com) -- Сковорода Никита Андреевич (chalkerx@gmail.com) -- greenkeeper[bot] (greenkeeper[bot]@users.noreply.github.com) -- ukstv (sergey.ukustov@machinomy.com) -- Renée Kooi (renee@kooi.me) -- ranbochen (ranbochen@qq.com) -- Vladimir Borovik (bobahbdb@gmail.com) -- greenkeeper[bot] (23040076+greenkeeper[bot]@users.noreply.github.com) -- kumavis (aaron@kumavis.me) -- Sergey Ukustov (sergey.ukustov@machinomy.com) -- Fei Liu (liu.feiwood@gmail.com) -- Blaine Bublitz (blaine.bublitz@gmail.com) -- clement (clement@seald.io) -- Koushik Dutta (koushd@gmail.com) -- Jordan Harband (ljharb@gmail.com) -- Niklas Mischkulnig (mischnic@users.noreply.github.com) -- Nikolai Vavilov (vvnicholas@gmail.com) -- Fedor Nezhivoi (gyzerok@users.noreply.github.com) -- shuse2 (shus.toda@gmail.com) -- Peter Newman (peternewman@users.noreply.github.com) -- mathmakgakpak (44949126+mathmakgakpak@users.noreply.github.com) -- jkkang (jkkang@smartauth.kr) -- Deklan Webster (deklanw@gmail.com) -- Martin Heidegger (martin.heidegger@gmail.com) - -#### Generated by bin/update-authors.sh. diff --git a/node_modules/buffer/LICENSE b/node_modules/buffer/LICENSE deleted file mode 100644 index d6bf75d..0000000 --- a/node_modules/buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Feross Aboukhadijeh, 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/buffer/README.md b/node_modules/buffer/README.md deleted file mode 100644 index 451e235..0000000 --- a/node_modules/buffer/README.md +++ /dev/null @@ -1,410 +0,0 @@ -# buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] - -[travis-image]: https://img.shields.io/travis/feross/buffer/master.svg -[travis-url]: https://travis-ci.org/feross/buffer -[npm-image]: https://img.shields.io/npm/v/buffer.svg -[npm-url]: https://npmjs.org/package/buffer -[downloads-image]: https://img.shields.io/npm/dm/buffer.svg -[downloads-url]: https://npmjs.org/package/buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com - -#### The buffer module from [node.js](https://nodejs.org/), for the browser. - -[![saucelabs][saucelabs-image]][saucelabs-url] - -[saucelabs-image]: https://saucelabs.com/browser-matrix/buffer.svg -[saucelabs-url]: https://saucelabs.com/u/buffer - -With [browserify](http://browserify.org), simply `require('buffer')` or use the `Buffer` global and you will get this module. - -The goal is to provide an API that is 100% identical to -[node's Buffer API](https://nodejs.org/api/buffer.html). Read the -[official docs](https://nodejs.org/api/buffer.html) for the full list of properties, -instance methods, and class methods that are supported. - -## features - -- Manipulate binary data like a boss, in all browsers! -- Super fast. Backed by Typed Arrays (`Uint8Array`/`ArrayBuffer`, not `Object`) -- Extremely small bundle size (**6.75KB minified + gzipped**, 51.9KB with comments) -- Excellent browser support (Chrome, Firefox, Edge, Safari 11+, iOS 11+, Android, etc.) -- Preserves Node API exactly, with one minor difference (see below) -- Square-bracket `buf[4]` notation works! -- Does not modify any browser prototypes or put anything on `window` -- Comprehensive test suite (including all buffer tests from node.js core) - -## install - -To use this module directly (without browserify), install it: - -```bash -npm install buffer -``` - -This module was previously called **native-buffer-browserify**, but please use **buffer** -from now on. - -If you do not use a bundler, you can use the [standalone script](https://bundle.run/buffer). - -## usage - -The module's API is identical to node's `Buffer` API. Read the -[official docs](https://nodejs.org/api/buffer.html) for the full list of properties, -instance methods, and class methods that are supported. - -As mentioned above, `require('buffer')` or use the `Buffer` global with -[browserify](http://browserify.org) and this module will automatically be included -in your bundle. Almost any npm module will work in the browser, even if it assumes that -the node `Buffer` API will be available. - -To depend on this module explicitly (without browserify), require it like this: - -```js -var Buffer = require('buffer/').Buffer // note: the trailing slash is important! -``` - -To require this module explicitly, use `require('buffer/')` which tells the node.js module -lookup algorithm (also used by browserify) to use the **npm module** named `buffer` -instead of the **node.js core** module named `buffer`! - - -## how does it work? - -The Buffer constructor returns instances of `Uint8Array` that have their prototype -changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, -so the returned instances will have all the node `Buffer` methods and the -`Uint8Array` methods. Square bracket notation works as expected -- it returns a -single octet. - -The `Uint8Array` prototype remains unmodified. - - -## tracking the latest node api - -This module tracks the Buffer API in the latest (unstable) version of node.js. The Buffer -API is considered **stable** in the -[node stability index](https://nodejs.org/docs/latest/api/documentation.html#documentation_stability_index), -so it is unlikely that there will ever be breaking changes. -Nonetheless, when/if the Buffer API changes in node, this module's API will change -accordingly. - -## related packages - -- [`buffer-reverse`](https://www.npmjs.com/package/buffer-reverse) - Reverse a buffer -- [`buffer-xor`](https://www.npmjs.com/package/buffer-xor) - Bitwise xor a buffer -- [`is-buffer`](https://www.npmjs.com/package/is-buffer) - Determine if an object is a Buffer without including the whole `Buffer` package - -## conversion packages - -### convert typed array to buffer - -Use [`typedarray-to-buffer`](https://www.npmjs.com/package/typedarray-to-buffer) to convert any kind of typed array to a `Buffer`. Does not perform a copy, so it's super fast. - -### convert buffer to typed array - -`Buffer` is a subclass of `Uint8Array` (which is a typed array). So there is no need to explicitly convert to typed array. Just use the buffer as a `Uint8Array`. - -### convert blob to buffer - -Use [`blob-to-buffer`](https://www.npmjs.com/package/blob-to-buffer) to convert a `Blob` to a `Buffer`. - -### convert buffer to blob - -To convert a `Buffer` to a `Blob`, use the `Blob` constructor: - -```js -var blob = new Blob([ buffer ]) -``` - -Optionally, specify a mimetype: - -```js -var blob = new Blob([ buffer ], { type: 'text/html' }) -``` - -### convert arraybuffer to buffer - -To convert an `ArrayBuffer` to a `Buffer`, use the `Buffer.from` function. Does not perform a copy, so it's super fast. - -```js -var buffer = Buffer.from(arrayBuffer) -``` - -### convert buffer to arraybuffer - -To convert a `Buffer` to an `ArrayBuffer`, use the `.buffer` property (which is present on all `Uint8Array` objects): - -```js -var arrayBuffer = buffer.buffer.slice( - buffer.byteOffset, buffer.byteOffset + buffer.byteLength -) -``` - -Alternatively, use the [`to-arraybuffer`](https://www.npmjs.com/package/to-arraybuffer) module. - -## performance - -See perf tests in `/perf`. - -`BrowserBuffer` is the browser `buffer` module (this repo). `Uint8Array` is included as a -sanity check (since `BrowserBuffer` uses `Uint8Array` under the hood, `Uint8Array` will -always be at least a bit faster). Finally, `NodeBuffer` is the node.js buffer module, -which is included to compare against. - -NOTE: Performance has improved since these benchmarks were taken. PR welcome to update the README. - -### Chrome 38 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 11,457,464 ops/sec | ±0.86% | 66 | ✓ | -| Uint8Array#bracket-notation | 10,824,332 ops/sec | ±0.74% | 65 | | -| | | | | -| BrowserBuffer#concat | 450,532 ops/sec | ±0.76% | 68 | | -| Uint8Array#concat | 1,368,911 ops/sec | ±1.50% | 62 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 903,001 ops/sec | ±0.96% | 67 | | -| Uint8Array#copy(16000) | 1,422,441 ops/sec | ±1.04% | 66 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 11,431,358 ops/sec | ±0.46% | 69 | | -| Uint8Array#copy(16) | 13,944,163 ops/sec | ±1.12% | 68 | ✓ | -| | | | | -| BrowserBuffer#new(16000) | 106,329 ops/sec | ±6.70% | 44 | | -| Uint8Array#new(16000) | 131,001 ops/sec | ±2.85% | 31 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 1,554,491 ops/sec | ±1.60% | 65 | | -| Uint8Array#new(16) | 6,623,930 ops/sec | ±1.66% | 65 | ✓ | -| | | | | -| BrowserBuffer#readDoubleBE | 112,830 ops/sec | ±0.51% | 69 | ✓ | -| DataView#getFloat64 | 93,500 ops/sec | ±0.57% | 68 | | -| | | | | -| BrowserBuffer#readFloatBE | 146,678 ops/sec | ±0.95% | 68 | ✓ | -| DataView#getFloat32 | 99,311 ops/sec | ±0.41% | 67 | | -| | | | | -| BrowserBuffer#readUInt32LE | 843,214 ops/sec | ±0.70% | 69 | ✓ | -| DataView#getUint32 | 103,024 ops/sec | ±0.64% | 67 | | -| | | | | -| BrowserBuffer#slice | 1,013,941 ops/sec | ±0.75% | 67 | | -| Uint8Array#subarray | 1,903,928 ops/sec | ±0.53% | 67 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 61,387 ops/sec | ±0.90% | 67 | | -| DataView#setFloat32 | 141,249 ops/sec | ±0.40% | 66 | ✓ | - - -### Firefox 33 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 20,800,421 ops/sec | ±1.84% | 60 | | -| Uint8Array#bracket-notation | 20,826,235 ops/sec | ±2.02% | 61 | ✓ | -| | | | | -| BrowserBuffer#concat | 153,076 ops/sec | ±2.32% | 61 | | -| Uint8Array#concat | 1,255,674 ops/sec | ±8.65% | 52 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 1,105,312 ops/sec | ±1.16% | 63 | | -| Uint8Array#copy(16000) | 1,615,911 ops/sec | ±0.55% | 66 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 16,357,599 ops/sec | ±0.73% | 68 | | -| Uint8Array#copy(16) | 31,436,281 ops/sec | ±1.05% | 68 | ✓ | -| | | | | -| BrowserBuffer#new(16000) | 52,995 ops/sec | ±6.01% | 35 | | -| Uint8Array#new(16000) | 87,686 ops/sec | ±5.68% | 45 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 252,031 ops/sec | ±1.61% | 66 | | -| Uint8Array#new(16) | 8,477,026 ops/sec | ±0.49% | 68 | ✓ | -| | | | | -| BrowserBuffer#readDoubleBE | 99,871 ops/sec | ±0.41% | 69 | | -| DataView#getFloat64 | 285,663 ops/sec | ±0.70% | 68 | ✓ | -| | | | | -| BrowserBuffer#readFloatBE | 115,540 ops/sec | ±0.42% | 69 | | -| DataView#getFloat32 | 288,722 ops/sec | ±0.82% | 68 | ✓ | -| | | | | -| BrowserBuffer#readUInt32LE | 633,926 ops/sec | ±1.08% | 67 | ✓ | -| DataView#getUint32 | 294,808 ops/sec | ±0.79% | 64 | | -| | | | | -| BrowserBuffer#slice | 349,425 ops/sec | ±0.46% | 69 | | -| Uint8Array#subarray | 5,965,819 ops/sec | ±0.60% | 65 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 59,980 ops/sec | ±0.41% | 67 | | -| DataView#setFloat32 | 317,634 ops/sec | ±0.63% | 68 | ✓ | - -### Safari 8 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 10,279,729 ops/sec | ±2.25% | 56 | ✓ | -| Uint8Array#bracket-notation | 10,030,767 ops/sec | ±2.23% | 59 | | -| | | | | -| BrowserBuffer#concat | 144,138 ops/sec | ±1.38% | 65 | | -| Uint8Array#concat | 4,950,764 ops/sec | ±1.70% | 63 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 1,058,548 ops/sec | ±1.51% | 64 | | -| Uint8Array#copy(16000) | 1,409,666 ops/sec | ±1.17% | 65 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 6,282,529 ops/sec | ±1.88% | 58 | | -| Uint8Array#copy(16) | 11,907,128 ops/sec | ±2.87% | 58 | ✓ | -| | | | | -| BrowserBuffer#new(16000) | 101,663 ops/sec | ±3.89% | 57 | | -| Uint8Array#new(16000) | 22,050,818 ops/sec | ±6.51% | 46 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 176,072 ops/sec | ±2.13% | 64 | | -| Uint8Array#new(16) | 24,385,731 ops/sec | ±5.01% | 51 | ✓ | -| | | | | -| BrowserBuffer#readDoubleBE | 41,341 ops/sec | ±1.06% | 67 | | -| DataView#getFloat64 | 322,280 ops/sec | ±0.84% | 68 | ✓ | -| | | | | -| BrowserBuffer#readFloatBE | 46,141 ops/sec | ±1.06% | 65 | | -| DataView#getFloat32 | 337,025 ops/sec | ±0.43% | 69 | ✓ | -| | | | | -| BrowserBuffer#readUInt32LE | 151,551 ops/sec | ±1.02% | 66 | | -| DataView#getUint32 | 308,278 ops/sec | ±0.94% | 67 | ✓ | -| | | | | -| BrowserBuffer#slice | 197,365 ops/sec | ±0.95% | 66 | | -| Uint8Array#subarray | 9,558,024 ops/sec | ±3.08% | 58 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 17,518 ops/sec | ±1.03% | 63 | | -| DataView#setFloat32 | 319,751 ops/sec | ±0.48% | 68 | ✓ | - - -### Node 0.11.14 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 10,489,828 ops/sec | ±3.25% | 90 | | -| Uint8Array#bracket-notation | 10,534,884 ops/sec | ±0.81% | 92 | ✓ | -| NodeBuffer#bracket-notation | 10,389,910 ops/sec | ±0.97% | 87 | | -| | | | | -| BrowserBuffer#concat | 487,830 ops/sec | ±2.58% | 88 | | -| Uint8Array#concat | 1,814,327 ops/sec | ±1.28% | 88 | ✓ | -| NodeBuffer#concat | 1,636,523 ops/sec | ±1.88% | 73 | | -| | | | | -| BrowserBuffer#copy(16000) | 1,073,665 ops/sec | ±0.77% | 90 | | -| Uint8Array#copy(16000) | 1,348,517 ops/sec | ±0.84% | 89 | ✓ | -| NodeBuffer#copy(16000) | 1,289,533 ops/sec | ±0.82% | 93 | | -| | | | | -| BrowserBuffer#copy(16) | 12,782,706 ops/sec | ±0.74% | 85 | | -| Uint8Array#copy(16) | 14,180,427 ops/sec | ±0.93% | 92 | ✓ | -| NodeBuffer#copy(16) | 11,083,134 ops/sec | ±1.06% | 89 | | -| | | | | -| BrowserBuffer#new(16000) | 141,678 ops/sec | ±3.30% | 67 | | -| Uint8Array#new(16000) | 161,491 ops/sec | ±2.96% | 60 | | -| NodeBuffer#new(16000) | 292,699 ops/sec | ±3.20% | 55 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 1,655,466 ops/sec | ±2.41% | 82 | | -| Uint8Array#new(16) | 14,399,926 ops/sec | ±0.91% | 94 | ✓ | -| NodeBuffer#new(16) | 3,894,696 ops/sec | ±0.88% | 92 | | -| | | | | -| BrowserBuffer#readDoubleBE | 109,582 ops/sec | ±0.75% | 93 | ✓ | -| DataView#getFloat64 | 91,235 ops/sec | ±0.81% | 90 | | -| NodeBuffer#readDoubleBE | 88,593 ops/sec | ±0.96% | 81 | | -| | | | | -| BrowserBuffer#readFloatBE | 139,854 ops/sec | ±1.03% | 85 | ✓ | -| DataView#getFloat32 | 98,744 ops/sec | ±0.80% | 89 | | -| NodeBuffer#readFloatBE | 92,769 ops/sec | ±0.94% | 93 | | -| | | | | -| BrowserBuffer#readUInt32LE | 710,861 ops/sec | ±0.82% | 92 | | -| DataView#getUint32 | 117,893 ops/sec | ±0.84% | 91 | | -| NodeBuffer#readUInt32LE | 851,412 ops/sec | ±0.72% | 93 | ✓ | -| | | | | -| BrowserBuffer#slice | 1,673,877 ops/sec | ±0.73% | 94 | | -| Uint8Array#subarray | 6,919,243 ops/sec | ±0.67% | 90 | ✓ | -| NodeBuffer#slice | 4,617,604 ops/sec | ±0.79% | 93 | | -| | | | | -| BrowserBuffer#writeFloatBE | 66,011 ops/sec | ±0.75% | 93 | | -| DataView#setFloat32 | 127,760 ops/sec | ±0.72% | 93 | ✓ | -| NodeBuffer#writeFloatBE | 103,352 ops/sec | ±0.83% | 93 | | - -### iojs 1.8.1 - -| Method | Operations | Accuracy | Sampled | Fastest | -|:-------|:-----------|:---------|:--------|:-------:| -| BrowserBuffer#bracket-notation | 10,990,488 ops/sec | ±1.11% | 91 | | -| Uint8Array#bracket-notation | 11,268,757 ops/sec | ±0.65% | 97 | | -| NodeBuffer#bracket-notation | 11,353,260 ops/sec | ±0.83% | 94 | ✓ | -| | | | | -| BrowserBuffer#concat | 378,954 ops/sec | ±0.74% | 94 | | -| Uint8Array#concat | 1,358,288 ops/sec | ±0.97% | 87 | | -| NodeBuffer#concat | 1,934,050 ops/sec | ±1.11% | 78 | ✓ | -| | | | | -| BrowserBuffer#copy(16000) | 894,538 ops/sec | ±0.56% | 84 | | -| Uint8Array#copy(16000) | 1,442,656 ops/sec | ±0.71% | 96 | | -| NodeBuffer#copy(16000) | 1,457,898 ops/sec | ±0.53% | 92 | ✓ | -| | | | | -| BrowserBuffer#copy(16) | 12,870,457 ops/sec | ±0.67% | 95 | | -| Uint8Array#copy(16) | 16,643,989 ops/sec | ±0.61% | 93 | ✓ | -| NodeBuffer#copy(16) | 14,885,848 ops/sec | ±0.74% | 94 | | -| | | | | -| BrowserBuffer#new(16000) | 109,264 ops/sec | ±4.21% | 63 | | -| Uint8Array#new(16000) | 138,916 ops/sec | ±1.87% | 61 | | -| NodeBuffer#new(16000) | 281,449 ops/sec | ±3.58% | 51 | ✓ | -| | | | | -| BrowserBuffer#new(16) | 1,362,935 ops/sec | ±0.56% | 99 | | -| Uint8Array#new(16) | 6,193,090 ops/sec | ±0.64% | 95 | ✓ | -| NodeBuffer#new(16) | 4,745,425 ops/sec | ±1.56% | 90 | | -| | | | | -| BrowserBuffer#readDoubleBE | 118,127 ops/sec | ±0.59% | 93 | ✓ | -| DataView#getFloat64 | 107,332 ops/sec | ±0.65% | 91 | | -| NodeBuffer#readDoubleBE | 116,274 ops/sec | ±0.94% | 95 | | -| | | | | -| BrowserBuffer#readFloatBE | 150,326 ops/sec | ±0.58% | 95 | ✓ | -| DataView#getFloat32 | 110,541 ops/sec | ±0.57% | 98 | | -| NodeBuffer#readFloatBE | 121,599 ops/sec | ±0.60% | 87 | | -| | | | | -| BrowserBuffer#readUInt32LE | 814,147 ops/sec | ±0.62% | 93 | | -| DataView#getUint32 | 137,592 ops/sec | ±0.64% | 90 | | -| NodeBuffer#readUInt32LE | 931,650 ops/sec | ±0.71% | 96 | ✓ | -| | | | | -| BrowserBuffer#slice | 878,590 ops/sec | ±0.68% | 93 | | -| Uint8Array#subarray | 2,843,308 ops/sec | ±1.02% | 90 | | -| NodeBuffer#slice | 4,998,316 ops/sec | ±0.68% | 90 | ✓ | -| | | | | -| BrowserBuffer#writeFloatBE | 65,927 ops/sec | ±0.74% | 93 | | -| DataView#setFloat32 | 139,823 ops/sec | ±0.97% | 89 | ✓ | -| NodeBuffer#writeFloatBE | 135,763 ops/sec | ±0.65% | 96 | | -| | | | | - -## Testing the project - -First, install the project: - - npm install - -Then, to run tests in Node.js, run: - - npm run test-node - -To test locally in a browser, you can run: - - npm run test-browser-es5-local # For ES5 browsers that don't support ES6 - npm run test-browser-es6-local # For ES6 compliant browsers - -This will print out a URL that you can then open in a browser to run the tests, using [airtap](https://www.npmjs.com/package/airtap). - -To run automated browser tests using Saucelabs, ensure that your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables are set, then run: - - npm test - -This is what's run in Travis, to check against various browsers. The list of browsers is kept in the `bin/airtap-es5.yml` and `bin/airtap-es6.yml` files. - -## JavaScript Standard Style - -This module uses [JavaScript Standard Style](https://github.com/feross/standard). - -[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) - -To test that the code conforms to the style, `npm install` and run: - - ./node_modules/.bin/standard - -## credit - -This was originally forked from [buffer-browserify](https://github.com/toots/buffer-browserify). - -## Security Policies and Procedures - -The `buffer` team and community take all security bugs in `buffer` seriously. Please see our [security policies and procedures](https://github.com/feross/security) document to learn how to report issues. - -## license - -MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org), and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis. diff --git a/node_modules/buffer/index.d.ts b/node_modules/buffer/index.d.ts deleted file mode 100644 index 07096a2..0000000 --- a/node_modules/buffer/index.d.ts +++ /dev/null @@ -1,194 +0,0 @@ -export class Buffer extends Uint8Array { - length: number - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - toJSON(): { type: 'Buffer', data: any[] }; - equals(otherBuffer: Buffer): boolean; - compare(otherBuffer: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; - copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - slice(start?: number, end?: number): Buffer; - writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; - readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; - readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; - readUInt8(offset: number, noAssert?: boolean): number; - readUInt16LE(offset: number, noAssert?: boolean): number; - readUInt16BE(offset: number, noAssert?: boolean): number; - readUInt32LE(offset: number, noAssert?: boolean): number; - readUInt32BE(offset: number, noAssert?: boolean): number; - readBigUInt64LE(offset: number): BigInt; - readBigUInt64BE(offset: number): BigInt; - readInt8(offset: number, noAssert?: boolean): number; - readInt16LE(offset: number, noAssert?: boolean): number; - readInt16BE(offset: number, noAssert?: boolean): number; - readInt32LE(offset: number, noAssert?: boolean): number; - readInt32BE(offset: number, noAssert?: boolean): number; - readBigInt64LE(offset: number): BigInt; - readBigInt64BE(offset: number): BigInt; - readFloatLE(offset: number, noAssert?: boolean): number; - readFloatBE(offset: number, noAssert?: boolean): number; - readDoubleLE(offset: number, noAssert?: boolean): number; - readDoubleBE(offset: number, noAssert?: boolean): number; - reverse(): this; - swap16(): Buffer; - swap32(): Buffer; - swap64(): Buffer; - writeUInt8(value: number, offset: number, noAssert?: boolean): number; - writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeBigUInt64LE(value: number, offset: number): BigInt; - writeBigUInt64BE(value: number, offset: number): BigInt; - writeInt8(value: number, offset: number, noAssert?: boolean): number; - writeInt16LE(value: number, offset: number, noAssert?: boolean): number; - writeInt16BE(value: number, offset: number, noAssert?: boolean): number; - writeInt32LE(value: number, offset: number, noAssert?: boolean): number; - writeInt32BE(value: number, offset: number, noAssert?: boolean): number; - writeBigInt64LE(value: number, offset: number): BigInt; - writeBigInt64BE(value: number, offset: number): BigInt; - writeFloatLE(value: number, offset: number, noAssert?: boolean): number; - writeFloatBE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; - writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; - fill(value: any, offset?: number, end?: number): this; - indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; - includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; - - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - */ - constructor (str: string, encoding?: string); - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - */ - constructor (size: number); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: Uint8Array); - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}. - * - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - */ - constructor (arrayBuffer: ArrayBuffer); - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - */ - constructor (array: any[]); - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - */ - constructor (buffer: Buffer); - prototype: Buffer; - /** - * Allocates a new Buffer using an {array} of octets. - * - * @param array - */ - static from(array: any[]): Buffer; - /** - * When passed a reference to the .buffer property of a TypedArray instance, - * the newly created Buffer will share the same allocated memory as the TypedArray. - * The optional {byteOffset} and {length} arguments specify a memory range - * within the {arrayBuffer} that will be shared by the Buffer. - * - * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() - * @param byteOffset - * @param length - */ - static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; - /** - * Copies the passed {buffer} data onto a new Buffer instance. - * - * @param buffer - */ - static from(buffer: Buffer | Uint8Array): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - * - * @param str - */ - static from(str: string, encoding?: string): Buffer; - /** - * Returns true if {obj} is a Buffer - * - * @param obj object to test. - */ - static isBuffer(obj: any): obj is Buffer; - /** - * Returns true if {encoding} is a valid encoding argument. - * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' - * - * @param encoding string to test. - */ - static isEncoding(encoding: string): boolean; - /** - * Gives the actual byte length of a string. encoding defaults to 'utf8'. - * This is not the same as String.prototype.length since that returns the number of characters in a string. - * - * @param string string to test. - * @param encoding encoding used to evaluate (defaults to 'utf8') - */ - static byteLength(string: string, encoding?: string): number; - /** - * Returns a buffer which is the result of concatenating all the buffers in the list together. - * - * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. - * If the list has exactly one item, then the first item of the list is returned. - * If the list has more than one item, then a new Buffer is created. - * - * @param list An array of Buffer objects to concatenate - * @param totalLength Total length of the buffers when concatenated. - * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. - */ - static concat(list: Uint8Array[], totalLength?: number): Buffer; - /** - * The same as buf1.compare(buf2). - */ - static compare(buf1: Uint8Array, buf2: Uint8Array): number; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @param fill if specified, buffer will be initialized by calling buf.fill(fill). - * If parameter is omitted, buffer will be filled with zeros. - * @param encoding encoding used for call to buf.fill while initializing - */ - static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; - /** - * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafe(size: number): Buffer; - /** - * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents - * of the newly created Buffer are unknown and may contain sensitive data. - * - * @param size count of octets to allocate - */ - static allocUnsafeSlow(size: number): Buffer; -} diff --git a/node_modules/buffer/index.js b/node_modules/buffer/index.js deleted file mode 100644 index 7a0e9c2..0000000 --- a/node_modules/buffer/index.js +++ /dev/null @@ -1,2106 +0,0 @@ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -const base64 = require('base64-js') -const ieee754 = require('ieee754') -const customInspectSymbol = - (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -const K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1) - const proto = { foo: function () { return 42 } } - Object.setPrototypeOf(proto, Uint8Array.prototype) - Object.setPrototypeOf(arr, proto) - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length) - Object.setPrototypeOf(buf, Buffer.prototype) - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayView(value) - } - - if (value == null) { - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof SharedArrayBuffer !== 'undefined' && - (isInstance(value, SharedArrayBuffer) || - (value && isInstance(value.buffer, SharedArrayBuffer)))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - const valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - const b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) -Object.setPrototypeOf(Buffer, Uint8Array) - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - const length = byteLength(string, encoding) | 0 - let buf = createBuffer(length) - - const actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0 - const buf = createBuffer(length) - for (let i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayView (arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView) - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) - } - return fromArrayLike(arrayView) -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - let buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype) - - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0 - const buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - let x = a.length - let y = b.length - - for (let i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - let i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - const buffer = Buffer.allocUnsafe(length) - let pos = 0 - for (i = 0; i < list.length; ++i) { - let buf = list[i] - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) - buf.copy(buffer, pos) - } else { - Uint8Array.prototype.set.call( - buffer, - buf, - pos - ) - } - } else if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } else { - buf.copy(buffer, pos) - } - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - const len = string.length - const mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - let loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - let loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - const i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - const len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (let i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - const len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (let i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - const len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (let i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - const length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - let str = '' - const max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} -if (customInspectSymbol) { - Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - let x = thisEnd - thisStart - let y = end - start - const len = Math.min(x, y) - - const thisCopy = this.slice(thisStart, thisEnd) - const targetCopy = target.slice(start, end) - - for (let i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - let indexSize = 1 - let arrLength = arr.length - let valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - let i - if (dir) { - let foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - let found = true - for (let j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - const remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - const strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - let i - for (i = 0; i < length; ++i) { - const parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - const remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - let loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - const res = [] - - let i = start - while (i < end) { - const firstByte = buf[i] - let codePoint = null - let bytesPerSequence = (firstByte > 0xEF) - ? 4 - : (firstByte > 0xDF) - ? 3 - : (firstByte > 0xBF) - ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - const len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - let res = '' - let i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - let ret = '' - end = Math.min(buf.length, end) - - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - let ret = '' - end = Math.min(buf.length, end) - - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - const len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - let out = '' - for (let i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]] - } - return out -} - -function utf16leSlice (buf, start, end) { - const bytes = buf.slice(start, end) - let res = '' - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for (let i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - const len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - const newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype) - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUintLE = -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let val = this[offset] - let mul = 1 - let i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUintBE = -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - let val = this[offset + --byteLength] - let mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUint8 = -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUint16LE = -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUint16BE = -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUint32LE = -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUint32BE = -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const lo = first + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 24 - - const hi = this[++offset] + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - last * 2 ** 24 - - return BigInt(lo) + (BigInt(hi) << BigInt(32)) -}) - -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const hi = first * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - this[++offset] - - const lo = this[++offset] * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - last - - return (BigInt(hi) << BigInt(32)) + BigInt(lo) -}) - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let val = this[offset] - let mul = 1 - let i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let i = byteLength - let mul = 1 - let val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - const val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - const val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const val = this[offset + 4] + - this[offset + 5] * 2 ** 8 + - this[offset + 6] * 2 ** 16 + - (last << 24) // Overflow - - return (BigInt(val) << BigInt(32)) + - BigInt(first + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 24) -}) - -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - this[++offset] - - return (BigInt(val) << BigInt(32)) + - BigInt(this[++offset] * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - last) -}) - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUintLE = -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - let mul = 1 - let i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUintBE = -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - let i = byteLength - 1 - let mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUint8 = -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUint16LE = -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUint16BE = -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUint32LE = -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUint32BE = -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function wrtBigUInt64LE (buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7) - - let lo = Number(value & BigInt(0xffffffff)) - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - return offset -} - -function wrtBigUInt64BE (buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7) - - let lo = Number(value & BigInt(0xffffffff)) - buf[offset + 7] = lo - lo = lo >> 8 - buf[offset + 6] = lo - lo = lo >> 8 - buf[offset + 5] = lo - lo = lo >> 8 - buf[offset + 4] = lo - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) - buf[offset + 3] = hi - hi = hi >> 8 - buf[offset + 2] = hi - hi = hi >> 8 - buf[offset + 1] = hi - hi = hi >> 8 - buf[offset] = hi - return offset + 8 -} - -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) -}) - -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) -}) - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - let i = 0 - let mul = 1 - let sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - let i = byteLength - 1 - let mul = 1 - let sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) -}) - -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) -}) - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - const len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - const code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } else if (typeof val === 'boolean') { - val = Number(val) - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - let i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - const bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - const len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// CUSTOM ERRORS -// ============= - -// Simplified versions from Node, changed for Buffer-only usage -const errors = {} -function E (sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor () { - super() - - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }) - - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]` - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - // Reset the name to the actual name. - delete this.name - } - - get code () { - return sym - } - - set code (value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }) - } - - toString () { - return `${this.name} [${sym}]: ${this.message}` - } - } -} - -E('ERR_BUFFER_OUT_OF_BOUNDS', - function (name) { - if (name) { - return `${name} is outside of buffer bounds` - } - - return 'Attempt to access memory outside buffer bounds' - }, RangeError) -E('ERR_INVALID_ARG_TYPE', - function (name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}` - }, TypeError) -E('ERR_OUT_OF_RANGE', - function (str, range, input) { - let msg = `The value of "${str}" is out of range.` - let received = input - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { - received = addNumericalSeparator(received) - } - received += 'n' - } - msg += ` It must be ${range}. Received ${received}` - return msg - }, RangeError) - -function addNumericalSeparator (val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` -} - -// CHECK FUNCTIONS -// =============== - -function checkBounds (buf, offset, byteLength) { - validateNumber(offset, 'offset') - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { - boundsError(offset, buf.length - (byteLength + 1)) - } -} - -function checkIntBI (value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : '' - let range - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) { - range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` - } else { - range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + - `${(byteLength + 1) * 8 - 1}${n}` - } - } else { - range = `>= ${min}${n} and <= ${max}${n}` - } - throw new errors.ERR_OUT_OF_RANGE('value', range, value) - } - checkBounds(buf, offset, byteLength) -} - -function validateNumber (value, name) { - if (typeof value !== 'number') { - throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) - } -} - -function boundsError (value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type) - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) - } - - if (length < 0) { - throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() - } - - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', - `>= ${type ? 1 : 0} and <= ${length}`, - value) -} - -// HELPER FUNCTIONS -// ================ - -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function utf8ToBytes (string, units) { - units = units || Infinity - let codePoint - const length = string.length - let leadSurrogate = null - const bytes = [] - - for (let i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - const byteArray = [] - for (let i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - let c, hi, lo - const byteArray = [] - for (let i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - let i - for (i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = (function () { - const alphabet = '0123456789abcdef' - const table = new Array(256) - for (let i = 0; i < 16; ++i) { - const i16 = i * 16 - for (let j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j] - } - } - return table -})() - -// Return not function with Error if BigInt not supported -function defineBigIntMethod (fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn -} - -function BufferBigIntNotDefined () { - throw new Error('BigInt not supported') -} diff --git a/node_modules/buffer/package.json b/node_modules/buffer/package.json deleted file mode 100644 index ca1ad9a..0000000 --- a/node_modules/buffer/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "buffer", - "description": "Node.js Buffer API, for the browser", - "version": "6.0.3", - "author": { - "name": "Feross Aboukhadijeh", - "email": "feross@feross.org", - "url": "https://feross.org" - }, - "bugs": { - "url": "https://github.com/feross/buffer/issues" - }, - "contributors": [ - "Romain Beauxis ", - "James Halliday " - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - }, - "devDependencies": { - "airtap": "^3.0.0", - "benchmark": "^2.1.4", - "browserify": "^17.0.0", - "concat-stream": "^2.0.0", - "hyperquest": "^2.1.3", - "is-buffer": "^2.0.5", - "is-nan": "^1.3.0", - "split": "^1.0.1", - "standard": "*", - "tape": "^5.0.1", - "through2": "^4.0.2", - "uglify-js": "^3.11.5" - }, - "homepage": "https://github.com/feross/buffer", - "jspm": { - "map": { - "./index.js": { - "node": "@node/buffer" - } - } - }, - "keywords": [ - "arraybuffer", - "browser", - "browserify", - "buffer", - "compatible", - "dataview", - "uint8array" - ], - "license": "MIT", - "main": "index.js", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "git://github.com/feross/buffer.git" - }, - "scripts": { - "perf": "browserify --debug perf/bracket-notation.js > perf/bundle.js && open perf/index.html", - "perf-node": "node perf/bracket-notation.js && node perf/concat.js && node perf/copy-big.js && node perf/copy.js && node perf/new-big.js && node perf/new.js && node perf/readDoubleBE.js && node perf/readFloatBE.js && node perf/readUInt32LE.js && node perf/slice.js && node perf/writeFloatBE.js", - "size": "browserify -r ./ | uglifyjs -c -m | gzip | wc -c", - "test": "standard && node ./bin/test.js", - "test-browser-old": "airtap -- test/*.js", - "test-browser-old-local": "airtap --local -- test/*.js", - "test-browser-new": "airtap -- test/*.js test/node/*.js", - "test-browser-new-local": "airtap --local -- test/*.js test/node/*.js", - "test-node": "tape test/*.js test/node/*.js", - "update-authors": "./bin/update-authors.sh" - }, - "standard": { - "ignore": [ - "test/node/**/*.js", - "test/common.js", - "test/_polyfill.js", - "perf/**/*.js" - ] - }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] -} diff --git a/node_modules/call-bind/.eslintignore b/node_modules/call-bind/.eslintignore deleted file mode 100644 index 404abb2..0000000 --- a/node_modules/call-bind/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -coverage/ diff --git a/node_modules/call-bind/.eslintrc b/node_modules/call-bind/.eslintrc deleted file mode 100644 index dfa9a6c..0000000 --- a/node_modules/call-bind/.eslintrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", - - "rules": { - "func-name-matching": 0, - "id-length": 0, - "new-cap": [2, { - "capIsNewExceptions": [ - "GetIntrinsic", - ], - }], - "no-magic-numbers": 0, - }, -} diff --git a/node_modules/call-bind/.github/FUNDING.yml b/node_modules/call-bind/.github/FUNDING.yml deleted file mode 100644 index c70c2ec..0000000 --- a/node_modules/call-bind/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# 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/call-bind -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/call-bind/.nycrc b/node_modules/call-bind/.nycrc deleted file mode 100644 index bdd626c..0000000 --- a/node_modules/call-bind/.nycrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "all": true, - "check-coverage": false, - "reporter": ["text-summary", "text", "html", "json"], - "exclude": [ - "coverage", - "test" - ] -} diff --git a/node_modules/call-bind/CHANGELOG.md b/node_modules/call-bind/CHANGELOG.md deleted file mode 100644 index c653f70..0000000 --- a/node_modules/call-bind/CHANGELOG.md +++ /dev/null @@ -1,93 +0,0 @@ -# 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/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12 - -### Commits - -- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03) -- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590) - -## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05 - -### Commits - -- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa) -- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e) -- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5) -- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582) - -## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19 - -### Commits - -- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d) -- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871) - -## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19 - -## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19 - -### Commits - -- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453) -- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5) -- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22) -- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90) -- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150) -- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4) -- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11) -- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff) -- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223) -- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5) -- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05) -- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329) -- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958) -- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5) -- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3) -- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91) -- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60) - -## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11 - -### Commits - -- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d) - -## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08 - -### Commits - -- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1) -- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e) -- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb) -- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71) -- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee) -- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2) -- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8) -- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532) -- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6) - -## v1.0.0 - 2020-10-30 - -### Commits - -- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50) -- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df) -- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65) -- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249) -- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13) -- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4) -- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717) -- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af) -- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650) -- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f) diff --git a/node_modules/call-bind/LICENSE b/node_modules/call-bind/LICENSE deleted file mode 100644 index 48f05d0..0000000 --- a/node_modules/call-bind/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 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/call-bind/README.md b/node_modules/call-bind/README.md deleted file mode 100644 index 48e9047..0000000 --- a/node_modules/call-bind/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# call-bind [![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] - -Robustly `.call.bind()` a function. - -## Getting started - -```sh -npm install --save call-bind -``` - -## Usage/Examples - -```js -const assert = require('assert'); -const callBind = require('call-bind'); -const callBound = require('call-bind/callBound'); - -function f(a, b) { - assert.equal(this, 1); - assert.equal(a, 2); - assert.equal(b, 3); - assert.equal(arguments.length, 2); -} - -const fBound = callBind(f); - -const slice = callBound('Array.prototype.slice'); - -delete Function.prototype.call; -delete Function.prototype.bind; - -fBound(1, 2, 3); - -assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); -``` - -## Tests - -Clone the repo, `npm install`, and run `npm test` - -[package-url]: https://npmjs.org/package/call-bind -[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg -[deps-svg]: https://david-dm.org/ljharb/call-bind.svg -[deps-url]: https://david-dm.org/ljharb/call-bind -[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg -[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies -[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/call-bind.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg -[downloads-url]: https://npm-stat.com/charts.html?package=call-bind -[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind -[actions-url]: https://github.com/ljharb/call-bind/actions diff --git a/node_modules/call-bind/callBound.js b/node_modules/call-bind/callBound.js deleted file mode 100644 index 8374adf..0000000 --- a/node_modules/call-bind/callBound.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var callBind = require('./'); - -var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - -module.exports = function callBoundIntrinsic(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { - return callBind(intrinsic); - } - return intrinsic; -}; diff --git a/node_modules/call-bind/index.js b/node_modules/call-bind/index.js deleted file mode 100644 index 01c5b3d..0000000 --- a/node_modules/call-bind/index.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); -var GetIntrinsic = require('get-intrinsic'); -var setFunctionLength = require('set-function-length'); - -var $TypeError = require('es-errors/type'); -var $apply = GetIntrinsic('%Function.prototype.apply%'); -var $call = GetIntrinsic('%Function.prototype.call%'); -var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - -var $defineProperty = require('es-define-property'); -var $max = GetIntrinsic('%Math.max%'); - -module.exports = function callBind(originalFunction) { - if (typeof originalFunction !== 'function') { - throw new $TypeError('a function is required'); - } - var func = $reflectApply(bind, $call, arguments); - return setFunctionLength( - func, - 1 + $max(0, originalFunction.length - (arguments.length - 1)), - true - ); -}; - -var applyBind = function applyBind() { - return $reflectApply(bind, $apply, arguments); -}; - -if ($defineProperty) { - $defineProperty(module.exports, 'apply', { value: applyBind }); -} else { - module.exports.apply = applyBind; -} diff --git a/node_modules/call-bind/package.json b/node_modules/call-bind/package.json deleted file mode 100644 index 5ba88ff..0000000 --- a/node_modules/call-bind/package.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "name": "call-bind", - "version": "1.0.7", - "description": "Robustly `.call.bind()` a function", - "main": "index.js", - "exports": { - ".": "./index.js", - "./callBound": "./callBound.js", - "./package.json": "./package.json" - }, - "scripts": { - "prepack": "npmignore --auto --commentLines=auto", - "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/ljharb/call-bind.git" - }, - "keywords": [ - "javascript", - "ecmascript", - "es", - "js", - "callbind", - "callbound", - "call", - "bind", - "bound", - "call-bind", - "call-bound", - "function", - "es-abstract" - ], - "author": "Jordan Harband ", - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/ljharb/call-bind/issues" - }, - "homepage": "https://github.com/ljharb/call-bind#readme", - "devDependencies": { - "@ljharb/eslint-config": "^21.1.0", - "aud": "^2.0.4", - "auto-changelog": "^2.4.0", - "es-value-fixtures": "^1.4.2", - "eslint": "=8.8.0", - "evalmd": "^0.0.19", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-strict-mode": "^1.0.1", - "in-publish": "^2.0.1", - "npmignore": "^0.3.1", - "nyc": "^10.3.2", - "object-inspect": "^1.13.1", - "safe-publish-latest": "^2.0.0", - "tape": "^5.7.4" - }, - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" - }, - "testling": { - "files": "test/index.js" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - }, - "engines": { - "node": ">= 0.4" - } -} diff --git a/node_modules/call-bind/test/callBound.js b/node_modules/call-bind/test/callBound.js deleted file mode 100644 index c32319d..0000000 --- a/node_modules/call-bind/test/callBound.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -var test = require('tape'); - -var callBound = require('../callBound'); - -test('callBound', function (t) { - // static primitive - t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself'); - t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself'); - - // static non-function object - t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself'); - t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself'); - t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself'); - t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself'); - - // static function - t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself'); - t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself'); - - // prototype primitive - t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself'); - t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself'); - - // prototype function - t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself'); - t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself'); - t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original'); - t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original'); - - t['throws']( - function () { callBound('does not exist'); }, - SyntaxError, - 'nonexistent intrinsic throws' - ); - t['throws']( - function () { callBound('does not exist', true); }, - SyntaxError, - 'allowMissing arg still throws for unknown intrinsic' - ); - - t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { - st['throws']( - function () { callBound('WeakRef'); }, - TypeError, - 'real but absent intrinsic throws' - ); - st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception'); - st.end(); - }); - - t.end(); -}); diff --git a/node_modules/call-bind/test/index.js b/node_modules/call-bind/test/index.js deleted file mode 100644 index 1fd4668..0000000 --- a/node_modules/call-bind/test/index.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -var callBind = require('../'); -var bind = require('function-bind'); -var gOPD = require('gopd'); -var hasStrictMode = require('has-strict-mode')(); -var forEach = require('for-each'); -var inspect = require('object-inspect'); -var v = require('es-value-fixtures'); - -var test = require('tape'); - -/* - * older engines have length nonconfigurable - * in io.js v3, it is configurable except on bound functions, hence the .bind() - */ -var functionsHaveConfigurableLengths = !!( - gOPD - && Object.getOwnPropertyDescriptor - && Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable -); - -test('callBind', function (t) { - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - function () { callBind(nonFunction); }, - TypeError, - inspect(nonFunction) + ' is not a function' - ); - }); - - var sentinel = { sentinel: true }; - var func = function (a, b) { - // eslint-disable-next-line no-invalid-this - return [!hasStrictMode && this === global ? undefined : this, a, b]; - }; - t.equal(func.length, 2, 'original function length is 2'); - t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); - t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args'); - t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args'); - - var bound = callBind(func); - t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); - t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args'); - t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args'); - t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); - - var boundR = callBind(func, sentinel); - t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); - t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args'); - t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args'); - t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args'); - - var boundArg = callBind(func, sentinel, 1); - t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); - t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args'); - t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg'); - t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args'); - - t.test('callBind.apply', function (st) { - var aBound = callBind.apply(func); - st.deepEqual(aBound(sentinel), [sentinel, undefined, undefined], 'apply-bound func with no args'); - st.deepEqual(aBound(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); - st.deepEqual(aBound(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); - - var aBoundArg = callBind.apply(func); - st.deepEqual(aBoundArg(sentinel, [1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with too many args'); - st.deepEqual(aBoundArg(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args'); - st.deepEqual(aBoundArg(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args'); - - var aBoundR = callBind.apply(func, sentinel); - st.deepEqual(aBoundR([1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with receiver and too many args'); - st.deepEqual(aBoundR([1, 2], 4), [sentinel, 1, 2], 'apply-bound func with receiver and right args'); - st.deepEqual(aBoundR([1], 4), [sentinel, 1, undefined], 'apply-bound func with receiver and too few args'); - - st.end(); - }); - - t.end(); -}); diff --git a/node_modules/callsites/index.d.ts b/node_modules/callsites/index.d.ts deleted file mode 100644 index 61f597c..0000000 --- a/node_modules/callsites/index.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -declare namespace callsites { - interface CallSite { - /** - Returns the value of `this`. - */ - getThis(): unknown | undefined; - - /** - Returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property. - */ - getTypeName(): string | null; - - /** - Returns the current function. - */ - getFunction(): Function | undefined; - - /** - Returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context. - */ - getFunctionName(): string | null; - - /** - Returns the name of the property of `this` or one of its prototypes that holds the current function. - */ - getMethodName(): string | undefined; - - /** - Returns the name of the script if this function was defined in a script. - */ - getFileName(): string | null; - - /** - Returns the current line number if this function was defined in a script. - */ - getLineNumber(): number | null; - - /** - Returns the current column number if this function was defined in a script. - */ - getColumnNumber(): number | null; - - /** - Returns a string representing the location where `eval` was called if this function was created using a call to `eval`. - */ - getEvalOrigin(): string | undefined; - - /** - Returns `true` if this is a top-level invocation, that is, if it's a global object. - */ - isToplevel(): boolean; - - /** - Returns `true` if this call takes place in code defined by a call to `eval`. - */ - isEval(): boolean; - - /** - Returns `true` if this call is in native V8 code. - */ - isNative(): boolean; - - /** - Returns `true` if this is a constructor call. - */ - isConstructor(): boolean; - } -} - -declare const callsites: { - /** - Get callsites from the V8 stack trace API. - - @returns An array of `CallSite` objects. - - @example - ``` - import callsites = require('callsites'); - - function unicorn() { - console.log(callsites()[0].getFileName()); - //=> '/Users/sindresorhus/dev/callsites/test.js' - } - - unicorn(); - ``` - */ - (): callsites.CallSite[]; - - // TODO: Remove this for the next major release, refactor the whole definition to: - // declare function callsites(): callsites.CallSite[]; - // export = callsites; - default: typeof callsites; -}; - -export = callsites; diff --git a/node_modules/callsites/index.js b/node_modules/callsites/index.js deleted file mode 100644 index 486c241..0000000 --- a/node_modules/callsites/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const callsites = () => { - const _prepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = (_, stack) => stack; - const stack = new Error().stack.slice(1); - Error.prepareStackTrace = _prepareStackTrace; - return stack; -}; - -module.exports = callsites; -// TODO: Remove this for the next major release -module.exports.default = callsites; diff --git a/node_modules/callsites/license b/node_modules/callsites/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/callsites/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/callsites/package.json b/node_modules/callsites/package.json deleted file mode 100644 index 93463c3..0000000 --- a/node_modules/callsites/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "callsites", - "version": "3.1.0", - "description": "Get callsites from the V8 stack trace API", - "license": "MIT", - "repository": "sindresorhus/callsites", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "stacktrace", - "v8", - "callsite", - "callsites", - "stack", - "trace", - "function", - "file", - "line", - "debug" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/callsites/readme.md b/node_modules/callsites/readme.md deleted file mode 100644 index fc84613..0000000 --- a/node_modules/callsites/readme.md +++ /dev/null @@ -1,48 +0,0 @@ -# callsites [![Build Status](https://travis-ci.org/sindresorhus/callsites.svg?branch=master)](https://travis-ci.org/sindresorhus/callsites) - -> Get callsites from the [V8 stack trace API](https://v8.dev/docs/stack-trace-api) - - -## Install - -``` -$ npm install callsites -``` - - -## Usage - -```js -const callsites = require('callsites'); - -function unicorn() { - console.log(callsites()[0].getFileName()); - //=> '/Users/sindresorhus/dev/callsites/test.js' -} - -unicorn(); -``` - - -## API - -Returns an array of callsite objects with the following methods: - -- `getThis`: returns the value of `this`. -- `getTypeName`: returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property. -- `getFunction`: returns the current function. -- `getFunctionName`: returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context. -- `getMethodName`: returns the name of the property of `this` or one of its prototypes that holds the current function. -- `getFileName`: if this function was defined in a script returns the name of the script. -- `getLineNumber`: if this function was defined in a script returns the current line number. -- `getColumnNumber`: if this function was defined in a script returns the current column number -- `getEvalOrigin`: if this function was created using a call to `eval` returns a string representing the location where `eval` was called. -- `isToplevel`: is this a top-level invocation, that is, is this the global object? -- `isEval`: does this call take place in code defined by a call to `eval`? -- `isNative`: is this call in native V8 code? -- `isConstructor`: is this a constructor call? - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/catering/LICENSE b/node_modules/catering/LICENSE deleted file mode 100644 index 6030018..0000000 --- a/node_modules/catering/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright © 2018 Vincent Weevers - -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/catering/index.d.ts b/node_modules/catering/index.d.ts deleted file mode 100644 index 51bfb08..0000000 --- a/node_modules/catering/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function fromCallback(callback: Callback | undefined, symbol: S) - : Callback & { [K in S]?: Promise }; - -export function fromCallback(callback: Callback | undefined) - : Callback & { promise?: Promise }; - -export function fromPromise(promise: Promise, callback: Callback | undefined) - : Promise | undefined; - -type Callback = (err: Error | null, result: T) => void; diff --git a/node_modules/catering/index.js b/node_modules/catering/index.js deleted file mode 100644 index 696317e..0000000 --- a/node_modules/catering/index.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict' - -var nextTick = require('./next-tick') - -exports.fromCallback = function (callback, symbol) { - if (callback === undefined) { - var promise = new Promise(function (resolve, reject) { - callback = function (err, res) { - if (err) reject(err) - else resolve(res) - } - }) - - callback[symbol !== undefined ? symbol : 'promise'] = promise - } else if (typeof callback !== 'function') { - throw new TypeError('Callback must be a function') - } - - return callback -} - -exports.fromPromise = function (promise, callback) { - if (callback === undefined) return promise - - promise - .then(function (res) { nextTick(() => callback(null, res)) }) - .catch(function (err) { nextTick(() => callback(err)) }) -} diff --git a/node_modules/catering/next-tick-browser.js b/node_modules/catering/next-tick-browser.js deleted file mode 100644 index e0b8cf3..0000000 --- a/node_modules/catering/next-tick-browser.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = typeof queueMicrotask === 'function' ? queueMicrotask : (fn) => Promise.resolve().then(fn) diff --git a/node_modules/catering/next-tick.js b/node_modules/catering/next-tick.js deleted file mode 100644 index c6d33ee..0000000 --- a/node_modules/catering/next-tick.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = process.nextTick.bind(process) diff --git a/node_modules/catering/package.json b/node_modules/catering/package.json deleted file mode 100644 index c04215a..0000000 --- a/node_modules/catering/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "catering", - "version": "2.1.1", - "description": "Simple utility to allow your module to be consumed with a callback or promise", - "license": "MIT", - "author": "Vincent Weevers", - "scripts": { - "test": "standard && node test.js", - "test-browsers-local": "airtap test.js" - }, - "types": "index.d.ts", - "files": [ - "index.js", - "index.d.ts", - "next-tick.js", - "next-tick-browser.js" - ], - "browser": { - "./next-tick.js": "./next-tick-browser.js" - }, - "devDependencies": { - "airtap": "^4.0.4", - "airtap-playwright": "^1.0.1", - "standard": "^16.0.4", - "tape": "^5.4.0" - }, - "keywords": [ - "callback", - "promise", - "promisify" - ], - "engines": { - "node": ">=6" - }, - "repository": "vweevers/catering", - "bugs": "https://github.com/vweevers/catering/issues", - "homepage": "https://github.com/vweevers/catering" -} diff --git a/node_modules/catering/readme.md b/node_modules/catering/readme.md deleted file mode 100644 index bf74ce1..0000000 --- a/node_modules/catering/readme.md +++ /dev/null @@ -1,55 +0,0 @@ -# catering - -**Cater to callback and promise crowds.** -Simple utility to allow your module to be consumed with a callback or promise. For Node.js and browsers. - -[![npm status](https://img.shields.io/npm/v/catering.svg)](https://www.npmjs.com/package/catering) -[![Node version](https://img.shields.io/node/v/catering.svg)](https://www.npmjs.com/package/catering) -[![Test](https://img.shields.io/github/workflow/status/vweevers/catering/Test?label=test)](https://github.com/vweevers/catering/actions/workflows/test.yml) -[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript&logoColor=fff)](https://standardjs.com) - -## Menu - -If your module internally uses callbacks: - -```js -const { fromCallback } = require('catering') -const kPromise = Symbol('promise') - -module.exports = function (callback) { - callback = fromCallback(callback, kPromise) - queueMicrotask(() => callback(null, 'example')) - return callback[kPromise] -} -``` - -If your module internally uses promises: - -```js -const { fromPromise } = require('catering') - -module.exports = function (callback) { - return fromPromise(Promise.resolve('example'), callback) -} -``` - -Either way your module can now be consumed in two ways: - -```js -example((err, result) => {}) -const result = await example() -``` - -When converting from a promise to a callback, `fromPromise` calls the callback in a next tick to escape the promise chain and not let it steal your beautiful errors. - -## Install - -With [npm](https://npmjs.org) do: - -``` -npm install catering -``` - -## License - -[MIT](LICENSE) © 2018-present Vincent Weevers. Originally extracted from [`levelup`](https://github.com/Level/levelup/blob/37e0270c8c29d5086904e29e247e918dddcce6e2/lib/promisify.js). diff --git a/node_modules/chalk/license b/node_modules/chalk/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/chalk/license +++ /dev/null @@ -1,9 +0,0 @@ -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/chalk/package.json b/node_modules/chalk/package.json deleted file mode 100644 index 3c50010..0000000 --- a/node_modules/chalk/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "chalk", - "version": "5.3.0", - "description": "Terminal string styling done right", - "license": "MIT", - "repository": "chalk/chalk", - "funding": "https://github.com/chalk/chalk?sponsor=1", - "type": "module", - "main": "./source/index.js", - "exports": "./source/index.js", - "imports": { - "#ansi-styles": "./source/vendor/ansi-styles/index.js", - "#supports-color": { - "node": "./source/vendor/supports-color/index.js", - "default": "./source/vendor/supports-color/browser.js" - } - }, - "types": "./source/index.d.ts", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "scripts": { - "test": "xo && c8 ava && tsd", - "bench": "matcha benchmark.js" - }, - "files": [ - "source", - "!source/index.test-d.ts" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "devDependencies": { - "@types/node": "^16.11.10", - "ava": "^3.15.0", - "c8": "^7.10.0", - "color-convert": "^2.0.1", - "execa": "^6.0.0", - "log-update": "^5.0.0", - "matcha": "^0.7.0", - "tsd": "^0.19.0", - "xo": "^0.53.0", - "yoctodelay": "^2.0.0" - }, - "sideEffects": false, - "xo": { - "rules": { - "unicorn/prefer-string-slice": "off", - "@typescript-eslint/consistent-type-imports": "off", - "@typescript-eslint/consistent-type-exports": "off", - "@typescript-eslint/consistent-type-definitions": "off", - "unicorn/expiring-todo-comments": "off" - } - }, - "c8": { - "reporter": [ - "text", - "lcov" - ], - "exclude": [ - "source/vendor" - ] - } -} diff --git a/node_modules/chalk/readme.md b/node_modules/chalk/readme.md deleted file mode 100644 index 93511c0..0000000 --- a/node_modules/chalk/readme.md +++ /dev/null @@ -1,325 +0,0 @@ -

-
-
- Chalk -
-
-
-

- -> Terminal string styling done right - -[![Coverage Status](https://codecov.io/gh/chalk/chalk/branch/main/graph/badge.svg)](https://codecov.io/gh/chalk/chalk) -[![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) -[![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) -[![run on repl.it](https://img.shields.io/badge/Run_on_Replit-f26207?logo=replit&logoColor=white)](https://repl.it/github/chalk/chalk) - -![](media/screenshot.png) - -
- ---- - - - ---- - -
- -## Highlights - -- Expressive API -- Highly performant -- No dependencies -- Ability to nest styles -- [256/Truecolor color support](#256-and-truecolor-color-support) -- Auto-detects color support -- Doesn't extend `String.prototype` -- Clean and focused -- Actively maintained -- [Used by ~86,000 packages](https://www.npmjs.com/browse/depended/chalk) as of October 4, 2022 - -## Install - -```sh -npm install chalk -``` - -**IMPORTANT:** Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. [Read more.](https://github.com/chalk/chalk/releases/tag/v5.0.0) - -## Usage - -```js -import chalk from 'chalk'; - -console.log(chalk.blue('Hello world!')); -``` - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -import chalk from 'chalk'; - -const log = console.log; - -// Combine styled and normal strings -log(chalk.blue('Hello') + ' World' + chalk.red('!')); - -// Compose multiple styles using the chainable API -log(chalk.blue.bgRed.bold('Hello world!')); - -// Pass in multiple arguments -log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); - -// Nest styles -log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); - -// Nest styles of the same type even (color, underline, background) -log(chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -)); - -// ES2015 template literal -log(` -CPU: ${chalk.red('90%')} -RAM: ${chalk.green('40%')} -DISK: ${chalk.yellow('70%')} -`); - -// Use RGB colors in terminal emulators that support it. -log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); -log(chalk.hex('#DEADED').bold('Bold gray!')); -``` - -Easily define your own themes: - -```js -import chalk from 'chalk'; - -const error = chalk.bold.red; -const warning = chalk.hex('#FFA500'); // Orange color - -console.log(error('Error!')); -console.log(warning('Warning!')); -``` - -Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): - -```js -import chalk from 'chalk'; - -const name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> 'Hello Sindre' -``` - -## API - -### chalk.` - - -
-

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/json-with-metadata.js b/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js deleted file mode 100644 index 6899471..0000000 --- a/node_modules/eslint/lib/cli-engine/formatters/json-with-metadata.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @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 deleted file mode 100644 index 82138af..0000000 --- a/node_modules/eslint/lib/cli-engine/formatters/json.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @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/stylish.js b/node_modules/eslint/lib/cli-engine/formatters/stylish.js deleted file mode 100644 index a5cf39b..0000000 --- a/node_modules/eslint/lib/cli-engine/formatters/stylish.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @fileoverview Stylish reporter - * @author Sindre Sorhus - */ -"use strict"; - -const chalk = require("chalk"), - util = require("node:util"), - table = require("../../shared/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 [ - "", - String(message.line || 0), - String(message.column || 0), - messageType, - message.message.replace(/([^ ])\.$/u, "$1"), - chalk.dim(message.ruleId || "") - ]; - }), - { - align: ["", "r", "l"], - stringLength(str) { - return util.stripVTControlCharacters(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/hash.js b/node_modules/eslint/lib/cli-engine/hash.js deleted file mode 100644 index 8e46773..0000000 --- a/node_modules/eslint/lib/cli-engine/hash.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @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 deleted file mode 100644 index 52e45a6..0000000 --- a/node_modules/eslint/lib/cli-engine/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"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 deleted file mode 100644 index 320362d..0000000 --- a/node_modules/eslint/lib/cli-engine/lint-result-cache.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * @fileoverview Utility for caching lint results. - * @author Kevin Partington - */ -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const fs = require("node:fs"); -const fileEntryCache = require("file-entry-cache"); -const stringify = require("json-stable-stringify-without-jsonify"); -const pkg = require("../../package.json"); -const assert = require("../shared/assert"); -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; - } - - const cachedResults = fileDescriptor.meta.results; - - // Just in case, not sure if this can ever happen. - if (!cachedResults) { - return cachedResults; - } - - /* - * Shallow clone the object to ensure that any properties added or modified afterwards - * will not be accidentally stored in the cache file when `reconcile()` is called. - * https://github.com/eslint/eslint/issues/13507 - * All intentional changes to the cache file must be done through `setCachedLintResults()`. - */ - const results = { ...cachedResults }; - - // If source is present but null, need to reread the file from the filesystem. - if (results.source === null) { - debug(`Rereading cached result source from filesystem: ${filePath}`); - results.source = fs.readFileSync(filePath, "utf-8"); - } - - return 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.hasOwn(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.hasOwn(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 deleted file mode 100644 index a58f954..0000000 --- a/node_modules/eslint/lib/cli-engine/load-rules.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @fileoverview Module for loading rules from files and directories. - * @author Michael Ficarra - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const fs = require("node:fs"), - path = require("node: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.js b/node_modules/eslint/lib/cli.js deleted file mode 100644 index 3229d6a..0000000 --- a/node_modules/eslint/lib/cli.js +++ /dev/null @@ -1,548 +0,0 @@ -/** - * @fileoverview Main CLI object. - * @author Nicholas C. Zakas - */ - -"use strict"; - -/* - * NOTE: 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("node:fs"), - path = require("node:path"), - { promisify } = require("node:util"), - { LegacyESLint } = require("./eslint"), - { ESLint, shouldUseFlatConfig, locateConfigFileToUse } = require("./eslint/eslint"), - createCLIOptions = require("./options"), - log = require("./shared/logging"), - RuntimeInfo = require("./shared/runtime-info"), - { normalizeSeverityToString } = require("./shared/severity"); -const { Legacy: { naming } } = require("@eslint/eslintrc"); -const { ModuleImporter } = require("@humanwhocodes/module-importer"); -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 */ -/** @typedef {import("./shared/types").Plugin} Plugin */ -/** @typedef {import("./shared/types").ResultsMeta} ResultsMeta */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const mkdir = promisify(fs.mkdir); -const stat = promisify(fs.stat); -const writeFile = promisify(fs.writeFile); - -/** - * Loads plugins with the specified names. - * @param {{ "import": (name: string) => Promise }} importer An object with an `import` method called once for each plugin. - * @param {string[]} pluginNames The names of the plugins to be loaded, with or without the "eslint-plugin-" prefix. - * @returns {Promise>} A mapping of plugin short names to implementations. - */ -async function loadPlugins(importer, pluginNames) { - const plugins = {}; - - await Promise.all(pluginNames.map(async pluginName => { - - const longName = naming.normalizePackageName(pluginName, "eslint-plugin"); - const module = await importer.import(longName); - - if (!("default" in module)) { - throw new Error(`"${longName}" cannot be used with the \`--plugin\` option because its default module does not provide a \`default\` export`); - } - - const shortName = naming.getShorthandName(pluginName, "eslint-plugin"); - - plugins[shortName] = module.default; - })); - - return plugins; -} - -/** - * 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; -} - -/** - * Predicate function for whether or not to run a rule in quiet mode. - * If a rule is set to warning, do not run it. - * @param {{ ruleId: string; severity: number; }} rule The rule id and severity. - * @returns {boolean} True if the lint rule should run, false otherwise. - */ -function quietRuleFilter(rule) { - return rule.severity === 2; -} - -/** - * Translates the CLI options into the options expected by the ESLint constructor. - * @param {ParsedCLIOptions} cliOptions The CLI options to translate. - * @param {"flat"|"eslintrc"} [configType="eslintrc"] The format of the - * config to generate. - * @returns {Promise} The options object for the ESLint constructor. - * @private - */ -async function translateOptions({ - cache, - cacheFile, - cacheLocation, - cacheStrategy, - config, - configLookup, - env, - errorOnUnmatchedPattern, - eslintrc, - ext, - fix, - fixDryRun, - fixType, - flag, - global, - ignore, - ignorePath, - ignorePattern, - inlineConfig, - parser, - parserOptions, - plugin, - quiet, - reportUnusedDisableDirectives, - reportUnusedDisableDirectivesSeverity, - resolvePluginsRelativeTo, - rule, - rulesdir, - stats, - warnIgnored, - passOnNoPatterns, - maxWarnings -}, configType) { - - let overrideConfig, overrideConfigFile; - const importer = new ModuleImporter(); - - if (configType === "flat") { - overrideConfigFile = (typeof config === "string") ? config : !configLookup; - if (overrideConfigFile === false) { - overrideConfigFile = void 0; - } - - const languageOptions = {}; - - if (global) { - languageOptions.globals = global.reduce((obj, name) => { - if (name.endsWith(":true")) { - obj[name.slice(0, -5)] = "writable"; - } else { - obj[name] = "readonly"; - } - return obj; - }, {}); - } - - if (parserOptions) { - languageOptions.parserOptions = parserOptions; - } - - if (parser) { - languageOptions.parser = await importer.import(parser); - } - - overrideConfig = [{ - ...Object.keys(languageOptions).length > 0 ? { languageOptions } : {}, - rules: rule ? rule : {} - }]; - - if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) { - overrideConfig[0].linterOptions = { - reportUnusedDisableDirectives: reportUnusedDisableDirectives - ? "error" - : normalizeSeverityToString(reportUnusedDisableDirectivesSeverity) - }; - } - - if (plugin) { - overrideConfig[0].plugins = await loadPlugins(importer, plugin); - } - - } else { - overrideConfigFile = config; - - 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 - }; - } - - const options = { - allowInlineConfig: inlineConfig, - cache, - cacheLocation: cacheLocation || cacheFile, - cacheStrategy, - errorOnUnmatchedPattern, - fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true), - fixTypes: fixType, - ignore, - overrideConfig, - overrideConfigFile, - passOnNoPatterns - }; - - if (configType === "flat") { - options.ignorePatterns = ignorePattern; - options.stats = stats; - options.warnIgnored = warnIgnored; - options.flags = flag; - - /* - * For performance reasons rules not marked as 'error' are filtered out in quiet mode. As maxWarnings - * requires rules set to 'warn' to be run, we only filter out 'warn' rules if maxWarnings is not specified. - */ - options.ruleFilter = quiet && maxWarnings === -1 ? quietRuleFilter : () => true; - } else { - options.resolvePluginsRelativeTo = resolvePluginsRelativeTo; - options.rulePaths = rulesdir; - options.useEslintrc = eslintrc; - options.extensions = ext; - options.ignorePath = ignorePath; - if (reportUnusedDisableDirectives || reportUnusedDisableDirectivesSeverity !== void 0) { - options.reportUnusedDisableDirectives = reportUnusedDisableDirectives - ? "error" - : normalizeSeverityToString(reportUnusedDisableDirectivesSeverity); - } - } - - return options; -} - -/** - * Count error messages. - * @param {LintResult[]} results The lint results. - * @returns {{errorCount:number;fatalErrorCount: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. - * @param {ResultsMeta} resultsMeta Warning count and max threshold. - * @returns {Promise} True if the printing succeeds, false if not. - * @private - */ -async function printResults(engine, results, format, outputFile, resultsMeta) { - let formatter; - - try { - formatter = await engine.loadFormatter(format); - } catch (e) { - log.error(e.message); - return false; - } - - const output = await formatter.format(results, resultsMeta); - - 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 if (output) { - 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 = { - - /** - * Calculates the command string for the --inspect-config operation. - * @param {string} configFile The path to the config file to inspect. - * @param {boolean} hasUnstableTSConfigFlag `true` if the `unstable_ts_config` flag is enabled, `false` if it's not. - * @returns {Promise} The command string to execute. - */ - async calculateInspectConfigFlags(configFile, hasUnstableTSConfigFlag) { - - // find the config file - const { - configFilePath, - basePath - } = await locateConfigFileToUse({ cwd: process.cwd(), configFile }, hasUnstableTSConfigFlag); - - return ["--config", configFilePath, "--basePath", basePath]; - }, - - /** - * 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). - * @param {boolean} [allowFlatConfig=true] Whether or not to allow flat config. - * @returns {Promise} The exit code for the operation. - */ - async execute(args, text, allowFlatConfig = true) { - if (Array.isArray(args)) { - debug("CLI args: %o", args.slice(2)); - } - - /* - * Before doing anything, we need to see if we are using a - * flat config file. If so, then we need to change the way command - * line args are parsed. This is temporary, and when we fully - * switch to flat config we can remove this logic. - */ - - const usingFlatConfig = allowFlatConfig && await shouldUseFlatConfig(); - - debug("Using flat config?", usingFlatConfig); - - if (allowFlatConfig && !usingFlatConfig) { - process.emitWarning("You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.", "ESLintRCWarning"); - } - - const CLIOptions = createCLIOptions(usingFlatConfig); - - /** @type {ParsedCLIOptions} */ - let options; - - try { - options = CLIOptions.parse(args); - } catch (error) { - debug("Error parsing CLI options:", error.message); - - let errorMessage = error.message; - - if (usingFlatConfig) { - errorMessage += "\nYou're using eslint.config.js, some command line flags are no longer available. Please see https://eslint.org/docs/latest/use/command-line-interface for details."; - } - - log.error(errorMessage); - 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) { - debug("Error retrieving environment info"); - 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 = usingFlatConfig - ? new ESLint(await translateOptions(options, "flat")) - : new LegacyESLint(await translateOptions(options)); - const fileConfig = - await engine.calculateConfigForFile(options.printConfig); - - log.info(JSON.stringify(fileConfig, null, " ")); - return 0; - } - - if (options.inspectConfig) { - - log.info("You can also run this command directly using 'npx @eslint/config-inspector@latest' in the same directory as your configuration file."); - - try { - const flatOptions = await translateOptions(options, "flat"); - const spawn = require("cross-spawn"); - const flags = await cli.calculateInspectConfigFlags(flatOptions.overrideConfigFile, flatOptions.flags ? flatOptions.flags.includes("unstable_ts_config") : false); - - spawn.sync("npx", ["@eslint/config-inspector@latest", ...flags], { encoding: "utf8", stdio: "inherit" }); - } catch (error) { - log.error(error); - return 2; - } - - 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; - } - - if (options.reportUnusedDisableDirectives && options.reportUnusedDisableDirectivesSeverity !== void 0) { - log.error("The --report-unused-disable-directives option and the --report-unused-disable-directives-severity option cannot be used together."); - return 2; - } - - const ActiveESLint = usingFlatConfig ? ESLint : LegacyESLint; - const eslintOptions = await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc"); - const engine = new ActiveESLint(eslintOptions); - let results; - - if (useStdin) { - results = await engine.lintText(text, { - filePath: options.stdinFilename, - - // flatConfig respects CLI flag and constructor warnIgnored, eslintrc forces true for backwards compatibility - warnIgnored: usingFlatConfig ? void 0 : true - }); - } else { - results = await engine.lintFiles(files); - } - - if (options.fix) { - debug("Fix mode enabled - applying fixes"); - await ActiveESLint.outputFixes(results); - } - - let resultsToPrint = results; - - if (options.quiet) { - debug("Quiet mode enabled - filtering out warnings"); - resultsToPrint = ActiveESLint.getErrorResults(resultsToPrint); - } - - const resultCounts = countErrors(results); - const tooManyWarnings = options.maxWarnings >= 0 && resultCounts.warningCount > options.maxWarnings; - const resultsMeta = tooManyWarnings - ? { - maxWarningsExceeded: { - maxWarnings: options.maxWarnings, - foundWarnings: resultCounts.warningCount - } - } - : {}; - - if (await printResults(engine, resultsToPrint, options.format, options.outputFile, resultsMeta)) { - - // Errors and warnings from the original unfiltered results should determine the exit code - const shouldExitForFatalErrors = - options.exitOnFatalError && resultCounts.fatalErrorCount > 0; - - if (!resultCounts.errorCount && tooManyWarnings) { - log.error( - "ESLint found too many warnings (maximum: %s).", - options.maxWarnings - ); - } - - if (shouldExitForFatalErrors) { - return 2; - } - - return (resultCounts.errorCount || tooManyWarnings) ? 1 : 0; - } - - return 2; - } -}; - -module.exports = cli; diff --git a/node_modules/eslint/lib/config/config-loader.js b/node_modules/eslint/lib/config/config-loader.js deleted file mode 100644 index 845cd0c..0000000 --- a/node_modules/eslint/lib/config/config-loader.js +++ /dev/null @@ -1,719 +0,0 @@ -/** - * @fileoverview Utility to load config files - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const path = require("node:path"); -const fs = require("node:fs/promises"); -const findUp = require("find-up"); -const { pathToFileURL } = require("node:url"); -const debug = require("debug")("eslint:config-loader"); -const { FlatConfigArray } = require("./flat-config-array"); - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** - * @typedef {import("../shared/types").FlatConfigObject} FlatConfigObject - * @typedef {import("../shared/types").FlatConfigArray} FlatConfigArray - * @typedef {Object} ConfigLoaderOptions - * @property {string|false|undefined} configFile The path to the config file to use. - * @property {string} cwd The current working directory. - * @property {boolean} ignoreEnabled Indicates if ignore patterns should be honored. - * @property {FlatConfigArray} [baseConfig] The base config to use. - * @property {Array} [defaultConfigs] The default configs to use. - * @property {Array} [ignorePatterns] The ignore patterns to use. - * @property {FlatConfigObject|Array} overrideConfig The override config to use. - * @property {boolean} allowTS Indicates if TypeScript configuration files are allowed. - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const FLAT_CONFIG_FILENAMES = [ - "eslint.config.js", - "eslint.config.mjs", - "eslint.config.cjs" -]; - -const TS_FLAT_CONFIG_FILENAMES = [ - "eslint.config.ts", - "eslint.config.mts", - "eslint.config.cts" -]; - -const importedConfigFileModificationTime = new Map(); - -/** - * Asserts that the given file path is valid. - * @param {string} filePath The file path to check. - * @returns {void} - * @throws {Error} If `filePath` is not a non-empty string. - */ -function assertValidFilePath(filePath) { - if (!filePath || typeof filePath !== "string") { - throw new Error("'filePath' must be a non-empty string"); - } -} - -/** - * Asserts that a configuration exists. A configuration exists if any - * of the following are true: - * - `configFilePath` is defined. - * - `useConfigFile` is `false`. - * @param {string|undefined} configFilePath The path to the config file. - * @param {ConfigLoaderOptions} loaderOptions The options to use when loading configuration files. - * @returns {void} - * @throws {Error} If no configuration exists. - */ -function assertConfigurationExists(configFilePath, loaderOptions) { - - const { - configFile: useConfigFile - } = loaderOptions; - - if (!configFilePath && useConfigFile !== false) { - const error = new Error("Could not find config file."); - - error.messageTemplate = "config-file-missing"; - throw error; - } - -} - -/** - * Check if the file is a TypeScript file. - * @param {string} filePath The file path to check. - * @returns {boolean} `true` if the file is a TypeScript file, `false` if it's not. - */ -function isFileTS(filePath) { - const fileExtension = path.extname(filePath); - - return /^\.[mc]?ts$/u.test(fileExtension); -} - -/** - * Check if ESLint is running in Bun. - * @returns {boolean} `true` if the ESLint is running Bun, `false` if it's not. - */ -function isRunningInBun() { - return !!globalThis.Bun; -} - -/** - * Check if ESLint is running in Deno. - * @returns {boolean} `true` if the ESLint is running in Deno, `false` if it's not. - */ -function isRunningInDeno() { - return !!globalThis.Deno; -} - -/** - * Load the config array from the given filename. - * @param {string} filePath The filename to load from. - * @param {boolean} allowTS Indicates if TypeScript configuration files are allowed. - * @returns {Promise} The config loaded from the config file. - */ -async function loadConfigFile(filePath, allowTS) { - - debug(`Loading config from ${filePath}`); - - const fileURL = pathToFileURL(filePath); - - debug(`Config file URL is ${fileURL}`); - - const mtime = (await fs.stat(filePath)).mtime.getTime(); - - /* - * Append a query with the config file's modification time (`mtime`) in order - * to import the current version of the config file. Without the query, `import()` would - * cache the config file module by the pathname only, and then always return - * the same version (the one that was actual when the module was imported for the first time). - * - * This ensures that the config file module is loaded and executed again - * if it has been changed since the last time it was imported. - * If it hasn't been changed, `import()` will just return the cached version. - * - * Note that we should not overuse queries (e.g., by appending the current time - * to always reload the config file module) as that could cause memory leaks - * because entries are never removed from the import cache. - */ - fileURL.searchParams.append("mtime", mtime); - - /* - * With queries, we can bypass the import cache. However, when import-ing a CJS module, - * Node.js uses the require infrastructure under the hood. That includes the require cache, - * which caches the config file module by its file path (queries have no effect). - * Therefore, we also need to clear the require cache before importing the config file module. - * In order to get the same behavior with ESM and CJS config files, in particular - to reload - * the config file only if it has been changed, we track file modification times and clear - * the require cache only if the file has been changed. - */ - if (importedConfigFileModificationTime.get(filePath) !== mtime) { - delete require.cache[filePath]; - } - - const isTS = isFileTS(filePath); - const isBun = isRunningInBun(); - const isDeno = isRunningInDeno(); - - /* - * If we are dealing with a TypeScript file, then we need to use `jiti` to load it - * in Node.js. Deno and Bun both allow native importing of TypeScript files. - * - * When Node.js supports native TypeScript imports, we can remove this check. - */ - if (allowTS && isTS && !isDeno && !isBun) { - - // eslint-disable-next-line no-use-before-define -- `ConfigLoader.loadJiti` can be overwritten for testing - const { createJiti } = await ConfigLoader.loadJiti().catch(() => { - throw new Error("The 'jiti' library is required for loading TypeScript configuration files. Make sure to install it."); - }); - - // `createJiti` was added in jiti v2. - if (typeof createJiti !== "function") { - throw new Error("You are using an outdated version of the 'jiti' library. Please update to the latest version of 'jiti' to ensure compatibility and access to the latest features."); - } - - /* - * Disabling `moduleCache` allows us to reload a - * config file when the last modified timestamp changes. - */ - - const jiti = createJiti(__filename, { moduleCache: false, interopDefault: false }); - const config = await jiti.import(fileURL.href); - - importedConfigFileModificationTime.set(filePath, mtime); - - return config?.default ?? config; - } - - - // fallback to normal runtime behavior - - const config = (await import(fileURL)).default; - - importedConfigFileModificationTime.set(filePath, mtime); - - return config; -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * Encapsulates the loading and caching of configuration files when looking up - * from the file being linted. - */ -class ConfigLoader { - - /** - * Map of config file paths to the config arrays for those directories. - * @type {Map>} - */ - #configArrays = new Map(); - - /** - * Map of absolute directory names to the config file paths for those directories. - * @type {Map>} - */ - #configFilePaths = new Map(); - - /** - * The options to use when loading configuration files. - * @type {ConfigLoaderOptions} - */ - #options; - - /** - * Creates a new instance. - * @param {ConfigLoaderOptions} options The options to use when loading configuration files. - */ - constructor(options) { - this.#options = options; - } - - /** - * Determines which config file to use. This is determined by seeing if an - * override config file was specified, and if so, using it; otherwise, as long - * as override config file is not explicitly set to `false`, it will search - * upwards from `fromDirectory` for a file named `eslint.config.js`. - * @param {string} fromDirectory The directory from which to start searching. - * @returns {Promise<{configFilePath:string|undefined,basePath:string}>} Location information for - * the config file. - */ - async #locateConfigFileToUse(fromDirectory) { - - // check cache first - if (this.#configFilePaths.has(fromDirectory)) { - return this.#configFilePaths.get(fromDirectory); - } - - const resultPromise = ConfigLoader.locateConfigFileToUse({ - useConfigFile: this.#options.configFile, - cwd: this.#options.cwd, - fromDirectory, - allowTS: this.#options.allowTS - }); - - // ensure `ConfigLoader.locateConfigFileToUse` is called only once for `fromDirectory` - this.#configFilePaths.set(fromDirectory, resultPromise); - - // Unwrap the promise. This is primarily for the sync `getCachedConfigArrayForPath` method. - const result = await resultPromise; - - this.#configFilePaths.set(fromDirectory, result); - - return result; - } - - /** - * Calculates the config array for this run based on inputs. - * @param {string} configFilePath The absolute path to the config file to use if not overridden. - * @param {string} basePath The base path to use for relative paths in the config file. - * @returns {Promise} The config array for `eslint`. - */ - async #calculateConfigArray(configFilePath, basePath) { - - // check for cached version first - if (this.#configArrays.has(configFilePath)) { - return this.#configArrays.get(configFilePath); - } - - const configsPromise = ConfigLoader.calculateConfigArray(configFilePath, basePath, this.#options); - - // ensure `ConfigLoader.calculateConfigArray` is called only once for `configFilePath` - this.#configArrays.set(configFilePath, configsPromise); - - // Unwrap the promise. This is primarily for the sync `getCachedConfigArrayForPath` method. - const configs = await configsPromise; - - this.#configArrays.set(configFilePath, configs); - - return configs; - } - - /** - * Returns the config file path for the given directory or file. This will either use - * the override config file that was specified in the constructor options or - * search for a config file from the directory. - * @param {string} fileOrDirPath The file or directory path to get the config file path for. - * @returns {Promise} The config file path or `undefined` if not found. - * @throws {Error} If `fileOrDirPath` is not a non-empty string. - * @throws {Error} If `fileOrDirPath` is not an absolute path. - */ - async findConfigFileForPath(fileOrDirPath) { - - assertValidFilePath(fileOrDirPath); - - const absoluteDirPath = path.resolve(this.#options.cwd, path.dirname(fileOrDirPath)); - const { configFilePath } = await this.#locateConfigFileToUse(absoluteDirPath); - - return configFilePath; - } - - /** - * 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 or directory to retrieve config for. - * @returns {Promise} A configuration object for the file - * or `undefined` if there is no configuration data for the file. - * @throws {Error} If no configuration for `filePath` exists. - */ - async loadConfigArrayForFile(filePath) { - - assertValidFilePath(filePath); - - debug(`Calculating config for file ${filePath}`); - - const configFilePath = await this.findConfigFileForPath(filePath); - - assertConfigurationExists(configFilePath, this.#options); - - return this.loadConfigArrayForDirectory(filePath); - } - - /** - * Returns a configuration object for the given directory 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} dirPath The path of the directory to retrieve config for. - * @returns {Promise} A configuration object for the directory - * or `undefined` if there is no configuration data for the directory. - */ - async loadConfigArrayForDirectory(dirPath) { - - assertValidFilePath(dirPath); - - debug(`Calculating config for directory ${dirPath}`); - - const absoluteDirPath = path.resolve(this.#options.cwd, path.dirname(dirPath)); - const { configFilePath, basePath } = await this.#locateConfigFileToUse(absoluteDirPath); - - debug(`Using config file ${configFilePath} and base path ${basePath}`); - return this.#calculateConfigArray(configFilePath, basePath); - } - - /** - * Returns a configuration array for the given file based on the CLI options. - * This is a synchronous operation and does not read any files from disk. It's - * intended to be used in locations where we know the config file has already - * been loaded and we just need to get the configuration for a file. - * @param {string} filePath The path of the file to retrieve a config object for. - * @returns {ConfigData|undefined} A configuration object for the file - * or `undefined` if there is no configuration data for the file. - * @throws {Error} If `filePath` is not a non-empty string. - * @throws {Error} If `filePath` is not an absolute path. - * @throws {Error} If the config file was not already loaded. - */ - getCachedConfigArrayForFile(filePath) { - assertValidFilePath(filePath); - - debug(`Looking up cached config for ${filePath}`); - - return this.getCachedConfigArrayForPath(path.dirname(filePath)); - } - - /** - * Returns a configuration array for the given directory based on the CLI options. - * This is a synchronous operation and does not read any files from disk. It's - * intended to be used in locations where we know the config file has already - * been loaded and we just need to get the configuration for a file. - * @param {string} fileOrDirPath The path of the directory to retrieve a config object for. - * @returns {ConfigData|undefined} A configuration object for the directory - * or `undefined` if there is no configuration data for the directory. - * @throws {Error} If `dirPath` is not a non-empty string. - * @throws {Error} If `dirPath` is not an absolute path. - * @throws {Error} If the config file was not already loaded. - */ - getCachedConfigArrayForPath(fileOrDirPath) { - assertValidFilePath(fileOrDirPath); - - debug(`Looking up cached config for ${fileOrDirPath}`); - - const absoluteDirPath = path.resolve(this.#options.cwd, fileOrDirPath); - - if (!this.#configFilePaths.has(absoluteDirPath)) { - throw new Error(`Could not find config file for ${fileOrDirPath}`); - } - - const configFilePathInfo = this.#configFilePaths.get(absoluteDirPath); - - if (typeof configFilePathInfo.then === "function") { - throw new Error(`Config file path for ${fileOrDirPath} has not yet been calculated or an error occurred during the calculation`); - } - - const { configFilePath } = configFilePathInfo; - - const configArray = this.#configArrays.get(configFilePath); - - if (!configArray || typeof configArray.then === "function") { - throw new Error(`Config array for ${fileOrDirPath} has not yet been calculated or an error occurred during the calculation`); - } - - return configArray; - } - - /** - * Used to import the jiti dependency. This method is exposed internally for testing purposes. - * @returns {Promise>} A promise that fulfills with a module object - * or rejects with an error if jiti is not found. - */ - static loadJiti() { - return import("jiti"); - } - - /** - * Determines which config file to use. This is determined by seeing if an - * override config file was specified, and if so, using it; otherwise, as long - * as override config file is not explicitly set to `false`, it will search - * upwards from `fromDirectory` for a file named `eslint.config.js`. - * This method is exposed internally for testing purposes. - * @param {Object} [options] the options object - * @param {string|false|undefined} options.useConfigFile The path to the config file to use. - * @param {string} options.cwd Path to a directory that should be considered as the current working directory. - * @param {string} [options.fromDirectory] The directory from which to start searching. Defaults to `cwd`. - * @param {boolean} options.allowTS Indicates if TypeScript configuration files are allowed. - * @returns {Promise<{configFilePath:string|undefined,basePath:string}>} Location information for - * the config file. - */ - static async locateConfigFileToUse({ useConfigFile, cwd, fromDirectory = cwd, allowTS }) { - - const configFilenames = allowTS - ? [...FLAT_CONFIG_FILENAMES, ...TS_FLAT_CONFIG_FILENAMES] - : FLAT_CONFIG_FILENAMES; - - // determine where to load config file from - let configFilePath; - let basePath = cwd; - - if (typeof useConfigFile === "string") { - debug(`Override config file path is ${useConfigFile}`); - configFilePath = path.resolve(cwd, useConfigFile); - basePath = cwd; - } else if (useConfigFile !== false) { - debug("Searching for eslint.config.js"); - configFilePath = await findUp( - configFilenames, - { cwd: fromDirectory } - ); - - if (configFilePath) { - basePath = path.dirname(configFilePath); - } - - } - - return { - configFilePath, - basePath - }; - - } - - /** - * Calculates the config array for this run based on inputs. - * This method is exposed internally for testing purposes. - * @param {string} configFilePath The absolute path to the config file to use if not overridden. - * @param {string} basePath The base path to use for relative paths in the config file. - * @param {ConfigLoaderOptions} options The options to use when loading configuration files. - * @returns {Promise} The config array for `eslint`. - */ - static async calculateConfigArray(configFilePath, basePath, options) { - - const { - cwd, - baseConfig, - ignoreEnabled, - ignorePatterns, - overrideConfig, - defaultConfigs = [], - allowTS - } = options; - - debug(`Calculating config array from config file ${configFilePath} and base path ${basePath}`); - - const configs = new FlatConfigArray(baseConfig || [], { basePath, shouldIgnore: ignoreEnabled }); - - // load config file - if (configFilePath) { - - debug(`Loading config file ${configFilePath}`); - const fileConfig = await loadConfigFile(configFilePath, allowTS); - - if (Array.isArray(fileConfig)) { - configs.push(...fileConfig); - } else { - configs.push(fileConfig); - } - } - - // add in any configured defaults - configs.push(...defaultConfigs); - - // append command line ignore patterns - if (ignorePatterns && ignorePatterns.length > 0) { - - let relativeIgnorePatterns; - - /* - * If the config file basePath is different than the cwd, then - * the ignore patterns won't work correctly. Here, we adjust the - * ignore pattern to include the correct relative path. Patterns - * passed as `ignorePatterns` are relative to the cwd, whereas - * the config file basePath can be an ancestor of the cwd. - */ - if (basePath === cwd) { - relativeIgnorePatterns = ignorePatterns; - } else { - - // relative path must only have Unix-style separators - const relativeIgnorePath = path.relative(basePath, cwd).replace(/\\/gu, "/"); - - relativeIgnorePatterns = ignorePatterns.map(pattern => { - const negated = pattern.startsWith("!"); - const basePattern = negated ? pattern.slice(1) : pattern; - - return (negated ? "!" : "") + - path.posix.join(relativeIgnorePath, basePattern); - }); - } - - /* - * Ignore patterns are added to the end of the config array - * so they can override default ignores. - */ - configs.push({ - ignores: relativeIgnorePatterns - }); - } - - if (overrideConfig) { - if (Array.isArray(overrideConfig)) { - configs.push(...overrideConfig); - } else { - configs.push(overrideConfig); - } - } - - await configs.normalize(); - - return configs; - } - -} - -/** - * Encapsulates the loading and caching of configuration files when looking up - * from the current working directory. - */ -class LegacyConfigLoader extends ConfigLoader { - - /** - * The options to use when loading configuration files. - * @type {ConfigLoaderOptions} - */ - #options; - - /** - * The cached config file path for this instance. - * @type {Promise<{configFilePath:string,basePath:string}|undefined>} - */ - #configFilePath; - - /** - * The cached config array for this instance. - * @type {FlatConfigArray|Promise} - */ - #configArray; - - /** - * Creates a new instance. - * @param {ConfigLoaderOptions} options The options to use when loading configuration files. - */ - constructor(options) { - super(options); - this.#options = options; - } - - /** - * Determines which config file to use. This is determined by seeing if an - * override config file was specified, and if so, using it; otherwise, as long - * as override config file is not explicitly set to `false`, it will search - * upwards from the cwd for a file named `eslint.config.js`. - * @returns {Promise<{configFilePath:string|undefined,basePath:string}>} Location information for - * the config file. - */ - #locateConfigFileToUse() { - if (!this.#configFilePath) { - this.#configFilePath = ConfigLoader.locateConfigFileToUse({ - useConfigFile: this.#options.configFile, - cwd: this.#options.cwd, - allowTS: this.#options.allowTS - }); - } - - return this.#configFilePath; - } - - /** - * Calculates the config array for this run based on inputs. - * @param {string} configFilePath The absolute path to the config file to use if not overridden. - * @param {string} basePath The base path to use for relative paths in the config file. - * @returns {Promise} The config array for `eslint`. - */ - async #calculateConfigArray(configFilePath, basePath) { - - // check for cached version first - if (this.#configArray) { - return this.#configArray; - } - - // ensure `ConfigLoader.calculateConfigArray` is called only once - this.#configArray = ConfigLoader.calculateConfigArray(configFilePath, basePath, this.#options); - - // Unwrap the promise. This is primarily for the sync `getCachedConfigArrayForPath` method. - this.#configArray = await this.#configArray; - - return this.#configArray; - } - - - /** - * Returns the config file path for the given directory. This will either use - * the override config file that was specified in the constructor options or - * search for a config file from the directory of the file being linted. - * @param {string} dirPath The directory path to get the config file path for. - * @returns {Promise} The config file path or `undefined` if not found. - * @throws {Error} If `fileOrDirPath` is not a non-empty string. - * @throws {Error} If `fileOrDirPath` is not an absolute path. - */ - async findConfigFileForPath(dirPath) { - - assertValidFilePath(dirPath); - - const { configFilePath } = await this.#locateConfigFileToUse(); - - return configFilePath; - } - - /** - * 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} dirPath The path of the directory to retrieve config for. - * @returns {Promise} A configuration object for the file - * or `undefined` if there is no configuration data for the file. - */ - async loadConfigArrayForDirectory(dirPath) { - - assertValidFilePath(dirPath); - - debug(`[Legacy]: Calculating config for ${dirPath}`); - - const { configFilePath, basePath } = await this.#locateConfigFileToUse(); - - debug(`[Legacy]: Using config file ${configFilePath} and base path ${basePath}`); - return this.#calculateConfigArray(configFilePath, basePath); - } - - /** - * Returns a configuration array for the given directory based on the CLI options. - * This is a synchronous operation and does not read any files from disk. It's - * intended to be used in locations where we know the config file has already - * been loaded and we just need to get the configuration for a file. - * @param {string} dirPath The path of the directory to retrieve a config object for. - * @returns {ConfigData|undefined} A configuration object for the file - * or `undefined` if there is no configuration data for the file. - * @throws {Error} If `dirPath` is not a non-empty string. - * @throws {Error} If `dirPath` is not an absolute path. - * @throws {Error} If the config file was not already loaded. - */ - getCachedConfigArrayForPath(dirPath) { - assertValidFilePath(dirPath); - - debug(`[Legacy]: Looking up cached config for ${dirPath}`); - - if (!this.#configArray) { - throw new Error(`Could not find config file for ${dirPath}`); - } - - if (typeof this.#configArray.then === "function") { - throw new Error(`Config array for ${dirPath} has not yet been calculated or an error occurred during the calculation`); - } - - return this.#configArray; - } -} - -module.exports = { ConfigLoader, LegacyConfigLoader }; diff --git a/node_modules/eslint/lib/config/config.js b/node_modules/eslint/lib/config/config.js deleted file mode 100644 index 009d09f..0000000 --- a/node_modules/eslint/lib/config/config.js +++ /dev/null @@ -1,297 +0,0 @@ -/** - * @fileoverview The `Config` class - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { deepMergeArrays } = require("../shared/deep-merge-arrays"); -const { getRuleFromConfig } = require("./flat-config-helpers"); -const { flatConfigSchema, hasMethod } = require("./flat-config-schema"); -const { RuleValidator } = require("./rule-validator"); -const { ObjectSchema } = require("@eslint/config-array"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const ruleValidator = new RuleValidator(); - -const severities = new Map([ - [0, 0], - [1, 1], - [2, 2], - ["off", 0], - ["warn", 1], - ["error", 2] -]); - -/** - * 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("/") - }; -} - -/** - * Returns the name of an object in the config by reading its `meta` key. - * @param {Object} object The object to check. - * @returns {string?} The name of the object if found or `null` if there - * is no name. - */ -function getObjectId(object) { - - // first check old-style name - let name = object.name; - - if (!name) { - - if (!object.meta) { - return null; - } - - name = object.meta.name; - - if (!name) { - return null; - } - } - - // now check for old-style version - let version = object.version; - - if (!version) { - version = object.meta && object.meta.version; - } - - // if there's a version then append that - if (version) { - return `${name}@${version}`; - } - - return name; -} - -/** - * Converts a languageOptions object to a JSON representation. - * @param {Record} languageOptions The options to create a JSON - * representation of. - * @param {string} objectKey The key of the object being converted. - * @returns {Record} The JSON representation of the languageOptions. - * @throws {TypeError} If a function is found in the languageOptions. - */ -function languageOptionsToJSON(languageOptions, objectKey = "languageOptions") { - - const result = {}; - - for (const [key, value] of Object.entries(languageOptions)) { - if (value) { - if (typeof value === "object") { - const name = getObjectId(value); - - if (name && hasMethod(value)) { - result[key] = name; - } else { - result[key] = languageOptionsToJSON(value, key); - } - continue; - } - - if (typeof value === "function") { - throw new TypeError(`Cannot serialize key "${key}" in ${objectKey}: Function values are not supported.`); - } - - } - - result[key] = value; - } - - return result; -} - - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * Represents a normalized configuration object. - */ -class Config { - - /** - * The name to use for the language when serializing to JSON. - * @type {string|undefined} - */ - #languageName; - - /** - * The name to use for the processor when serializing to JSON. - * @type {string|undefined} - */ - #processorName; - - /** - * Creates a new instance. - * @param {Object} config The configuration object. - */ - constructor(config) { - - const { plugins, language, languageOptions, processor, ...otherKeys } = config; - - // Validate config object - const schema = new ObjectSchema(flatConfigSchema); - - schema.validate(config); - - // first, copy all the other keys over - Object.assign(this, otherKeys); - - // ensure that a language is specified - if (!language) { - throw new TypeError("Key 'language' is required."); - } - - // copy the rest over - this.plugins = plugins; - this.language = language; - - // Check language value - const { pluginName: languagePluginName, objectName: localLanguageName } = splitPluginIdentifier(language); - - this.#languageName = language; - - if (!plugins || !plugins[languagePluginName] || !plugins[languagePluginName].languages || !plugins[languagePluginName].languages[localLanguageName]) { - throw new TypeError(`Key "language": Could not find "${localLanguageName}" in plugin "${languagePluginName}".`); - } - - this.language = plugins[languagePluginName].languages[localLanguageName]; - - if (this.language.defaultLanguageOptions ?? languageOptions) { - this.languageOptions = flatConfigSchema.languageOptions.merge( - this.language.defaultLanguageOptions, - languageOptions - ); - } else { - this.languageOptions = {}; - } - - // Validate language options - try { - this.language.validateLanguageOptions(this.languageOptions); - } catch (error) { - throw new TypeError(`Key "languageOptions": ${error.message}`, { cause: error }); - } - - // Normalize language options if necessary - if (this.language.normalizeLanguageOptions) { - this.languageOptions = this.language.normalizeLanguageOptions(this.languageOptions); - } - - // Check processor value - if (processor) { - this.processor = processor; - - if (typeof processor === "string") { - const { pluginName, objectName: localProcessorName } = splitPluginIdentifier(processor); - - this.#processorName = processor; - - if (!plugins || !plugins[pluginName] || !plugins[pluginName].processors || !plugins[pluginName].processors[localProcessorName]) { - throw new TypeError(`Key "processor": Could not find "${localProcessorName}" in plugin "${pluginName}".`); - } - - this.processor = plugins[pluginName].processors[localProcessorName]; - } else if (typeof processor === "object") { - this.#processorName = getObjectId(processor); - this.processor = processor; - } else { - throw new TypeError("Key 'processor' must be a string or an object."); - } - } - - // Process the rules - if (this.rules) { - this.#normalizeRulesConfig(); - ruleValidator.validate(this); - } - } - - /** - * Converts the configuration to a JSON representation. - * @returns {Record} The JSON representation of the configuration. - * @throws {Error} If the configuration cannot be serialized. - */ - toJSON() { - - if (this.processor && !this.#processorName) { - throw new Error("Could not serialize processor object (missing 'meta' object)."); - } - - if (!this.#languageName) { - throw new Error("Could not serialize language object (missing 'meta' object)."); - } - - return { - ...this, - plugins: Object.entries(this.plugins).map(([namespace, plugin]) => { - - const pluginId = getObjectId(plugin); - - if (!pluginId) { - return namespace; - } - - return `${namespace}:${pluginId}`; - }), - language: this.#languageName, - languageOptions: languageOptionsToJSON(this.languageOptions), - processor: this.#processorName - }; - } - - /** - * Normalizes the rules configuration. Ensures that each rule config is - * an array and that the severity is a number. Applies meta.defaultOptions. - * This function modifies `this.rules`. - * @returns {void} - */ - #normalizeRulesConfig() { - for (const [ruleId, originalConfig] of Object.entries(this.rules)) { - - // ensure rule config is an array - let ruleConfig = Array.isArray(originalConfig) - ? originalConfig - : [originalConfig]; - - // normalize severity - ruleConfig[0] = severities.get(ruleConfig[0]); - - const rule = getRuleFromConfig(ruleId, this); - - // apply meta.defaultOptions - const slicedOptions = ruleConfig.slice(1); - const mergedOptions = deepMergeArrays(rule?.meta?.defaultOptions, slicedOptions); - - if (mergedOptions.length) { - ruleConfig = [ruleConfig[0], ...mergedOptions]; - } - - this.rules[ruleId] = ruleConfig; - } - } -} - -module.exports = { Config }; diff --git a/node_modules/eslint/lib/config/default-config.js b/node_modules/eslint/lib/config/default-config.js deleted file mode 100644 index 1b4ec45..0000000 --- a/node_modules/eslint/lib/config/default-config.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @fileoverview Default configuration - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const Rules = require("../rules"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -exports.defaultConfig = Object.freeze([ - { - plugins: { - "@": { - - languages: { - js: require("../languages/js") - }, - - /* - * 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); - } - }) - } - }, - language: "@/js", - linterOptions: { - reportUnusedDisableDirectives: 1 - } - }, - - // default ignores are listed here - { - ignores: [ - "**/node_modules/", - ".git/" - ] - }, - - // intentionally empty config to ensure these files are globbed by default - { - files: ["**/*.js", "**/*.mjs"] - }, - { - files: ["**/*.cjs"], - languageOptions: { - sourceType: "commonjs", - ecmaVersion: "latest" - } - } -]); diff --git a/node_modules/eslint/lib/config/flat-config-array.js b/node_modules/eslint/lib/config/flat-config-array.js deleted file mode 100644 index 7c91101..0000000 --- a/node_modules/eslint/lib/config/flat-config-array.js +++ /dev/null @@ -1,222 +0,0 @@ -/** - * @fileoverview Flat Config Array - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { ConfigArray, ConfigArraySymbol } = require("@eslint/config-array"); -const { flatConfigSchema } = require("./flat-config-schema"); -const { defaultConfig } = require("./default-config"); -const { Config } = require("./config"); - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -/** - * Fields that are considered metadata and not part of the config object. - */ -const META_FIELDS = new Set(["name"]); - -/** - * Wraps a config error with details about where the error occurred. - * @param {Error} error The original error. - * @param {number} originalLength The original length of the config array. - * @param {number} baseLength The length of the base config. - * @returns {TypeError} The new error with details. - */ -function wrapConfigErrorWithDetails(error, originalLength, baseLength) { - - let location = "user-defined"; - let configIndex = error.index; - - /* - * A config array is set up in this order: - * 1. Base config - * 2. Original configs - * 3. User-defined configs - * 4. CLI-defined configs - * - * So we need to adjust the index to account for the base config. - * - * - If the index is less than the base length, it's in the base config - * (as specified by `baseConfig` argument to `FlatConfigArray` constructor). - * - If the index is greater than the base length but less than the original - * length + base length, it's in the original config. The original config - * is passed to the `FlatConfigArray` constructor as the first argument. - * - Otherwise, it's in the user-defined config, which is loaded from the - * config file and merged with any command-line options. - */ - if (error.index < baseLength) { - location = "base"; - } else if (error.index < originalLength + baseLength) { - location = "original"; - configIndex = error.index - baseLength; - } else { - configIndex = error.index - originalLength - baseLength; - } - - return new TypeError( - `${error.message.slice(0, -1)} at ${location} index ${configIndex}.`, - { cause: error } - ); -} - - -const originalBaseConfig = Symbol("originalBaseConfig"); -const originalLength = Symbol("originalLength"); -const baseLength = Symbol("baseLength"); - -//----------------------------------------------------------------------------- -// 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, shouldIgnore: boolean, baseConfig: FlatConfig}} options The options - * to use for the config array instance. - */ - constructor(configs, { - basePath, - shouldIgnore = true, - baseConfig = defaultConfig - } = {}) { - super(configs, { - basePath, - schema: flatConfigSchema - }); - - /** - * The original length of the array before any modifications. - * @type {number} - */ - this[originalLength] = this.length; - - if (baseConfig[Symbol.iterator]) { - this.unshift(...baseConfig); - } else { - this.unshift(baseConfig); - } - - /** - * The length of the array after applying the base config. - * @type {number} - */ - this[baseLength] = this.length - this[originalLength]; - - /** - * The base config used to build the config array. - * @type {Array} - */ - this[originalBaseConfig] = baseConfig; - Object.defineProperty(this, originalBaseConfig, { writable: false }); - - /** - * Determines if `ignores` fields should be honored. - * If true, then all `ignores` fields are honored. - * if false, then only `ignores` fields in the baseConfig are honored. - * @type {boolean} - */ - this.shouldIgnore = shouldIgnore; - Object.defineProperty(this, "shouldIgnore", { writable: false }); - } - - /** - * Normalizes the array by calling the superclass method and catching/rethrowing - * any ConfigError exceptions with additional details. - * @param {any} [context] The context to use to normalize the array. - * @returns {Promise} A promise that resolves when the array is normalized. - */ - normalize(context) { - return super.normalize(context) - .catch(error => { - if (error.name === "ConfigError") { - throw wrapConfigErrorWithDetails(error, this[originalLength], this[baseLength]); - } - - throw error; - - }); - } - - /** - * Normalizes the array by calling the superclass method and catching/rethrowing - * any ConfigError exceptions with additional details. - * @param {any} [context] The context to use to normalize the array. - * @returns {FlatConfigArray} The current instance. - * @throws {TypeError} If the config is invalid. - */ - normalizeSync(context) { - - try { - - return super.normalizeSync(context); - - } catch (error) { - - if (error.name === "ConfigError") { - throw wrapConfigErrorWithDetails(error, this[originalLength], this[baseLength]); - } - - throw error; - - } - - } - - /* 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 a config object has `ignores` and no other non-meta fields, then it's an object - * for global ignores. If `shouldIgnore` is false, that object shouldn't apply, - * so we'll remove its `ignores`. - */ - if ( - !this.shouldIgnore && - !this[originalBaseConfig].includes(config) && - config.ignores && - Object.keys(config).filter(key => !META_FIELDS.has(key)).length === 1 - ) { - /* eslint-disable-next-line no-unused-vars -- need to strip off other keys */ - const { ignores, ...otherKeys } = config; - - return otherKeys; - } - - 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) { - return new Config(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 deleted file mode 100644 index a904a0d..0000000 --- a/node_modules/eslint/lib/config/flat-config-helpers.js +++ /dev/null @@ -1,128 +0,0 @@ -/** - * @fileoverview Shared functions to work with configs. - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").Rule} Rule */ - -//------------------------------------------------------------------------------ -// Private Members -//------------------------------------------------------------------------------ - -// JSON schema that disallows passing any options -const noOptionsSchema = Object.freeze({ - type: "array", - minItems: 0, - maxItems: 0 -}); - -//----------------------------------------------------------------------------- -// 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("/")) { - - // mimic scoped npm packages - if (ruleId.startsWith("@")) { - pluginName = ruleId.slice(0, ruleId.lastIndexOf("/")); - } else { - pluginName = ruleId.slice(0, ruleId.indexOf("/")); - } - - 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); - - return config.plugins?.[pluginName]?.rules?.[ruleName]; -} - -/** - * Gets a complete options schema for a rule. - * @param {Rule} rule A rule object - * @throws {TypeError} If `meta.schema` is specified but is not an array, object or `false`. - * @returns {Object|null} JSON Schema for the rule's options. `null` if `meta.schema` is `false`. - */ -function getRuleOptionsSchema(rule) { - - if (!rule.meta) { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - const schema = rule.meta.schema; - - if (typeof schema === "undefined") { - return { ...noOptionsSchema }; // default if `meta.schema` is not specified - } - - // `schema:false` is an allowed explicit opt-out of options validation for the rule - if (schema === false) { - return null; - } - - if (typeof schema !== "object" || schema === null) { - throw new TypeError("Rule's `meta.schema` must be an array or object"); - } - - // ESLint-specific array form needs to be converted into a valid JSON Schema definition - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - - // `schema:[]` is an explicit way to specify that the rule does not accept any options - return { ...noOptionsSchema }; - } - - // `schema:` is assumed to be a valid JSON Schema definition - return schema; -} - - -//----------------------------------------------------------------------------- -// 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 deleted file mode 100644 index bffbae7..0000000 --- a/node_modules/eslint/lib/config/flat-config-schema.js +++ /dev/null @@ -1,576 +0,0 @@ -/** - * @fileoverview Flat config schema - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { normalizeSeverityToNumber } = require("../shared/severity"); - -//----------------------------------------------------------------------------- -// 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] -]); - -/** - * 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 a non-null non-array object. - * @param {any} value The value to check. - * @returns {boolean} `true` if the value is a non-null non-array object. - */ -function isNonArrayObject(value) { - return isNonNullObject(value) && !Array.isArray(value); -} - -/** - * 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 non-array objects. - * @param {Object} first The base object. - * @param {Object} second The overrides object. - * @param {Map>} [mergeMap] Maps the combination of first and second arguments to a merged result. - * @returns {Object} An object with properties from both first and second. - */ -function deepMerge(first, second, mergeMap = new Map()) { - - let secondMergeMap = mergeMap.get(first); - - if (secondMergeMap) { - const result = secondMergeMap.get(second); - - if (result) { - - // If this combination of first and second arguments has been already visited, return the previously created result. - return result; - } - } else { - secondMergeMap = new Map(); - mergeMap.set(first, secondMergeMap); - } - - /* - * 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 - }; - - delete result.__proto__; // eslint-disable-line no-proto -- don't merge own property "__proto__" - - // Store the pending result for this combination of first and second arguments. - secondMergeMap.set(second, result); - - for (const key of Object.keys(second)) { - - // avoid hairy edge case - if (key === "__proto__" || !Object.prototype.propertyIsEnumerable.call(first, key)) { - continue; - } - - const firstValue = first[key]; - const secondValue = second[key]; - - if (isNonArrayObject(firstValue) && isNonArrayObject(secondValue)) { - result[key] = deepMerge(firstValue, secondValue, mergeMap); - } else if (isUndefined(secondValue)) { - result[key] = firstValue; - } - } - - 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 structuredClone(finalOptions); -} - -/** - * Determines if an object has any methods. - * @param {Object} object The object to check. - * @returns {boolean} `true` if the object has any methods. - */ -function hasMethod(object) { - - for (const key of Object.keys(object)) { - - if (typeof object[key] === "function") { - return true; - } - } - - return false; -} - -//----------------------------------------------------------------------------- -// Assertions -//----------------------------------------------------------------------------- - -/** - * The error type when a rule's options are configured with an invalid type. - */ -class InvalidRuleOptionsError extends Error { - - /** - * @param {string} ruleId Rule name being configured. - * @param {any} value The invalid value. - */ - constructor(ruleId, value) { - super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`); - this.messageTemplate = "invalid-rule-options"; - this.messageData = { ruleId, value }; - } -} - -/** - * Validates that a value is a valid rule options entry. - * @param {string} ruleId Rule name being configured. - * @param {any} value The value to check. - * @returns {void} - * @throws {InvalidRuleOptionsError} If the value isn't a valid rule options. - */ -function assertIsRuleOptions(ruleId, value) { - if (typeof value !== "string" && typeof value !== "number" && !Array.isArray(value)) { - throw new InvalidRuleOptionsError(ruleId, value); - } -} - -/** - * The error type when a rule's severity is invalid. - */ -class InvalidRuleSeverityError extends Error { - - /** - * @param {string} ruleId Rule name being configured. - * @param {any} value The invalid value. - */ - constructor(ruleId, value) { - super(`Key "${ruleId}": Expected severity of "off", 0, "warn", 1, "error", or 2.`); - this.messageTemplate = "invalid-rule-severity"; - this.messageData = { ruleId, value }; - } -} - -/** - * Validates that a value is valid rule severity. - * @param {string} ruleId Rule name being configured. - * @param {any} value The value to check. - * @returns {void} - * @throws {InvalidRuleSeverityError} If the value isn't a valid rule severity. - */ -function assertIsRuleSeverity(ruleId, value) { - const severity = ruleSeverities.get(value); - - if (typeof severity === "undefined") { - throw new InvalidRuleSeverityError(ruleId, value); - } -} - -/** - * 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."); - } -} - -/** - * The error type when there's an eslintrc-style options in a flat config. - */ -class IncompatibleKeyError extends Error { - - /** - * @param {string} key The invalid key. - */ - constructor(key) { - super("This appears to be in eslintrc format rather than flat config format."); - this.messageTemplate = "eslintrc-incompat"; - this.messageData = { key }; - } -} - -/** - * The error type when there's an eslintrc-style plugins array found. - */ -class IncompatiblePluginsError extends Error { - - /** - * Creates a new instance. - * @param {Array} plugins The plugins array. - */ - constructor(plugins) { - super("This appears to be in eslintrc format (array of strings) rather than flat config format (object)."); - this.messageTemplate = "eslintrc-plugins"; - this.messageData = { plugins }; - } -} - - -//----------------------------------------------------------------------------- -// Low-Level Schemas -//----------------------------------------------------------------------------- - -/** @type {ObjectPropertySchema} */ -const booleanSchema = { - merge: "replace", - validate: "boolean" -}; - -const ALLOWED_SEVERITIES = new Set(["error", "warn", "off", 2, 1, 0]); - -/** @type {ObjectPropertySchema} */ -const disableDirectiveSeveritySchema = { - merge(first, second) { - const value = second === void 0 ? first : second; - - if (typeof value === "boolean") { - return value ? "warn" : "off"; - } - - return normalizeSeverityToNumber(value); - }, - validate(value) { - if (!(ALLOWED_SEVERITIES.has(value) || typeof value === "boolean")) { - throw new TypeError("Expected one of: \"error\", \"warn\", \"off\", 0, 1, 2, or a boolean."); - } - } -}; - -/** @type {ObjectPropertySchema} */ -const deepObjectAssignSchema = { - merge(first = {}, second = {}) { - return deepMerge(first, second); - }, - validate: "object" -}; - - -//----------------------------------------------------------------------------- -// High-Level Schemas -//----------------------------------------------------------------------------- - -/** @type {ObjectPropertySchema} */ -const languageOptionsSchema = { - merge(first = {}, second = {}) { - - const result = deepMerge(first, second); - - for (const [key, value] of Object.entries(result)) { - - /* - * Special case: Because the `parser` property is an object, it should - * not be deep merged. Instead, it should be replaced if it exists in - * the second object. To make this more generic, we just check for - * objects with methods and replace them if they exist in the second - * object. - */ - if (isNonArrayObject(value)) { - if (hasMethod(value)) { - result[key] = second[key] ?? first[key]; - continue; - } - - // for other objects, make sure we aren't reusing the same object - result[key] = { ...result[key] }; - continue; - } - - } - - return result; - }, - validate: "object" -}; - -/** @type {ObjectPropertySchema} */ -const languageSchema = { - merge: "replace", - validate: assertIsPluginMemberName -}; - -/** @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."); - } - - // make sure it's not an array, which would mean eslintrc-style is used - if (Array.isArray(value)) { - throw new IncompatiblePluginsError(value); - } - - // 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)) { - - try { - - // 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. - */ - } catch (ex) { - throw new Error(`Key "${ruleId}": ${ex.message}`, { cause: ex }); - } - - } - - return result; - - - }, - - validate(value) { - assertIsObject(value); - - /* - * 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; - } - - const ruleOptions = value[ruleId]; - - assertIsRuleOptions(ruleId, ruleOptions); - - if (Array.isArray(ruleOptions)) { - assertIsRuleSeverity(ruleId, ruleOptions[0]); - } else { - assertIsRuleSeverity(ruleId, ruleOptions); - } - } - } -}; - -/** - * Creates a schema that always throws an error. Useful for warning - * about eslintrc-style keys. - * @param {string} key The eslintrc key to create a schema for. - * @returns {ObjectPropertySchema} The schema. - */ -function createEslintrcErrorSchema(key) { - return { - merge: "replace", - validate() { - throw new IncompatibleKeyError(key); - } - }; -} - -const eslintrcKeys = [ - "env", - "extends", - "globals", - "ignorePatterns", - "noInlineConfig", - "overrides", - "parser", - "parserOptions", - "reportUnusedDisableDirectives", - "root" -]; - -//----------------------------------------------------------------------------- -// Full schema -//----------------------------------------------------------------------------- - -const flatConfigSchema = { - - // eslintrc-style keys that should always error - ...Object.fromEntries(eslintrcKeys.map(key => [key, createEslintrcErrorSchema(key)])), - - // flat config keys - settings: deepObjectAssignSchema, - linterOptions: { - schema: { - noInlineConfig: booleanSchema, - reportUnusedDisableDirectives: disableDirectiveSeveritySchema - } - }, - language: languageSchema, - languageOptions: languageOptionsSchema, - processor: processorSchema, - plugins: pluginsSchema, - rules: rulesSchema -}; - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = { - flatConfigSchema, - hasMethod, - assertIsRuleSeverity -}; diff --git a/node_modules/eslint/lib/config/rule-validator.js b/node_modules/eslint/lib/config/rule-validator.js deleted file mode 100644 index 3b4ea61..0000000 --- a/node_modules/eslint/lib/config/rule-validator.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @fileoverview Rule Validator - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const ajvImport = require("../shared/ajv"); -const ajv = ajvImport(); -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); -} - -/** - * The error type when a rule has an invalid `meta.schema`. - */ -class InvalidRuleOptionsSchemaError extends Error { - - /** - * Creates a new instance. - * @param {string} ruleId Id of the rule that has an invalid `meta.schema`. - * @param {Error} processingError Error caught while processing the `meta.schema`. - */ - constructor(ruleId, processingError) { - super( - `Error while processing options validation schema of rule '${ruleId}': ${processingError.message}`, - { cause: processingError } - ); - this.code = "ESLINT_INVALID_RULE_OPTIONS_SCHEMA"; - } -} - -//----------------------------------------------------------------------------- -// 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)) { - try { - const schema = getRuleOptionsSchema(rule); - - if (schema) { - this.validators.set(rule, ajv.compile(schema)); - } - } catch (err) { - throw new InvalidRuleOptionsSchemaError(ruleId, err); - } - } - - const validateRule = this.validators.get(rule); - - if (validateRule) { - - validateRule(ruleOptions.slice(1)); - - if (validateRule.errors) { - throw new Error(`Key "rules": Key "${ruleId}":\n${ - validateRule.errors.map( - error => { - if ( - error.keyword === "additionalProperties" && - error.schema === false && - typeof error.parentSchema?.properties === "object" && - typeof error.params?.additionalProperty === "string" - ) { - const expectedProperties = Object.keys(error.parentSchema.properties).map(property => `"${property}"`); - - return `\tValue ${JSON.stringify(error.data)} ${error.message}.\n\t\tUnexpected property "${error.params.additionalProperty}". Expected properties: ${expectedProperties.join(", ")}.\n`; - } - - return `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`; - } - ).join("") - }`); - } - } - } - } -} - -exports.RuleValidator = RuleValidator; diff --git a/node_modules/eslint/lib/eslint/eslint-helpers.js b/node_modules/eslint/lib/eslint/eslint-helpers.js deleted file mode 100644 index c844510..0000000 --- a/node_modules/eslint/lib/eslint/eslint-helpers.js +++ /dev/null @@ -1,965 +0,0 @@ -/** - * @fileoverview Helper functions for ESLint class - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const path = require("node:path"); -const fs = require("node:fs"); -const fsp = fs.promises; -const isGlob = require("is-glob"); -const hash = require("../cli-engine/hash"); -const minimatch = require("minimatch"); -const globParent = require("glob-parent"); - -//----------------------------------------------------------------------------- -// Fixup references -//----------------------------------------------------------------------------- - -const Minimatch = minimatch.Minimatch; -const MINIMATCH_OPTIONS = { dot: true }; - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** - * @typedef {Object} GlobSearch - * @property {Array} patterns The normalized patterns to use for a search. - * @property {Array} rawPatterns The patterns as entered by the user - * before doing any normalization. - */ - -//----------------------------------------------------------------------------- -// Errors -//----------------------------------------------------------------------------- - -/** - * 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} globEnabled If `false` then the pattern was a glob pattern, but glob was disabled. - */ - constructor(pattern, globEnabled) { - super(`No files matching '${pattern}' were found${!globEnabled ? " (glob was disabled)" : ""}.`); - this.messageTemplate = "file-not-found"; - this.messageData = { pattern, globDisabled: !globEnabled }; - } -} - -/** - * The error type when a search fails to match multiple patterns. - */ -class UnmatchedSearchPatternsError extends Error { - - /** - * @param {Object} options The options for the error. - * @param {string} options.basePath The directory that was searched. - * @param {Array} options.unmatchedPatterns The glob patterns - * which were not found. - * @param {Array} options.patterns The glob patterns that were - * searched. - * @param {Array} options.rawPatterns The raw glob patterns that - * were searched. - */ - constructor({ basePath, unmatchedPatterns, patterns, rawPatterns }) { - super(`No files matching '${rawPatterns}' in '${basePath}' were found.`); - this.basePath = basePath; - this.unmatchedPatterns = unmatchedPatterns; - this.patterns = patterns; - this.rawPatterns = rawPatterns; - } -} - -/** - * 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-matched-files-ignored"; - this.messageData = { pattern }; - } -} - - -//----------------------------------------------------------------------------- -// General Helpers -//----------------------------------------------------------------------------- - -/** - * Check if a given value is a non-empty string or not. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is a non-empty string. - */ -function isNonEmptyString(value) { - return typeof value === "string" && value.trim() !== ""; -} - -/** - * Check if a given value is an array of non-empty strings or not. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is an array of non-empty strings. - */ -function isArrayOfNonEmptyString(value) { - return Array.isArray(value) && value.length && value.every(isNonEmptyString); -} - -/** - * Check if a given value is an empty array or an array of non-empty strings. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is an empty array or an array of non-empty - * strings. - */ -function isEmptyArrayOrArrayOfNonEmptyString(value) { - return Array.isArray(value) && value.every(isNonEmptyString); -} - -//----------------------------------------------------------------------------- -// File-related Helpers -//----------------------------------------------------------------------------- - -/** - * Normalizes slashes in a file pattern to posix-style. - * @param {string} pattern The pattern to replace slashes in. - * @returns {string} The pattern with slashes normalized. - */ -function normalizeToPosix(pattern) { - return pattern.replace(/\\/gu, "/"); -} - -/** - * 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 === "\\" ? normalizeToPosix(pattern) : pattern); -} - - -/** - * Determines if a given glob pattern will return any results. - * Used primarily to help with useful error messages. - * @param {Object} options The options for the function. - * @param {string} options.basePath The directory to search. - * @param {string} options.pattern An absolute path glob pattern to match. - * @returns {Promise} True if there is a glob match, false if not. - */ -async function globMatch({ basePath, pattern }) { - - let found = false; - const { hfs } = await import("@humanfs/node"); - const patternToUse = normalizeToPosix(path.relative(basePath, pattern)); - - const matcher = new Minimatch(patternToUse, MINIMATCH_OPTIONS); - - const walkSettings = { - - directoryFilter(entry) { - return !found && matcher.match(entry.path, true); - }, - - entryFilter(entry) { - if (found || entry.isDirectory) { - return false; - } - - if (matcher.match(entry.path)) { - found = true; - return true; - } - - return false; - } - }; - - if (await hfs.isDirectory(basePath)) { - return hfs.walk(basePath, walkSettings).next().then(() => found); - } - - return found; -} - -/** - * Searches a directory looking for matching glob patterns. This uses - * the config array's logic to determine if a directory or file should - * be ignored, so it is consistent with how ignoring works throughout - * ESLint. - * @param {Object} options The options for this function. - * @param {string} options.basePath The directory to search. - * @param {Array} options.patterns An array of absolute path glob patterns - * to match. - * @param {Array} options.rawPatterns An array of glob patterns - * as the user inputted them. Used for errors. - * @param {ConfigLoader|LegacyConfigLoader} options.configLoader The config array to use for - * determining what to ignore. - * @param {boolean} options.errorOnUnmatchedPattern Determines if an error - * should be thrown when a pattern is unmatched. - * @returns {Promise>} An array of matching file paths - * or an empty array if there are no matches. - * @throws {UnmatchedSearchPatternsError} If there is a pattern that doesn't - * match any files. - */ -async function globSearch({ - basePath, - patterns, - rawPatterns, - configLoader, - errorOnUnmatchedPattern -}) { - - if (patterns.length === 0) { - return []; - } - - /* - * In this section we are converting the patterns into Minimatch - * instances for performance reasons. Because we are doing the same - * matches repeatedly, it's best to compile those patterns once and - * reuse them multiple times. - * - * To do that, we convert any patterns with an absolute path into a - * relative path and normalize it to Posix-style slashes. We also keep - * track of the relative patterns to map them back to the original - * patterns, which we need in order to throw an error if there are any - * unmatched patterns. - */ - const relativeToPatterns = new Map(); - const matchers = patterns.map((pattern, i) => { - const patternToUse = normalizeToPosix(path.relative(basePath, pattern)); - - relativeToPatterns.set(patternToUse, patterns[i]); - - return new Minimatch(patternToUse, MINIMATCH_OPTIONS); - }); - - /* - * We track unmatched patterns because we may want to throw an error when - * they occur. To start, this set is initialized with all of the patterns. - * Every time a match occurs, the pattern is removed from the set, making - * it easy to tell if we have any unmatched patterns left at the end of - * search. - */ - const unmatchedPatterns = new Set([...relativeToPatterns.keys()]); - const { hfs } = await import("@humanfs/node"); - - const walk = hfs.walk( - basePath, - { - async directoryFilter(entry) { - - if (!matchers.some(matcher => matcher.match(entry.path, true))) { - return false; - } - - const absolutePath = path.resolve(basePath, entry.path); - const configs = await configLoader.loadConfigArrayForDirectory(absolutePath); - - return !configs.isDirectoryIgnored(absolutePath); - }, - async entryFilter(entry) { - const absolutePath = path.resolve(basePath, entry.path); - - // entries may be directories or files so filter out directories - if (entry.isDirectory) { - return false; - } - - const configs = await configLoader.loadConfigArrayForFile(absolutePath); - const config = configs.getConfig(absolutePath); - - /* - * Optimization: We need to track when patterns are left unmatched - * and so we use `unmatchedPatterns` to do that. There is a bit of - * complexity here because the same file can be matched by more than - * one pattern. So, when we start, we actually need to test every - * pattern against every file. Once we know there are no remaining - * unmatched patterns, then we can switch to just looking for the - * first matching pattern for improved speed. - */ - const matchesPattern = unmatchedPatterns.size > 0 - ? matchers.reduce((previousValue, matcher) => { - const pathMatches = matcher.match(entry.path); - - /* - * We updated the unmatched patterns set only if the path - * matches and the file has a config. If the file has no - * config, that means there wasn't a match for the - * pattern so it should not be removed. - * - * Performance note: `getConfig()` aggressively caches - * results so there is no performance penalty for calling - * it multiple times with the same argument. - */ - if (pathMatches && config) { - unmatchedPatterns.delete(matcher.pattern); - } - - return pathMatches || previousValue; - }, false) - : matchers.some(matcher => matcher.match(entry.path)); - - return matchesPattern && config !== void 0; - } - } - ); - - const filePaths = []; - - if (await hfs.isDirectory(basePath)) { - for await (const entry of walk) { - filePaths.push(path.resolve(basePath, entry.path)); - } - } - - // now check to see if we have any unmatched patterns - if (errorOnUnmatchedPattern && unmatchedPatterns.size > 0) { - throw new UnmatchedSearchPatternsError({ - basePath, - unmatchedPatterns: [...unmatchedPatterns].map( - pattern => relativeToPatterns.get(pattern) - ), - patterns, - rawPatterns - }); - } - - return filePaths; -} - -/** - * Throws an error for unmatched patterns. The error will only contain information about the first one. - * Checks to see if there are any ignored results for a given search. - * @param {Object} options The options for this function. - * @param {string} options.basePath The directory to search. - * @param {Array} options.patterns An array of glob patterns - * that were used in the original search. - * @param {Array} options.rawPatterns An array of glob patterns - * as the user inputted them. Used for errors. - * @param {Array} options.unmatchedPatterns A non-empty array of absolute path glob patterns - * that were unmatched in the original search. - * @returns {void} Always throws an error. - * @throws {NoFilesFoundError} If the first unmatched pattern - * doesn't match any files even when there are no ignores. - * @throws {AllFilesIgnoredError} If the first unmatched pattern - * matches some files when there are no ignores. - */ -async function throwErrorForUnmatchedPatterns({ - basePath, - patterns, - rawPatterns, - unmatchedPatterns -}) { - - const pattern = unmatchedPatterns[0]; - const rawPattern = rawPatterns[patterns.indexOf(pattern)]; - - const patternHasMatch = await globMatch({ - basePath, - pattern - }); - - if (patternHasMatch) { - throw new AllFilesIgnoredError(rawPattern); - } - - // if we get here there are truly no matches - throw new NoFilesFoundError(rawPattern, true); -} - -/** - * Performs multiple glob searches in parallel. - * @param {Object} options The options for this function. - * @param {Map} options.searches - * A map of absolute path glob patterns to match. - * @param {ConfigLoader|LegacyConfigLoader} options.configLoader The config loader to use for - * determining what to ignore. - * @param {boolean} options.errorOnUnmatchedPattern Determines if an - * unmatched glob pattern should throw an error. - * @returns {Promise>} An array of matching file paths - * or an empty array if there are no matches. - */ -async function globMultiSearch({ searches, configLoader, errorOnUnmatchedPattern }) { - - /* - * For convenience, we normalized the search map into an array of objects. - * Next, we filter out all searches that have no patterns. This happens - * primarily for the cwd, which is prepopulated in the searches map as an - * optimization. However, if it has no patterns, it means all patterns - * occur outside of the cwd and we can safely filter out that search. - */ - const normalizedSearches = [...searches].map( - ([basePath, { patterns, rawPatterns }]) => ({ basePath, patterns, rawPatterns }) - ).filter(({ patterns }) => patterns.length > 0); - - const results = await Promise.allSettled( - normalizedSearches.map( - ({ basePath, patterns, rawPatterns }) => globSearch({ - basePath, - patterns, - rawPatterns, - configLoader, - errorOnUnmatchedPattern - }) - ) - ); - - /* - * The first loop handles errors from the glob searches. Since we can't - * use `await` inside `flatMap`, we process errors separately in this loop. - * This results in two iterations over `results`, but since the length is - * less than or equal to the number of globs and directories passed on the - * command line, the performance impact should be minimal. - */ - for (let i = 0; i < results.length; i++) { - - const result = results[i]; - const currentSearch = normalizedSearches[i]; - - if (result.status === "fulfilled") { - continue; - } - - // if we make it here then there was an error - const error = result.reason; - - // unexpected errors should be re-thrown - if (!error.basePath) { - throw error; - } - - if (errorOnUnmatchedPattern) { - - await throwErrorForUnmatchedPatterns({ - ...currentSearch, - unmatchedPatterns: error.unmatchedPatterns - }); - - } - - } - - // second loop for `fulfulled` results - return results.flatMap(result => result.value); - -} - -/** - * Finds all files matching the options specified. - * @param {Object} args The arguments objects. - * @param {Array} args.patterns An array of glob patterns. - * @param {boolean} args.globInputPaths true to interpret glob patterns, - * false to not interpret glob patterns. - * @param {string} args.cwd The current working directory to find from. - * @param {ConfigLoader|LegacyConfigLoader} args.configLoader The config loeader for the current run. - * @param {boolean} args.errorOnUnmatchedPattern Determines if an unmatched pattern - * should throw an error. - * @returns {Promise>} The fully resolved file paths. - * @throws {AllFilesIgnoredError} If there are no results due to an ignore pattern. - * @throws {NoFilesFoundError} If no files matched the given patterns. - */ -async function findFiles({ - patterns, - globInputPaths, - cwd, - configLoader, - errorOnUnmatchedPattern -}) { - - const results = []; - const missingPatterns = []; - let globbyPatterns = []; - let rawPatterns = []; - const searches = new Map([[cwd, { patterns: globbyPatterns, rawPatterns: [] }]]); - - /* - * This part is a bit involved because we need to account for - * the different ways that the patterns can match directories. - * For each different way, we need to decide if we should look - * for a config file or just use the default config. (Directories - * without a config file always use the default config.) - * - * Here are the cases: - * - * 1. A directory is passed directly (e.g., "subdir"). In this case, we - * can assume that the user intends to lint this directory and we should - * not look for a config file in the parent directory, because the only - * reason to do that would be to ignore this directory (which we already - * know we don't want to do). Instead, we use the default config until we - * get to the directory that was passed, at which point we start looking - * for config files again. - * - * 2. A dot (".") or star ("*"). In this case, we want to read - * the config file in the current directory because the user is - * explicitly asking to lint the current directory. Note that "." - * will traverse into subdirectories while "*" will not. - * - * 3. A directory is passed in the form of "subdir/subsubdir". - * In this case, we don't want to look for a config file in the - * parent directory ("subdir"). We can skip looking for a config - * file until `entry.depth` is greater than 1 because there's no - * way that the pattern can match `entry.path` yet. - * - * 4. A directory glob pattern is passed (e.g., "subd*"). We want - * this case to act like case 2 because it's unclear whether or not - * any particular directory is meant to be traversed. - * - * 5. A recursive glob pattern is passed (e.g., "**"). We want this - * case to act like case 2. - */ - - // check to see if we have explicit files and directories - const filePaths = patterns.map(filePath => path.resolve(cwd, filePath)); - const stats = await Promise.all( - filePaths.map( - filePath => fsp.stat(filePath).catch(() => { }) - ) - ); - - stats.forEach((stat, index) => { - - const filePath = filePaths[index]; - const pattern = normalizeToPosix(patterns[index]); - - if (stat) { - - // files are added directly to the list - if (stat.isFile()) { - results.push(filePath); - } - - // directories need extensions attached - if (stat.isDirectory()) { - - if (!searches.has(filePath)) { - searches.set(filePath, { patterns: [], rawPatterns: [] }); - } - ({ patterns: globbyPatterns, rawPatterns } = searches.get(filePath)); - - globbyPatterns.push(`${normalizeToPosix(filePath)}/**`); - rawPatterns.push(pattern); - } - - return; - } - - // save patterns for later use based on whether globs are enabled - if (globInputPaths && isGlobPattern(pattern)) { - - /* - * We are grouping patterns by their glob parent. This is done to - * make it easier to determine when a config file should be loaded. - */ - - const basePath = path.resolve(cwd, globParent(pattern)); - - if (!searches.has(basePath)) { - searches.set(basePath, { patterns: [], rawPatterns: [] }); - } - ({ patterns: globbyPatterns, rawPatterns } = searches.get(basePath)); - - globbyPatterns.push(filePath); - rawPatterns.push(pattern); - } else { - missingPatterns.push(pattern); - } - }); - - // there were patterns that didn't match anything, tell the user - if (errorOnUnmatchedPattern && missingPatterns.length) { - throw new NoFilesFoundError(missingPatterns[0], globInputPaths); - } - - // now we are safe to do the search - const globbyResults = await globMultiSearch({ - searches, - configLoader, - errorOnUnmatchedPattern - }); - - return [ - ...new Set([ - ...results, - ...globbyResults - ]) - ]; -} - -//----------------------------------------------------------------------------- -// Results-related Helpers -//----------------------------------------------------------------------------- - -/** - * 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; -} - -/** - * Returns result with warning by ignore settings - * @param {string} filePath Absolute file path of checked code - * @param {string} baseDir Absolute path of base directory - * @param {"ignored"|"external"|"unconfigured"} configStatus A status that determines why the file is ignored - * @returns {LintResult} Result with single warning - * @private - */ -function createIgnoreResult(filePath, baseDir, configStatus) { - let message; - - switch (configStatus) { - case "external": - message = "File ignored because outside of base path."; - break; - case "unconfigured": - message = "File ignored because no matching configuration was supplied."; - break; - default: - { - const isInNodeModules = baseDir && path.dirname(path.relative(baseDir, filePath)).split(path.sep).includes("node_modules"); - - if (isInNodeModules) { - message = "File ignored by default because it is located under the node_modules directory. Use ignore pattern \"!**/node_modules/\" to disable file ignore settings or use \"--no-warn-ignored\" to suppress this warning."; - } else { - message = "File ignored because of a matching ignore pattern. Use \"--no-ignore\" to disable file ignore settings or use \"--no-warn-ignored\" to suppress this warning."; - } - } - break; - } - - return { - filePath, - messages: [ - { - ruleId: null, - fatal: false, - severity: 1, - message, - nodeType: null - } - ], - suppressedMessages: [], - errorCount: 0, - warningCount: 1, - fatalErrorCount: 0, - fixableErrorCount: 0, - fixableWarningCount: 0 - }; -} - -//----------------------------------------------------------------------------- -// Options-related Helpers -//----------------------------------------------------------------------------- - - -/** - * 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, - 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. - flags = [], - globInputPaths = true, - ignore = true, - ignorePatterns = null, - overrideConfig = null, - overrideConfigFile = null, - plugins = {}, - stats = false, - warnIgnored = true, - passOnNoPatterns = false, - ruleFilter = () => 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."); - } - if (unknownOptionKeys.includes("extensions")) { - errors.push("'extensions' has been removed."); - } - if (unknownOptionKeys.includes("resolvePluginsRelativeTo")) { - errors.push("'resolvePluginsRelativeTo' has been removed."); - } - if (unknownOptionKeys.includes("globals")) { - errors.push("'globals' has been removed. Please use the 'overrideConfig.languageOptions.globals' option instead."); - } - if (unknownOptionKeys.includes("ignorePath")) { - errors.push("'ignorePath' has been removed."); - } - 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.languageOptions.parser' option instead."); - } - if (unknownOptionKeys.includes("parserOptions")) { - errors.push("'parserOptions' has been removed. Please use the 'overrideConfig.languageOptions.parserOptions' option instead."); - } - if (unknownOptionKeys.includes("rules")) { - errors.push("'rules' has been removed. Please use the 'overrideConfig.rules' option instead."); - } - if (unknownOptionKeys.includes("rulePaths")) { - errors.push("'rulePaths' has been removed. Please define your rules using plugins."); - } - if (unknownOptionKeys.includes("reportUnusedDisableDirectives")) { - errors.push("'reportUnusedDisableDirectives' has been removed. Please use the 'overrideConfig.linterOptions.reportUnusedDisableDirectives' 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 (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 (!isEmptyArrayOrArrayOfNonEmptyString(flags)) { - errors.push("'flags' must be an array of non-empty strings."); - } - if (typeof globInputPaths !== "boolean") { - errors.push("'globInputPaths' must be a boolean."); - } - if (typeof ignore !== "boolean") { - errors.push("'ignore' must be a boolean."); - } - if (!isEmptyArrayOrArrayOfNonEmptyString(ignorePatterns) && ignorePatterns !== null) { - errors.push("'ignorePatterns' must be an array of non-empty strings or null."); - } - if (typeof overrideConfig !== "object") { - errors.push("'overrideConfig' must be an object or null."); - } - if (!isNonEmptyString(overrideConfigFile) && overrideConfigFile !== null && overrideConfigFile !== true) { - errors.push("'overrideConfigFile' must be a non-empty string, null, or true."); - } - if (typeof passOnNoPatterns !== "boolean") { - errors.push("'passOnNoPatterns' must be a boolean."); - } - 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 (typeof stats !== "boolean") { - errors.push("'stats' must be a boolean."); - } - if (typeof warnIgnored !== "boolean") { - errors.push("'warnIgnored' must be a boolean."); - } - if (typeof ruleFilter !== "function") { - errors.push("'ruleFilter' must be a function."); - } - if (errors.length > 0) { - throw new ESLintInvalidOptionsError(errors); - } - - return { - allowInlineConfig, - baseConfig, - cache, - cacheLocation, - cacheStrategy, - - // when overrideConfigFile is true that means don't do config file lookup - configFile: overrideConfigFile === true ? false : overrideConfigFile, - overrideConfig, - cwd: path.normalize(cwd), - errorOnUnmatchedPattern, - fix, - fixTypes, - flags: [...flags], - globInputPaths, - ignore, - ignorePatterns, - stats, - passOnNoPatterns, - warnIgnored, - ruleFilter - }; -} - - -//----------------------------------------------------------------------------- -// Cache-related helpers -//----------------------------------------------------------------------------- - -/** - * 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 in 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; -} - - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = { - findFiles, - - isNonEmptyString, - isArrayOfNonEmptyString, - - createIgnoreResult, - isErrorMessage, - - processOptions, - - getCacheFile -}; diff --git a/node_modules/eslint/lib/eslint/eslint.js b/node_modules/eslint/lib/eslint/eslint.js deleted file mode 100644 index c91a376..0000000 --- a/node_modules/eslint/lib/eslint/eslint.js +++ /dev/null @@ -1,1121 +0,0 @@ -/** - * @fileoverview Main class using flat config - * @author Nicholas C. Zakas - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const fs = require("node:fs/promises"); -const { existsSync } = require("node:fs"); -const path = require("node:path"); -const { version } = require("../../package.json"); -const { Linter } = require("../linter"); -const { getRuleFromConfig } = require("../config/flat-config-helpers"); -const { defaultConfig } = require("../config/default-config"); -const { - Legacy: { - ConfigOps: { - getRuleSeverity - }, - ModuleResolver, - naming - } -} = require("@eslint/eslintrc"); - -const { - findFiles, - getCacheFile, - - isNonEmptyString, - isArrayOfNonEmptyString, - - createIgnoreResult, - isErrorMessage, - - processOptions -} = require("./eslint-helpers"); -const { pathToFileURL } = require("node:url"); -const LintResultCache = require("../cli-engine/lint-result-cache"); -const { Retrier } = require("@humanwhocodes/retry"); -const { ConfigLoader, LegacyConfigLoader } = require("../config/config-loader"); - -/* - * This is necessary to allow overwriting writeFile for testing purposes. - * We can just use fs/promises once we drop Node.js 12 support. - */ - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -// For VSCode IntelliSense -/** @typedef {import("../cli-engine/cli-engine").ConfigArray} ConfigArray */ -/** @typedef {import("../shared/types").ConfigData} ConfigData */ -/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */ -/** @typedef {import("../shared/types").LintMessage} LintMessage */ -/** @typedef {import("../shared/types").LintResult} LintResult */ -/** @typedef {import("../shared/types").ParserOptions} ParserOptions */ -/** @typedef {import("../shared/types").Plugin} Plugin */ -/** @typedef {import("../shared/types").ResultsMeta} ResultsMeta */ -/** @typedef {import("../shared/types").RuleConf} RuleConf */ -/** @typedef {import("../shared/types").Rule} Rule */ -/** @typedef {ReturnType} ExtractedConfig */ -/** @typedef {import('../cli-engine/cli-engine').CLIEngine} CLIEngine */ -/** @typedef {import('./legacy-eslint').CLIEngineLintReport} CLIEngineLintReport */ - -/** - * The options with which to configure the ESLint instance. - * @typedef {Object} ESLintOptions - * @property {boolean} [allowInlineConfig] Enable or disable inline configuration comments. - * @property {ConfigData|Array} [baseConfig] Base config, 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 {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[]} [flags] Array of feature flags to enable. - * @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 all ignore patterns except for the default ones. - * @property {string[]} [ignorePatterns] Ignore file patterns to use in addition to config ignores. These patterns are relative to `cwd`. - * @property {ConfigData|Array} [overrideConfig] Override config, overrides all configs used with this instance - * @property {boolean|string} [overrideConfigFile] Searches for default config file when falsy; - * doesn't do any config file lookup when `true`; considered to be a config filename - * when a string. - * @property {Record} [plugins] An array of plugin implementations. - * @property {boolean} [stats] True enables added statistics on lint results. - * @property {boolean} [warnIgnored] Show warnings when the file list includes ignored files - * @property {boolean} [passOnNoPatterns=false] When set to true, missing patterns cause - * the linting operation to short circuit and not report any failures. - */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const debug = require("debug")("eslint:eslint"); -const privateMembers = new WeakMap(); -const removedFormatters = new Set([ - "checkstyle", - "codeframe", - "compact", - "jslint-xml", - "junit", - "table", - "tap", - "unix", - "visualstudio" -]); - -/** - * 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) { - const stat = { - errorCount: 0, - fatalErrorCount: 0, - warningCount: 0, - fixableErrorCount: 0, - fixableWarningCount: 0 - }; - - for (let i = 0; i < messages.length; i++) { - const message = messages[i]; - - 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; -} - -/** - * 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; - }, {}); -} - -/** - * Return the absolute path of a file named `"__placeholder__.js"` in a given directory. - * This is used as a replacement for a missing file path. - * @param {string} cwd An absolute directory path. - * @returns {string} The absolute path of a file named `"__placeholder__.js"` in the given directory. - */ -function getPlaceholderPath(cwd) { - return path.join(cwd, "__placeholder__.js"); -} - -/** @type {WeakMap} */ -const usedDeprecatedRulesCache = new WeakMap(); - -/** - * Create used deprecated rule list. - * @param {CLIEngine} eslint The CLIEngine instance. - * @param {string} maybeFilePath The absolute path to a lint target file or `""`. - * @returns {DeprecatedRuleInfo[]} The used deprecated rule list. - */ -function getOrFindUsedDeprecatedRules(eslint, maybeFilePath) { - const { - options: { cwd }, - configLoader - } = privateMembers.get(eslint); - const filePath = path.isAbsolute(maybeFilePath) - ? maybeFilePath - : getPlaceholderPath(cwd); - const configs = configLoader.getCachedConfigArrayForFile(filePath); - const config = configs.getConfig(filePath); - - // Most files use the same config, so cache it. - if (config && !usedDeprecatedRulesCache.has(config)) { - const retv = []; - - if (config.rules) { - for (const [ruleId, ruleConf] of Object.entries(config.rules)) { - if (getRuleSeverity(ruleConf) === 0) { - continue; - } - const rule = getRuleFromConfig(ruleId, config); - const meta = rule && rule.meta; - - if (meta && meta.deprecated) { - retv.push({ ruleId, replacedBy: meta.replacedBy || [] }); - } - } - } - - - usedDeprecatedRulesCache.set(config, Object.freeze(retv)); - } - - return config ? usedDeprecatedRulesCache.get(config) : Object.freeze([]); -} - -/** - * Processes the linting results generated by a CLIEngine linting report to - * match the ESLint class's API. - * @param {CLIEngine} eslint The CLIEngine instance. - * @param {CLIEngineLintReport} report The CLIEngine linting report to process. - * @returns {LintResult[]} The processed linting results. - */ -function processLintReport(eslint, { results }) { - const descriptor = { - configurable: true, - enumerable: true, - get() { - return getOrFindUsedDeprecatedRules(eslint, 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; -} - - -/** - * Determines which config file to use. This is determined by seeing if an - * override config file was passed, and if so, using it; otherwise, as long - * as override config file is not explicitly set to `false`, it will search - * upwards from the cwd for a file named `eslint.config.js`. - * - * This function is used primarily by the `--inspect-config` option. For now, - * we will maintain the existing behavior, which is to search up from the cwd. - * @param {ESLintOptions} options The ESLint instance options. - * @param {boolean} allowTS `true` if the `unstable_ts_config` flag is enabled, `false` if it's not. - * @returns {Promise<{configFilePath:string|undefined;basePath:string}>} Location information for - * the config file. - */ -async function locateConfigFileToUse({ configFile, cwd }, allowTS) { - - const configLoader = new ConfigLoader({ - cwd, - allowTS, - configFile - }); - - const configFilePath = await configLoader.findConfigFileForPath(path.join(cwd, "__placeholder__.js")); - - if (!configFilePath) { - throw new Error("No ESLint configuration file was found."); - } - - return { - configFilePath, - basePath: configFile ? cwd : path.dirname(configFilePath) - }; -} - -/** - * 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 {FlatConfigArray} config.configs The config. - * @param {boolean} config.fix If `true` then it does fix. - * @param {boolean} config.allowInlineConfig If `true` then it uses directive comments. - * @param {Function} config.ruleFilter A predicate function to filter which rules should be run. - * @param {boolean} config.stats If `true`, then if reports extra statistics with the lint results. - * @param {Linter} config.linter The linter instance to verify. - * @returns {LintResult} The result of linting. - * @private - */ -function verifyText({ - text, - cwd, - filePath: providedFilePath, - configs, - fix, - allowInlineConfig, - ruleFilter, - stats, - 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 === "" ? getPlaceholderPath(cwd) : filePath; - const { fixed, messages, output } = linter.verifyAndFix( - text, - configs, - { - allowInlineConfig, - filename: filePathToVerify, - fix, - ruleFilter, - stats, - - /** - * 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 configs.getConfig(blockFilename) !== void 0; - } - } - ); - - // Tweak and return. - const result = { - filePath: filePath === "" ? filePath : path.resolve(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; - } - - if (stats) { - result.stats = { - times: linter.getTimes(), - fixPasses: linter.getFixPassCount() - }; - } - - return result; -} - -/** - * Checks whether a message's rule type should be fixed. - * @param {LintMessage} message The message to check. - * @param {FlatConfig} config The config for the file that generated the message. - * @param {string[]} fixTypes An array of fix types to check. - * @returns {boolean} Whether the message should be fixed. - */ -function shouldMessageBeFixed(message, config, fixTypes) { - if (!message.ruleId) { - return fixTypes.has("directive"); - } - - const rule = message.ruleId && getRuleFromConfig(message.ruleId, config); - - return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type)); -} - -/** - * Creates an error to be thrown when an array of results passed to `getRulesMetaForResults` was not created by the current engine. - * @returns {TypeError} An error object. - */ -function createExtraneousResultsError() { - return new TypeError("Results object was not created from this ESLint instance."); -} - -/** - * Creates a fixer function based on the provided fix, fixTypesSet, and config. - * @param {Function|boolean} fix The original fix option. - * @param {Set} fixTypesSet A set of fix types to filter messages for fixing. - * @param {FlatConfig} config The config for the file that generated the message. - * @returns {Function|boolean} The fixer function or the original fix value. - */ -function getFixerForFixTypes(fix, fixTypesSet, config) { - if (!fix || !fixTypesSet) { - return fix; - } - - const originalFix = (typeof fix === "function") ? fix : () => true; - - return message => shouldMessageBeFixed(message, config, fixTypesSet) && originalFix(message); -} - -//----------------------------------------------------------------------------- -// Main API -//----------------------------------------------------------------------------- - -/** - * Primary Node.js API for ESLint. - */ -class ESLint { - - /** - * The type of configuration used by this class. - * @type {string} - */ - static configType = "flat"; - - /** - * The loader to use for finding config files. - * @type {ConfigLoader|LegacyConfigLoader} - */ - #configLoader; - - /** - * Creates a new instance of the main ESLint API. - * @param {ESLintOptions} options The options for this instance. - */ - constructor(options = {}) { - - const defaultConfigs = []; - const processedOptions = processOptions(options); - const linter = new Linter({ - cwd: processedOptions.cwd, - configType: "flat", - flags: processedOptions.flags - }); - - const cacheFilePath = getCacheFile( - processedOptions.cacheLocation, - processedOptions.cwd - ); - - const lintResultCache = processedOptions.cache - ? new LintResultCache(cacheFilePath, processedOptions.cacheStrategy) - : null; - - const configLoaderOptions = { - cwd: processedOptions.cwd, - baseConfig: processedOptions.baseConfig, - overrideConfig: processedOptions.overrideConfig, - configFile: processedOptions.configFile, - ignoreEnabled: processedOptions.ignore, - ignorePatterns: processedOptions.ignorePatterns, - defaultConfigs, - allowTS: processedOptions.flags.includes("unstable_ts_config") - }; - - this.#configLoader = processedOptions.flags.includes("unstable_config_lookup_from_file") - ? new ConfigLoader(configLoaderOptions) - : new LegacyConfigLoader(configLoaderOptions); - - debug(`Using config loader ${this.#configLoader.constructor.name}`); - - privateMembers.set(this, { - options: processedOptions, - linter, - cacheFilePath, - lintResultCache, - defaultConfigs, - configs: null, - configLoader: this.#configLoader - }); - - - /** - * If additional plugins are passed in, add that to the default - * configs for this instance. - */ - if (options.plugins) { - - const plugins = {}; - - for (const [pluginName, plugin] of Object.entries(options.plugins)) { - plugins[naming.getShorthandName(pluginName, "eslint-plugin")] = plugin; - } - - defaultConfigs.push({ - plugins - }); - } - - // Check for the .eslintignore file, and warn if it's present. - if (existsSync(path.resolve(processedOptions.cwd, ".eslintignore"))) { - process.emitWarning( - "The \".eslintignore\" file is no longer supported. Switch to using the \"ignores\" property in \"eslint.config.js\": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files", - "ESLintIgnoreWarning" - ); - } - } - - /** - * The version text. - * @type {string} - */ - static get version() { - return version; - } - - /** - * The default configuration that ESLint uses internally. This is provided for tooling that wants to calculate configurations using the same defaults as ESLint. - * Keep in mind that the default configuration may change from version to version, so you shouldn't rely on any particular keys or values to be present. - * @type {ConfigArray} - */ - static get defaultConfig() { - return defaultConfig; - } - - /** - * 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 => fs.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) { - 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; - } - - /** - * 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. - * @throws {TypeError} When the results object wasn't created from this ESLint instance. - * @throws {TypeError} When a plugin or rule is missing. - */ - getRulesMetaForResults(results) { - - // short-circuit simple case - if (results.length === 0) { - return {}; - } - - const resultRules = new Map(); - const { - configLoader, - options: { cwd } - } = privateMembers.get(this); - - for (const result of results) { - - /* - * Normalize filename for . - */ - const filePath = result.filePath === "" - ? getPlaceholderPath(cwd) : result.filePath; - const allMessages = result.messages.concat(result.suppressedMessages); - - for (const { ruleId } of allMessages) { - if (!ruleId) { - continue; - } - - /* - * All of the plugin and rule information is contained within the - * calculated config for the given file. - */ - let configs; - - try { - configs = configLoader.getCachedConfigArrayForFile(filePath); - } catch { - throw createExtraneousResultsError(); - } - - const config = configs.getConfig(filePath); - - if (!config) { - throw createExtraneousResultsError(); - } - const rule = getRuleFromConfig(ruleId, config); - - // ignore unknown rules - if (rule) { - resultRules.set(ruleId, rule); - } - } - } - - return createRulesMeta(resultRules); - } - - /** - * Indicates if the given feature flag is enabled for this instance. - * @param {string} flag The feature flag to check. - * @returns {boolean} `true` if the feature flag is enabled, `false` if not. - */ - hasFlag(flag) { - - // note: Linter does validation of the flags - return privateMembers.get(this).linter.hasFlag(flag); - } - - /** - * Executes the current configuration on an array of file and directory names. - * @param {string|string[]} patterns An array of file and directory names. - * @returns {Promise} The results of linting the file patterns given. - */ - async lintFiles(patterns) { - - let normalizedPatterns = patterns; - const { - cacheFilePath, - lintResultCache, - linter, - options: eslintOptions - } = privateMembers.get(this); - - /* - * Special cases: - * 1. `patterns` is an empty string - * 2. `patterns` is an empty array - * - * In both cases, we use the cwd as the directory to lint. - */ - if (patterns === "" || Array.isArray(patterns) && patterns.length === 0) { - - /* - * Special case: If `passOnNoPatterns` is true, then we just exit - * without doing any work. - */ - if (eslintOptions.passOnNoPatterns) { - return []; - } - - normalizedPatterns = ["."]; - } else { - - if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) { - throw new Error("'patterns' must be a non-empty string or an array of non-empty strings"); - } - - if (typeof patterns === "string") { - normalizedPatterns = [patterns]; - } - } - - debug(`Using file patterns: ${normalizedPatterns}`); - - const { - allowInlineConfig, - cache, - cwd, - fix, - fixTypes, - ruleFilter, - stats, - globInputPaths, - errorOnUnmatchedPattern, - warnIgnored - } = eslintOptions; - const startTime = Date.now(); - const fixTypesSet = fixTypes ? new Set(fixTypes) : null; - - // Delete cache file; should this be done here? - if (!cache && cacheFilePath) { - debug(`Deleting cache file at ${cacheFilePath}`); - - try { - await fs.unlink(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" && !existsSync(cacheFilePath))) { - throw error; - } - } - } - - const filePaths = await findFiles({ - patterns: normalizedPatterns, - cwd, - globInputPaths, - configLoader: this.#configLoader, - errorOnUnmatchedPattern - }); - const controller = new AbortController(); - const retryCodes = new Set(["ENFILE", "EMFILE"]); - const retrier = new Retrier(error => retryCodes.has(error.code), { concurrency: 100 }); - - debug(`${filePaths.length} files found in: ${Date.now() - startTime}ms`); - - /* - * Because we need to process multiple files, including reading from disk, - * it is most efficient to start by reading each file via promises so that - * they can be done in parallel. Then, we can lint the returned text. This - * ensures we are waiting the minimum amount of time in between lints. - */ - const results = await Promise.all( - - filePaths.map(async filePath => { - - const configs = await this.#configLoader.loadConfigArrayForFile(filePath); - const config = configs.getConfig(filePath); - - /* - * If a filename was entered that cannot be matched - * to a config, then notify the user. - */ - if (!config) { - if (warnIgnored) { - const configStatus = configs.getConfigStatus(filePath); - - return createIgnoreResult(filePath, cwd, configStatus); - } - - return void 0; - } - - // 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}`); - return cachedResult; - } - } - } - - - // set up fixer for fixTypes if necessary - const fixer = getFixerForFixTypes(fix, fixTypesSet, config); - - return retrier.retry(() => fs.readFile(filePath, { encoding: "utf8", signal: controller.signal }) - .then(text => { - - // fail immediately if an error occurred in another file - controller.signal.throwIfAborted(); - - // do the linting - const result = verifyText({ - text, - filePath, - configs, - cwd, - fix: fixer, - allowInlineConfig, - ruleFilter, - stats, - linter - }); - - /* - * 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); - } - - return result; - }), { signal: controller.signal }) - .catch(error => { - controller.abort(error); - throw error; - }); - }) - ); - - // Persist the cache to disk. - if (lintResultCache) { - lintResultCache.reconcile(); - } - - const finalResults = results.filter(result => !!result); - - return processLintReport(this, { - results: finalResults - }); - } - - /** - * 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 = {}) { - - // Parameter validation - - 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"); - } - - // Options validation - - const { - filePath, - warnIgnored, - ...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" && typeof warnIgnored !== "undefined") { - throw new Error("'options.warnIgnored' must be a boolean or undefined"); - } - - // Now we can get down to linting - - const { - linter, - options: eslintOptions - } = privateMembers.get(this); - const { - allowInlineConfig, - cwd, - fix, - fixTypes, - warnIgnored: constructorWarnIgnored, - ruleFilter, - stats - } = eslintOptions; - const results = []; - const startTime = Date.now(); - const fixTypesSet = fixTypes ? new Set(fixTypes) : null; - const resolvedFilename = path.resolve(cwd, filePath || "__placeholder__.js"); - const configs = await this.#configLoader.loadConfigArrayForFile(resolvedFilename); - const configStatus = configs?.getConfigStatus(resolvedFilename) ?? "unconfigured"; - - // Clear the last used config arrays. - if (resolvedFilename && configStatus !== "matched") { - const shouldWarnIgnored = typeof warnIgnored === "boolean" ? warnIgnored : constructorWarnIgnored; - - if (shouldWarnIgnored) { - results.push(createIgnoreResult(resolvedFilename, cwd, configStatus)); - } - } else { - - const config = configs.getConfig(resolvedFilename); - const fixer = getFixerForFixTypes(fix, fixTypesSet, config); - - // Do lint. - results.push(verifyText({ - text: code, - filePath: resolvedFilename.endsWith("__placeholder__.js") ? "" : resolvedFilename, - configs, - cwd, - fix: fixer, - allowInlineConfig, - ruleFilter, - stats, - linter - })); - } - - debug(`Linting complete in: ${Date.now() - startTime}ms`); - - return processLintReport(this, { - results - }); - - } - - /** - * 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"); - } - - // replace \ with / for Windows compatibility - const normalizedFormatName = name.replace(/\\/gu, "/"); - const namespace = naming.getNamespaceFromTerm(normalizedFormatName); - - // grab our options - const { cwd } = privateMembers.get(this).options; - - - 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"); - - // TODO: This is pretty dirty...would be nice to clean up at some point. - formatterPath = ModuleResolver.resolve(npmFormat, getPlaceholderPath(cwd)); - } catch { - formatterPath = path.resolve(__dirname, "../", "cli-engine", "formatters", `${normalizedFormatName}.js`); - } - } - - let formatter; - - try { - formatter = (await import(pathToFileURL(formatterPath))).default; - } catch (ex) { - - // check for formatters that have been removed - if (removedFormatters.has(name)) { - ex.message = `The ${name} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${name}\``; - } else { - ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`; - } - - throw ex; - } - - - if (typeof formatter !== "function") { - throw new TypeError(`Formatter must be a function, but got a ${typeof formatter}.`); - } - - const eslint = this; - - return { - - /** - * The main formatter method. - * @param {LintResult[]} results The lint results to format. - * @param {ResultsMeta} resultsMeta Warning count and max threshold. - * @returns {string} The formatted lint results. - */ - format(results, resultsMeta) { - let rulesMeta = null; - - results.sort(compareResultsByFilePath); - - return formatter(results, { - ...resultsMeta, - cwd, - get rulesMeta() { - if (!rulesMeta) { - rulesMeta = eslint.getRulesMetaForResults(results); - } - - 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 - * or `undefined` if there is no configuration data for the object. - */ - async calculateConfigForFile(filePath) { - if (!isNonEmptyString(filePath)) { - throw new Error("'filePath' must be a non-empty string"); - } - const options = privateMembers.get(this).options; - const absolutePath = path.resolve(options.cwd, filePath); - const configs = await this.#configLoader.loadConfigArrayForFile(absolutePath); - - if (!configs) { - const error = new Error("Could not find config file."); - - error.messageTemplate = "config-file-missing"; - throw error; - } - - return configs.getConfig(absolutePath); - } - - /** - * Finds the config file being used by this instance based on the options - * passed to the constructor. - * @param {string} [filePath] The path of the file to find the config file for. - * @returns {Promise} The path to the config file being used or - * `undefined` if no config file is being used. - */ - findConfigFile(filePath) { - const options = privateMembers.get(this).options; - - /* - * Because the new config lookup scheme skips the current directory - * and looks into the parent directories, we need to use a placeholder - * directory to ensure the file in cwd is checked. - */ - const fakeCwd = path.join(options.cwd, "__placeholder__"); - - return this.#configLoader.findConfigFileForPath(filePath ?? fakeCwd) - .catch(() => void 0); - } - - /** - * 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) { - const config = await this.calculateConfigForFile(filePath); - - return config === void 0; - } -} - -/** - * Returns whether flat config should be used. - * @returns {Promise} Whether flat config should be used. - */ -async function shouldUseFlatConfig() { - return (process.env.ESLINT_USE_FLAT_CONFIG !== "false"); -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - ESLint, - shouldUseFlatConfig, - locateConfigFileToUse -}; diff --git a/node_modules/eslint/lib/eslint/index.js b/node_modules/eslint/lib/eslint/index.js deleted file mode 100644 index b7c52a4..0000000 --- a/node_modules/eslint/lib/eslint/index.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; - -const { ESLint } = require("./eslint"); -const { LegacyESLint } = require("./legacy-eslint"); - -module.exports = { - ESLint, - LegacyESLint -}; diff --git a/node_modules/eslint/lib/eslint/legacy-eslint.js b/node_modules/eslint/lib/eslint/legacy-eslint.js deleted file mode 100644 index f282e58..0000000 --- a/node_modules/eslint/lib/eslint/legacy-eslint.js +++ /dev/null @@ -1,742 +0,0 @@ -/** - * @fileoverview Main API Class - * @author Kai Cataldo - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const path = require("node:path"); -const fs = require("node:fs"); -const { promisify } = require("node: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 */ -/** @typedef {import("../shared/types").ResultsMeta} ResultsMeta */ - -/** - * The main formatter object. - * @typedef LoadedFormatter - * @property {(results: LintResult[], resultsMeta: ResultsMeta) => string | Promise} format format function. - */ - -/** - * The options with which to configure the LegacyESLint instance. - * @typedef {Object} LegacyESLintOptions - * @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. - * @property {boolean} [passOnNoPatterns=false] When set to true, missing patterns cause - * the linting operation to short circuit and not report any failures. - */ - -/** - * 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 {LegacyESLintOptions} 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} value The value to check. - * @returns {boolean} `true` if `value` is a non-empty string. - */ -function isNonEmptyString(value) { - return typeof value === "string" && value.trim() !== ""; -} - -/** - * Check if a given value is an array of non-empty strings or not. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is an array of non-empty strings. - */ -function isArrayOfNonEmptyString(value) { - return Array.isArray(value) && value.length && value.every(isNonEmptyString); -} - -/** - * Check if a given value is an empty array or an array of non-empty strings. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is an empty array or an array of non-empty - * strings. - */ -function isEmptyArrayOrArrayOfNonEmptyString(value) { - return Array.isArray(value) && value.every(isNonEmptyString); -} - -/** - * Check if a given value is a valid fix type or not. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is valid fix type. - */ -function isFixType(value) { - return value === "directive" || value === "problem" || value === "suggestion" || value === "layout"; -} - -/** - * Check if a given value is an array of fix types or not. - * @param {any} value The value to check. - * @returns {boolean} `true` if `value` is an array of fix types. - */ -function isFixTypeArray(value) { - return Array.isArray(value) && value.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 {LegacyESLintOptions} options The options to process. - * @throws {ESLintInvalidOptionsError} If of any of a variety of type errors. - * @returns {LegacyESLintOptions} 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. - flags, /* eslint-disable-line no-unused-vars -- leaving for compatibility with ESLint#hasFlag */ - 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, - passOnNoPatterns = false, - ...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 (!isEmptyArrayOrArrayOfNonEmptyString(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 (!isEmptyArrayOrArrayOfNonEmptyString(rulePaths)) { - errors.push("'rulePaths' must be an array of non-empty strings."); - } - if (typeof useEslintrc !== "boolean") { - errors.push("'useEslintrc' must be a boolean."); - } - if (typeof passOnNoPatterns !== "boolean") { - errors.push("'passOnNoPatterns' must be a boolean."); - } - - if (errors.length > 0) { - throw new ESLintInvalidOptionsError(errors); - } - - return { - allowInlineConfig, - baseConfig, - cache, - cacheLocation, - cacheStrategy, - configFile: overrideConfigFile, - cwd: path.normalize(cwd), - errorOnUnmatchedPattern, - extensions, - fix, - fixTypes, - flags: [], // LegacyESLint does not support flags, so just ignore them. - globInputPaths, - ignore, - ignorePath, - reportUnusedDisableDirectives, - resolvePluginsRelativeTo, - rulePaths, - useEslintrc, - passOnNoPatterns - }; -} - -/** - * 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 LegacyESLint { - - /** - * The type of configuration used by this class. - * @type {string} - */ - static configType = "eslintrc"; - - /** - * Creates a new instance of the main ESLint API. - * @param {LegacyESLintOptions} 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); - - } - - /* eslint-disable no-unused-vars, class-methods-use-this -- leaving for compatibility with ESLint#hasFlag */ - /** - * Indicates if the given feature flag is enabled for this instance. For this - * class, this always returns `false` because it does not support feature flags. - * @param {string} flag The feature flag to check. - * @returns {boolean} Always false. - */ - hasFlag(flag) { - return false; - } - /* eslint-enable no-unused-vars, class-methods-use-this -- reenable rules for the rest of the file */ - - /** - * 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) { - const { cliEngine, options } = privateMembersMap.get(this); - - if (options.passOnNoPatterns && (patterns === "" || (Array.isArray(patterns) && patterns.length === 0))) { - return []; - } - - if (!isNonEmptyString(patterns) && !isArrayOfNonEmptyString(patterns)) { - throw new Error("'patterns' must be a non-empty string or an array of non-empty strings"); - } - - 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. - * @param {ResultsMeta} resultsMeta Warning count and max threshold. - * @returns {string | Promise} The formatted lint results. - */ - format(results, resultsMeta) { - let rulesMeta = null; - - results.sort(compareResultsByFilePath); - - return formatter(results, { - ...resultsMeta, - 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 = { - LegacyESLint, - - /** - * 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/languages/js/index.js b/node_modules/eslint/lib/languages/js/index.js deleted file mode 100644 index 98d72a5..0000000 --- a/node_modules/eslint/lib/languages/js/index.js +++ /dev/null @@ -1,336 +0,0 @@ -/** - * @fileoverview JavaScript Language Object - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const { SourceCode } = require("./source-code"); -const createDebug = require("debug"); -const astUtils = require("../../shared/ast-utils"); -const espree = require("espree"); -const eslintScope = require("eslint-scope"); -const evk = require("eslint-visitor-keys"); -const { validateLanguageOptions } = require("./validate-language-options"); -const { LATEST_ECMA_VERSION } = require("../../../conf/ecma-version"); - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** @typedef {import("@eslint/core").File} File */ -/** @typedef {import("@eslint/core").Language} Language */ -/** @typedef {import("@eslint/core").OkParseResult} OkParseResult */ - -//----------------------------------------------------------------------------- -// Helpers -//----------------------------------------------------------------------------- - -const debug = createDebug("eslint:languages:js"); -const DEFAULT_ECMA_VERSION = 5; -const parserSymbol = Symbol.for("eslint.RuleTester.parser"); - -/** - * 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: evk.getKeys - }); -} - -/** - * 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); -} - -/** - * 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 LATEST_ECMA_VERSION; -} - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * @type {Language} - */ -module.exports = { - - fileType: "text", - lineStart: 1, - columnStart: 0, - nodeTypeKey: "type", - visitorKeys: evk.KEYS, - - defaultLanguageOptions: { - sourceType: "module", - ecmaVersion: "latest", - parser: espree, - parserOptions: {} - }, - - validateLanguageOptions, - - /** - * Normalizes the language options. - * @param {Object} languageOptions The language options to normalize. - * @returns {Object} The normalized language options. - */ - normalizeLanguageOptions(languageOptions) { - - languageOptions.ecmaVersion = normalizeEcmaVersionForLanguageOptions( - languageOptions.ecmaVersion - ); - - // 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; - } - } - } - - return languageOptions; - - }, - - /** - * Determines if a given node matches a given selector class. - * @param {string} className The class name to check. - * @param {ASTNode} node The node to check. - * @param {Array} ancestry The ancestry of the node. - * @returns {boolean} True if there's a match, false if not. - * @throws {Error} When an unknown class name is passed. - */ - matchesSelectorClass(className, node, ancestry) { - - /* - * 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. - */ - - switch (className.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"; - - default: - throw new Error(`Unknown class name: ${className}`); - } - }, - - /** - * Parses the given file into an AST. - * @param {File} file The virtual file to parse. - * @param {Object} options Additional options passed from ESLint. - * @param {LanguageOptions} options.languageOptions The language options. - * @returns {Object} The result of parsing. - */ - parse(file, { languageOptions }) { - - // Note: BOM already removed - const { body: text, path: filePath } = file; - const textToParse = 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, - services: parserServices = {}, - visitorKeys = evk.KEYS, - scopeManager - } = parseResult; - - return { - ok: true, - ast, - parserServices, - visitorKeys, - scopeManager - }; - } catch (ex) { - - // If the message includes a leading line number, strip it: - const message = ex.message.replace(/^line \d+:/iu, "").trim(); - - debug("%s\n%s", message, ex.stack); - - return { - ok: false, - errors: [{ - message, - line: ex.lineNumber, - column: ex.column - }] - }; - } - - }, - - /** - * Creates a new `SourceCode` object from the given information. - * @param {File} file The virtual file to create a `SourceCode` object from. - * @param {OkParseResult} parseResult The result returned from `parse()`. - * @param {Object} options Additional options passed from ESLint. - * @param {LanguageOptions} options.languageOptions The language options. - * @returns {SourceCode} The new `SourceCode` object. - */ - createSourceCode(file, parseResult, { languageOptions }) { - - const { body: text, path: filePath, bom: hasBOM } = file; - const { ast, parserServices, visitorKeys } = parseResult; - - debug("Scope analysis:", filePath); - const scopeManager = parseResult.scopeManager || analyzeScope(ast, languageOptions, visitorKeys); - - debug("Scope analysis successful:", filePath); - - return new SourceCode({ - text, - ast, - hasBOM, - parserServices, - scopeManager, - visitorKeys - }); - } - -}; diff --git a/node_modules/eslint/lib/languages/js/source-code/index.js b/node_modules/eslint/lib/languages/js/source-code/index.js deleted file mode 100644 index 1ecfbe4..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -const SourceCode = require("./source-code"); - -module.exports = { - SourceCode -}; diff --git a/node_modules/eslint/lib/languages/js/source-code/source-code.js b/node_modules/eslint/lib/languages/js/source-code/source-code.js deleted file mode 100644 index 9c073fa..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/source-code.js +++ /dev/null @@ -1,1202 +0,0 @@ -/** - * @fileoverview Abstraction of JavaScript source code. - * @author Nicholas C. Zakas - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - { isCommentToken } = require("@eslint-community/eslint-utils"), - TokenStore = require("./token-store"), - astUtils = require("../../../shared/ast-utils"), - Traverser = require("../../../shared/traverser"), - globals = require("../../../../conf/globals"), - { - directivesPattern - } = require("../../../shared/directives"), - - CodePathAnalyzer = require("../../../linter/code-path-analysis/code-path-analyzer"), - createEmitter = require("../../../linter/safe-emitter"), - { ConfigCommentParser, VisitNodeStep, CallMethodStep, Directive } = require("@eslint/plugin-kit"), - - eslintScope = require("eslint-scope"); - -//------------------------------------------------------------------------------ -// Type Definitions -//------------------------------------------------------------------------------ - -/** @typedef {import("eslint-scope").Variable} Variable */ -/** @typedef {import("eslint-scope").Scope} Scope */ -/** @typedef {import("@eslint/core").SourceCode} ISourceCode */ -/** @typedef {import("@eslint/core").Directive} IDirective */ -/** @typedef {import("@eslint/core").TraversalStep} ITraversalStep */ - -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -const commentParser = new ConfigCommentParser(); - -const CODE_PATH_EVENTS = [ - "onCodePathStart", - "onCodePathEnd", - "onCodePathSegmentStart", - "onCodePathSegmentEnd", - "onCodePathSegmentLoop", - "onUnreachableCodePathSegmentStart", - "onUnreachableCodePathSegmentEnd" -]; - -/** - * 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"); - } -} - -/** - * 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}`]; - } -} - -/** - * 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; -} - -/** - * 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')`); - } -} - -/** - * 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; -} - -//----------------------------------------------------------------------------- -// Directive Comments -//----------------------------------------------------------------------------- - -/** - * 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|undefined} configGlobals The globals declared in configuration - * @param {Object|undefined} inlineGlobals The globals declared in the source code - * @returns {void} - */ -function addDeclaredGlobals(globalScope, configGlobals = {}, inlineGlobals = {}) { - - // Define configured global variables. - for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(inlineGlobals)])) { - - /* - * `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 : normalizeConfigGlobal(configGlobals[id]); - const commentValue = inlineGlobals[id] && inlineGlobals[id].value; - const value = commentValue || configValue; - const sourceComments = inlineGlobals[id] && inlineGlobals[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"); - } - - /* - * "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; - }); -} - -/** - * Sets the given variable names as exported so they won't be triggered by - * the `no-unused-vars` rule. - * @param {eslint.Scope} globalScope The global scope to define exports in. - * @param {Record} variables An object whose keys are the variable - * names to export. - * @returns {void} - */ -function markExportedVariables(globalScope, variables) { - - Object.keys(variables).forEach(name => { - const variable = globalScope.set.get(name); - - if (variable) { - variable.eslintUsed = true; - variable.eslintExported = true; - } - }); - -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -const caches = Symbol("caches"); - -/** - * Represents parsed source code. - * @implements {ISourceCode} - */ -class SourceCode extends TokenStore { - - /** - * The cache of steps that were taken while traversing the source code. - * @type {Array} - */ - #steps; - - /** - * Creates a new instance. - * @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 {boolean} textOrConfig.hasBOM Indicates if the text has a Unicode BOM. - * @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, hasBOM, ast, parserServices, scopeManager, visitorKeys; - - // Process overloading of arguments - if (typeof textOrConfig === "string") { - text = textOrConfig; - ast = astIfNoConfig; - hasBOM = false; - } else if (typeof textOrConfig === "object" && textOrConfig !== null) { - text = textOrConfig.text; - ast = textOrConfig.ast; - hasBOM = textOrConfig.hasBOM; - parserServices = textOrConfig.parserServices; - scopeManager = textOrConfig.scopeManager; - visitorKeys = textOrConfig.visitorKeys; - } - - validate(ast); - super(ast.tokens, ast.comments); - - /** - * General purpose caching for the class. - */ - this[caches] = new Map([ - ["scopes", new WeakMap()], - ["vars", new Map()], - ["configNodes", void 0] - ]); - - /** - * Indicates if the AST is ESTree compatible. - * @type {boolean} - */ - this.isESTree = ast.type === "Program"; - - /* - * Backwards compatibility for BOM handling. - * - * The `hasBOM` property has been available on the `SourceCode` object - * for a long time and is used to indicate if the source contains a BOM. - * The linter strips the BOM and just passes the `hasBOM` property to the - * `SourceCode` constructor to make it easier for languages to not deal with - * the BOM. - * - * However, the text passed in to the `SourceCode` constructor might still - * have a BOM if the constructor is called outside of the linter, so we still - * need to check for the BOM in the text. - */ - const textHasBOM = text.charCodeAt(0) === 0xFEFF; - - /** - * The flag to indicate that the source code has Unicode BOM. - * @type {boolean} - */ - this.hasBOM = textHasBOM || !!hasBOM; - - /** - * The original text source code. - * BOM was stripped from this text. - * @type {string} - */ - this.text = (textHasBOM ? 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.at(-1), match.index)); - this.lineStartIndices.push(match.index + match[0].length); - } - this.lines.push(this.text.slice(this.lineStartIndices.at(-1))); - - // don't allow further 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; - } - - /** - * 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.at(-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.at(-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; - } - - /** - * Gets the scope for the given node - * @param {ASTNode} currentNode The node to get the scope of - * @returns {Scope} The scope information for this node - * @throws {TypeError} If the `currentNode` argument is missing. - */ - getScope(currentNode) { - - if (!currentNode) { - throw new TypeError("Missing required argument: node."); - } - - // check cache first - const cache = this[caches].get("scopes"); - const cachedScope = cache.get(currentNode); - - if (cachedScope) { - return cachedScope; - } - - // 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 = this.scopeManager.acquire(node, inner); - - if (scope) { - if (scope.type === "function-expression-name") { - cache.set(currentNode, scope.childScopes[0]); - return scope.childScopes[0]; - } - - cache.set(currentNode, scope); - return scope; - } - } - - cache.set(currentNode, this.scopeManager.scopes[0]); - return this.scopeManager.scopes[0]; - } - - /** - * Get the variables that `node` defines. - * This is a convenience method that passes through - * to the same method on the `scopeManager`. - * @param {ASTNode} node The node for which the variables are obtained. - * @returns {Array} An array of variable nodes representing - * the variables that `node` defines. - */ - getDeclaredVariables(node) { - return this.scopeManager.getDeclaredVariables(node); - } - - /* eslint-disable class-methods-use-this -- node is owned by SourceCode */ - /** - * Gets all the ancestors of a given node - * @param {ASTNode} node The node - * @returns {Array} All the ancestor nodes in the AST, not including the provided node, starting - * from the root node at index 0 and going inwards to the parent node. - * @throws {TypeError} When `node` is missing. - */ - getAncestors(node) { - - if (!node) { - throw new TypeError("Missing required argument: node."); - } - - const ancestorsStartingAtParent = []; - - for (let ancestor = node.parent; ancestor; ancestor = ancestor.parent) { - ancestorsStartingAtParent.push(ancestor); - } - - return ancestorsStartingAtParent.reverse(); - } - - /** - * Returns the location of the given node or token. - * @param {ASTNode|Token} nodeOrToken The node or token to get the location of. - * @returns {SourceLocation} The location of the node or token. - */ - getLoc(nodeOrToken) { - return nodeOrToken.loc; - } - - /** - * Returns the range of the given node or token. - * @param {ASTNode|Token} nodeOrToken The node or token to get the range of. - * @returns {[number, number]} The range of the node or token. - */ - getRange(nodeOrToken) { - return nodeOrToken.range; - } - - /* eslint-enable class-methods-use-this -- node is owned by SourceCode */ - - /** - * Marks a variable as used in the current scope - * @param {string} name The name of the variable to mark as used. - * @param {ASTNode} [refNode] The closest node to the variable reference. - * @returns {boolean} True if the variable was found and marked as used, false if not. - */ - markVariableAsUsed(name, refNode = this.ast) { - - const currentScope = this.getScope(refNode); - let initialScope = currentScope; - - /* - * When we are in an ESM or CommonJS module, we need to start searching - * from the top-level scope, not the global scope. For ESM the top-level - * scope is the module scope; for CommonJS the top-level scope is the - * outer function scope. - * - * Without this check, we might miss a variable declared with `var` at - * the top-level because it won't exist in the global scope. - */ - if ( - currentScope.type === "global" && - currentScope.childScopes.length > 0 && - - // top-level scopes refer to a `Program` node - currentScope.childScopes[0].block === this.ast - ) { - initialScope = currentScope.childScopes[0]; - } - - 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; - } - - - /** - * Returns an array of all inline configuration nodes found in the - * source code. - * @returns {Array} An array of all inline configuration nodes. - */ - getInlineConfigNodes() { - - // check the cache first - let configNodes = this[caches].get("configNodes"); - - if (configNodes) { - return configNodes; - } - - // calculate fresh config nodes - configNodes = this.ast.comments.filter(comment => { - - // shebang comments are never directives - if (comment.type === "Shebang") { - return false; - } - - const directive = commentParser.parseDirective(comment.value); - - if (!directive) { - return false; - } - - if (!directivesPattern.test(directive.label)) { - return false; - } - - // only certain comment types are supported as line comments - return comment.type !== "Line" || !!/^eslint-disable-(next-)?line$/u.test(directive.label); - }); - - this[caches].set("configNodes", configNodes); - - return configNodes; - } - - /** - * Returns an all directive nodes that enable or disable rules along with any problems - * encountered while parsing the directives. - * @returns {{problems:Array,directives:Array}} Information - * that ESLint needs to further process the directives. - */ - getDisableDirectives() { - - // check the cache first - const cachedDirectives = this[caches].get("disableDirectives"); - - if (cachedDirectives) { - return cachedDirectives; - } - - const problems = []; - const directives = []; - - this.getInlineConfigNodes().forEach(comment => { - - // Step 1: Parse the directive - const { - label, - value, - justification: justificationPart - } = commentParser.parseDirective(comment.value); - - // Step 2: Extract the directive value - const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(label); - - if (comment.type === "Line" && !lineCommentSupported) { - return; - } - - // Step 3: Validate the directive does not span multiple lines - if (label === "eslint-disable-line" && comment.loc.start.line !== comment.loc.end.line) { - const message = `${label} comment should not span multiple lines.`; - - problems.push({ - ruleId: null, - message, - loc: comment.loc - }); - return; - } - - // Step 4: Extract the directive value and create the Directive object - switch (label) { - case "eslint-disable": - case "eslint-enable": - case "eslint-disable-next-line": - case "eslint-disable-line": { - const directiveType = label.slice("eslint-".length); - - directives.push(new Directive({ - type: directiveType, - node: comment, - value, - justification: justificationPart - })); - } - - // no default - } - }); - - const result = { problems, directives }; - - this[caches].set("disableDirectives", result); - - return result; - } - - /** - * Applies language options sent in from the core. - * @param {Object} languageOptions The language options for this run. - * @returns {void} - */ - applyLanguageOptions(languageOptions) { - - /* - * Add configured globals and language globals - * - * Using Object.assign instead of object spread for performance reasons - * https://github.com/eslint/eslint/issues/16302 - */ - const configGlobals = Object.assign( - Object.create(null), // https://github.com/eslint/eslint/issues/18363 - getGlobalsForEcmaVersion(languageOptions.ecmaVersion), - languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0, - languageOptions.globals - ); - const varsCache = this[caches].get("vars"); - - varsCache.set("configGlobals", configGlobals); - } - - /** - * Applies configuration found inside of the source code. This method is only - * called when ESLint is running with inline configuration allowed. - * @returns {{problems:Array,configs:{config:FlatConfigArray,loc:Location}}} Information - * that ESLint needs to further process the inline configuration. - */ - applyInlineConfig() { - - const problems = []; - const configs = []; - const exportedVariables = {}; - const inlineGlobals = Object.create(null); - - this.getInlineConfigNodes().forEach(comment => { - - const { label, value } = commentParser.parseDirective(comment.value); - - switch (label) { - case "exported": - Object.assign(exportedVariables, commentParser.parseListConfig(value)); - break; - - case "globals": - case "global": - for (const [id, idSetting] of Object.entries(commentParser.parseStringConfig(value))) { - let normalizedValue; - - try { - normalizedValue = normalizeConfigGlobal(idSetting); - } catch (err) { - problems.push({ - ruleId: null, - loc: comment.loc, - message: err.message - }); - continue; - } - - if (inlineGlobals[id]) { - inlineGlobals[id].comments.push(comment); - inlineGlobals[id].value = normalizedValue; - } else { - inlineGlobals[id] = { - comments: [comment], - value: normalizedValue - }; - } - } - break; - - case "eslint": { - const parseResult = commentParser.parseJSONLikeConfig(value); - - if (parseResult.ok) { - configs.push({ - config: { - rules: parseResult.config - }, - loc: comment.loc - }); - } else { - problems.push({ - ruleId: null, - loc: comment.loc, - message: parseResult.error.message - }); - } - - break; - } - - // no default - } - }); - - // save all the new variables for later - const varsCache = this[caches].get("vars"); - - varsCache.set("inlineGlobals", inlineGlobals); - varsCache.set("exportedVariables", exportedVariables); - - return { - configs, - problems - }; - } - - /** - * Called by ESLint core to indicate that it has finished providing - * information. We now add in all the missing variables and ensure that - * state-changing methods cannot be called by rules. - * @returns {void} - */ - finalize() { - - const varsCache = this[caches].get("vars"); - const configGlobals = varsCache.get("configGlobals"); - const inlineGlobals = varsCache.get("inlineGlobals"); - const exportedVariables = varsCache.get("exportedVariables"); - const globalScope = this.scopeManager.scopes[0]; - - addDeclaredGlobals(globalScope, configGlobals, inlineGlobals); - - if (exportedVariables) { - markExportedVariables(globalScope, exportedVariables); - } - - } - - /** - * Traverse the source code and return the steps that were taken. - * @returns {Array} The steps that were taken while traversing the source code. - */ - traverse() { - - // Because the AST doesn't mutate, we can cache the steps - if (this.#steps) { - return this.#steps; - } - - const steps = this.#steps = []; - - /* - * This logic works for any AST, not just ESTree. Because ESLint has allowed - * custom parsers to return any AST, we need to ensure that the traversal - * logic works for any AST. - */ - const emitter = createEmitter(); - let analyzer = { - enterNode(node) { - steps.push(new VisitNodeStep({ - target: node, - phase: 1, - args: [node, node.parent] - })); - }, - leaveNode(node) { - steps.push(new VisitNodeStep({ - target: node, - phase: 2, - args: [node, node.parent] - })); - }, - emitter - }; - - /* - * We do code path analysis for ESTree only. Code path analysis is not - * necessary for other ASTs, and it's also not possible to do for other - * ASTs because the necessary information is not available. - * - * Generally speaking, we can tell that the AST is an ESTree if it has a - * Program node at the top level. This is not a perfect heuristic, but it - * is good enough for now. - */ - if (this.isESTree) { - analyzer = new CodePathAnalyzer(analyzer); - - CODE_PATH_EVENTS.forEach(eventName => { - emitter.on(eventName, (...args) => { - steps.push(new CallMethodStep({ - target: eventName, - args - })); - }); - }); - } - - /* - * The actual AST traversal is done by the `Traverser` class. This class - * is responsible for walking the AST and calling the appropriate methods - * on the `analyzer` object, which is appropriate for the given AST. - */ - Traverser.traverse(this.ast, { - enter(node, parent) { - - // save the parent node on a property for backwards compatibility - node.parent = parent; - - analyzer.enterNode(node); - }, - leave(node) { - analyzer.leaveNode(node); - }, - visitorKeys: this.visitorKeys - }); - - return steps; - } -} - -module.exports = SourceCode; diff --git a/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js deleted file mode 100644 index 7255a62..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-comment-cursor.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @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/languages/js/source-code/token-store/backward-token-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js deleted file mode 100644 index d3469c9..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/backward-token-cursor.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens only in reverse. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const { getLastIndex, getFirstIndex } = 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 = getLastIndex(tokens, indexMap, endLoc); - this.indexEnd = 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/languages/js/source-code/token-store/cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js deleted file mode 100644 index 0b72600..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/cursor.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @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 - */ - /* c8 ignore next */ - moveNext() { // eslint-disable-line class-methods-use-this -- Unused - throw new Error("Not implemented."); - } -}; diff --git a/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js b/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js deleted file mode 100644 index f2676f1..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/cursors.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @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 -//------------------------------------------------------------------------------ - -module.exports = { - forward: new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor), - backward: new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor) -}; diff --git a/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js deleted file mode 100644 index 3ee7b0b..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/decorative-cursor.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @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/languages/js/source-code/token-store/filter-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js deleted file mode 100644 index 08c4f22..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/filter-cursor.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @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/languages/js/source-code/token-store/forward-token-comment-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js deleted file mode 100644 index 8aa46c2..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-comment-cursor.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens and comments. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const { getFirstIndex, search } = 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 = getFirstIndex(tokens, indexMap, startLoc); - this.commentIndex = 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/languages/js/source-code/token-store/forward-token-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js deleted file mode 100644 index 9305cbe..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/forward-token-cursor.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @fileoverview Define the cursor which iterates tokens only. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Cursor = require("./cursor"); -const { getFirstIndex, getLastIndex } = 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 = getFirstIndex(tokens, indexMap, startLoc); - this.indexEnd = 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/languages/js/source-code/token-store/index.js b/node_modules/eslint/lib/languages/js/source-code/token-store/index.js deleted file mode 100644 index d44191a..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/index.js +++ /dev/null @@ -1,627 +0,0 @@ -/** - * @fileoverview Object to handle access and retrieval of tokens. - * @author Brandon Mills - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { isCommentToken } = require("@eslint-community/eslint-utils"); -const assert = require("../../../../shared/assert"); -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; - let range; - - 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/languages/js/source-code/token-store/limit-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js deleted file mode 100644 index 0fd92a7..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/limit-cursor.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @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/languages/js/source-code/token-store/padded-token-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js deleted file mode 100644 index 89349fa..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/padded-token-cursor.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @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/languages/js/source-code/token-store/skip-cursor.js b/node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js deleted file mode 100644 index f068f53..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/skip-cursor.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @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/languages/js/source-code/token-store/utils.js b/node_modules/eslint/lib/languages/js/source-code/token-store/utils.js deleted file mode 100644 index 3e01470..0000000 --- a/node_modules/eslint/lib/languages/js/source-code/token-store/utils.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @fileoverview Define utility functions for token store. - * @author Toru Nagashima - */ -"use strict"; - -//------------------------------------------------------------------------------ -// 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) { - for (let minIndex = 0, maxIndex = tokens.length - 1; minIndex <= maxIndex;) { - - /* - * Calculate the index in the middle between minIndex and maxIndex. - * `| 0` is used to round a fractional value down to the nearest integer: this is similar to - * using `Math.trunc()` or `Math.floor()`, but performance tests have shown this method to - * be faster. - */ - const index = (minIndex + maxIndex) / 2 | 0; - const token = tokens[index]; - const tokenStartLocation = token.range[0]; - - if (location <= tokenStartLocation) { - if (index === minIndex) { - return index; - } - maxIndex = index; - } else { - minIndex = index + 1; - } - } - return tokens.length; -}; - -/** - * 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 = tokens[index]; - - // If the mapped index is out of bounds, the returned cursor index will point after the end of the tokens array. - if (!token) { - return tokens.length; - } - - /* - * 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.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 = tokens[index]; - - // If the mapped index is out of bounds, the returned cursor index will point before the end of the tokens array. - if (!token) { - return tokens.length - 1; - } - - /* - * 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.range[1] > endLoc) { - return index - 1; - } - return index; - } - return tokens.length - 1; -}; diff --git a/node_modules/eslint/lib/languages/js/validate-language-options.js b/node_modules/eslint/lib/languages/js/validate-language-options.js deleted file mode 100644 index ba1e5e3..0000000 --- a/node_modules/eslint/lib/languages/js/validate-language-options.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * @fileoverview The schema to validate language options - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Data -//----------------------------------------------------------------------------- - -const globalVariablesValues = new Set([ - true, "true", "writable", "writeable", - false, "false", "readonly", "readable", null, - "off" -]); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * 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 a non-null non-array object. - * @param {any} value The value to check. - * @returns {boolean} `true` if the value is a non-null non-array object. - */ -function isNonArrayObject(value) { - return isNonNullObject(value) && !Array.isArray(value); -} - -/** - * 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"; -} - -//----------------------------------------------------------------------------- -// Schemas -//----------------------------------------------------------------------------- - -/** - * Validates the ecmaVersion property. - * @param {string|number} ecmaVersion The value to check. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ -function validateEcmaVersion(ecmaVersion) { - - if (isUndefined(ecmaVersion)) { - throw new TypeError("Key \"ecmaVersion\": Expected an \"ecmaVersion\" property."); - } - - if (typeof ecmaVersion !== "number" && ecmaVersion !== "latest") { - throw new TypeError("Key \"ecmaVersion\": Expected a number or \"latest\"."); - } - -} - -/** - * Validates the sourceType property. - * @param {string} sourceType The value to check. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ -function validateSourceType(sourceType) { - - if (typeof sourceType !== "string" || !/^(?:script|module|commonjs)$/u.test(sourceType)) { - throw new TypeError("Key \"sourceType\": Expected \"script\", \"module\", or \"commonjs\"."); - } - -} - -/** - * Validates the globals property. - * @param {Object} globals The value to check. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ -function validateGlobals(globals) { - - if (!isNonArrayObject(globals)) { - throw new TypeError("Key \"globals\": Expected an object."); - } - - for (const key of Object.keys(globals)) { - - // avoid hairy edge case - if (key === "__proto__") { - continue; - } - - if (key !== key.trim()) { - throw new TypeError(`Key "globals": Global "${key}" has leading or trailing whitespace.`); - } - - if (!globalVariablesValues.has(globals[key])) { - throw new TypeError(`Key "globals": Key "${key}": Expected "readonly", "writable", or "off".`); - } - } -} - -/** - * Validates the parser property. - * @param {Object} parser The value to check. - * @returns {void} - * @throws {TypeError} If the value is invalid. - */ -function validateParser(parser) { - - if (!parser || typeof parser !== "object" || - (typeof parser.parse !== "function" && typeof parser.parseForESLint !== "function") - ) { - throw new TypeError("Key \"parser\": Expected object with parse() or parseForESLint() method."); - } - -} - -/** - * Validates the language options. - * @param {Object} languageOptions The language options to validate. - * @returns {void} - * @throws {TypeError} If the language options are invalid. - */ -function validateLanguageOptions(languageOptions) { - - if (!isNonArrayObject(languageOptions)) { - throw new TypeError("Expected an object."); - } - - const { - ecmaVersion, - sourceType, - globals, - parser, - parserOptions, - ...otherOptions - } = languageOptions; - - if ("ecmaVersion" in languageOptions) { - validateEcmaVersion(ecmaVersion); - } - - if ("sourceType" in languageOptions) { - validateSourceType(sourceType); - } - - if ("globals" in languageOptions) { - validateGlobals(globals); - } - - if ("parser" in languageOptions) { - validateParser(parser); - } - - if ("parserOptions" in languageOptions) { - if (!isNonArrayObject(parserOptions)) { - throw new TypeError("Key \"parserOptions\": Expected an object."); - } - } - - const otherOptionKeys = Object.keys(otherOptions); - - if (otherOptionKeys.length > 0) { - throw new TypeError(`Unexpected key "${otherOptionKeys[0]}" found.`); - } - -} - -module.exports = { validateLanguageOptions }; diff --git a/node_modules/eslint/lib/linter/apply-disable-directives.js b/node_modules/eslint/lib/linter/apply-disable-directives.js deleted file mode 100644 index 1f07447..0000000 --- a/node_modules/eslint/lib/linter/apply-disable-directives.js +++ /dev/null @@ -1,502 +0,0 @@ -/** - * @fileoverview A module that filters reported problems based on `eslint-disable` and `eslint-enable` comments - * @author Teddy Katz - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").LintMessage} LintMessage */ -/** @typedef {import("@eslint/core").Language} Language */ -/** @typedef {import("@eslint/core").Position} Position */ -/** @typedef {import("@eslint/core").RulesConfig} RulesConfig */ - -//------------------------------------------------------------------------------ -// Module Definition -//------------------------------------------------------------------------------ - -const escapeRegExp = require("escape-string-regexp"); -const { - Legacy: { - ConfigOps - } -} = require("@eslint/eslintrc/universal"); - -/** - * Compares the locations of two objects in a source file - * @param {Position} itemA The first object - * @param {Position} 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 {Iterable} directives Unused directives to be removed. - * @returns {Directive[][]} Directives grouped by their parent comment. - */ -function groupByParentDirective(directives) { - const groups = new Map(); - - for (const directive of directives) { - const { unprocessedDirective: { parentDirective } } = directive; - - if (groups.has(parentDirective)) { - groups.get(parentDirective).push(directive); - } else { - groups.set(parentDirective, [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 {{node: Token, value: string}} parentDirective Data about the backing directive. - * @param {SourceCode} sourceCode The source code object for the file being linted. - * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems. - */ -function createIndividualDirectivesRemoval(directives, parentDirective, sourceCode) { - - /* - * Get the list of the rules 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 = parentDirective.value.trim(); - - // Calculate where it starts in the source code text - const listStart = sourceCode.text.indexOf(listText, sourceCode.getRange(parentDirective.node)[0]); - - /* - * 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)}\k(?:\s*,\s*|$)`, "u"); - const match = regex.exec(listText); - const matchedText = match[0]; - const matchStart = listStart + match.index; - const matchEnd = matchStart + matchedText.length; - - const firstIndexOfComma = matchedText.indexOf(","); - const lastIndexOfComma = matchedText.lastIndexOf(","); - - let removalStart, removalEnd; - - 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 - * ^^^^^^^^^^^ - */ - removalStart = matchStart + firstIndexOfComma; - removalEnd = matchStart + 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 - * ^^^^^^^^^^^^^ - */ - removalStart = matchStart; - removalEnd = matchEnd; - } - - return { - description: `'${ruleId}'`, - fix: { - range: [ - removalStart, - removalEnd - ], - text: "" - }, - unprocessedDirective: directive.unprocessedDirective - }; - }); -} - -/** - * Creates a description of deleting an entire unused disable directive. - * @param {Directive[]} directives Unused directives to be removed. - * @param {Token} node The backing Comment token. - * @param {SourceCode} sourceCode The source code object for the file being linted. - * @returns {{ description, fix, unprocessedDirective }} Details for later creation of an output problem. - */ -function createDirectiveRemoval(directives, node, sourceCode) { - const range = sourceCode.getRange(node); - 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.at(-1)}`, - fix: { - range, - text: " " - }, - unprocessedDirective: directives[0].unprocessedDirective - }; -} - -/** - * Parses details from directives to create output Problems. - * @param {Iterable} allDirectives Unused directives to be removed. - * @param {SourceCode} sourceCode The source code object for the file being linted. - * @returns {{ description, fix, unprocessedDirective }[]} Details for later creation of output Problems. - */ -function processUnusedDirectives(allDirectives, sourceCode) { - const directiveGroups = groupByParentDirective(allDirectives); - - return directiveGroups.flatMap( - directives => { - const { parentDirective } = directives[0].unprocessedDirective; - const remainingRuleIds = new Set(parentDirective.ruleIds); - - for (const directive of directives) { - remainingRuleIds.delete(directive.ruleId); - } - - return remainingRuleIds.size - ? createIndividualDirectivesRemoval(directives, parentDirective, sourceCode) - : [createDirectiveRemoval(directives, parentDirective.node, sourceCode)]; - } - ); -} - -/** - * Collect eslint-enable comments that are removing suppressions by eslint-disable comments. - * @param {Directive[]} directives The directives to check. - * @returns {Set} The used eslint-enable comments - */ -function collectUsedEnableDirectives(directives) { - - /** - * A Map of `eslint-enable` keyed by ruleIds that may be marked as used. - * If `eslint-enable` does not have a ruleId, the key will be `null`. - * @type {Map} - */ - const enabledRules = new Map(); - - /** - * A Set of `eslint-enable` marked as used. - * It is also the return value of `collectUsedEnableDirectives` function. - * @type {Set} - */ - const usedEnableDirectives = new Set(); - - /* - * Checks the directives backwards to see if the encountered `eslint-enable` is used by the previous `eslint-disable`, - * and if so, stores the `eslint-enable` in `usedEnableDirectives`. - */ - for (let index = directives.length - 1; index >= 0; index--) { - const directive = directives[index]; - - if (directive.type === "disable") { - if (enabledRules.size === 0) { - continue; - } - if (directive.ruleId === null) { - - // If encounter `eslint-disable` without ruleId, - // mark all `eslint-enable` currently held in enabledRules as used. - // e.g. - // /* eslint-disable */ <- current directive - // /* eslint-enable rule-id1 */ <- used - // /* eslint-enable rule-id2 */ <- used - // /* eslint-enable */ <- used - for (const enableDirective of enabledRules.values()) { - usedEnableDirectives.add(enableDirective); - } - enabledRules.clear(); - } else { - const enableDirective = enabledRules.get(directive.ruleId); - - if (enableDirective) { - - // If encounter `eslint-disable` with ruleId, and there is an `eslint-enable` with the same ruleId in enabledRules, - // mark `eslint-enable` with ruleId as used. - // e.g. - // /* eslint-disable rule-id */ <- current directive - // /* eslint-enable rule-id */ <- used - usedEnableDirectives.add(enableDirective); - } else { - const enabledDirectiveWithoutRuleId = enabledRules.get(null); - - if (enabledDirectiveWithoutRuleId) { - - // If encounter `eslint-disable` with ruleId, and there is no `eslint-enable` with the same ruleId in enabledRules, - // mark `eslint-enable` without ruleId as used. - // e.g. - // /* eslint-disable rule-id */ <- current directive - // /* eslint-enable */ <- used - usedEnableDirectives.add(enabledDirectiveWithoutRuleId); - } - } - } - } else if (directive.type === "enable") { - if (directive.ruleId === null) { - - // If encounter `eslint-enable` without ruleId, the `eslint-enable` that follows it are unused. - // So clear enabledRules. - // e.g. - // /* eslint-enable */ <- current directive - // /* eslint-enable rule-id *// <- unused - // /* eslint-enable */ <- unused - enabledRules.clear(); - enabledRules.set(null, directive); - } else { - enabledRules.set(directive.ruleId, directive); - } - } - } - return usedEnableDirectives; -} - -/** - * 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: LintMessage[], unusedDirectives: LintMessage[]}} An object with a list - * of problems (including suppressed ones) and unused eslint-disable directives - */ -function applyDirectives(options) { - const problems = []; - const usedDisableDirectives = new Set(); - const { sourceCode } = options; - - 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.at(-1)); - } - } - - problems.push(problem); - } - - const unusedDisableDirectivesToReport = options.directives - .filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive) && !options.rulesToIgnore.has(directive.ruleId)); - - - const unusedEnableDirectivesToReport = new Set( - options.directives.filter(directive => directive.unprocessedDirective.type === "enable" && !options.rulesToIgnore.has(directive.ruleId)) - ); - - /* - * If directives has the eslint-enable directive, - * check whether the eslint-enable comment is used. - */ - if (unusedEnableDirectivesToReport.size > 0) { - for (const directive of collectUsedEnableDirectives(options.directives)) { - unusedEnableDirectivesToReport.delete(directive); - } - } - - const processed = processUnusedDirectives(unusedDisableDirectivesToReport, sourceCode) - .concat(processUnusedDirectives(unusedEnableDirectivesToReport, sourceCode)); - const columnOffset = options.language.columnStart === 1 ? 0 : 1; - const lineOffset = options.language.lineStart === 1 ? 0 : 1; - - const unusedDirectives = processed - .map(({ description, fix, unprocessedDirective }) => { - const { parentDirective, type, line, column } = unprocessedDirective; - - let message; - - if (type === "enable") { - message = description - ? `Unused eslint-enable directive (no matching eslint-disable directives were found for ${description}).` - : "Unused eslint-enable directive (no matching eslint-disable directives were found)."; - } else { - message = description - ? `Unused eslint-disable directive (no problems were reported from ${description}).` - : "Unused eslint-disable directive (no problems were reported)."; - } - - const loc = sourceCode.getLoc(parentDirective.node); - - return { - ruleId: null, - message, - line: type === "disable-next-line" ? loc.start.line + lineOffset : line, - column: type === "disable-next-line" ? loc.start.column + columnOffset : column, - severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2, - nodeType: null, - ...options.disableFixes ? {} : { fix } - }; - }); - - return { problems, unusedDirectives }; -} - -/** - * 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 {Language} options.language The language being linted. - * @param {SourceCode} options.sourceCode The source code object for the file being linted. - * @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 {RulesConfig} options.configuredRules The rules configuration. - * @param {Function} options.ruleFilter A predicate function to filter which rules should be executed. - * @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 = ({ language, sourceCode, directives, disableFixes, problems, configuredRules, ruleFilter, 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); - - // This determines a list of rules that are not being run by the given ruleFilter, if present. - const rulesToIgnore = configuredRules && ruleFilter - ? new Set(Object.keys(configuredRules).filter(ruleId => { - const severity = ConfigOps.getRuleSeverity(configuredRules[ruleId]); - - // Ignore for disabled rules. - if (severity === 0) { - return false; - } - - return !ruleFilter({ severity, ruleId }); - })) - : new Set(); - - // If no ruleId is supplied that means this directive is applied to all rules, so we can't determine if it's unused if any rules are filtered out. - if (rulesToIgnore.size > 0) { - rulesToIgnore.add(null); - } - - const blockDirectivesResult = applyDirectives({ - language, - sourceCode, - problems, - directives: blockDirectives, - disableFixes, - reportUnusedDisableDirectives, - rulesToIgnore - }); - const lineDirectivesResult = applyDirectives({ - language, - sourceCode, - problems: blockDirectivesResult.problems, - directives: lineDirectives, - disableFixes, - reportUnusedDisableDirectives, - rulesToIgnore - }); - - return reportUnusedDisableDirectives !== "off" - ? lineDirectivesResult.problems - .concat(blockDirectivesResult.unusedDirectives) - .concat(lineDirectivesResult.unusedDirectives) - .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 deleted file mode 100644 index baa6e99..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js +++ /dev/null @@ -1,851 +0,0 @@ -/** - * @fileoverview A class of the code path analyzer. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = require("../../shared/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) { - - const eventName = currentSegment.reachable - ? "onCodePathSegmentEnd" - : "onUnreachableCodePathSegmentEnd"; - - debug.dump(`${eventName} ${currentSegment.id}`); - - analyzer.emitter.emit( - eventName, - 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) { - - const eventName = headSegment.reachable - ? "onCodePathSegmentStart" - : "onUnreachableCodePathSegmentStart"; - - debug.dump(`${eventName} ${headSegment.id}`); - CodePathSegment.markUsed(headSegment); - analyzer.emitter.emit( - eventName, - 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]; - const eventName = currentSegment.reachable - ? "onCodePathSegmentEnd" - : "onUnreachableCodePathSegmentEnd"; - - debug.dump(`${eventName} ${currentSegment.id}`); - - analyzer.emitter.emit( - eventName, - 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 deleted file mode 100644 index 3b8dbb4..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path-segment.js +++ /dev/null @@ -1,263 +0,0 @@ -/** - * @fileoverview The CodePathSegment class. - * @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. - * - * Each segment is arranged in a series of linked lists (implemented by arrays) - * that keep track of the previous and next segments in a code path. In this way, - * you can navigate between all segments in any code path so long as you have a - * reference to any segment in that code path. - * - * When first created, the segment is in a detached state, meaning that it knows the - * segments that came before it but those segments don't know that this new segment - * follows it. Only when `CodePathSegment#markUsed()` is called on a segment does it - * officially become part of the code path by updating the previous segments to know - * that this new segment follows. - */ -class CodePathSegment { - - /** - * Creates a new instance. - * @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 reachable segments. - * @type {CodePathSegment[]} - */ - this.nextSegments = []; - - /** - * An array of the previous reachable segments. - * @type {CodePathSegment[]} - */ - this.prevSegments = allPrevSegments.filter(isReachable); - - /** - * An array of all next segments including reachable and unreachable. - * @type {CodePathSegment[]} - */ - this.allNextSegments = []; - - /** - * An array of all previous segments including reachable and unreachable. - * @type {CodePathSegment[]} - */ - this.allPrevSegments = allPrevSegments; - - /** - * A flag which shows this is reachable. - * @type {boolean} - */ - this.reachable = reachable; - - // Internal data. - Object.defineProperty(this, "internal", { - value: { - - // determines if the segment has been attached to the code path - used: false, - - // array of previous segments coming from the end of a loop - loopedPrevSegments: [] - } - }); - - /* c8 ignore start */ - if (debug.enabled) { - this.internal.nodes = []; - }/* c8 ignore stop */ - } - - /** - * 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 new segment and appends it after the given segments. - * @param {string} id An identifier. - * @param {CodePathSegment[]} allPrevSegments An array of the previous segments - * to append to. - * @returns {CodePathSegment} The created segment. - */ - static newNext(id, allPrevSegments) { - return new CodePathSegment( - id, - CodePathSegment.flattenUnusedSegments(allPrevSegments), - allPrevSegments.some(isReachable) - ); - } - - /** - * Creates an unreachable segment and appends it after the 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 removed. - */ - 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)); - } - - /** - * Marks a given segment as 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) { - - /* - * If the segment is reachable, then it's officially part of the - * code path. This loops through all previous segments to update - * their list of next segments. Because the segment is reachable, - * it's added to both `nextSegments` and `allNextSegments`. - */ - for (i = 0; i < segment.allPrevSegments.length; ++i) { - const prevSegment = segment.allPrevSegments[i]; - - prevSegment.allNextSegments.push(segment); - prevSegment.nextSegments.push(segment); - } - } else { - - /* - * If the segment is not reachable, then it's not officially part of the - * code path. This loops through all previous segments to update - * their list of next segments. Because the segment is not reachable, - * it's added only to `allNextSegments`. - */ - 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); - } - - /** - * Creates a new array based on an array of segments. If any segment in the - * array is unused, then it is replaced by all of its previous segments. - * All used segments are returned as-is without replacement. - * @param {CodePathSegment[]} segments The array of segments to flatten. - * @returns {CodePathSegment[]} The flattened array. - */ - static flattenUnusedSegments(segments) { - const done = new Set(); - - for (let i = 0; i < segments.length; ++i) { - const segment = segments[i]; - - // Ignores duplicated. - if (done.has(segment)) { - 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.has(prevSegment)) { - done.add(prevSegment); - } - } - } else { - done.add(segment); - } - } - - return [...done]; - } -} - -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 deleted file mode 100644 index 2b0dc2b..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path-state.js +++ /dev/null @@ -1,2348 +0,0 @@ -/** - * @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"); - -//----------------------------------------------------------------------------- -// Contexts -//----------------------------------------------------------------------------- - -/** - * Represents the context in which a `break` statement can be used. - * - * A `break` statement without a label is only valid in a few places in - * JavaScript: any type of loop or a `switch` statement. Otherwise, `break` - * without a label causes a syntax error. For these contexts, `breakable` is - * set to `true` to indicate that a `break` without a label is valid. - * - * However, a `break` statement with a label is also valid inside of a labeled - * statement. For example, this is valid: - * - * a : { - * break a; - * } - * - * The `breakable` property is set false for labeled statements to indicate - * that `break` without a label is invalid. - */ -class BreakContext { - - /** - * Creates a new instance. - * @param {BreakContext} upperContext The previous `BreakContext`. - * @param {boolean} breakable Indicates if we are inside a statement where - * `break` without a label will exit the statement. - * @param {string|null} label The label for the statement. - * @param {ForkContext} forkContext The current fork context. - */ - constructor(upperContext, breakable, label, forkContext) { - - /** - * The previous `BreakContext` - * @type {BreakContext} - */ - this.upper = upperContext; - - /** - * Indicates if we are inside a statement where `break` without a label - * will exit the statement. - * @type {boolean} - */ - this.breakable = breakable; - - /** - * The label associated with the statement. - * @type {string|null} - */ - this.label = label; - - /** - * The fork context for the `break`. - * @type {ForkContext} - */ - this.brokenForkContext = ForkContext.newEmpty(forkContext); - } -} - -/** - * Represents the context for `ChainExpression` nodes. - */ -class ChainContext { - - /** - * Creates a new instance. - * @param {ChainContext} upperContext The previous `ChainContext`. - */ - constructor(upperContext) { - - /** - * The previous `ChainContext` - * @type {ChainContext} - */ - this.upper = upperContext; - - /** - * The number of choice contexts inside of the `ChainContext`. - * @type {number} - */ - this.choiceContextCount = 0; - - } -} - -/** - * Represents a choice in the code path. - * - * Choices are created by logical operators such as `&&`, loops, conditionals, - * and `if` statements. This is the point at which the code path has a choice of - * which direction to go. - * - * The result of a choice might be in the left (test) expression of another choice, - * and in that case, may create a new fork. For example, `a || b` is a choice - * but does not create a new fork because the result of the expression is - * not used as the test expression in another expression. In this case, - * `isForkingAsResult` is false. In the expression `a || b || c`, the `a || b` - * expression appears as the test expression for `|| c`, so the - * result of `a || b` creates a fork because execution may or may not - * continue to `|| c`. `isForkingAsResult` for `a || b` in this case is true - * while `isForkingAsResult` for `|| c` is false. (`isForkingAsResult` is always - * false for `if` statements, conditional expressions, and loops.) - * - * All of the choices except one (`??`) operate on a true/false fork, meaning if - * true go one way and if false go the other (tracked by `trueForkContext` and - * `falseForkContext`). The `??` operator doesn't operate on true/false because - * the left expression is evaluated to be nullish or not, so only if nullish do - * we fork to the right expression (tracked by `nullishForkContext`). - */ -class ChoiceContext { - - /** - * Creates a new instance. - * @param {ChoiceContext} upperContext The previous `ChoiceContext`. - * @param {string} kind The kind of choice. If it's a logical or assignment expression, this - * is `"&&"` or `"||"` or `"??"`; if it's an `if` statement or - * conditional expression, this is `"test"`; otherwise, this is `"loop"`. - * @param {boolean} isForkingAsResult Indicates if the result of the choice - * creates a fork. - * @param {ForkContext} forkContext The containing `ForkContext`. - */ - constructor(upperContext, kind, isForkingAsResult, forkContext) { - - /** - * The previous `ChoiceContext` - * @type {ChoiceContext} - */ - this.upper = upperContext; - - /** - * The kind of choice. If it's a logical or assignment expression, this - * is `"&&"` or `"||"` or `"??"`; if it's an `if` statement or - * conditional expression, this is `"test"`; otherwise, this is `"loop"`. - * @type {string} - */ - this.kind = kind; - - /** - * Indicates if the result of the choice forks the code path. - * @type {boolean} - */ - this.isForkingAsResult = isForkingAsResult; - - /** - * The fork context for the `true` path of the choice. - * @type {ForkContext} - */ - this.trueForkContext = ForkContext.newEmpty(forkContext); - - /** - * The fork context for the `false` path of the choice. - * @type {ForkContext} - */ - this.falseForkContext = ForkContext.newEmpty(forkContext); - - /** - * The fork context for when the choice result is `null` or `undefined`. - * @type {ForkContext} - */ - this.nullishForkContext = ForkContext.newEmpty(forkContext); - - /** - * Indicates if any of `trueForkContext`, `falseForkContext`, or - * `nullishForkContext` have been updated with segments from a child context. - * @type {boolean} - */ - this.processed = false; - } - -} - -/** - * Base class for all loop contexts. - */ -class LoopContextBase { - - /** - * Creates a new instance. - * @param {LoopContext|null} upperContext The previous `LoopContext`. - * @param {string} type The AST node's `type` for the loop. - * @param {string|null} label The label for the loop from an enclosing `LabeledStatement`. - * @param {BreakContext} breakContext The context for breaking the loop. - */ - constructor(upperContext, type, label, breakContext) { - - /** - * The previous `LoopContext`. - * @type {LoopContext} - */ - this.upper = upperContext; - - /** - * The AST node's `type` for the loop. - * @type {string} - */ - this.type = type; - - /** - * The label for the loop from an enclosing `LabeledStatement`. - * @type {string|null} - */ - this.label = label; - - /** - * The fork context for when `break` is encountered. - * @type {ForkContext} - */ - this.brokenForkContext = breakContext.brokenForkContext; - } -} - -/** - * Represents the context for a `while` loop. - */ -class WhileLoopContext extends LoopContextBase { - - /** - * Creates a new instance. - * @param {LoopContext|null} upperContext The previous `LoopContext`. - * @param {string|null} label The label for the loop from an enclosing `LabeledStatement`. - * @param {BreakContext} breakContext The context for breaking the loop. - */ - constructor(upperContext, label, breakContext) { - super(upperContext, "WhileStatement", label, breakContext); - - /** - * The hardcoded literal boolean test condition for - * the loop. Used to catch infinite or skipped loops. - * @type {boolean|undefined} - */ - this.test = void 0; - - /** - * The segments representing the test condition where `continue` will - * jump to. The test condition will typically have just one segment but - * it's possible for there to be more than one. - * @type {Array|null} - */ - this.continueDestSegments = null; - } -} - -/** - * Represents the context for a `do-while` loop. - */ -class DoWhileLoopContext extends LoopContextBase { - - /** - * Creates a new instance. - * @param {LoopContext|null} upperContext The previous `LoopContext`. - * @param {string|null} label The label for the loop from an enclosing `LabeledStatement`. - * @param {BreakContext} breakContext The context for breaking the loop. - * @param {ForkContext} forkContext The enclosing fork context. - */ - constructor(upperContext, label, breakContext, forkContext) { - super(upperContext, "DoWhileStatement", label, breakContext); - - /** - * The hardcoded literal boolean test condition for - * the loop. Used to catch infinite or skipped loops. - * @type {boolean|undefined} - */ - this.test = void 0; - - /** - * The segments at the start of the loop body. This is the only loop - * where the test comes at the end, so the first iteration always - * happens and we need a reference to the first statements. - * @type {Array|null} - */ - this.entrySegments = null; - - /** - * The fork context to follow when a `continue` is found. - * @type {ForkContext} - */ - this.continueForkContext = ForkContext.newEmpty(forkContext); - } -} - -/** - * Represents the context for a `for` loop. - */ -class ForLoopContext extends LoopContextBase { - - /** - * Creates a new instance. - * @param {LoopContext|null} upperContext The previous `LoopContext`. - * @param {string|null} label The label for the loop from an enclosing `LabeledStatement`. - * @param {BreakContext} breakContext The context for breaking the loop. - */ - constructor(upperContext, label, breakContext) { - super(upperContext, "ForStatement", label, breakContext); - - /** - * The hardcoded literal boolean test condition for - * the loop. Used to catch infinite or skipped loops. - * @type {boolean|undefined} - */ - this.test = void 0; - - /** - * The end of the init expression. This may change during the lifetime - * of the instance as we traverse the loop because some loops don't have - * an init expression. - * @type {Array|null} - */ - this.endOfInitSegments = null; - - /** - * The start of the test expression. This may change during the lifetime - * of the instance as we traverse the loop because some loops don't have - * a test expression. - * @type {Array|null} - */ - this.testSegments = null; - - /** - * The end of the test expression. This may change during the lifetime - * of the instance as we traverse the loop because some loops don't have - * a test expression. - * @type {Array|null} - */ - this.endOfTestSegments = null; - - /** - * The start of the update expression. This may change during the lifetime - * of the instance as we traverse the loop because some loops don't have - * an update expression. - * @type {Array|null} - */ - this.updateSegments = null; - - /** - * The end of the update expresion. This may change during the lifetime - * of the instance as we traverse the loop because some loops don't have - * an update expression. - * @type {Array|null} - */ - this.endOfUpdateSegments = null; - - /** - * The segments representing the test condition where `continue` will - * jump to. The test condition will typically have just one segment but - * it's possible for there to be more than one. This may change during the - * lifetime of the instance as we traverse the loop because some loops - * don't have an update expression. When there is an update expression, this - * will end up pointing to that expression; otherwise it will end up pointing - * to the test expression. - * @type {Array|null} - */ - this.continueDestSegments = null; - } -} - -/** - * Represents the context for a `for-in` loop. - * - * Terminology: - * - "left" means the part of the loop to the left of the `in` keyword. For - * example, in `for (var x in y)`, the left is `var x`. - * - "right" means the part of the loop to the right of the `in` keyword. For - * example, in `for (var x in y)`, the right is `y`. - */ -class ForInLoopContext extends LoopContextBase { - - /** - * Creates a new instance. - * @param {LoopContext|null} upperContext The previous `LoopContext`. - * @param {string|null} label The label for the loop from an enclosing `LabeledStatement`. - * @param {BreakContext} breakContext The context for breaking the loop. - */ - constructor(upperContext, label, breakContext) { - super(upperContext, "ForInStatement", label, breakContext); - - /** - * The segments that came immediately before the start of the loop. - * This allows you to traverse backwards out of the loop into the - * surrounding code. This is necessary to evaluate the right expression - * correctly, as it must be evaluated in the same way as the left - * expression, but the pointer to these segments would otherwise be - * lost if not stored on the instance. Once the right expression has - * been evaluated, this property is no longer used. - * @type {Array|null} - */ - this.prevSegments = null; - - /** - * Segments representing the start of everything to the left of the - * `in` keyword. This can be used to move forward towards - * `endOfLeftSegments`. `leftSegments` and `endOfLeftSegments` are - * effectively the head and tail of a doubly-linked list. - * @type {Array|null} - */ - this.leftSegments = null; - - /** - * Segments representing the end of everything to the left of the - * `in` keyword. This can be used to move backward towards `leftSegments`. - * `leftSegments` and `endOfLeftSegments` are effectively the head - * and tail of a doubly-linked list. - * @type {Array|null} - */ - this.endOfLeftSegments = null; - - /** - * The segments representing the left expression where `continue` will - * jump to. In `for-in` loops, `continue` must always re-execute the - * left expression each time through the loop. This contains the same - * segments as `leftSegments`, but is duplicated here so each loop - * context has the same property pointing to where `continue` should - * end up. - * @type {Array|null} - */ - this.continueDestSegments = null; - } -} - -/** - * Represents the context for a `for-of` loop. - */ -class ForOfLoopContext extends LoopContextBase { - - /** - * Creates a new instance. - * @param {LoopContext|null} upperContext The previous `LoopContext`. - * @param {string|null} label The label for the loop from an enclosing `LabeledStatement`. - * @param {BreakContext} breakContext The context for breaking the loop. - */ - constructor(upperContext, label, breakContext) { - super(upperContext, "ForOfStatement", label, breakContext); - - /** - * The segments that came immediately before the start of the loop. - * This allows you to traverse backwards out of the loop into the - * surrounding code. This is necessary to evaluate the right expression - * correctly, as it must be evaluated in the same way as the left - * expression, but the pointer to these segments would otherwise be - * lost if not stored on the instance. Once the right expression has - * been evaluated, this property is no longer used. - * @type {Array|null} - */ - this.prevSegments = null; - - /** - * Segments representing the start of everything to the left of the - * `of` keyword. This can be used to move forward towards - * `endOfLeftSegments`. `leftSegments` and `endOfLeftSegments` are - * effectively the head and tail of a doubly-linked list. - * @type {Array|null} - */ - this.leftSegments = null; - - /** - * Segments representing the end of everything to the left of the - * `of` keyword. This can be used to move backward towards `leftSegments`. - * `leftSegments` and `endOfLeftSegments` are effectively the head - * and tail of a doubly-linked list. - * @type {Array|null} - */ - this.endOfLeftSegments = null; - - /** - * The segments representing the left expression where `continue` will - * jump to. In `for-in` loops, `continue` must always re-execute the - * left expression each time through the loop. This contains the same - * segments as `leftSegments`, but is duplicated here so each loop - * context has the same property pointing to where `continue` should - * end up. - * @type {Array|null} - */ - this.continueDestSegments = null; - } -} - -/** - * Represents the context for any loop. - * @typedef {WhileLoopContext|DoWhileLoopContext|ForLoopContext|ForInLoopContext|ForOfLoopContext} LoopContext - */ - -/** - * Represents the context for a `switch` statement. - */ -class SwitchContext { - - /** - * Creates a new instance. - * @param {SwitchContext} upperContext The previous context. - * @param {boolean} hasCase Indicates if there is at least one `case` statement. - * `default` doesn't count. - */ - constructor(upperContext, hasCase) { - - /** - * The previous context. - * @type {SwitchContext} - */ - this.upper = upperContext; - - /** - * Indicates if there is at least one `case` statement. `default` doesn't count. - * @type {boolean} - */ - this.hasCase = hasCase; - - /** - * The `default` keyword. - * @type {Array|null} - */ - this.defaultSegments = null; - - /** - * The default case body starting segments. - * @type {Array|null} - */ - this.defaultBodySegments = null; - - /** - * Indicates if a `default` case and is empty exists. - * @type {boolean} - */ - this.foundEmptyDefault = false; - - /** - * Indicates that a `default` exists and is the last case. - * @type {boolean} - */ - this.lastIsDefault = false; - - /** - * The number of fork contexts created. This is equivalent to the - * number of `case` statements plus a `default` statement (if present). - * @type {number} - */ - this.forkCount = 0; - } -} - -/** - * Represents the context for a `try` statement. - */ -class TryContext { - - /** - * Creates a new instance. - * @param {TryContext} upperContext The previous context. - * @param {boolean} hasFinalizer Indicates if the `try` statement has a - * `finally` block. - * @param {ForkContext} forkContext The enclosing fork context. - */ - constructor(upperContext, hasFinalizer, forkContext) { - - /** - * The previous context. - * @type {TryContext} - */ - this.upper = upperContext; - - /** - * Indicates if the `try` statement has a `finally` block. - * @type {boolean} - */ - this.hasFinalizer = hasFinalizer; - - /** - * Tracks the traversal position inside of the `try` statement. This is - * used to help determine the context necessary to create paths because - * a `try` statement may or may not have `catch` or `finally` blocks, - * and code paths behave differently in those blocks. - * @type {"try"|"catch"|"finally"} - */ - this.position = "try"; - - /** - * If the `try` statement has a `finally` block, this affects how a - * `return` statement behaves in the `try` block. Without `finally`, - * `return` behaves as usual and doesn't require a fork; with `finally`, - * `return` forks into the `finally` block, so we need a fork context - * to track it. - * @type {ForkContext|null} - */ - this.returnedForkContext = hasFinalizer - ? ForkContext.newEmpty(forkContext) - : null; - - /** - * When a `throw` occurs inside of a `try` block, the code path forks - * into the `catch` or `finally` blocks, and this fork context tracks - * that path. - * @type {ForkContext} - */ - this.thrownForkContext = ForkContext.newEmpty(forkContext); - - /** - * Indicates if the last segment in the `try` block is reachable. - * @type {boolean} - */ - this.lastOfTryIsReachable = false; - - /** - * Indicates if the last segment in the `catch` block is reachable. - * @type {boolean} - */ - this.lastOfCatchIsReachable = false; - } -} - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Adds given segments into the `dest` array. - * If the `others` array does not include 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 based on a given label. - * @param {CodePathState} state The state to search within. - * @param {string|null} 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; - } - - /* c8 ignore next */ - return null; -} - -/** - * Gets a context for a `break` statement. - * @param {CodePathState} state The state to search within. - * @param {string|null} label The label of a `break` statement. - * @returns {BreakContext} 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; - } - - /* c8 ignore next */ - return null; -} - -/** - * Gets a context for a `return` statement. There is just one special case: - * if there is a `try` statement with a `finally` block, because that alters - * how `return` behaves; otherwise, this just passes through the given state. - * @param {CodePathState} state The state to search within - * @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. There is just one special case: - * if there is a `try` statement with a `finally` block and we are inside of - * a `catch` because that changes how `throw` behaves; otherwise, this just - * passes through the given state. - * @param {CodePathState} state The state to search within. - * @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 value from a given array. - * @param {any[]} elements An array to remove the specific element. - * @param {any} value The value to be removed. - * @returns {void} - */ -function removeFromArray(elements, value) { - elements.splice(elements.indexOf(value), 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 disconnectSegments(prevSegments, nextSegments) { - for (let i = 0; i < prevSegments.length; ++i) { - const prevSegment = prevSegments[i]; - const nextSegment = nextSegments[i]; - - removeFromArray(prevSegment.nextSegments, nextSegment); - removeFromArray(prevSegment.allNextSegments, nextSegment); - removeFromArray(nextSegment.prevSegments, prevSegment); - removeFromArray(nextSegment.allPrevSegments, prevSegment); - } -} - -/** - * Creates looping path between two arrays of segments, ensuring that there are - * paths going between matching segments in the arrays. - * @param {CodePathState} state The state to operate on. - * @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); - - /* - * This loop effectively updates a doubly-linked list between two collections - * of segments making sure that segments in the same array indices are - * combined to create a path. - */ - for (let i = 0; i < end; ++i) { - - // get the segments in matching array indices - const fromSegment = fromSegments[i]; - const toSegment = toSegments[i]; - - /* - * If the destination segment is reachable, then create a path from the - * source segment to the destination segment. - */ - if (toSegment.reachable) { - fromSegment.nextSegments.push(toSegment); - } - - /* - * If the source segment is reachable, then create a path from the - * destination segment back to the source segment. - */ - if (fromSegment.reachable) { - toSegment.prevSegments.push(fromSegment); - } - - /* - * Also update the arrays that don't care if the segments are reachable - * or not. This should always happen regardless of anything else. - */ - fromSegment.allNextSegments.push(toSegment); - toSegment.allPrevSegments.push(fromSegment); - - /* - * If the destination segment has at least two previous segments in its - * path then that means there was one previous segment before this iteration - * of the loop was executed. So, we need to mark the source segment as - * looped. - */ - if (toSegment.allPrevSegments.length >= 2) { - CodePathSegment.markPrevSegmentAsLooped(toSegment, fromSegment); - } - - // let the code path analyzer know that there's been a loop created - 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 this choice context doesn't already contain paths from a - * child context, then add the current head to each potential path. - */ - if (!choiceContext.processed) { - choiceContext.trueForkContext.add(head); - choiceContext.falseForkContext.add(head); - choiceContext.nullishForkContext.add(head); - } - - /* - * If the test condition isn't a hardcoded truthy value, then `break` - * must follow the same path as if the test condition is false. To represent - * that, we append the path for when the loop test is false (represented by - * `falseForkContext`) to the `brokenForkContext`. - */ - 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 { - - /** - * Creates a new instance. - * @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) { - - /** - * The ID generator to use when creating new segments. - * @type {IdGenerator} - */ - this.idGenerator = idGenerator; - - /** - * A callback function to call when there is a loop. - * @type {Function} - */ - this.notifyLooped = onLooped; - - /** - * The root fork context for this state. - * @type {ForkContext} - */ - this.forkContext = ForkContext.newRoot(idGenerator); - - /** - * Context for logical expressions, conditional expressions, `if` statements, - * and loops. - * @type {ChoiceContext} - */ - this.choiceContext = null; - - /** - * Context for `switch` statements. - * @type {SwitchContext} - */ - this.switchContext = null; - - /** - * Context for `try` statements. - * @type {TryContext} - */ - this.tryContext = null; - - /** - * Context for loop statements. - * @type {LoopContext} - */ - this.loopContext = null; - - /** - * Context for `break` statements. - * @type {BreakContext} - */ - this.breakContext = null; - - /** - * Context for `ChainExpression` nodes. - * @type {ChainContext} - */ - this.chainContext = null; - - /** - * An array that tracks the current segments in the state. The array - * starts empty and segments are added with each `onCodePathSegmentStart` - * event and removed with each `onCodePathSegmentEnd` event. Effectively, - * this is tracking the code path segment traversal as the state is - * modified. - * @type {Array} - */ - this.currentSegments = []; - - /** - * Tracks the starting segment for this path. This value never changes. - * @type {CodePathSegment} - */ - this.initialSegment = this.forkContext.head[0]; - - /** - * The final segments of the code path which are either `return` or `throw`. - * This is a union of the segments in `returnedForkContext` and `thrownForkContext`. - * @type {Array} - */ - this.finalSegments = []; - - /** - * The final segments of the code path which are `return`. These - * segments are also contained in `finalSegments`. - * @type {Array} - */ - this.returnedForkContext = []; - - /** - * The final segments of the code path which are `throw`. These - * segments are also contained in `finalSegments`. - * @type {Array} - */ - this.thrownForkContext = []; - - /* - * We add an `add` method so that these look more like fork contexts and - * can be used interchangeably when a fork context is needed to add more - * segments to a path. - * - * Ultimately, we want anything added to `returned` or `thrown` to also - * be added to `final`. We only add reachable and used segments to these - * arrays. - */ - 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); - } - - /** - * A passthrough property exposing the current pointer as part of the API. - * @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 Indicates if the result of the choice - * creates a fork. - * @returns {void} - */ - pushChoiceContext(kind, isForkingAsResult) { - this.choiceContext = new ChoiceContext(this.choiceContext, kind, isForkingAsResult, this.forkContext); - } - - /** - * Pops the last choice context and finalizes it. - * This is called upon leaving a node that represents a choice. - * @throws {Error} (Unreachable.) - * @returns {ChoiceContext} The popped context. - */ - popChoiceContext() { - const poppedChoiceContext = this.choiceContext; - const forkContext = this.forkContext; - const head = forkContext.head; - - this.choiceContext = poppedChoiceContext.upper; - - switch (poppedChoiceContext.kind) { - case "&&": - case "||": - case "??": - - /* - * The `head` are the path of the right-hand operand. - * If we haven't previously added segments from child contexts, - * then we add these segments to all possible forks. - */ - if (!poppedChoiceContext.processed) { - poppedChoiceContext.trueForkContext.add(head); - poppedChoiceContext.falseForkContext.add(head); - poppedChoiceContext.nullishForkContext.add(head); - } - - /* - * If this context is the left (test) expression for another choice - * context, such as `a || b` in the expression `a || b || c`, - * then we take the segments for this context and move them up - * to the parent context. - */ - if (poppedChoiceContext.isForkingAsResult) { - const parentContext = this.choiceContext; - - parentContext.trueForkContext.addAll(poppedChoiceContext.trueForkContext); - parentContext.falseForkContext.addAll(poppedChoiceContext.falseForkContext); - parentContext.nullishForkContext.addAll(poppedChoiceContext.nullishForkContext); - parentContext.processed = true; - - // Exit early so we don't collapse all paths into one. - return poppedChoiceContext; - } - - break; - - case "test": - if (!poppedChoiceContext.processed) { - - /* - * The head segments are the path of the `if` block here. - * Updates the `true` path with the end of the `if` block. - */ - poppedChoiceContext.trueForkContext.clear(); - poppedChoiceContext.trueForkContext.add(head); - } else { - - /* - * The head segments are the path of the `else` block here. - * Updates the `false` path with the end of the `else` - * block. - */ - poppedChoiceContext.falseForkContext.clear(); - poppedChoiceContext.falseForkContext.add(head); - } - - break; - - case "loop": - - /* - * Loops are addressed in `popLoopContext()` so just return - * the context without modification. - */ - return poppedChoiceContext; - - /* c8 ignore next */ - default: - throw new Error("unreachable"); - } - - /* - * Merge the true path with the false path to create a single path. - */ - const combinedForkContext = poppedChoiceContext.trueForkContext; - - combinedForkContext.addAll(poppedChoiceContext.falseForkContext); - forkContext.replaceHead(combinedForkContext.makeNext(0, -1)); - - return poppedChoiceContext; - } - - /** - * Creates a code path segment to represent right-hand operand of a logical - * expression. - * This is called in the preprocessing phase when entering a node. - * @throws {Error} (Unreachable.) - * @returns {void} - */ - makeLogicalRight() { - const currentChoiceContext = this.choiceContext; - const forkContext = this.forkContext; - - if (currentChoiceContext.processed) { - - /* - * This context was already assigned segments from a child - * choice context. In this case, we are concerned only about - * the path that does not short-circuit and so ends up on the - * right-hand operand of the logical expression. - */ - let prevForkContext; - - switch (currentChoiceContext.kind) { - case "&&": // if true then go to the right-hand side. - prevForkContext = currentChoiceContext.trueForkContext; - break; - case "||": // if false then go to the right-hand side. - prevForkContext = currentChoiceContext.falseForkContext; - break; - case "??": // Both true/false can short-circuit, so needs the third path to go to the right-hand side. That's nullishForkContext. - prevForkContext = currentChoiceContext.nullishForkContext; - break; - default: - throw new Error("unreachable"); - } - - /* - * Create the segment for the right-hand operand of the logical expression - * and adjust the fork context pointer to point there. The right-hand segment - * is added at the end of all segments in `prevForkContext`. - */ - forkContext.replaceHead(prevForkContext.makeNext(0, -1)); - - /* - * We no longer need this list of segments. - * - * Reset `processed` because we've removed the segments from the child - * choice context. This allows `popChoiceContext()` to continue adding - * segments later. - */ - prevForkContext.clear(); - currentChoiceContext.processed = false; - - } else { - - /* - * This choice context was not assigned segments from a child - * choice context, which means that it's a terminal logical - * expression. - * - * `head` is the segments for the left-hand operand of the - * logical expression. - * - * Each of the fork contexts below are empty at this point. We choose - * the path(s) that will short-circuit and add the segment for the - * left-hand operand to it. Ultimately, this will be the only segment - * in that path due to the short-circuting, so we are just seeding - * these paths to start. - */ - switch (currentChoiceContext.kind) { - case "&&": - - /* - * In most contexts, when a && expression evaluates to false, - * it short circuits, so we need to account for that by setting - * the `falseForkContext` to the left operand. - * - * When a && expression is the left-hand operand for a ?? - * expression, such as `(a && b) ?? c`, a nullish value will - * also short-circuit in a different way than a false value, - * so we also set the `nullishForkContext` to the left operand. - * This path is only used with a ?? expression and is thrown - * away for any other type of logical expression, so it's safe - * to always add. - */ - currentChoiceContext.falseForkContext.add(forkContext.head); - currentChoiceContext.nullishForkContext.add(forkContext.head); - break; - case "||": // the true path can short-circuit. - currentChoiceContext.trueForkContext.add(forkContext.head); - break; - case "??": // both can short-circuit. - currentChoiceContext.trueForkContext.add(forkContext.head); - currentChoiceContext.falseForkContext.add(forkContext.head); - break; - default: - throw new Error("unreachable"); - } - - /* - * Create the segment for the right-hand operand of the logical expression - * and adjust the fork context pointer to point there. - */ - 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.nullishForkContext.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 - //-------------------------------------------------------------------------- - - /** - * Pushes a new `ChainExpression` context to the stack. This method is - * called when entering a `ChainExpression` node. A chain 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 = new ChainContext(this.chainContext); - } - - /** - * 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.choiceContextCount; 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.choiceContextCount += 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 = new SwitchContext(this.switchContext, hasCase); - 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.forkCount === 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); - - /* - * Any value that doesn't match a `case` test should flow to the default - * case. That happens normally when the default case is last in the `switch`, - * but if it's not, we need to rewire some of the paths to be correct. - */ - if (!context.lastIsDefault) { - if (context.defaultBodySegments) { - - /* - * There is a non-empty default case, so remove the path from the `default` - * label to its body for an accurate representation. - */ - disconnectSegments(context.defaultSegments, context.defaultBodySegments); - - /* - * Connect the path from the last non-default case to the body of the - * default case. - */ - makeLooped(this, lastCaseSegments, context.defaultBodySegments); - - } else { - - /* - * There is no default case, so we treat this as if the last case - * had a `break` in it. - */ - brokenForkContext.add(lastCaseSegments); - } - } - - // Traverse up to the original fork context for the `switch` statement - for (let i = 0; i < context.forkCount; ++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} isCaseBodyEmpty `true` if the body is empty. - * @param {boolean} isDefaultCase `true` if the body is the default case. - * @returns {void} - */ - makeSwitchCaseBody(isCaseBodyEmpty, isDefaultCase) { - 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)); - - /* - * Add information about the default case. - * - * The purpose of this is to identify the starting segments for the - * default case to make sure there is a path there. - */ - if (isDefaultCase) { - - /* - * This is the default case in the `switch`. - * - * We first save the current pointer as `defaultSegments` to point - * to the `default` keyword. - */ - context.defaultSegments = parentForkContext.head; - - /* - * If the body of the case is empty then we just set - * `foundEmptyDefault` to true; otherwise, we save a reference - * to the current pointer as `defaultBodySegments`. - */ - if (isCaseBodyEmpty) { - context.foundEmptyDefault = true; - } else { - context.defaultBodySegments = forkContext.head; - } - - } else { - - /* - * This is not the default case in the `switch`. - * - * If it's not empty and there is already an empty default case found, - * that means the default case actually comes before this case, - * and that it will fall through to this case. So, we can now - * ignore the previous default case (reset `foundEmptyDefault` to false) - * and set `defaultBodySegments` to the current segments because this is - * effectively the new default case. - */ - if (!isCaseBodyEmpty && context.foundEmptyDefault) { - context.foundEmptyDefault = false; - context.defaultBodySegments = forkContext.head; - } - } - - // keep track if the default case ends up last - context.lastIsDefault = isDefaultCase; - context.forkCount += 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 = new TryContext(this.tryContext, hasFinalizer, this.forkContext); - } - - /** - * Pops the last context of TryStatement and finalizes it. - * @returns {void} - */ - popTryContext() { - const context = this.tryContext; - - this.tryContext = context.upper; - - /* - * If we're inside the `catch` block, that means there is no `finally`, - * so we can process the `try` and `catch` blocks the simple way and - * merge their two paths. - */ - if (context.position === "catch") { - this.popForkContext(); - return; - } - - /* - * The following process is executed only when there is a `finally` - * block. - */ - - const originalReturnedForkContext = context.returnedForkContext; - const originalThrownForkContext = context.thrownForkContext; - - // no `return` or `throw` in `try` or `catch` so there's nothing left to do - if (originalReturnedForkContext.empty && originalThrownForkContext.empty) { - return; - } - - /* - * The following process is executed only when there is a `finally` - * block and there was a `return` or `throw` in the `try` or `catch` - * blocks. - */ - - // 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 (!originalReturnedForkContext.empty) { - getReturnContext(this).returnedForkContext.add(leavingSegments); - } - if (!originalThrownForkContext.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 originalThrownForkContext = context.thrownForkContext; - - /* - * We are now in a catch block so we need to update the context - * with that information. This includes creating a new fork - * context in case we encounter any `throw` statements here. - */ - context.position = "catch"; - context.thrownForkContext = ForkContext.newEmpty(forkContext); - context.lastOfTryIsReachable = forkContext.reachable; - - // Merge the thrown paths from the `try` and `catch` blocks - originalThrownForkContext.add(forkContext.head); - const thrownSegments = originalThrownForkContext.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 originalReturnedForkContext = context.returnedForkContext; - const originalThrownForContext = 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 there was no `return` or `throw` in either the `try` or `catch` - * blocks, then there's no further code paths to create for `finally`. - */ - if (originalReturnedForkContext.empty && originalThrownForContext.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 < originalReturnedForkContext.segmentsList.length; ++j) { - prevSegsOfLeavingSegment.push(originalReturnedForkContext.segmentsList[j][i]); - } - for (let j = 0; j < originalThrownForContext.segmentsList.length; ++j) { - prevSegsOfLeavingSegment.push(originalThrownForContext.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; - - // All loops need a path to account for `break` statements - const breakContext = this.pushBreakContext(true, label); - - switch (type) { - case "WhileStatement": - this.pushChoiceContext("loop", false); - this.loopContext = new WhileLoopContext(this.loopContext, label, breakContext); - break; - - case "DoWhileStatement": - this.pushChoiceContext("loop", false); - this.loopContext = new DoWhileLoopContext(this.loopContext, label, breakContext, forkContext); - break; - - case "ForStatement": - this.pushChoiceContext("loop", false); - this.loopContext = new ForLoopContext(this.loopContext, label, breakContext); - break; - - case "ForInStatement": - this.loopContext = new ForInLoopContext(this.loopContext, label, breakContext); - break; - - case "ForOfStatement": - this.loopContext = new ForOfLoopContext(this.loopContext, label, breakContext); - break; - - /* c8 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(); - - /* - * Creates the path from the end of the loop body up to the - * location where `continue` would jump to. - */ - 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 this isn't a hardcoded `true` condition, then `break` - * should continue down the path as if the condition evaluated - * to false. - */ - if (context.test !== true) { - brokenForkContext.addAll(choiceContext.falseForkContext); - } - - /* - * When the condition is true, the loop continues back to the top, - * so create a path from each possible true condition back to the - * top of the loop. - */ - 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); - - /* - * Creates the path from the end of the loop body up to the - * left expression (left of `in` or `of`) of the loop. - */ - makeLooped( - this, - forkContext.head, - context.leftSegments - ); - break; - - /* c8 ignore next */ - default: - throw new Error("unreachable"); - } - - /* - * If there wasn't a `break` statement in the loop, then we're at - * the end of the loop's path, so we make an unreachable segment - * to mark that. - * - * If there was a `break` statement, then we continue on into the - * `brokenForkContext`. - */ - 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); - } - - /* - * If this isn't a hardcoded `true` condition, then `break` - * should continue down the path as if the condition evaluated - * to false. - */ - 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; - - /* - * If there is a `continue` statement in the loop then `continueForkContext` - * won't be empty. We wire up the path from `continue` to the loop - * test condition and then continue the traversal in the root fork context. - */ - 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 the state. - * - * The `continueDestSegments` are set to `testSegments` because we - * don't yet know if there is an update expression in this loop. So, - * from what we already know at this point, a `continue` statement - * will jump back to the test expression. - */ - 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 the state. - * - * The `continueDestSegments` are now set to `updateSegments` because we - * know there is an update expression in this loop. So, a `continue` statement - * in the loop will jump to the update expression first, and then to any - * test expression the loop might have. - */ - 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; - - /* - * Determine what to do based on which part of the `for` loop are present. - * 1. If there is an update expression, then `updateSegments` is not null and - * we need to assign `endOfUpdateSegments`, and if there is a test - * expression, we then need to create the looped path to get back to - * the test condition. - * 2. If there is no update expression but there is a test expression, - * then we only need to update the test segment information. - * 3. If there is no update expression and no test expression, then we - * just save `endOfInitSegments`. - */ - if (context.updateSegments) { - context.endOfUpdateSegments = forkContext.head; - - /* - * In a `for` loop that has both an update expression and a test - * condition, execution flows from the test expression into the - * loop body, to the update expression, and then back to the test - * expression to determine if the loop should continue. - * - * To account for that, we need to make a path from the end of the - * update expression to the start of the test expression. This is - * effectively what creates the loop in the code path. - */ - 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 there is a test condition, then there `endOfTestSegments` is also - * the start of the loop body. If there isn't a test condition then - * `bodySegments` will be null and we need to look elsewhere to find - * the start of the body. - * - * The body starts at the end of the init expression and ends at the end - * of the update expression, so we use those locations to determine the - * body segments. - */ - if (!bodySegments) { - - const prevForkContext = ForkContext.newEmpty(forkContext); - - prevForkContext.add(context.endOfInitSegments); - if (context.endOfUpdateSegments) { - prevForkContext.add(context.endOfUpdateSegments); - } - - bodySegments = prevForkContext.makeNext(0, -1); - } - - /* - * If there was no test condition and no update expression, then - * `continueDestSegments` will be null. In that case, a - * `continue` should skip directly to the body of the loop. - * Otherwise, we want to keep the current `continueDestSegments`. - */ - context.continueDestSegments = context.continueDestSegments || bodySegments; - - // move pointer to the body - 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 in which a `break` statement can be used. This occurs inside of a loop, - * labeled statement, or switch statement. - * @param {boolean} breakable Indicates if we are inside a statement where - * `break` without a label will exit the statement. - * @param {string|null} label The label associated with the statement. - * @returns {BreakContext} The new context. - */ - pushBreakContext(breakable, label) { - this.breakContext = new BreakContext(this.breakContext, breakable, label, 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|null} label A label of the break statement. - * @returns {void} - */ - makeBreak(label) { - const forkContext = this.forkContext; - - if (!forkContext.reachable) { - return; - } - - const context = getBreakContext(this, label); - - - if (context) { - context.brokenForkContext.add(forkContext.head); - } - - /* c8 ignore next */ - 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|null} label A label of the continue statement. - * @returns {void} - */ - makeContinue(label) { - const forkContext = this.forkContext; - - if (!forkContext.reachable) { - return; - } - - const context = getContinueContext(this, label); - - if (context) { - if (context.continueDestSegments) { - makeLooped(this, forkContext.head, context.continueDestSegments); - - // If the context is a for-in/of loop, this affects 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 deleted file mode 100644 index 8c438e2..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/code-path.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * @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. This is the segment that is at the head - * of the code path. - * This is a passthrough to the underlying `CodePathState`. - * @type {CodePathSegment} - */ - get initialSegment() { - return this.internal.initialSegment; - } - - /** - * Final code path segments. These are the terminal (tail) segments in the - * code path, which is the combination of `returnedSegments` and `thrownSegments`. - * All segments in this array are reachable. - * This is a passthrough to the underlying `CodePathState`. - * @type {CodePathSegment[]} - */ - get finalSegments() { - return this.internal.finalSegments; - } - - /** - * Final code path segments that represent normal completion of the code path. - * For functions, this means both explicit `return` statements and implicit returns, - * such as the last reachable segment in a function that does not have an - * explicit `return` as this implicitly returns `undefined`. For scripts, - * modules, class field initializers, and class static blocks, this means - * all lines of code have been executed. - * These segments are also present in `finalSegments`. - * This is a passthrough to the underlying `CodePathState`. - * @type {CodePathSegment[]} - */ - get returnedSegments() { - return this.internal.returnedForkContext; - } - - /** - * Final code path segments that represent `throw` statements. - * This is a passthrough to the underlying `CodePathState`. - * These segments are also present in `finalSegments`. - * @type {CodePathSegment[]} - */ - get thrownSegments() { - return this.internal.thrownForkContext; - } - - /** - * Traverses all segments in this code path. - * - * codePath.traverseSegments((segment, controller) => { - * // do something. - * }); - * - * This method enumerates segments in order from the head. - * - * The `controller` argument has two methods: - * - * - `skip()` - skips the following segments in this branch - * - `break()` - skips all following segments in the traversal - * - * A note on the parameters: the `options` argument is optional. This means - * the first argument might be an options object or the callback function. - * @param {Object} [optionsOrCallback] Optional first and last segments to traverse. - * @param {CodePathSegment} [optionsOrCallback.first] The first segment to traverse. - * @param {CodePathSegment} [optionsOrCallback.last] The last segment to traverse. - * @param {Function} callback A callback function. - * @returns {void} - */ - traverseSegments(optionsOrCallback, callback) { - - // normalize the arguments into a callback and options - let resolvedOptions; - let resolvedCallback; - - if (typeof optionsOrCallback === "function") { - resolvedCallback = optionsOrCallback; - resolvedOptions = {}; - } else { - resolvedOptions = optionsOrCallback || {}; - resolvedCallback = callback; - } - - // determine where to start traversing from based on the options - const startSegment = resolvedOptions.first || this.internal.initialSegment; - const lastSegment = resolvedOptions.last; - - // set up initial location information - let record; - let index; - let end; - let segment = null; - - // segments that have already been visited during traversal - const visited = new Set(); - - // tracks the traversal steps - const stack = [[startSegment, 0]]; - - // segments that have been skipped during traversal - const skipped = new Set(); - - // indicates if we exited early from the traversal - let broken = false; - - /** - * Maintains traversal state. - */ - const controller = { - - /** - * Skip the following segments in this branch. - * @returns {void} - */ - skip() { - skipped.add(segment); - }, - - /** - * Stop traversal completely - do not traverse to any - * other segments. - * @returns {void} - */ - break() { - broken = true; - } - }; - - /** - * Checks if 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.has(prevSegment) || - segment.isLoopedPrevSegment(prevSegment) - ); - } - - /** - * Checks if a given previous segment has been skipped. - * @param {CodePathSegment} prevSegment A previous segment to check. - * @returns {boolean} `true` if the segment has been skipped. - */ - function isSkipped(prevSegment) { - return ( - skipped.has(prevSegment) || - segment.isLoopedPrevSegment(prevSegment) - ); - } - - // the traversal - while (stack.length > 0) { - - /* - * This isn't a pure stack. We use the top record all the time - * but don't always pop it off. The record is popped only if - * one of the following is true: - * - * 1) We have already visited the segment. - * 2) We have not visited *all* of the previous segments. - * 3) We have traversed past the available next segments. - * - * Otherwise, we just read the value and sometimes modify the - * record as we traverse. - */ - record = stack.at(-1); - segment = record[0]; - index = record[1]; - - if (index === 0) { - - // Skip if this segment has been visited already. - if (visited.has(segment)) { - 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; - } - - visited.add(segment); - - - // Skips the segment if all previous segments have been skipped. - const shouldSkip = ( - skipped.size > 0 && - segment.prevSegments.length > 0 && - segment.prevSegments.every(isSkipped) - ); - - /* - * If the most recent segment hasn't been skipped, then we call - * the callback, passing in the segment and the controller. - */ - if (!shouldSkip) { - resolvedCallback.call(this, segment, controller); - - // exit if we're at the last segment - if (segment === lastSegment) { - controller.skip(); - } - - /* - * If the previous statement was executed, or if the callback - * called a method on the controller, we might need to exit the - * loop, so check for that and break accordingly. - */ - if (broken) { - break; - } - } else { - - // If the most recent segment has been skipped, then mark it as skipped. - skipped.add(segment); - } - } - - // Update the stack. - end = segment.nextSegments.length - 1; - if (index < end) { - - /* - * If we haven't yet visited all of the next segments, update - * the current top record on the stack to the next index to visit - * and then push a record for the current segment on top. - * - * Setting the current top record's index lets us know how many - * times we've been here and ensures that the segment won't be - * reprocessed (because we only process segments with an index - * of 0). - */ - record[1] += 1; - stack.push([segment.nextSegments[index], 0]); - } else if (index === end) { - - /* - * If we are at the last next segment, then reset the top record - * in the stack to next segment and set its index to 0 so it will - * be processed next. - */ - record[0] = segment.nextSegments[index]; - record[1] = 0; - } else { - - /* - * If index > end, that means we have no more segments that need - * processing. So, we pop that record off of the stack in order to - * continue traversing at the next level up. - */ - 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 deleted file mode 100644 index c0e01a8..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * @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. - */ -/* c8 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 : /* c8 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 : /* c8 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=true];\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 deleted file mode 100644 index d6598be..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/fork-context.js +++ /dev/null @@ -1,349 +0,0 @@ -/** - * @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("../../shared/assert"), - CodePathSegment = require("./code-path-segment"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines whether or not a given segment is reachable. - * @param {CodePathSegment} segment The segment to check. - * @returns {boolean} `true` if the segment is reachable. - */ -function isReachable(segment) { - return segment.reachable; -} - -/** - * Creates a new segment for each fork in the given context and appends it - * to the end of the specified range of segments. Ultimately, this ends up calling - * `new CodePathSegment()` for each of the forks using the `create` argument - * as a wrapper around special behavior. - * - * The `startIndex` and `endIndex` arguments specify a range of segments in - * `context` that should become `allPrevSegments` for the newly created - * `CodePathSegment` objects. - * - * When `context.segmentsList` is `[[a, b], [c, d], [e, f]]`, `begin` is `0`, and - * `end` is `-1`, this creates two new segments, `[g, h]`. This `g` is appended to - * the end of the path from `a`, `c`, and `e`. This `h` is appended to the end of - * `b`, `d`, and `f`. - * @param {ForkContext} context An instance from which the previous segments - * will be obtained. - * @param {number} startIndex The index of the first segment in the context - * that should be specified as previous segments for the newly created segments. - * @param {number} endIndex The index of the last segment in the context - * that should be specified as previous segments for the newly created segments. - * @param {Function} create A function that creates new `CodePathSegment` - * instances in a particular way. See the `CodePathSegment.new*` methods. - * @returns {Array} An array of the newly-created segments. - */ -function createSegments(context, startIndex, endIndex, create) { - - /** @type {Array>} */ - const list = context.segmentsList; - - /* - * Both `startIndex` and `endIndex` work the same way: if the number is zero - * or more, then the number is used as-is. If the number is negative, - * then that number is added to the length of the segments list to - * determine the index to use. That means -1 for either argument - * is the last element, -2 is the second to last, and so on. - * - * So if `startIndex` is 0, `endIndex` is -1, and `list.length` is 3, the - * effective `startIndex` is 0 and the effective `endIndex` is 2, so this function - * will include items at indices 0, 1, and 2. - * - * Therefore, if `startIndex` is -1 and `endIndex` is -1, that means we'll only - * be using the last segment in `list`. - */ - const normalizedBegin = startIndex >= 0 ? startIndex : list.length + startIndex; - const normalizedEnd = endIndex >= 0 ? endIndex : list.length + endIndex; - - /** @type {Array} */ - const segments = []; - - for (let i = 0; i < context.count; ++i) { - - // this is passed into `new CodePathSegment` to add to code path. - const allPrevSegments = []; - - for (let j = normalizedBegin; j <= normalizedEnd; ++j) { - allPrevSegments.push(list[j][i]); - } - - // note: `create` is just a wrapper that augments `new CodePathSegment`. - segments.push(create(context.idGenerator.next(), allPrevSegments)); - } - - return segments; -} - -/** - * Inside of a `finally` block we end up with two parallel paths. If the code path - * exits by a control statement (such as `break` or `continue`) from the `finally` - * block, then we need to merge the remaining parallel paths back into one. - * @param {ForkContext} context The fork context to work on. - * @param {Array} segments Segments to merge. - * @returns {Array} The merged segments. - */ -function mergeExtraSegments(context, segments) { - let currentSegments = segments; - - /* - * We need to ensure that the array returned from this function contains no more - * than the number of segments that the context allows. `context.count` indicates - * how many items should be in the returned array to ensure that the new segment - * entries will line up with the already existing segment entries. - */ - while (currentSegments.length > context.count) { - const merged = []; - - /* - * Because `context.count` is a factor of 2 inside of a `finally` block, - * we can divide the segment count by 2 to merge the paths together. - * This loops through each segment in the list and creates a new `CodePathSegment` - * that has the segment and the segment two slots away as previous segments. - * - * If `currentSegments` is [a,b,c,d], this will create new segments e and f, such - * that: - * - * When `i` is 0: - * a->e - * c->e - * - * When `i` is 1: - * b->f - * d->f - */ - for (let i = 0, length = Math.floor(currentSegments.length / 2); i < length; ++i) { - merged.push(CodePathSegment.newNext( - context.idGenerator.next(), - [currentSegments[i], currentSegments[i + length]] - )); - } - - /* - * Go through the loop condition one more time to see if we have the - * number of segments for the context. If not, we'll keep merging paths - * of the merged segments until we get there. - */ - currentSegments = merged; - } - - return currentSegments; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Manages the forking of code paths. - */ -class ForkContext { - - /** - * Creates a new instance. - * @param {IdGenerator} idGenerator An identifier generator for segments. - * @param {ForkContext|null} upper The preceding fork context. - * @param {number} count The number of parallel segments in each element - * of `segmentsList`. - */ - constructor(idGenerator, upper, count) { - - /** - * The ID generator that will generate segment IDs for any new - * segments that are created. - * @type {IdGenerator} - */ - this.idGenerator = idGenerator; - - /** - * The preceding fork context. - * @type {ForkContext|null} - */ - this.upper = upper; - - /** - * The number of elements in each element of `segmentsList`. In most - * cases, this is 1 but can be 2 when there is a `finally` present, - * which forks the code path outside of normal flow. In the case of nested - * `finally` blocks, this can be a multiple of 2. - * @type {number} - */ - this.count = count; - - /** - * The segments within this context. Each element in this array has - * `count` elements that represent one step in each fork. For example, - * when `segmentsList` is `[[a, b], [c, d], [e, f]]`, there is one path - * a->c->e and one path b->d->f, and `count` is 2 because each element - * is an array with two elements. - * @type {Array>} - */ - this.segmentsList = []; - } - - /** - * The segments that begin this fork context. - * @type {Array} - */ - get head() { - const list = this.segmentsList; - - return list.length === 0 ? [] : list.at(-1); - } - - /** - * Indicates if the context contains no segments. - * @type {boolean} - */ - get empty() { - return this.segmentsList.length === 0; - } - - /** - * Indicates if there are any segments that are reachable. - * @type {boolean} - */ - get reachable() { - const segments = this.head; - - return segments.length > 0 && segments.some(isReachable); - } - - /** - * Creates new segments in this context and appends them to the end of the - * already existing `CodePathSegment`s specified by `startIndex` and - * `endIndex`. - * @param {number} startIndex The index of the first segment in the context - * that should be specified as previous segments for the newly created segments. - * @param {number} endIndex The index of the last segment in the context - * that should be specified as previous segments for the newly created segments. - * @returns {Array} An array of the newly created segments. - */ - makeNext(startIndex, endIndex) { - return createSegments(this, startIndex, endIndex, CodePathSegment.newNext); - } - - /** - * Creates new unreachable segments in this context and appends them to the end of the - * already existing `CodePathSegment`s specified by `startIndex` and - * `endIndex`. - * @param {number} startIndex The index of the first segment in the context - * that should be specified as previous segments for the newly created segments. - * @param {number} endIndex The index of the last segment in the context - * that should be specified as previous segments for the newly created segments. - * @returns {Array} An array of the newly created segments. - */ - makeUnreachable(startIndex, endIndex) { - return createSegments(this, startIndex, endIndex, CodePathSegment.newUnreachable); - } - - /** - * Creates new segments in this context and does not append them to the end - * of the already existing `CodePathSegment`s specified by `startIndex` and - * `endIndex`. The `startIndex` and `endIndex` are only used to determine if - * the new segments should be reachable. If any of the segments in this range - * are reachable then the new segments are also reachable; otherwise, the new - * segments are unreachable. - * @param {number} startIndex The index of the first segment in the context - * that should be considered for reachability. - * @param {number} endIndex The index of the last segment in the context - * that should be considered for reachability. - * @returns {Array} An array of the newly created segments. - */ - makeDisconnected(startIndex, endIndex) { - return createSegments(this, startIndex, endIndex, CodePathSegment.newDisconnected); - } - - /** - * Adds segments to the head of this context. - * @param {Array} segments The 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 the given segments. - * The current head segments are removed. - * @param {Array} replacementHeadSegments The new head segments. - * @returns {void} - */ - replaceHead(replacementHeadSegments) { - assert( - replacementHeadSegments.length >= this.count, - `${replacementHeadSegments.length} >= ${this.count}` - ); - this.segmentsList.splice(-1, 1, mergeExtraSegments(this, replacementHeadSegments)); - } - - /** - * Adds all segments of a given fork context into this context. - * @param {ForkContext} otherForkContext The fork context to add from. - * @returns {void} - */ - addAll(otherForkContext) { - assert(otherForkContext.count === this.count); - this.segmentsList.push(...otherForkContext.segmentsList); - } - - /** - * Clears all segments in this context. - * @returns {void} - */ - clear() { - this.segmentsList = []; - } - - /** - * Creates a new root context, meaning that there are no parent - * fork contexts. - * @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} shouldForkLeavingPath Indicates that we are inside of - * a `finally` block and should therefore fork the path that leaves - * `finally`. - * @returns {ForkContext} New fork context. - */ - static newEmpty(parentContext, shouldForkLeavingPath) { - return new ForkContext( - parentContext.idGenerator, - parentContext, - (shouldForkLeavingPath ? 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 deleted file mode 100644 index b580104..0000000 --- a/node_modules/eslint/lib/linter/code-path-analysis/id-generator.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @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; - - /* c8 ignore start */ - if (this.n < 0) { - this.n = 1; - }/* c8 ignore stop */ - - return this.prefix + this.n; - } -} - -module.exports = IdGenerator; diff --git a/node_modules/eslint/lib/linter/file-context.js b/node_modules/eslint/lib/linter/file-context.js deleted file mode 100644 index b669472..0000000 --- a/node_modules/eslint/lib/linter/file-context.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @fileoverview The FileContext class. - * @author Nicholas C. Zakas - */ - -"use strict"; - -/** - * Represents a file context that the linter can use to lint a file. - */ -class FileContext { - - /** - * The current working directory. - * @type {string} - */ - cwd; - - /** - * The filename of the file being linted. - * @type {string} - */ - filename; - - /** - * The physical filename of the file being linted. - * @type {string} - */ - physicalFilename; - - /** - * The source code of the file being linted. - * @type {SourceCode} - */ - sourceCode; - - /** - * The parser options for the file being linted. - * @type {Record} - * @deprecated Use `languageOptions` instead. - */ - parserOptions; - - /** - * The path to the parser used to parse this file. - * @type {string} - * @deprecated No longer supported. - */ - parserPath; - - /** - * The language options used when parsing this file. - * @type {Record} - */ - languageOptions; - - /** - * The settings for the file being linted. - * @type {Record} - */ - settings; - - /** - * Creates a new instance. - * @param {Object} config The configuration object for the file context. - * @param {string} config.cwd The current working directory. - * @param {string} config.filename The filename of the file being linted. - * @param {string} config.physicalFilename The physical filename of the file being linted. - * @param {SourceCode} config.sourceCode The source code of the file being linted. - * @param {Record} config.parserOptions The parser options for the file being linted. - * @param {string} config.parserPath The path to the parser used to parse this file. - * @param {Record} config.languageOptions The language options used when parsing this file. - * @param {Record} config.settings The settings for the file being linted. - */ - constructor({ - cwd, - filename, - physicalFilename, - sourceCode, - parserOptions, - parserPath, - languageOptions, - settings - }) { - this.cwd = cwd; - this.filename = filename; - this.physicalFilename = physicalFilename; - this.sourceCode = sourceCode; - this.parserOptions = parserOptions; - this.parserPath = parserPath; - this.languageOptions = languageOptions; - this.settings = settings; - - Object.freeze(this); - } - - /** - * Gets the current working directory. - * @returns {string} The current working directory. - * @deprecated Use `cwd` instead. - */ - getCwd() { - return this.cwd; - } - - /** - * Gets the filename of the file being linted. - * @returns {string} The filename of the file being linted. - * @deprecated Use `filename` instead. - */ - getFilename() { - return this.filename; - } - - /** - * Gets the physical filename of the file being linted. - * @returns {string} The physical filename of the file being linted. - * @deprecated Use `physicalFilename` instead. - */ - getPhysicalFilename() { - return this.physicalFilename; - } - - /** - * Gets the source code of the file being linted. - * @returns {SourceCode} The source code of the file being linted. - * @deprecated Use `sourceCode` instead. - */ - getSourceCode() { - return this.sourceCode; - } -} - -exports.FileContext = FileContext; diff --git a/node_modules/eslint/lib/linter/index.js b/node_modules/eslint/lib/linter/index.js deleted file mode 100644 index 9e53977..0000000 --- a/node_modules/eslint/lib/linter/index.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -const { Linter } = require("./linter"); -const SourceCodeFixer = require("./source-code-fixer"); - -module.exports = { - Linter, - - // For testers. - SourceCodeFixer -}; diff --git a/node_modules/eslint/lib/linter/interpolate.js b/node_modules/eslint/lib/linter/interpolate.js deleted file mode 100644 index 5f4ff92..0000000 --- a/node_modules/eslint/lib/linter/interpolate.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @fileoverview Interpolate keys from an object into a string with {{ }} markers. - * @author Jed Fox - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * Returns a global expression matching placeholders in messages. - * @returns {RegExp} Global regular expression matching placeholders - */ -function getPlaceholderMatcher() { - return /\{\{([^{}]+?)\}\}/gu; -} - -/** - * Replaces {{ placeholders }} in the message with the provided data. - * Does not replace placeholders not available in the data. - * @param {string} text Original message with potential placeholders - * @param {Record} data Map of placeholder name to its value - * @returns {string} Message with replaced placeholders - */ -function interpolate(text, data) { - if (!data) { - return text; - } - - const matcher = getPlaceholderMatcher(); - - // Substitution content for any {{ }} markers. - return text.replace(matcher, (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; - }); -} - -module.exports = { - getPlaceholderMatcher, - interpolate -}; diff --git a/node_modules/eslint/lib/linter/linter.js b/node_modules/eslint/lib/linter/linter.js deleted file mode 100644 index 007fcf4..0000000 --- a/node_modules/eslint/lib/linter/linter.js +++ /dev/null @@ -1,2407 +0,0 @@ -/** - * @fileoverview Main Linter Class - * @author Gyandeep Singh - * @author aladdin-add - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - path = require("node:path"), - eslintScope = require("eslint-scope"), - evk = require("eslint-visitor-keys"), - espree = require("espree"), - merge = require("lodash.merge"), - pkg = require("../../package.json"), - { - Legacy: { - ConfigOps, - ConfigValidator, - environments: BuiltInEnvironments - } - } = require("@eslint/eslintrc/universal"), - Traverser = require("../shared/traverser"), - { SourceCode } = require("../languages/js/source-code"), - applyDisableDirectives = require("./apply-disable-directives"), - { ConfigCommentParser } = require("@eslint/plugin-kit"), - 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 { startTime, endTime } = require("../shared/stats"); -const { RuleValidator } = require("../config/rule-validator"); -const { assertIsRuleSeverity } = require("../config/flat-config-schema"); -const { normalizeSeverityToString } = require("../shared/severity"); -const { deepMergeArrays } = require("../shared/deep-merge-arrays"); -const jslang = require("../languages/js"); -const { activeFlags, inactiveFlags } = require("../shared/flags"); -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 { LATEST_ECMA_VERSION } = require("../../conf/ecma-version"); -const { VFile } = require("./vfile"); -const { ParserService } = require("../services/parser-service"); -const { FileContext } = require("./file-context"); -const { ProcessorService } = require("../services/processor-service"); -const STEP_KIND_VISIT = 1; -const STEP_KIND_CALL = 2; - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @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 */ -/** @typedef {import("../shared/types").Times} Times */ -/** @typedef {import("@eslint/core").Language} Language */ -/** @typedef {import("@eslint/core").RuleSeverity} RuleSeverity */ -/** @typedef {import("@eslint/core").RuleConfig} RuleConfig */ - - -/* 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 {Times} times The times spent on applying a rule to a file (see `stats` option). - * @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. - * @property {Function} [ruleFilter] A predicate function that determines whether a given rule should run. - */ - -/** - * @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); -} - -/** - * 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; - variable.eslintExported = 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.hasOwn(ruleReplacements.rules, ruleId) - ? `Rule '${ruleId}' was removed and replaced by: ${ruleReplacements.rules[ruleId].join(", ")}` - : `Definition for rule '${ruleId}' was not found.`; -} - -/** - * Updates a given location based on the language offsets. This allows us to - * change 0-based locations to 1-based locations. We always want ESLint - * reporting lines and columns starting from 1. - * @param {Object} location The location to update. - * @param {number} location.line The starting line number. - * @param {number} location.column The starting column number. - * @param {number} [location.endLine] The ending line number. - * @param {number} [location.endColumn] The ending column number. - * @param {Language} language The language to use to adjust the location information. - * @returns {Object} The updated location. - */ -function updateLocationInformation({ line, column, endLine, endColumn }, language) { - - const columnOffset = language.columnStart === 1 ? 0 : 1; - const lineOffset = language.lineStart === 1 ? 0 : 1; - - // calculate separately to account for undefined - const finalEndLine = endLine === void 0 ? endLine : endLine + lineOffset; - const finalEndColumn = endColumn === void 0 ? endColumn : endColumn + columnOffset; - - return { - line: line + lineOffset, - column: column + columnOffset, - endLine: finalEndLine, - endColumn: finalEndColumn - }; -} - -/** - * 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 {RuleSeverity} [options.severity] the error message to report - * @param {Language} [options.language] the language to use to adjust the location information - * @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, - - // fallback for eslintrc mode - language = { - columnStart: 0, - lineStart: 1 - } - } = options; - - return { - ruleId, - message, - ...updateLocationInformation({ - line: loc.start.line, - column: loc.start.column, - endLine: loc.end.line, - endColumn: loc.end.column - }, language), - 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 {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 {ASTNode|token} options.node The Comment node/token. - * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules - * @param {Language} language The language to use to adjust the location information. - * @param {SourceCode} sourceCode The SourceCode object to get comments from. - * @returns {Object} Directives and problems from the comment - */ -function createDisableDirectives({ type, value, justification, node }, ruleMapper, language, sourceCode) { - const ruleIds = Object.keys(commentParser.parseListConfig(value)); - const directiveRules = ruleIds.length ? ruleIds : [null]; - const result = { - directives: [], // valid disable directives - directiveProblems: [] // problems in directives - }; - const parentDirective = { node, value, ruleIds }; - - for (const ruleId of directiveRules) { - - const loc = sourceCode.getLoc(node); - - // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/) - if (ruleId === null || !!ruleMapper(ruleId)) { - - - if (type === "disable-next-line") { - const { line, column } = updateLocationInformation( - loc.end, - language - ); - - result.directives.push({ - parentDirective, - type, - line, - column, - ruleId, - justification - }); - } else { - const { line, column } = updateLocationInformation( - loc.start, - language - ); - - result.directives.push({ - parentDirective, - type, - line, - column, - ruleId, - justification - }); - } - } else { - result.directiveProblems.push(createLintingProblem({ ruleId, loc, language })); - } - } - return result; -} - -/** - * 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 {SourceCode} sourceCode The SourceCode object to get comments from. - * @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. - * @param {ConfigData} config Provided config. - * @returns {{configuredRules: Object, enabledGlobals: {value:string,comment:Token}[], exportedVariables: Object, problems: LintMessage[], disableDirectives: DisableDirective[]}} - * A collection of the directive comments that were found, along with any problems that occurred when parsing - */ -function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig, config) { - const configuredRules = {}; - const enabledGlobals = Object.create(null); - const exportedVariables = {}; - const problems = []; - const disableDirectives = []; - const validator = new ConfigValidator({ - builtInRules: Rules - }); - - sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => { - - const directive = commentParser.parseDirective(comment.value); - - if (!directive) { - return; - } - - const { - label, - value, - justification: justificationPart - } = directive; - - const lineCommentSupported = /^eslint-disable-(next-)?line$/u.test(label); - - if (comment.type === "Line" && !lineCommentSupported) { - return; - } - - const loc = sourceCode.getLoc(comment); - - if (warnInlineConfig) { - const kind = comment.type === "Block" ? `/*${label}*/` : `//${label}`; - - problems.push(createLintingProblem({ - ruleId: null, - message: `'${kind}' has no effect because you have 'noInlineConfig' setting in ${warnInlineConfig}.`, - loc, - severity: 1 - })); - return; - } - - if (label === "eslint-disable-line" && loc.start.line !== loc.end.line) { - const message = `${label} comment should not span multiple lines.`; - - problems.push(createLintingProblem({ - ruleId: null, - message, - loc - })); - return; - } - - switch (label) { - case "eslint-disable": - case "eslint-enable": - case "eslint-disable-next-line": - case "eslint-disable-line": { - const directiveType = label.slice("eslint-".length); - const { directives, directiveProblems } = createDisableDirectives({ - type: directiveType, - value, - justification: justificationPart, - node: comment - }, ruleMapper, jslang, sourceCode); - - disableDirectives.push(...directives); - problems.push(...directiveProblems); - break; - } - - case "exported": - Object.assign(exportedVariables, commentParser.parseListConfig(value)); - break; - - case "globals": - case "global": - for (const [id, idSetting] of Object.entries(commentParser.parseStringConfig(value))) { - let normalizedValue; - - try { - normalizedValue = ConfigOps.normalizeConfigGlobal(idSetting); - } catch (err) { - problems.push(createLintingProblem({ - ruleId: null, - 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.parseJSONLikeConfig(value); - - if (parseResult.ok) { - Object.keys(parseResult.config).forEach(name => { - const rule = ruleMapper(name); - const ruleValue = parseResult.config[name]; - - if (!rule) { - problems.push(createLintingProblem({ ruleId: name, loc })); - return; - } - - if (Object.hasOwn(configuredRules, name)) { - problems.push(createLintingProblem({ - message: `Rule "${name}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`, - loc - })); - return; - } - - let ruleOptions = Array.isArray(ruleValue) ? ruleValue : [ruleValue]; - - /* - * If the rule was already configured, inline rule configuration that - * only has severity should retain options from the config and just override the severity. - * - * Example: - * - * { - * rules: { - * curly: ["error", "multi"] - * } - * } - * - * /* eslint curly: ["warn"] * / - * - * Results in: - * - * curly: ["warn", "multi"] - */ - if ( - - /* - * If inline config for the rule has only severity - */ - ruleOptions.length === 1 && - - /* - * And the rule was already configured - */ - config.rules && Object.hasOwn(config.rules, name) - ) { - - /* - * Then use severity from the inline config and options from the provided config - */ - ruleOptions = [ - ruleOptions[0], // severity from the inline config - ...Array.isArray(config.rules[name]) ? config.rules[name].slice(1) : [] // options from the provided config - ]; - } - - try { - validator.validateRuleOptions(rule, name, ruleOptions); - } catch (err) { - - /* - * If the rule has invalid `meta.schema`, throw the error because - * this is not an invalid inline configuration but an invalid rule. - */ - if (err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA") { - throw err; - } - - problems.push(createLintingProblem({ - ruleId: name, - message: err.message, - loc - })); - - // do not apply the config, if found invalid options. - return; - } - - configuredRules[name] = ruleOptions; - }); - } else { - const problem = createLintingProblem({ - ruleId: null, - loc, - message: parseResult.error.message - }); - - problem.fatal = true; - problems.push(problem); - } - - break; - } - - // no default - } - }); - - return { - configuredRules, - enabledGlobals, - exportedVariables, - problems, - disableDirectives - }; -} - -/** - * Parses comments in file to extract disable directives. - * @param {SourceCode} sourceCode The SourceCode object to get comments from. - * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules - * @param {Language} language The language to use to adjust the location information - * @returns {{problems: LintMessage[], disableDirectives: DisableDirective[]}} - * A collection of the directive comments that were found, along with any problems that occurred when parsing - */ -function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper, language) { - const disableDirectives = []; - const problems = []; - - if (sourceCode.getDisableDirectives) { - const { - directives: directivesSources, - problems: directivesProblems - } = sourceCode.getDisableDirectives(); - - problems.push(...directivesProblems.map(directiveProblem => createLintingProblem({ - ...directiveProblem, - language - }))); - - directivesSources.forEach(directive => { - const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language, sourceCode); - - disableDirectives.push(...directives); - problems.push(...directiveProblems); - }); - } - - return { - 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 LATEST_ECMA_VERSION; -} - -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(commentParser.parseDirective(match[0].slice(2, -2)).value) - ); - } - } - - 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#filename` 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") { - if (typeof linterOptions.reportUnusedDisableDirectives === "boolean") { - reportUnusedDisableDirectives = linterOptions.reportUnusedDisableDirectives ? "warn" : "off"; - } else { - reportUnusedDisableDirectives = linterOptions.reportUnusedDisableDirectives === void 0 ? "off" : normalizeSeverityToString(linterOptions.reportUnusedDisableDirectives); - } - } - - let ruleFilter = providedOptions.ruleFilter; - - if (typeof ruleFilter !== "function") { - ruleFilter = () => true; - } - - return { - filename: normalizeFilename(providedOptions.filename || ""), - allowInlineConfig: !ignoreInlineConfig, - warnInlineConfig: disableInlineConfig && !ignoreInlineConfig - ? `your config${configNameOfNoInlineConfig}` - : null, - reportUnusedDisableDirectives, - disableFixes: Boolean(providedOptions.disableFixes), - stats: providedOptions.stats, - ruleFilter - }; -} - -/** - * 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( - Object.create(null), - ...enabledEnvironments.filter(env => env.globals).map(env => env.globals), - providedGlobals - ); -} - -/** - * Store time measurements in map - * @param {number} time Time measurement - * @param {Object} timeOpts Options relating which time was measured - * @param {WeakMap} slots Linter internal slots map - * @returns {void} - */ -function storeTime(time, timeOpts, slots) { - const { type, key } = timeOpts; - - if (!slots.times) { - slots.times = { passes: [{}] }; - } - - const passIndex = slots.fixPasses; - - if (passIndex > slots.times.passes.length - 1) { - slots.times.passes.push({}); - } - - if (key) { - slots.times.passes[passIndex][type] ??= {}; - slots.times.passes[passIndex][type][key] ??= { total: 0 }; - slots.times.passes[passIndex][type][key].total += time; - } else { - slots.times.passes[passIndex][type] ??= { total: 0 }; - slots.times.passes[passIndex][type].total += time; - } -} - -/** - * Get the options for a rule (not including severity), if any - * @param {RuleConfig} ruleConfig rule configuration - * @param {Object|undefined} defaultOptions rule.meta.defaultOptions - * @returns {Array} of rule options, empty Array if none - */ -function getRuleOptions(ruleConfig, defaultOptions) { - if (Array.isArray(ruleConfig)) { - return deepMergeArrays(defaultOptions, ruleConfig.slice(1)); - } - return defaultOptions ?? []; -} - -/** - * 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 - }); -} - -/** - * Runs a rule, and gets its listeners - * @param {Rule} rule A rule object - * @param {Context} ruleContext The context that should be passed to the rule - * @throws {TypeError} If `rule` is not an object with a `create` method - * @throws {any} Any error during the rule's `create` - * @returns {Object} A map of selector listeners provided by the rule - */ -function createRuleListeners(rule, ruleContext) { - - if (!rule || typeof rule !== "object" || typeof rule.create !== "function") { - throw new TypeError(`Error while loading rule '${ruleContext.id}': Rule must be an object with a \`create\` method`); - } - - try { - return rule.create(ruleContext); - } catch (ex) { - ex.message = `Error while loading rule '${ruleContext.id}': ${ex.message}`; - throw ex; - } -} - -/** - * 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 {Language} language The language object used for parsing. - * @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} applyDefaultOptions If true, apply rules' meta.defaultOptions in computing their config options. - * @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 - * @param {Function} ruleFilter A predicate function to filter which rules should be executed. - * @param {boolean} stats If true, stats are collected appended to the result - * @param {WeakMap} slots InternalSlotsMap of linter - * @returns {LintMessage[]} An array of reported problems - * @throws {Error} If traversal into a node fails. - */ -function runRules( - sourceCode, - configuredRules, - ruleMapper, - parserName, - language, - languageOptions, - settings, - filename, - applyDefaultOptions, - disableFixes, - cwd, - physicalFilename, - ruleFilter, - stats, - slots -) { - const emitter = createEmitter(); - - // must happen first to assign all node.parent properties - const eventQueue = sourceCode.traverse(); - - /* - * 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 = new FileContext({ - cwd, - filename, - physicalFilename: physicalFilename || filename, - sourceCode, - parserOptions: { - ...languageOptions.parserOptions - }, - parserPath: parserName, - languageOptions, - settings - }); - - const lintingProblems = []; - - Object.keys(configuredRules).forEach(ruleId => { - const severity = ConfigOps.getRuleSeverity(configuredRules[ruleId]); - - // not load disabled rules - if (severity === 0) { - return; - } - - if (ruleFilter && !ruleFilter({ ruleId, severity })) { - return; - } - - const rule = ruleMapper(ruleId); - - if (!rule) { - lintingProblems.push(createLintingProblem({ ruleId, language })); - 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], applyDefaultOptions ? rule.meta?.defaultOptions : void 0), - 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, - language - }); - } - 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 ruleListenersReturn = (timing.enabled || stats) - ? timing.time(ruleId, createRuleListeners, stats)(rule, ruleContext) : createRuleListeners(rule, ruleContext); - - const ruleListeners = stats ? ruleListenersReturn.result : ruleListenersReturn; - - if (stats) { - storeTime(ruleListenersReturn.tdiff, { type: "rules", key: ruleId }, slots); - } - - /** - * 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 { - const ruleListenerReturn = ruleListener(...listenerArgs); - - const ruleListenerResult = stats ? ruleListenerReturn.result : ruleListenerReturn; - - if (stats) { - storeTime(ruleListenerReturn.tdiff, { type: "rules", key: ruleId }, slots); - } - - return ruleListenerResult; - } catch (e) { - e.ruleId = ruleId; - throw e; - } - }; - } - - if (typeof ruleListeners === "undefined" || ruleListeners === null) { - throw new Error(`The create() function for rule '${ruleId}' did not return an object.`); - } - - // add all the selectors from the rule as listeners - Object.keys(ruleListeners).forEach(selector => { - const ruleListener = (timing.enabled || stats) - ? timing.time(ruleId, ruleListeners[selector], stats) : ruleListeners[selector]; - - emitter.on( - selector, - addRuleErrorHandler(ruleListener) - ); - }); - }); - - const eventGenerator = new NodeEventGenerator(emitter, { - visitorKeys: sourceCode.visitorKeys ?? language.visitorKeys, - fallback: Traverser.getKeys, - matchClass: language.matchesSelectorClass ?? (() => false), - nodeTypeKey: language.nodeTypeKey - }); - - for (const step of eventQueue) { - switch (step.kind) { - case STEP_KIND_VISIT: { - try { - if (step.phase === 1) { - eventGenerator.enterNode(step.target); - } else { - eventGenerator.leaveNode(step.target); - } - } catch (err) { - err.currentNode = step.target; - throw err; - } - break; - } - - case STEP_KIND_CALL: { - emitter.emit(step.target, ...step.args); - break; - } - - default: - throw new Error(`Invalid traversal step found: "${step.type}".`); - } - - } - - 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 {Array} [config.flags] the feature flags to enable. - * @param {"flat"|"eslintrc"} [config.configType="flat"] the type of config used. - */ - constructor({ cwd, configType = "flat", flags = [] } = {}) { - - flags.forEach(flag => { - if (inactiveFlags.has(flag)) { - throw new Error(`The flag '${flag}' is inactive: ${inactiveFlags.get(flag)}`); - } - - if (!activeFlags.has(flag)) { - throw new Error(`Unknown flag '${flag}'.`); - } - }); - - internalSlotsMap.set(this, { - cwd: normalizeCwd(cwd), - flags, - 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; - } - - /** - * Indicates if the given feature flag is enabled for this instance. - * @param {string} flag The feature flag to check. - * @returns {boolean} `true` if the feature flag is enabled, `false` if not. - */ - hasFlag(flag) { - return internalSlotsMap.get(this).flags.includes(flag); - } - - /** - * Lint using eslintrc and without processors. - * @param {VFile} file The file to lint. - * @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. - */ - #eslintrcVerifyWithoutProcessors(file, providedConfig, providedOptions) { - - const slots = internalSlotsMap.get(this); - const config = providedConfig || {}; - const options = normalizeVerifyOptions(providedOptions, config); - - // 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, - nodeType: null - }]; - } - parserName = config.parser; - parser = slots.parserMap.get(config.parser); - } - - // search and apply "eslint-env *". - const envInFile = options.allowInlineConfig && !options.warnInlineConfig - ? findEslintEnv(file.body) - : {}; - 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) { - let t; - - if (options.stats) { - t = startTime(); - } - - const parserService = new ParserService(); - const parseResult = parserService.parseSync( - file, - { - language: jslang, - languageOptions - } - ); - - if (options.stats) { - const time = endTime(t); - const timeOpts = { type: "parse" }; - - storeTime(time, timeOpts, slots); - } - - if (!parseResult.ok) { - return parseResult.errors; - } - - 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, - hasBOM: slots.lastSourceCode.hasBOM, - parserServices: slots.lastSourceCode.parserServices, - visitorKeys: slots.lastSourceCode.visitorKeys, - scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions) - }); - } - } - - const sourceCode = slots.lastSourceCode; - const commentDirectives = options.allowInlineConfig - ? getDirectiveComments(sourceCode, ruleId => getRule(slots, ruleId), options.warnInlineConfig, config) - : { configuredRules: {}, enabledGlobals: {}, exportedVariables: {}, problems: [], disableDirectives: [] }; - - 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, - jslang, - languageOptions, - settings, - options.filename, - true, - options.disableFixes, - slots.cwd, - providedOptions.physicalFilename, - null, - options.stats, - slots - ); - } catch (err) { - err.message += `\nOccurred while linting ${options.filename}`; - debug("An error occurred while traversing"); - debug("Filename:", options.filename); - if (err.currentNode) { - const { line } = sourceCode.getLoc(err.currentNode).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({ - language: jslang, - sourceCode, - 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 - }); - - } - - /** - * 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 filename = normalizeFilename(providedOptions.filename || ""); - let text; - - // evaluate arguments - if (typeof textOrSourceCode === "string") { - slots.lastSourceCode = null; - text = textOrSourceCode; - } else { - slots.lastSourceCode = textOrSourceCode; - text = textOrSourceCode.text; - } - - const file = new VFile(filename, text, { - physicalPath: providedOptions.physicalFilename - }); - - return this.#eslintrcVerifyWithoutProcessors(file, providedConfig, providedOptions); - } - - /** - * 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, cwd } = internalSlotsMap.get(this); - - const options = typeof filenameOrOptions === "string" - ? { filename: filenameOrOptions } - : filenameOrOptions || {}; - - const configToUse = config ?? {}; - - if (configType !== "eslintrc") { - - /* - * 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 = configToUse; - - if (!Array.isArray(configToUse) || typeof configToUse.getConfig !== "function") { - configArray = new FlatConfigArray(configToUse, { basePath: cwd }); - configArray.normalizeSync(); - } - - return this._distinguishSuppressedMessages(this._verifyWithFlatConfigArray(textOrSourceCode, configArray, options, true)); - } - - if (typeof configToUse.extractConfig === "function") { - return this._distinguishSuppressedMessages(this._verifyWithConfigArray(textOrSourceCode, configToUse, 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, configToUse, options)); - } - return this._distinguishSuppressedMessages(this._verifyWithoutProcessors(textOrSourceCode, configToUse, 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 slots = internalSlotsMap.get(this); - const filename = options.filename || ""; - const filenameToExpose = normalizeFilename(filename); - const physicalFilename = options.physicalFilename || filenameToExpose; - const text = ensureText(textOrSourceCode); - const file = new VFile(filenameToExpose, text, { - physicalPath: physicalFilename - }); - - const preprocess = options.preprocess || (rawText => [rawText]); - const postprocess = options.postprocess || (messagesList => messagesList.flat()); - - const processorService = new ProcessorService(); - const preprocessResult = processorService.preprocessSync(file, { - processor: { - preprocess, - postprocess - } - }); - - if (!preprocessResult.ok) { - return preprocessResult.errors; - } - - const filterCodeBlock = - options.filterCodeBlock || - (blockFilename => blockFilename.endsWith(".js")); - const originalExtname = path.extname(filename); - const { files } = preprocessResult; - - const messageLists = files.map(block => { - debug("A code block was found: %o", block.path || "(unnamed)"); - - // Keep the legacy behavior. - if (typeof block === "string") { - return this._verifyWithFlatConfigArrayAndWithoutProcessors(block, config, options); - } - - // Skip this block if filtered. - if (!filterCodeBlock(block.path, block.body)) { - debug("This code block was skipped."); - return []; - } - - // Resolve configuration again if the file content or extension was changed. - if (configForRecursive && (text !== block.rawBody || path.extname(block.path) !== originalExtname)) { - debug("Resolving configuration again because the file content or extension was changed."); - return this._verifyWithFlatConfigArray( - block.rawBody, - configForRecursive, - { ...options, filename: block.path, physicalFilename: block.physicalPath } - ); - } - - slots.lastSourceCode = null; - - // Does lint. - return this.#flatVerifyWithoutProcessors( - block, - config, - { ...options, filename: block.path, physicalFilename: block.physicalPath } - ); - }); - - return processorService.postprocessSync(file, messageLists, { - processor: { - preprocess, - postprocess - } - }); - } - - /** - * Verify using flat config and without any processors. - * @param {VFile} file The file to lint. - * @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. - */ - #flatVerifyWithoutProcessors(file, providedConfig, providedOptions) { - - const slots = internalSlotsMap.get(this); - const config = providedConfig || {}; - const { settings = {}, languageOptions } = config; - const options = normalizeVerifyOptions(providedOptions, config); - - if (!slots.lastSourceCode) { - let t; - - if (options.stats) { - t = startTime(); - } - - const parserService = new ParserService(); - const parseResult = parserService.parseSync( - file, - config - ); - - if (options.stats) { - const time = endTime(t); - - storeTime(time, { type: "parse" }, slots); - } - - if (!parseResult.ok) { - return parseResult.errors; - } - - 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). - * - * We check explicitly for `null` to ensure that this is a JS-flavored language. - * For non-JS languages we don't want to do this. - * - * TODO: Remove this check when we stop exporting the `SourceCode` object. - */ - if (slots.lastSourceCode.scopeManager === null) { - slots.lastSourceCode = new SourceCode({ - text: slots.lastSourceCode.text, - ast: slots.lastSourceCode.ast, - hasBOM: slots.lastSourceCode.hasBOM, - parserServices: slots.lastSourceCode.parserServices, - visitorKeys: slots.lastSourceCode.visitorKeys, - scopeManager: analyzeScope(slots.lastSourceCode.ast, languageOptions) - }); - } - } - - const sourceCode = slots.lastSourceCode; - - /* - * Make adjustments based on the language options. For JavaScript, - * this is primarily about adding variables into the global scope - * to account for ecmaVersion and configured globals. - */ - sourceCode.applyLanguageOptions?.(languageOptions); - - const mergedInlineConfig = { - rules: {} - }; - const inlineConfigProblems = []; - - /* - * Inline config can be either enabled or disabled. If disabled, it's possible - * to detect the inline config and emit a warning (though this is not required). - * So we first check to see if inline config is allowed at all, and if so, we - * need to check if it's a warning or not. - */ - if (options.allowInlineConfig) { - - // if inline config should warn then add the warnings - if (options.warnInlineConfig) { - if (sourceCode.getInlineConfigNodes) { - sourceCode.getInlineConfigNodes().forEach(node => { - - const loc = sourceCode.getLoc(node); - const range = sourceCode.getRange(node); - - inlineConfigProblems.push(createLintingProblem({ - ruleId: null, - message: `'${sourceCode.text.slice(range[0], range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`, - loc, - severity: 1, - language: config.language - })); - - }); - } - } else { - const inlineConfigResult = sourceCode.applyInlineConfig?.(); - - if (inlineConfigResult) { - inlineConfigProblems.push( - ...inlineConfigResult.problems - .map(problem => createLintingProblem({ ...problem, language: config.language })) - .map(problem => { - problem.fatal = true; - return problem; - }) - ); - - // next we need to verify information about the specified rules - const ruleValidator = new RuleValidator(); - - for (const { config: inlineConfig, loc } of inlineConfigResult.configs) { - - Object.keys(inlineConfig.rules).forEach(ruleId => { - const rule = getRuleFromConfig(ruleId, config); - const ruleValue = inlineConfig.rules[ruleId]; - - if (!rule) { - inlineConfigProblems.push(createLintingProblem({ - ruleId, - loc, - language: config.language - })); - return; - } - - if (Object.hasOwn(mergedInlineConfig.rules, ruleId)) { - inlineConfigProblems.push(createLintingProblem({ - message: `Rule "${ruleId}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`, - loc, - language: config.language - })); - return; - } - - try { - - let ruleOptions = Array.isArray(ruleValue) ? ruleValue : [ruleValue]; - - assertIsRuleSeverity(ruleId, ruleOptions[0]); - - /* - * If the rule was already configured, inline rule configuration that - * only has severity should retain options from the config and just override the severity. - * - * Example: - * - * { - * rules: { - * curly: ["error", "multi"] - * } - * } - * - * /* eslint curly: ["warn"] * / - * - * Results in: - * - * curly: ["warn", "multi"] - */ - - let shouldValidateOptions = true; - - if ( - - /* - * If inline config for the rule has only severity - */ - ruleOptions.length === 1 && - - /* - * And the rule was already configured - */ - config.rules && Object.hasOwn(config.rules, ruleId) - ) { - - /* - * Then use severity from the inline config and options from the provided config - */ - ruleOptions = [ - ruleOptions[0], // severity from the inline config - ...config.rules[ruleId].slice(1) // options from the provided config - ]; - - // if the rule was enabled, the options have already been validated - if (config.rules[ruleId][0] > 0) { - shouldValidateOptions = false; - } - } else { - - /** - * Since we know the user provided options, apply defaults on top of them - */ - const slicedOptions = ruleOptions.slice(1); - const mergedOptions = deepMergeArrays(rule.meta?.defaultOptions, slicedOptions); - - if (mergedOptions.length) { - ruleOptions = [ruleOptions[0], ...mergedOptions]; - } - } - - if (shouldValidateOptions) { - ruleValidator.validate({ - plugins: config.plugins, - rules: { - [ruleId]: ruleOptions - } - }); - } - - mergedInlineConfig.rules[ruleId] = ruleOptions; - } catch (err) { - - /* - * If the rule has invalid `meta.schema`, throw the error because - * this is not an invalid inline configuration but an invalid rule. - */ - if (err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA") { - throw err; - } - - let baseMessage = err.message.slice( - err.message.startsWith("Key \"rules\":") - ? err.message.indexOf(":", 12) + 1 - : err.message.indexOf(":") + 1 - ).trim(); - - if (err.messageTemplate) { - baseMessage += ` You passed "${ruleValue}".`; - } - - inlineConfigProblems.push(createLintingProblem({ - ruleId, - message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`, - loc, - language: config.language - })); - } - }); - } - } - } - } - - const commentDirectives = options.allowInlineConfig && !options.warnInlineConfig - ? getDirectiveCommentsForFlatConfig( - sourceCode, - ruleId => getRuleFromConfig(ruleId, config), - config.language - ) - : { problems: [], disableDirectives: [] }; - - const configuredRules = Object.assign({}, config.rules, mergedInlineConfig.rules); - - let lintingProblems; - - sourceCode.finalize?.(); - - try { - lintingProblems = runRules( - sourceCode, - configuredRules, - ruleId => getRuleFromConfig(ruleId, config), - void 0, - config.language, - languageOptions, - settings, - options.filename, - false, - options.disableFixes, - slots.cwd, - providedOptions.physicalFilename, - options.ruleFilter, - options.stats, - slots - ); - } catch (err) { - err.message += `\nOccurred while linting ${options.filename}`; - debug("An error occurred while traversing"); - debug("Filename:", options.filename); - if (err.currentNode) { - const { line } = sourceCode.getLoc(err.currentNode).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({ - language: config.language, - sourceCode, - directives: commentDirectives.disableDirectives, - disableFixes: options.disableFixes, - problems: lintingProblems - .concat(commentDirectives.problems) - .concat(inlineConfigProblems) - .sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), - reportUnusedDisableDirectives: options.reportUnusedDisableDirectives, - ruleFilter: options.ruleFilter, - configuredRules - }); - - - } - - /** - * 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 filename = normalizeFilename(providedOptions.filename || ""); - let text; - - // evaluate arguments - if (typeof textOrSourceCode === "string") { - slots.lastSourceCode = null; - text = textOrSourceCode; - } else { - slots.lastSourceCode = textOrSourceCode; - text = textOrSourceCode.text; - } - - const file = new VFile(filename, text, { - physicalPath: providedOptions.physicalFilename - }); - - return this.#flatVerifyWithoutProcessors(file, providedConfig, providedOptions); - } - - /** - * 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 || "__placeholder__.js"; - - // Store the config array in order to get plugin envs and rules later. - internalSlotsMap.get(this).lastConfigArray = configArray; - const config = configArray.getConfig(filename); - - if (!config) { - return [ - { - ruleId: null, - severity: 1, - message: `No matching configuration found for ${filename}.`, - line: 0, - column: 0, - nodeType: null - } - ]; - } - - // 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 slots = internalSlotsMap.get(this); - const filename = options.filename || ""; - const filenameToExpose = normalizeFilename(filename); - const physicalFilename = options.physicalFilename || filenameToExpose; - const text = ensureText(textOrSourceCode); - const file = new VFile(filenameToExpose, text, { - physicalPath: physicalFilename - }); - - const preprocess = options.preprocess || (rawText => [rawText]); - const postprocess = options.postprocess || (messagesList => messagesList.flat()); - - const processorService = new ProcessorService(); - const preprocessResult = processorService.preprocessSync(file, { - processor: { - preprocess, - postprocess - } - }); - - if (!preprocessResult.ok) { - return preprocessResult.errors; - } - - const filterCodeBlock = - options.filterCodeBlock || - (blockFilePath => blockFilePath.endsWith(".js")); - const originalExtname = path.extname(filename); - - const { files } = preprocessResult; - - const messageLists = files.map(block => { - debug("A code block was found: %o", block.path ?? "(unnamed)"); - - // Keep the legacy behavior. - if (typeof block === "string") { - return this._verifyWithoutProcessors(block, config, options); - } - - // Skip this block if filtered. - if (!filterCodeBlock(block.path, block.body)) { - debug("This code block was skipped."); - return []; - } - - // Resolve configuration again if the file content or extension was changed. - if (configForRecursive && (text !== block.rawBody || path.extname(block.path) !== originalExtname)) { - debug("Resolving configuration again because the file content or extension was changed."); - return this._verifyWithConfigArray( - block.rawBody, - configForRecursive, - { ...options, filename: block.path, physicalFilename: block.physicalPath } - ); - } - - slots.lastSourceCode = null; - - // Does lint. - return this.#eslintrcVerifyWithoutProcessors( - block, - config, - { ...options, filename: block.path, physicalFilename: block.physicalPath } - ); - }); - - return processorService.postprocessSync(file, messageLists, { - processor: { - preprocess, - postprocess - } - }); - - } - - /** - * 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 {Array} 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 times spent on (parsing, fixing, linting) a file. - * @returns {LintTimes} The times. - */ - getTimes() { - return internalSlotsMap.get(this).times ?? { passes: [] }; - } - - /** - * Gets the number of autofix passes that were made in the last run. - * @returns {number} The number of autofix passes. - */ - getFixPassCount() { - return internalSlotsMap.get(this).fixPasses ?? 0; - } - - /** - * 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 {Rule} rule A rule object - * @returns {void} - */ - defineRule(ruleId, rule) { - assertEslintrcConfig(this); - internalSlotsMap.get(this).ruleMap.define(ruleId, rule); - } - - /** - * 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; - const stats = options?.stats; - - /** - * 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. - */ - const slots = internalSlotsMap.get(this); - - // Remove lint times from the last run. - if (stats) { - delete slots.times; - slots.fixPasses = 0; - } - - do { - passNumber++; - let tTotal; - - if (stats) { - tTotal = startTime(); - } - - debug(`Linting code for ${debugTextDescription} (pass ${passNumber})`); - messages = this.verify(currentText, config, options); - - debug(`Generating fixed text for ${debugTextDescription} (pass ${passNumber})`); - let t; - - if (stats) { - t = startTime(); - } - - fixedResult = SourceCodeFixer.applyFixes(currentText, messages, shouldFix); - - if (stats) { - - if (fixedResult.fixed) { - const time = endTime(t); - - storeTime(time, { type: "fix" }, slots); - slots.fixPasses++; - } else { - storeTime(0, { type: "fix" }, slots); - } - } - - /* - * 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; - - if (stats) { - tTotal = endTime(tTotal); - const passIndex = slots.times.passes.length - 1; - - slots.times.passes[passIndex].total = tTotal; - } - - } 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) { - let tTotal; - - if (stats) { - tTotal = startTime(); - } - - fixedResult.messages = this.verify(currentText, config, options); - - if (stats) { - storeTime(0, { type: "fix" }, slots); - slots.times.passes.at(-1).total = endTime(tTotal); - } - } - - // 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 deleted file mode 100644 index 0eb2f8d..0000000 --- a/node_modules/eslint/lib/linter/node-event-generator.js +++ /dev/null @@ -1,352 +0,0 @@ -/** - * @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) { - this.applySelectors(node, false); - this.currentAncestry.unshift(node); - } - - /** - * Emits an event of leaving AST node. - * @param {ASTNode} node A node which was left. - * @returns {void} - */ - leaveNode(node) { - this.currentAncestry.shift(); - this.applySelectors(node, true); - } -} - -module.exports = NodeEventGenerator; diff --git a/node_modules/eslint/lib/linter/report-translator.js b/node_modules/eslint/lib/linter/report-translator.js deleted file mode 100644 index e0a4630..0000000 --- a/node_modules/eslint/lib/linter/report-translator.js +++ /dev/null @@ -1,376 +0,0 @@ -/** - * @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("../shared/assert"); -const { RuleFixer } = require("./rule-fixer"); -const { interpolate } = require("./interpolate"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").LintMessage} LintMessage */ - -/** - * 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. - */ - -//------------------------------------------------------------------------------ -// 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.start) { - return descriptor.loc; - } - return { start: descriptor.loc, end: null }; -} - -/** - * Clones the given fix object. - * @param {Fix|null} fix The fix to clone. - * @returns {Fix|null} Deep cloned fix object or `null` if `null` or `undefined` was passed in. - */ -function cloneFix(fix) { - if (!fix) { - return null; - } - - return { - range: [fix.range[0], fix.range[1]], - text: fix.text - }; -} - -/** - * 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 cloneFix(fixes[0]); - } - - fixes.sort(compareFixesByRange); - - const originalText = sourceCode.text; - const start = fixes[0].range[0]; - const end = fixes.at(-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; - } - - const ruleFixer = new RuleFixer({ sourceCode }); - - // @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 cloneFix(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 - * @param {Language} [options.language] The language to use to adjust line and column offsets. - * @returns {LintMessage} Information about the report - */ -function createProblem(options) { - const { language } = options; - - // calculate offsets based on the language in use - const columnOffset = language.columnStart === 1 ? 0 : 1; - const lineOffset = language.lineStart === 1 ? 0 : 1; - - const problem = { - ruleId: options.ruleId, - severity: options.severity, - message: options.message, - line: options.loc.start.line + lineOffset, - column: options.loc.start.column + columnOffset, - 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 + lineOffset; - problem.endColumn = options.loc.end.column + columnOffset; - } - - 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, language:Language}} metadata Metadata for the reported problem - * @returns {function(...args): LintMessage} 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; - const { sourceCode } = metadata; - - 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.hasOwn(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: descriptor.loc ? normalizeReportLoc(descriptor) : sourceCode.getLoc(descriptor.node), - fix: metadata.disableFixes ? null : normalizeFixes(descriptor, sourceCode), - suggestions: metadata.disableFixes ? [] : mapSuggestions(descriptor, sourceCode, messages), - language: metadata.language - }); - }; -}; diff --git a/node_modules/eslint/lib/linter/rule-fixer.js b/node_modules/eslint/lib/linter/rule-fixer.js deleted file mode 100644 index f9c45fe..0000000 --- a/node_modules/eslint/lib/linter/rule-fixer.js +++ /dev/null @@ -1,163 +0,0 @@ -/** - * @fileoverview An object that creates fix commands for rules. - * @author Nicholas C. Zakas - */ -"use strict"; - -/* eslint class-methods-use-this: off -- Methods desired on instance */ - -//------------------------------------------------------------------------------ -// 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. - */ -class RuleFixer { - - /** - * The source code object representing the text to be fixed. - * @type {SourceCode} - */ - #sourceCode; - - /** - * Creates a new instance. - * @param {Object} options The options for the fixer. - * @param {SourceCode} options.sourceCode The source code object representing the text to be fixed. - */ - constructor({ sourceCode }) { - this.#sourceCode = sourceCode; - } - - /** - * 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) { - const range = this.#sourceCode.getRange(nodeOrToken); - - return this.insertTextAfterRange(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) { - const range = this.#sourceCode.getRange(nodeOrToken); - - return this.insertTextBeforeRange(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) { - const range = this.#sourceCode.getRange(nodeOrToken); - - return this.replaceTextRange(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) { - const range = this.#sourceCode.getRange(nodeOrToken); - - return this.removeRange(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 deleted file mode 100644 index bb8e368..0000000 --- a/node_modules/eslint/lib/linter/rules.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @fileoverview Defines a storage for rules. - * @author Nicholas C. Zakas - * @author aladdin-add - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const builtInRules = require("../rules"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").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 {Rule} rule Rule object. - * @returns {void} - */ - define(ruleId, rule) { - this._rules[ruleId] = rule; - } - - /** - * Access rule handler by id (file name). - * @param {string} ruleId Rule id (file name). - * @returns {Rule} Rule object. - */ - 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 deleted file mode 100644 index f4837c1..0000000 --- a/node_modules/eslint/lib/linter/safe-emitter.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @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 deleted file mode 100644 index 312e84f..0000000 --- a/node_modules/eslint/lib/linter/source-code-fixer.js +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @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.hasOwn(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 deleted file mode 100644 index 232c5f4..0000000 --- a/node_modules/eslint/lib/linter/timing.js +++ /dev/null @@ -1,169 +0,0 @@ -/** - * @fileoverview Tracks performance of individual rules. - * @author Brandon Mills - */ - -"use strict"; - -const { startTime, endTime } = require("../shared/stats"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/* c8 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 || " "); -} - -/* c8 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; -} - -/* c8 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 -} - -/* c8 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 - * @param {boolean} stats if 'stats' is true, return the result and the time difference - * @returns {Function} function to be executed - * @private - */ - function time(key, fn, stats) { - - return function(...args) { - - const t = startTime(); - const result = fn(...args); - const tdiff = endTime(t); - - if (enabled) { - if (typeof data[key] === "undefined") { - data[key] = 0; - } - - data[key] += tdiff; - } - - return stats ? { result, tdiff } : result; - }; - } - - if (enabled) { - process.on("exit", () => { - display(data); - }); - } - - return { - time, - enabled, - getListSize - }; - -}()); diff --git a/node_modules/eslint/lib/linter/vfile.js b/node_modules/eslint/lib/linter/vfile.js deleted file mode 100644 index bb2da0a..0000000 --- a/node_modules/eslint/lib/linter/vfile.js +++ /dev/null @@ -1,118 +0,0 @@ -/** - * @fileoverview Virtual file - * @author Nicholas C. Zakas - */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Type Definitions -//----------------------------------------------------------------------------- - -/** @typedef {import("@eslint/core").File} File */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Determines if a given value has a byte order mark (BOM). - * @param {string|Uint8Array} value The value to check. - * @returns {boolean} `true` if the value has a BOM, `false` otherwise. - */ -function hasUnicodeBOM(value) { - return typeof value === "string" - ? value.charCodeAt(0) === 0xFEFF - : value[0] === 0xEF && value[1] === 0xBB && value[2] === 0xBF; -} - -/** - * Strips Unicode BOM from the given value. - * @param {string|Uint8Array} value The value to remove the BOM from. - * @returns {string|Uint8Array} The stripped value. - */ -function stripUnicodeBOM(value) { - - if (!hasUnicodeBOM(value)) { - return value; - } - - if (typeof value === "string") { - - /* - * 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 - */ - return value.slice(1); - } - - /* - * In a Uint8Array, the BOM is represented by three bytes: 0xEF, 0xBB, and 0xBF, - * so we can just remove the first three bytes. - */ - return value.slice(3); -} - -//------------------------------------------------------------------------------ -// Exports -//------------------------------------------------------------------------------ - -/** - * Represents a virtual file inside of ESLint. - * @implements {File} - */ -class VFile { - - /** - * The file path including any processor-created virtual path. - * @type {string} - * @readonly - */ - path; - - /** - * The file path on disk. - * @type {string} - * @readonly - */ - physicalPath; - - /** - * The file contents. - * @type {string|Uint8Array} - * @readonly - */ - body; - - /** - * The raw body of the file, including a BOM if present. - * @type {string|Uint8Array} - * @readonly - */ - rawBody; - - /** - * Indicates whether the file has a byte order mark (BOM). - * @type {boolean} - * @readonly - */ - bom; - - /** - * Creates a new instance. - * @param {string} path The file path. - * @param {string|Uint8Array} body The file contents. - * @param {Object} [options] Additional options. - * @param {string} [options.physicalPath] The file path on disk. - */ - constructor(path, body, { physicalPath } = {}) { - this.path = path; - this.physicalPath = physicalPath ?? path; - this.bom = hasUnicodeBOM(body); - this.body = stripUnicodeBOM(body); - this.rawBody = body; - } -} - -module.exports = { VFile }; diff --git a/node_modules/eslint/lib/options.js b/node_modules/eslint/lib/options.js deleted file mode 100644 index d35c9f6..0000000 --- a/node_modules/eslint/lib/options.js +++ /dev/null @@ -1,442 +0,0 @@ -/** - * @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 {string[]} [flag] Feature flags - * @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] Patterns of files to ignore. In eslintrc mode, these are in addition to `.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 and eslint-enable directives - * @property {string | undefined} reportUnusedDisableDirectivesSeverity A severity string indicating if and how unused disable and enable directives should be tracked and reported. - * @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 {boolean} warnIgnored Show warnings when the file list includes ignored files - * @property {boolean} [passOnNoPatterns=false] When set to true, missing patterns cause - * the linting operation to short circuit and not report any failures. - * @property {string[]} _ Positional filenames or patterns - * @property {boolean} [stats] Report additional statistics - */ - -//------------------------------------------------------------------------------ -// Initialization and Public Interface -//------------------------------------------------------------------------------ - -// exports "parse(args)", "generateHelp()", and "generateHelpForOption(optionName)" - -/** - * Creates the CLI options for ESLint. - * @param {boolean} usingFlatConfig Indicates if flat config is being used. - * @returns {Object} The optionator instance. - */ -module.exports = function(usingFlatConfig) { - - let lookupFlag; - - if (usingFlatConfig) { - lookupFlag = { - option: "config-lookup", - type: "Boolean", - default: "true", - description: "Disable look up for eslint.config.js" - }; - } else { - lookupFlag = { - option: "eslintrc", - type: "Boolean", - default: "true", - description: "Disable use of configuration from .eslintrc.*" - }; - } - - let envFlag; - - if (!usingFlatConfig) { - envFlag = { - option: "env", - type: "[String]", - description: "Specify environments" - }; - } - - let inspectConfigFlag; - - if (usingFlatConfig) { - inspectConfigFlag = { - option: "inspect-config", - type: "Boolean", - description: "Open the config inspector with the current configuration" - }; - } - - let extFlag; - - if (!usingFlatConfig) { - extFlag = { - option: "ext", - type: "[String]", - description: "Specify JavaScript file extensions" - }; - } - - let resolvePluginsFlag; - - if (!usingFlatConfig) { - resolvePluginsFlag = { - option: "resolve-plugins-relative-to", - type: "path::String", - description: "A folder where plugins should be resolved from, CWD by default" - }; - } - - let rulesDirFlag; - - if (!usingFlatConfig) { - rulesDirFlag = { - option: "rulesdir", - type: "[path::String]", - description: "Load additional rules from this directory. Deprecated: Use rules from plugins" - }; - } - - let ignorePathFlag; - - if (!usingFlatConfig) { - ignorePathFlag = { - option: "ignore-path", - type: "path::String", - description: "Specify path of ignore file" - }; - } - - let statsFlag; - - if (usingFlatConfig) { - statsFlag = { - option: "stats", - type: "Boolean", - default: "false", - description: "Add statistics to the lint report" - }; - } - - let warnIgnoredFlag; - - if (usingFlatConfig) { - warnIgnoredFlag = { - option: "warn-ignored", - type: "Boolean", - default: "true", - description: "Suppress warnings when the file list includes ignored files" - }; - } - - let flagFlag; - - if (usingFlatConfig) { - flagFlag = { - option: "flag", - type: "[String]", - description: "Enable a feature flag" - }; - } - - return optionator({ - prepend: "eslint [options] file.js [file.js] [dir]", - defaults: { - concatRepeatedArrays: true, - mergeRepeatedObjects: true - }, - options: [ - { - heading: "Basic configuration" - }, - lookupFlag, - { - option: "config", - alias: "c", - type: "path::String", - description: usingFlatConfig - ? "Use this configuration instead of eslint.config.js, eslint.config.mjs, or eslint.config.cjs" - : "Use this configuration, overriding .eslintrc.* config options if present" - }, - inspectConfigFlag, - envFlag, - extFlag, - { - 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" - }, - resolvePluginsFlag, - { - heading: "Specify Rules and Plugins" - }, - { - option: "plugin", - type: "[String]", - description: "Specify plugins" - }, - { - option: "rule", - type: "Object", - description: "Specify rules" - }, - rulesDirFlag, - { - heading: "Fix 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: "Ignore Files" - }, - ignorePathFlag, - { - option: "ignore", - type: "Boolean", - default: "true", - description: "Disable use of ignore files and patterns" - }, - { - option: "ignore-pattern", - type: "[String]", - description: `Patterns of files to ignore${usingFlatConfig ? "" : " (in addition to those in .eslintignore)"}`, - concatRepeatedArrays: [true, { - oneValuePerFlag: true - }] - }, - { - heading: "Use 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: "Handle 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 and eslint-enable directives" - }, - { - option: "report-unused-disable-directives-severity", - type: "String", - default: void 0, - description: "Chooses severity level for reporting unused eslint-disable and eslint-enable directives", - enum: ["off", "warn", "error", "0", "1", "2"] - }, - { - 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" - }, - warnIgnoredFlag, - { - option: "pass-on-no-patterns", - type: "Boolean", - default: false, - description: "Exit with exit code 0 in case no file patterns are passed" - }, - { - 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" - }, - statsFlag, - flagFlag - ].filter(value => !!value) - }); -}; diff --git a/node_modules/eslint/lib/rule-tester/index.js b/node_modules/eslint/lib/rule-tester/index.js deleted file mode 100644 index 58f67ee..0000000 --- a/node_modules/eslint/lib/rule-tester/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -const RuleTester = require("./rule-tester"); - -module.exports = { - RuleTester -}; diff --git a/node_modules/eslint/lib/rule-tester/rule-tester.js b/node_modules/eslint/lib/rule-tester/rule-tester.js deleted file mode 100644 index 4ffcfed..0000000 --- a/node_modules/eslint/lib/rule-tester/rule-tester.js +++ /dev/null @@ -1,1307 +0,0 @@ -/** - * @fileoverview Mocha/Jest test wrapper - * @author Ilya Volodin - */ -"use strict"; - -/* globals describe, it -- Mocha globals */ - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const - assert = require("node:assert"), - util = require("node:util"), - path = require("node:path"), - equal = require("fast-deep-equal"), - Traverser = require("../shared/traverser"), - { getRuleOptionsSchema } = require("../config/flat-config-helpers"), - { Linter, SourceCodeFixer } = require("../linter"), - { interpolate, getPlaceholderMatcher } = require("../linter/interpolate"), - stringify = require("json-stable-stringify-without-jsonify"); - -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 { ConfigArraySymbol } = require("@eslint/config-array"); -const { isSerializable } = require("../shared/serialization"); - -const jslang = require("../languages/js"); -const { SourceCode } = require("../languages/js/source-code"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").Parser} Parser */ -/** @typedef {import("../shared/types").LanguageOptions} LanguageOptions */ -/** @typedef {import("../shared/types").Rule} Rule */ - - -/** - * 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 {Function} [before] Function to execute before testing the case. - * @property {Function} [after] Function to execute after testing the case regardless of its result. - * @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 {Function} [before] Function to execute before testing the case. - * @property {Function} [after] Function to execute after testing the case regardless of its result. - * @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. - */ - -//------------------------------------------------------------------------------ -// 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", - "before", - "after", - "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(", ")}]`; - -/* - * Ignored test case properties when checking for test case duplicates. - */ -const duplicationIgnoredParameters = new Set([ - "name", - "errors", - "output" -]); - -const forbiddenMethods = [ - "applyInlineConfig", - "applyLanguageOptions", - "finalize" -]; - -/** @type {Map} */ -const forbiddenMethodCalls = new Map(forbiddenMethods.map(methodName => ([methodName, new WeakSet()]))); - -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 forbidden `SourceCode` methods. Allows just one call per method. - * @param {string} methodName The name of the method to forbid. - * @param {Function} prototype The prototype with the original method to call. - * @returns {Function} The function that throws the error. - */ -function throwForbiddenMethodError(methodName, prototype) { - - const original = prototype[methodName]; - - return function(...args) { - - const called = forbiddenMethodCalls.get(methodName); - - /* eslint-disable no-invalid-this -- needed to operate as a method. */ - if (!called.has(this)) { - called.add(this); - - return original.apply(this, args); - } - /* eslint-enable no-invalid-this -- not needed past this point */ - - throw new Error( - `\`SourceCode#${methodName}()\` cannot be called inside a rule.` - ); - }; -} - -/** - * Extracts names of {{ placeholders }} from the reported message. - * @param {string} message Reported message - * @returns {string[]} Array of placeholder names - */ -function getMessagePlaceholders(message) { - const matcher = getPlaceholderMatcher(); - - return Array.from(message.matchAll(matcher), ([, name]) => name.trim()); -} - -/** - * Returns the placeholders in the reported messages but - * only includes the placeholders available in the raw message and not in the provided data. - * @param {string} message The reported message - * @param {string} raw The raw message specified in the rule meta.messages - * @param {undefined|Record} data The passed - * @returns {string[]} Missing placeholder names - */ -function getUnsubstitutedMessagePlaceholders(message, raw, data = {}) { - const unsubstituted = getMessagePlaceholders(message); - - if (unsubstituted.length === 0) { - return []; - } - - // Remove false positives by only counting placeholders in the raw message, which were not provided in the data matcher or added with a data property - const known = getMessagePlaceholders(raw); - const provided = Object.keys(data); - - return unsubstituted.filter(name => known.includes(name) && !provided.includes(name)); -} - -const metaSchemaDescription = ` -\t- If the rule has options, set \`meta.schema\` to an array or non-empty object to enable options validation. -\t- If the rule doesn't have options, omit \`meta.schema\` to enforce that no options can be passed to the rule. -\t- You can also set \`meta.schema\` to \`false\` to opt-out of options validation (not recommended). - -\thttps://eslint.org/docs/latest/extend/custom-rules#options-schemas -`; - -//------------------------------------------------------------------------------ -// 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 = [ - 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" || config === null) { - throw new TypeError("RuleTester.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/latest/integrate/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 {Rule} rule The rule to test. - * @param {{ - * valid: (ValidTestCase | string)[], - * invalid: InvalidTestCase[] - * }} test The collection of tests to run. - * @throws {TypeError|Error} If `rule` is not an object with a `create` method, - * or 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}`; - - const seenValidTestCases = new Set(); - const seenInvalidTestCases = new Set(); - - if (!rule || typeof rule !== "object" || typeof rule.create !== "function") { - throw new TypeError("Rule must be an object with a `create` method"); - } - - 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 = [ - { files: ["**"] }, // Make sure the default config matches for all files - { - 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, - languages: defaultConfig[0].plugins["@"].languages - }, - "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 rule.create(context); - } - }) - } - } - }, - language: defaultConfig[0].language - }, - ...defaultConfig.slice(1) - ]; - - /** - * Runs a hook on the given item when it's assigned to the given property - * @param {string|Object} item Item to run the hook on - * @param {string} prop The property having the hook assigned to - * @throws {Error} If the property is not a function or that function throws an error - * @returns {void} - * @private - */ - function runHook(item, prop) { - if (typeof item === "object" && hasOwnProperty(item, prop)) { - assert.strictEqual(typeof item[prop], "function", `Optional test case property '${prop}' must be a function`); - item[prop](); - } - } - - /** - * 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 flatConfigArrayOptions = { - baseConfig - }; - - if (item.filename) { - flatConfigArrayOptions.basePath = path.parse(item.filename).root || void 0; - } - - const configs = new FlatConfigArray(testerConfig, flatConfigArrayOptions); - - /* - * 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 - if (calculatedConfig.language === jslang) { - 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]; - } - - /* - * Create the config object from the tester config and this item - * specific configurations. - */ - configs.push(itemConfig); - } - - if (hasOwnProperty(item, "only")) { - assert.ok(typeof item.only === "boolean", "Optional test case property 'only' must be a boolean"); - } - if (hasOwnProperty(item, "filename")) { - assert.ok(typeof item.filename === "string", "Optional test case property 'filename' must be a string"); - 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 - } - }); - - let schema; - - try { - schema = getRuleOptionsSchema(rule); - } catch (err) { - err.message += metaSchemaDescription; - throw err; - } - - /* - * Check and throw an error if the schema is an empty object (`schema:{}`), because such schema - * doesn't validate or enforce anything and is therefore considered a possible error. If the intent - * was to skip options validation, `schema:false` should be set instead (explicit opt-out). - * - * For this purpose, a schema object is considered empty if it doesn't have any own enumerable string-keyed - * properties. While `ajv.compile()` does use enumerable properties from the prototype chain as well, - * it caches compiled schemas by serializing only own enumerable properties, so it's generally not a good idea - * to use inherited properties in schemas because schemas that differ only in inherited properties would end up - * having the same cache entry that would be correct for only one of them. - * - * At this point, `schema` can only be an object or `null`. - */ - if (schema && Object.keys(schema).length === 0) { - throw new Error(`\`schema: {}\` is a no-op${metaSchemaDescription}`); - } - - /* - * 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": { - create() { - 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}`); - } - } - - // 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; - } - - // Verify the code. - const { applyLanguageOptions, applyInlineConfig, finalize } = SourceCode.prototype; - let messages; - - try { - forbiddenMethods.forEach(methodName => { - SourceCode.prototype[methodName] = throwForbiddenMethodError(methodName, SourceCode.prototype); - }); - - messages = linter.verify(code, configs, filename); - } finally { - SourceCode.prototype.applyInlineConfig = applyInlineConfig; - SourceCode.prototype.applyLanguageOptions = applyLanguageOptions; - SourceCode.prototype.finalize = finalize; - } - - - 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), - configs, - filename - }; - } - - /** - * 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 this test case is a duplicate of one we have seen before. - * @param {string|Object} item test case object - * @param {Set} seenTestCases set of serialized test cases we have seen so far (managed by this function) - * @returns {void} - * @private - */ - function checkDuplicateTestCase(item, seenTestCases) { - if (!isSerializable(item)) { - - /* - * If we can't serialize a test case (because it contains a function, RegExp, etc), skip the check. - * This might happen with properties like: options, plugins, settings, languageOptions.parser, languageOptions.parserOptions. - */ - return; - } - - const normalizedItem = typeof item === "string" ? { code: item } : item; - const serializedTestCase = stringify(normalizedItem, { - replacer(key, value) { - - // "this" is the currently stringified object --> only ignore top-level properties - return (normalizedItem !== this || !duplicationIgnoredParameters.has(key)) ? value : void 0; - } - }); - - assert( - !seenTestCases.has(serializedTestCase), - "detected duplicate test case" - ); - seenTestCases.add(serializedTestCase); - } - - /** - * 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"); - } - - checkDuplicateTestCase(item, seenValidTestCases); - - 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"); - } - - checkDuplicateTestCase(item, seenInvalidTestCases); - - 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; - - for (const message of messages) { - if (hasOwnProperty(message, "suggestions")) { - - /** @type {Map} */ - const seenMessageIndices = new Map(); - - for (let i = 0; i < message.suggestions.length; i += 1) { - const suggestionMessage = message.suggestions[i].desc; - const previous = seenMessageIndices.get(suggestionMessage); - - assert.ok(!seenMessageIndices.has(suggestionMessage), `Suggestion message '${suggestionMessage}' reported from suggestion ${i} was previously reported by suggestion ${previous}. Suggestion messages should be unique within an error.`); - seenMessageIndices.set(suggestionMessage, i); - } - } - } - - 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); - assert.ok(message.suggestions === void 0, `Error at index ${i} has suggestions. Please convert the test error into an object and specify 'suggestions' property on it to test suggestions.`); - } 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}'.` - ); - - const unsubstitutedPlaceholders = getUnsubstitutedMessagePlaceholders( - message.message, - rule.meta.messages[message.messageId], - error.data - ); - - assert.ok( - unsubstitutedPlaceholders.length === 0, - `The reported message has ${unsubstitutedPlaceholders.length > 1 ? `unsubstituted placeholders: ${unsubstitutedPlaceholders.map(name => `'${name}'`).join(", ")}` : `an unsubstituted placeholder '${unsubstitutedPlaceholders[0]}'`}. Please provide the missing ${unsubstitutedPlaceholders.length > 1 ? "values" : "value"} via the 'data' property in the context.report() call.` - ); - - 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}"` - ); - } - } else { - assert.fail("Test error must specify either a 'messageId' or 'message'."); - } - - 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}`); - } - - assert.ok(!message.suggestions || hasOwnProperty(error, "suggestions"), `Error at index ${i} has suggestions. Please specify 'suggestions' property on the test error object.`); - if (hasOwnProperty(error, "suggestions")) { - - // Support asserting there are no suggestions - const expectsSuggestions = Array.isArray(error.suggestions) ? error.suggestions.length > 0 : Boolean(error.suggestions); - const hasSuggestions = message.suggestions !== void 0; - - if (!hasSuggestions && expectsSuggestions) { - assert.ok(!error.suggestions, `Error should have suggestions on error with message: "${message.message}"`); - } else if (hasSuggestions) { - assert.ok(expectsSuggestions, `Error should have no suggestions on error with message: "${message.message}"`); - if (typeof error.suggestions === "number") { - assert.strictEqual(message.suggestions.length, error.suggestions, `Error should have ${error.suggestions} suggestions. Instead found ${message.suggestions.length} suggestions`); - } else if (Array.isArray(error.suggestions)) { - 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.ok( - !hasOwnProperty(expectedSuggestion, "messageId"), - `${suggestionPrefix} Test should not specify both 'desc' and 'messageId'.` - ); - assert.strictEqual( - actualSuggestion.desc, - expectedSuggestion.desc, - `${suggestionPrefix} desc should be "${expectedSuggestion.desc}" but got "${actualSuggestion.desc}" instead.` - ); - } else 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.` - ); - - const unsubstitutedPlaceholders = getUnsubstitutedMessagePlaceholders( - actualSuggestion.desc, - rule.meta.messages[expectedSuggestion.messageId], - expectedSuggestion.data - ); - - assert.ok( - unsubstitutedPlaceholders.length === 0, - `The message of the suggestion has ${unsubstitutedPlaceholders.length > 1 ? `unsubstituted placeholders: ${unsubstitutedPlaceholders.map(name => `'${name}'`).join(", ")}` : `an unsubstituted placeholder '${unsubstitutedPlaceholders[0]}'`}. Please provide the missing ${unsubstitutedPlaceholders.length > 1 ? "values" : "value"} via the 'data' property for the suggestion in the context.report() call.` - ); - - 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 if (hasOwnProperty(expectedSuggestion, "data")) { - assert.fail( - `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.` - ); - } else { - assert.fail( - `${suggestionPrefix} Test must specify either 'messageId' or 'desc'.` - ); - } - - assert.ok(hasOwnProperty(expectedSuggestion, "output"), `${suggestionPrefix} The "output" property is required.`); - const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes(item.code, [actualSuggestion]).output; - - // Verify if suggestion fix makes a syntax error or not. - const errorMessageInSuggestion = - linter.verify(codeWithAppliedSuggestion, result.configs, result.filename).find(m => m.fatal); - - assert(!errorMessageInSuggestion, [ - "A fatal parsing error occurred in suggestion fix.", - `Error: ${errorMessageInSuggestion && errorMessageInSuggestion.message}`, - "Suggestion output:", - codeWithAppliedSuggestion - ].join("\n")); - - 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}"`); - assert.notStrictEqual(expectedSuggestion.output, item.code, `The output of a suggestion should differ from the original source code for suggestion at index: ${index} on error with message: "${message.message}"`); - }); - } else { - assert.fail("Test error object property 'suggestions' should be an array or a number"); - } - } - } - } 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."); - assert.notStrictEqual(item.code, item.output, "Test property 'output' matches 'code'. If no autofix is expected, then omit the 'output' property or set it to null."); - } - } 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. - * The test suites for valid/invalid are created conditionally as - * test runners (eg. vitest) fail for empty test suites. - */ - this.constructor.describe(ruleName, () => { - if (test.valid.length > 0) { - this.constructor.describe("valid", () => { - test.valid.forEach(valid => { - this.constructor[valid.only ? "itOnly" : "it"]( - sanitize(typeof valid === "object" ? valid.name || valid.code : valid), - () => { - try { - runHook(valid, "before"); - testValidTemplate(valid); - } finally { - runHook(valid, "after"); - } - } - ); - }); - }); - } - - if (test.invalid.length > 0) { - this.constructor.describe("invalid", () => { - test.invalid.forEach(invalid => { - this.constructor[invalid.only ? "itOnly" : "it"]( - sanitize(invalid.name || invalid.code), - () => { - try { - runHook(invalid, "before"); - testInvalidTemplate(invalid); - } finally { - runHook(invalid, "after"); - } - } - ); - }); - }); - } - }); - } -} - -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 deleted file mode 100644 index e95c7d0..0000000 --- a/node_modules/eslint/lib/rules/accessor-pairs.js +++ /dev/null @@ -1,350 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - enforceForClassMembers: true, - getWithoutSet: false, - setWithoutGet: true - }], - - docs: { - description: "Enforce getter and setter pairs in objects and classes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/accessor-pairs" - }, - - schema: [{ - type: "object", - properties: { - getWithoutSet: { - type: "boolean" - }, - setWithoutGet: { - type: "boolean" - }, - enforceForClassMembers: { - type: "boolean" - } - }, - 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 [{ - getWithoutSet: checkGetWithoutSet, - setWithoutGet: checkSetWithoutGet, - enforceForClassMembers - }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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); - } - } - - /** - * Checks accessor pairs in the given list of nodes. - * @param {ASTNode[]} nodes The list to check. - * @returns {void} - * @private - */ - function checkList(nodes) { - const accessors = []; - let found = false; - - for (let i = 0; i < nodes.length; i++) { - const node = nodes[i]; - - if (isAccessorKind(node)) { - - // Creates a new `AccessorData` object for the given getter or setter node. - const name = astUtils.getStaticPropertyName(node); - const key = (name !== null) ? name : sourceCode.getTokens(node.key); - - // Merges the given `AccessorData` object into the given accessors list. - for (let j = 0; j < accessors.length; j++) { - const accessor = accessors[j]; - - if (areEqualKeys(accessor.key, key)) { - accessor.getters.push(...node.kind === "get" ? [node] : []); - accessor.setters.push(...node.kind === "set" ? [node] : []); - found = true; - break; - } - } - if (!found) { - accessors.push({ - key, - getters: node.kind === "get" ? [node] : [], - setters: node.kind === "set" ? [node] : [] - }); - } - found = false; - } - } - - 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 deleted file mode 100644 index 9eb7258..0000000 --- a/node_modules/eslint/lib/rules/array-bracket-newline.js +++ /dev/null @@ -1,261 +0,0 @@ -/** - * @fileoverview Rule to enforce linebreaks after open and before close array brackets - * @author Jan Peer Stöcklmair - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce linebreaks after opening and before closing array brackets", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - - //---------------------------------------------------------------------- - // 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; - - 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 deleted file mode 100644 index 31ace98..0000000 --- a/node_modules/eslint/lib/rules/array-bracket-spacing.js +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of array brackets. - * @author Jamund Ferguson - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing inside array brackets", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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.at(-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 deleted file mode 100644 index 974fea8..0000000 --- a/node_modules/eslint/lib/rules/array-callback-return.js +++ /dev/null @@ -1,448 +0,0 @@ -/** - * @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(?:Last)?(?:Index)?|flatMap|forEach|map|reduce(?:Right)?|some|sort|toSorted)$/u; - -/** - * 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); -} - -/** - * Checks all segments in a set and returns true if any are reachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if any segment is reachable; false otherwise. - */ -function isAnySegmentReachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - return true; - } - } - - return false; -} - -/** - * 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; - } - } - - /* c8 ignore next */ - return null; -} - -/** - * Checks if the given node is a void expression. - * @param {ASTNode} node The node to check. - * @returns {boolean} - `true` if the node is a void expression - */ -function isExpressionVoid(node) { - return node.type === "UnaryExpression" && node.operator === "void"; -} - -/** - * Fixes the linting error by prepending "void " to the given node - * @param {Object} sourceCode context given by context.sourceCode - * @param {ASTNode} node The node to fix. - * @param {Object} fixer The fixer object provided by ESLint. - * @returns {Array} - An array of fix objects to apply to the node. - */ -function voidPrependFixer(sourceCode, node, fixer) { - - const requiresParens = - - // prepending `void ` will fail if the node has a lower precedence than void - astUtils.getPrecedence(node) < astUtils.getPrecedence({ type: "UnaryExpression", operator: "void" }) && - - // check if there are parentheses around the node to avoid redundant parentheses - !astUtils.isParenthesised(sourceCode, node); - - // avoid parentheses issues - const returnOrArrowToken = sourceCode.getTokenBefore( - node, - node.parent.type === "ArrowFunctionExpression" - ? astUtils.isArrowToken - - // isReturnToken - : token => token.type === "Keyword" && token.value === "return" - ); - - const firstToken = sourceCode.getTokenAfter(returnOrArrowToken); - - const prependSpace = - - // is return token, as => allows void to be adjacent - returnOrArrowToken.value === "return" && - - // If two tokens (return and "(") are adjacent - returnOrArrowToken.range[1] === firstToken.range[0]; - - return [ - fixer.insertTextBefore(firstToken, `${prependSpace ? " " : ""}void ${requiresParens ? "(" : ""}`), - fixer.insertTextAfter(node, requiresParens ? ")" : "") - ]; -} - -/** - * Fixes the linting error by `wrapping {}` around the given node's body. - * @param {Object} sourceCode context given by context.sourceCode - * @param {ASTNode} node The node to fix. - * @param {Object} fixer The fixer object provided by ESLint. - * @returns {Array} - An array of fix objects to apply to the node. - */ -function curlyWrapFixer(sourceCode, node, fixer) { - const arrowToken = sourceCode.getTokenBefore(node.body, astUtils.isArrowToken); - const firstToken = sourceCode.getTokenAfter(arrowToken); - const lastToken = sourceCode.getLastToken(node); - - return [ - fixer.insertTextBefore(firstToken, "{"), - fixer.insertTextAfter(lastToken, "}") - ]; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - defaultOptions: [{ - allowImplicit: false, - checkForEach: false, - allowVoid: false - }], - - docs: { - description: "Enforce `return` statements in callbacks of array methods", - recommended: false, - url: "https://eslint.org/docs/latest/rules/array-callback-return" - }, - - // eslint-disable-next-line eslint-plugin/require-meta-has-suggestions -- false positive - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - allowImplicit: { - type: "boolean" - }, - checkForEach: { - type: "boolean" - }, - allowVoid: { - type: "boolean" - } - }, - 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}}.", - wrapBraces: "Wrap the expression in `{}`.", - prependVoid: "Prepend `void` to the expression." - } - }, - - create(context) { - const [options] = context.options; - const sourceCode = context.sourceCode; - - 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; - } - - const messageAndSuggestions = { messageId: "", suggest: [] }; - - if (funcInfo.arrayMethodName === "forEach") { - if (options.checkForEach && node.type === "ArrowFunctionExpression" && node.expression) { - - if (options.allowVoid) { - if (isExpressionVoid(node.body)) { - return; - } - - messageAndSuggestions.messageId = "expectedNoReturnValue"; - messageAndSuggestions.suggest = [ - { - messageId: "wrapBraces", - fix(fixer) { - return curlyWrapFixer(sourceCode, node, fixer); - } - }, - { - messageId: "prependVoid", - fix(fixer) { - return voidPrependFixer(sourceCode, node.body, fixer); - } - } - ]; - } else { - messageAndSuggestions.messageId = "expectedNoReturnValue"; - messageAndSuggestions.suggest = [{ - messageId: "wrapBraces", - fix(fixer) { - return curlyWrapFixer(sourceCode, node, fixer); - } - }]; - } - } - } else { - if (node.body.type === "BlockStatement" && isAnySegmentReachable(funcInfo.currentSegments)) { - messageAndSuggestions.messageId = funcInfo.hasReturn ? "expectedAtEnd" : "expectedInside"; - } - } - - if (messageAndSuggestions.messageId) { - const name = astUtils.getFunctionNameWithKind(node); - - context.report({ - node, - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - messageId: messageAndSuggestions.messageId, - data: { name, arrayMethodName: fullMethodName(funcInfo.arrayMethodName) }, - suggest: messageAndSuggestions.suggest.length !== 0 ? messageAndSuggestions.suggest : null - }); - } - } - - 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, - currentSegments: new Set() - }; - }, - - // Pops this function's information. - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - onUnreachableCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - onCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - - // Checks the return statement is valid. - ReturnStatement(node) { - - if (!funcInfo.shouldCheck) { - return; - } - - funcInfo.hasReturn = true; - - const messageAndSuggestions = { messageId: "", suggest: [] }; - - if (funcInfo.arrayMethodName === "forEach") { - - // if checkForEach: true, returning a value at any path inside a forEach is not allowed - if (options.checkForEach && node.argument) { - - if (options.allowVoid) { - if (isExpressionVoid(node.argument)) { - return; - } - - messageAndSuggestions.messageId = "expectedNoReturnValue"; - messageAndSuggestions.suggest = [{ - messageId: "prependVoid", - fix(fixer) { - return voidPrependFixer(sourceCode, node.argument, fixer); - } - }]; - } else { - messageAndSuggestions.messageId = "expectedNoReturnValue"; - } - } - } else { - - // if allowImplicit: false, should also check node.argument - if (!options.allowImplicit && !node.argument) { - messageAndSuggestions.messageId = "expectedReturnValue"; - } - } - - if (messageAndSuggestions.messageId) { - context.report({ - node, - messageId: messageAndSuggestions.messageId, - data: { - name: astUtils.getFunctionNameWithKind(funcInfo.node), - arrayMethodName: fullMethodName(funcInfo.arrayMethodName) - }, - suggest: messageAndSuggestions.suggest.length !== 0 ? messageAndSuggestions.suggest : null - }); - } - }, - - // 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 deleted file mode 100644 index 504fe04..0000000 --- a/node_modules/eslint/lib/rules/array-element-newline.js +++ /dev/null @@ -1,311 +0,0 @@ -/** - * @fileoverview Rule to enforce line breaks after each array element - * @author Jan Peer Stöcklmair - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce line breaks after each array element", - recommended: false, - url: "https://eslint.org/docs/latest/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 - } - ] - } - }, - type: "array", - 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.sourceCode; - - //---------------------------------------------------------------------- - // 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); - } - - let linebreaksCount = 0; - - for (let i = 0; i < node.elements.length; i++) { - const element = node.elements[i]; - - const previousElement = elements[i - 1]; - - if (i === 0 || element === null || previousElement === null) { - continue; - } - - const commaToken = sourceCode.getFirstTokenBetween(previousElement, element, astUtils.isCommaToken); - const lastTokenOfPreviousElement = sourceCode.getTokenBefore(commaToken); - const firstTokenOfCurrentElement = sourceCode.getTokenAfter(commaToken); - - if (!astUtils.isTokenOnSameLine(lastTokenOfPreviousElement, firstTokenOfCurrentElement)) { - linebreaksCount++; - } - } - - 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 deleted file mode 100644 index a5947e5..0000000 --- a/node_modules/eslint/lib/rules/arrow-body-style.js +++ /dev/null @@ -1,298 +0,0 @@ -/** - * @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", - - defaultOptions: ["as-needed"], - - docs: { - description: "Require braces around arrow function bodies", - recommended: false, - url: "https://eslint.org/docs/latest/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] === "as-needed"; - const never = options[0] === "never"; - const requireReturnForObjectLiteral = options[1] && options[1].requireReturnForObjectLiteral; - const sourceCode = context.sourceCode; - 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 deleted file mode 100644 index 2206d8c..0000000 --- a/node_modules/eslint/lib/rules/arrow-parens.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * @fileoverview Rule to require parens in arrow function arguments. - * @author Jxck - * @deprecated in ESLint v8.53.0 - */ -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require parentheses around arrow function arguments", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 2b7d464..0000000 --- a/node_modules/eslint/lib/rules/arrow-spacing.js +++ /dev/null @@ -1,164 +0,0 @@ -/** - * @fileoverview Rule to define spacing before/after arrow function's arrow. - * @author Jxck - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after the arrow in arrow functions", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index d65fc07..0000000 --- a/node_modules/eslint/lib/rules/block-scoped-var.js +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @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/latest/rules/block-scoped-var" - }, - - schema: [], - - messages: { - outOfScope: "'{{name}}' declared on line {{definitionLine}} column {{definitionColumn}} is used outside of binding context." - } - }, - - create(context) { - let stack = []; - const sourceCode = context.sourceCode; - - /** - * 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. - * @param {eslint-scope.Definition} definition A definition for which to report reference. - * @returns {void} - */ - function report(reference, definition) { - const identifier = reference.identifier; - const definitionPosition = definition.name.loc.start; - - context.report({ - node: identifier, - messageId: "outOfScope", - data: { - name: identifier.name, - definitionLine: definitionPosition.line, - definitionColumn: definitionPosition.column + 1 - } - }); - } - - /** - * 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.at(-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 = sourceCode.getDeclaredVariables(node); - - for (let i = 0; i < variables.length; ++i) { - - // Reports. - variables[i] - .references - .filter(isOutsideOfScope) - .forEach(ref => report(ref, variables[i].defs.find(def => def.parent === node))); - } - } - - 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 deleted file mode 100644 index 9ca4611..0000000 --- a/node_modules/eslint/lib/rules/block-spacing.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @fileoverview A rule to disallow or enforce spaces inside of single line blocks. - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const util = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - 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/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 0fb4c65..0000000 --- a/node_modules/eslint/lib/rules/brace-style.js +++ /dev/null @@ -1,197 +0,0 @@ -/** - * @fileoverview Rule to flag block statements that do not use the one true brace style - * @author Ian Christian Myers - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent brace style for blocks", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index ffc34b1..0000000 --- a/node_modules/eslint/lib/rules/callback-return.js +++ /dev/null @@ -1,187 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - //-------------------------------------------------------------------------- - // 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.at(-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.at(-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 deleted file mode 100644 index 6fac746..0000000 --- a/node_modules/eslint/lib/rules/camelcase.js +++ /dev/null @@ -1,410 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allow: [], - ignoreDestructuring: false, - ignoreGlobals: false, - ignoreImports: false, - properties: "always" - }], - - docs: { - description: "Enforce camelcase naming convention", - recommended: false, - url: "https://eslint.org/docs/latest/rules/camelcase" - }, - - schema: [ - { - type: "object", - properties: { - ignoreDestructuring: { - type: "boolean" - }, - ignoreImports: { - type: "boolean" - }, - ignoreGlobals: { - type: "boolean" - }, - 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 [{ - allow, - ignoreDestructuring, - ignoreGlobals, - ignoreImports, - properties - }] = context.options; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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; - } - - /* - * Import attribute keys are always ignored - */ - if (astUtils.isImportAttributeKey(node)) { - return; - } - - report(node); - } - - return { - - // Report camelcase of global variable references ------------------ - Program(node) { - const scope = sourceCode.getScope(node); - - 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) || astUtils.isImportAttributeKey(id)) { - 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 sourceCode.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" || astUtils.isImportAttributeKey(node) || 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 sourceCode.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 deleted file mode 100644 index 07a27b6..0000000 --- a/node_modules/eslint/lib/rules/capitalized-comments.js +++ /dev/null @@ -1,303 +0,0 @@ -/** - * @fileoverview enforce or disallow capitalization of the first letter of a comment - * @author Kevin Partington - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -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? - LETTER_PATTERN = /\p{L}/u; - -/* - * 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/latest/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.sourceCode; - - 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; - } - - // Get the first Unicode character (1 or 2 code units). - const [firstWordChar] = commentWordCharsOnly; - - 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); - const char = match[0]; - - // Offset match.index by 2 to account for the first 2 characters that start the comment (// or /*) - const charIndex = comment.range[0] + match.index + 2; - - return fixer.replaceTextRange( - [charIndex, charIndex + char.length], - capitalize === "always" ? char.toLocaleUpperCase() : char.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 deleted file mode 100644 index 1105463..0000000 --- a/node_modules/eslint/lib/rules/class-methods-use-this.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - enforceForClassFields: true, - exceptMethods: [] - }], - - docs: { - description: "Enforce that class methods utilize `this`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/class-methods-use-this" - }, - - schema: [{ - type: "object", - properties: { - exceptMethods: { - type: "array", - items: { - type: "string" - } - }, - enforceForClassFields: { - type: "boolean" - } - }, - additionalProperties: false - }], - - messages: { - missingThis: "Expected 'this' to be used by class {{name}}." - } - }, - create(context) { - const [options] = context.options; - const { enforceForClassFields } = options; - const exceptMethods = new Set(options.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.sourceCode), - 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 deleted file mode 100644 index c24c147..0000000 --- a/node_modules/eslint/lib/rules/comma-dangle.js +++ /dev/null @@ -1,373 +0,0 @@ -/** - * @fileoverview Rule to forbid or enforce dangling commas. - * @author Ian Christian Myers - * @deprecated in ESLint v8.53.0 - */ - -"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 < 2017 ? "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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow trailing commas", - recommended: false, - url: "https://eslint.org/docs/latest/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.languageOptions.ecmaVersion); - - const sourceCode = context.sourceCode; - - /** - * 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.at(-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 deleted file mode 100644 index e266de4..0000000 --- a/node_modules/eslint/lib/rules/comma-spacing.js +++ /dev/null @@ -1,192 +0,0 @@ -/** - * @fileoverview Comma spacing - validates spacing before and after comma - * @author Vignesh Anand aka vegetableman. - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after commas", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 - } - }); - } - - /** - * 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; - } - - const previousToken = tokensAndComments[i - 1]; - const nextToken = tokensAndComments[i + 1]; - - if ( - previousToken && - !astUtils.isCommaToken(previousToken) && // ignore spacing between two commas - - /* - * `commaTokensToIgnore` are ending commas of `null` elements (array holes/elisions). - * In addition to spacing between two commas, this can also ignore: - * - * - Spacing after `[` (controlled by array-bracket-spacing) - * Example: [ , ] - * ^ - * - Spacing after a comment (for backwards compatibility, this was possibly unintentional) - * Example: [a, /* * / ,] - * ^ - */ - !commaTokensToIgnore.includes(token) && - - astUtils.isTokenOnSameLine(previousToken, token) && - options.before !== sourceCode.isSpaceBetweenTokens(previousToken, token) - ) { - report(token, "before", previousToken); - } - - if ( - nextToken && - !astUtils.isCommaToken(nextToken) && // ignore spacing between two commas - !astUtils.isClosingParenToken(nextToken) && // controlled by space-in-parens - !astUtils.isClosingBracketToken(nextToken) && // controlled by array-bracket-spacing - !astUtils.isClosingBraceToken(nextToken) && // controlled by object-curly-spacing - !(!options.after && nextToken.type === "Line") && // special case, allow space before line comment - astUtils.isTokenOnSameLine(token, nextToken) && - options.after !== sourceCode.isSpaceBetweenTokens(token, nextToken) - ) { - report(token, "after", nextToken); - } - }); - }, - ArrayExpression: addNullElementsToIgnoreList, - ArrayPattern: addNullElementsToIgnoreList - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/comma-style.js b/node_modules/eslint/lib/rules/comma-style.js deleted file mode 100644 index d632a3b..0000000 --- a/node_modules/eslint/lib/rules/comma-style.js +++ /dev/null @@ -1,314 +0,0 @@ -/** - * @fileoverview Comma style - enforces comma styles of two types: last and first - * @author Vignesh Anand aka vegetableman - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent comma style", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - const exceptions = { - ArrayPattern: true, - ArrowFunctionExpression: true, - CallExpression: true, - FunctionDeclaration: true, - FunctionExpression: true, - ImportDeclaration: true, - ObjectPattern: true, - NewExpression: true - }; - - if (context.options.length === 2 && Object.hasOwn(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.at(-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 deleted file mode 100644 index 7358fe1..0000000 --- a/node_modules/eslint/lib/rules/complexity.js +++ /dev/null @@ -1,192 +0,0 @@ -/** - * @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 -//------------------------------------------------------------------------------ - -const THRESHOLD_DEFAULT = 20; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - defaultOptions: [THRESHOLD_DEFAULT], - - docs: { - description: "Enforce a maximum cyclomatic complexity allowed in a program", - recommended: false, - url: "https://eslint.org/docs/latest/rules/complexity" - }, - - schema: [ - { - oneOf: [ - { - type: "integer", - minimum: 0 - }, - { - type: "object", - properties: { - maximum: { - type: "integer", - minimum: 0 - }, - max: { - type: "integer", - minimum: 0 - }, - variant: { - enum: ["classic", "modified"] - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - complex: "{{name}} has a complexity of {{complexity}}. Maximum allowed is {{max}}." - } - }, - - create(context) { - const option = context.options[0]; - let threshold = THRESHOLD_DEFAULT; - let VARIANT = "classic"; - - if (typeof option === "object") { - if (Object.hasOwn(option, "maximum") || Object.hasOwn(option, "max")) { - threshold = option.maximum || option.max; - } - - if (Object.hasOwn(option, "variant")) { - VARIANT = option.variant; - } - } else if (typeof option === "number") { - threshold = option; - } - - const IS_MODIFIED_COMPLEXITY = VARIANT === "modified"; - - //-------------------------------------------------------------------------- - // 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, - AssignmentPattern: increaseComplexity, - - // Avoid `default` - "SwitchCase[test]": () => IS_MODIFIED_COMPLEXITY || increaseComplexity(), - SwitchStatement: () => IS_MODIFIED_COMPLEXITY && increaseComplexity(), - - // Logical assignment operators have short-circuiting behavior - AssignmentExpression(node) { - if (astUtils.isLogicalAssignmentOperator(node.operator)) { - increaseComplexity(); - } - }, - - MemberExpression(node) { - if (node.optional === true) { - increaseComplexity(); - } - }, - - CallExpression(node) { - if (node.optional === true) { - 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 deleted file mode 100644 index 2852877..0000000 --- a/node_modules/eslint/lib/rules/computed-property-spacing.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside computed properties. - * @author Jamund Ferguson - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing inside computed property brackets", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index f31c2e1..0000000 --- a/node_modules/eslint/lib/rules/consistent-return.js +++ /dev/null @@ -1,210 +0,0 @@ -/** - * @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 all segments in a set and returns true if all are unreachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if all segments are unreachable; false otherwise. - */ -function areAllSegmentsUnreachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - return false; - } - } - - return true; -} - -/** - * 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/latest/rules/consistent-return" - }, - - schema: [{ - type: "object", - properties: { - treatUndefinedAsUnspecified: { - type: "boolean" - } - }, - additionalProperties: false - }], - - defaultOptions: [{ treatUndefinedAsUnspecified: 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 [{ treatUndefinedAsUnspecified }] = context.options; - 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 || - areAllSegmentsUnreachable(funcInfo.currentSegments) || - 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.sourceCode.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.sourceCode.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, - currentSegments: new Set() - }; - }, - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - onUnreachableCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - onCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - - // 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 deleted file mode 100644 index 9a76e7a..0000000 --- a/node_modules/eslint/lib/rules/consistent-this.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @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/latest/rules/consistent-this" - }, - - schema: { - type: "array", - items: { - type: "string", - minLength: 1 - }, - uniqueItems: true - }, - - defaultOptions: ["that"], - - messages: { - aliasNotAssignedToThis: "Designated alias '{{name}}' is not assigned to 'this'.", - unexpectedAlias: "Unexpected alias '{{name}}' for 'this'." - } - }, - - create(context) { - const aliases = context.options; - const sourceCode = context.sourceCode; - - /** - * 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. - * @param {ASTNode} node The node that represents the scope to check. - * @returns {void} - */ - function ensureWasAssigned(node) { - const scope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index 6f46278..0000000 --- a/node_modules/eslint/lib/rules/constructor-super.js +++ /dev/null @@ -1,445 +0,0 @@ -/** - * @fileoverview A rule to verify `super()` callings in constructor. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// 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" - ); -} - -/** - * 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.at(-1); - - return isPossibleConstructor(lastExpression); - } - - default: - return false; - } -} - -/** - * A class to store information about a code path segment. - */ -class SegmentInfo { - - /** - * Indicates if super() is called in all code paths. - * @type {boolean} - */ - calledInEveryPaths = false; - - /** - * Indicates if super() is called in any code paths. - * @type {boolean} - */ - calledInSomePaths = false; - - /** - * The nodes which have been validated and don't need to be reconsidered. - * @type {ASTNode[]} - */ - validNodes = []; -} - -//------------------------------------------------------------------------------ -// 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/latest/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." - } - }, - - 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; - - /** - * @type {Record} - */ - const 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; - } - - /** - * Determines if a segment has been seen in the traversal. - * @param {CodePathSegment} segment A code path segment to check. - * @returns {boolean} `true` if the segment has been seen. - */ - function hasSegmentBeenSeen(segment) { - return !!segInfoMap[segment.id]; - } - - /** - * 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) { - 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, - currentSegments: new Set() - }; - } else { - funcInfo = { - upper: funcInfo, - isConstructor: false, - hasExtends: false, - superIsConstructor: false, - codePath, - currentSegments: new Set() - }; - } - }, - - /** - * 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 returnedSegments = codePath.returnedSegments; - const calledInEveryPaths = returnedSegments.every(isCalledInEveryPath); - const calledInSomePaths = returnedSegments.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. - * @param {CodePathSegment} node Node that starts the segment. - * @returns {void} - */ - onCodePathSegmentStart(segment, node) { - - funcInfo.currentSegments.add(segment); - - if (!(funcInfo.isConstructor && funcInfo.hasExtends)) { - return; - } - - // Initialize info. - const info = segInfoMap[segment.id] = new SegmentInfo(); - - const seenPrevSegments = segment.prevSegments.filter(hasSegmentBeenSeen); - - // When there are previous segments, aggregates these. - if (seenPrevSegments.length > 0) { - info.calledInSomePaths = seenPrevSegments.some(isCalledInSomePath); - info.calledInEveryPaths = seenPrevSegments.every(isCalledInEveryPath); - } - - /* - * ForStatement > *.update segments are a special case as they are created in advance, - * without seen previous segments. Since they logically don't affect `calledInEveryPaths` - * calculations, and they can never be a lone previous segment of another one, we'll set - * their `calledInEveryPaths` to `true` to effectively ignore them in those calculations. - * . - */ - if (node.parent && node.parent.type === "ForStatement" && node.parent.update === node) { - info.calledInEveryPaths = true; - } - }, - - onUnreachableCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - onCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - - /** - * 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.isConstructor && funcInfo.hasExtends)) { - return; - } - - funcInfo.codePath.traverseSegments( - { first: toSegment, last: fromSegment }, - (segment, controller) => { - const info = segInfoMap[segment.id]; - - // skip segments after the loop - if (!info) { - controller.skip(); - return; - } - - const seenPrevSegments = segment.prevSegments.filter(hasSegmentBeenSeen); - const calledInSomePreviousPaths = seenPrevSegments.some(isCalledInSomePath); - const calledInEveryPreviousPaths = seenPrevSegments.every(isCalledInEveryPath); - - info.calledInSomePaths ||= calledInSomePreviousPaths; - info.calledInEveryPaths ||= calledInEveryPreviousPaths; - - // If flags become true anew, reports the valid nodes. - if (calledInSomePreviousPaths) { - 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.isConstructor && funcInfo.hasExtends)) { - return; - } - - // Skips except `super()`. - if (node.callee.type !== "Super") { - return; - } - - // Reports if needed. - const segments = funcInfo.currentSegments; - let duplicate = false; - let info = null; - - for (const segment of segments) { - - 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); - } - } - }, - - /** - * 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.isConstructor && funcInfo.hasExtends)) { - return; - } - - // Skips if no argument. - if (!node.argument) { - return; - } - - // Returning argument is a substitute of 'super()'. - const segments = funcInfo.currentSegments; - - for (const segment of segments) { - - if (segment.reachable) { - const info = segInfoMap[segment.id]; - - info.calledInSomePaths = info.calledInEveryPaths = true; - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/curly.js b/node_modules/eslint/lib/rules/curly.js deleted file mode 100644 index fa273dc..0000000 --- a/node_modules/eslint/lib/rules/curly.js +++ /dev/null @@ -1,349 +0,0 @@ -/** - * @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/latest/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 - } - ] - }, - - defaultOptions: ["all"], - - 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.sourceCode; - - //-------------------------------------------------------------------------- - // 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 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; - } - - /** - * 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 || astUtils.areBracesNecessary(body, sourceCode))) { - 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 deleted file mode 100644 index d4a83b5..0000000 --- a/node_modules/eslint/lib/rules/default-case-last.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 9fa7acd..0000000 --- a/node_modules/eslint/lib/rules/default-case.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @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", - - defaultOptions: [{}], - - docs: { - description: "Require `default` cases in `switch` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/default-case" - }, - - schema: [{ - type: "object", - properties: { - commentPattern: { - type: "string" - } - }, - additionalProperties: false - }], - - messages: { - missingDefaultCase: "Expected a default case." - } - }, - - create(context) { - const [options] = context.options; - const commentPattern = options.commentPattern - ? new RegExp(options.commentPattern, "u") - : DEFAULT_COMMENT_PATTERN; - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // Helpers - //-------------------------------------------------------------------------- - - /** - * Shortcut to get last element of array - * @param {*[]} collection Array - * @returns {any} Last element - */ - function last(collection) { - return collection.at(-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 deleted file mode 100644 index 3254fa8..0000000 --- a/node_modules/eslint/lib/rules/default-param-last.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 0d017c1..0000000 --- a/node_modules/eslint/lib/rules/dot-location.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @fileoverview Validates newlines before and after dots - * @author Greg Cochard - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent newlines before and after dots", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 370c1ca..0000000 --- a/node_modules/eslint/lib/rules/dot-notation.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowKeywords: true, - allowPattern: "" - }], - - docs: { - description: "Enforce dot notation whenever possible", - recommended: false, - url: "https://eslint.org/docs/latest/rules/dot-notation" - }, - - schema: [ - { - type: "object", - properties: { - allowKeywords: { - type: "boolean" - }, - allowPattern: { - type: "string" - } - }, - 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; - const allowKeywords = options.allowKeywords; - const sourceCode = context.sourceCode; - - 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 && - astUtils.isStaticTemplateLiteral(node.property) - ) { - 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 deleted file mode 100644 index c46ff4e..0000000 --- a/node_modules/eslint/lib/rules/eol-last.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @fileoverview Require or disallow newline at the end of files - * @author Nodeca Team - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow newline at the end of files", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode, - src = sourceCode.getText(), - lastLine = sourceCode.lines.at(-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.at(-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 deleted file mode 100644 index 12b1e80..0000000 --- a/node_modules/eslint/lib/rules/eqeqeq.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - 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 deleted file mode 100644 index 69198d1..0000000 --- a/node_modules/eslint/lib/rules/for-direction.js +++ /dev/null @@ -1,140 +0,0 @@ -/** - * @fileoverview enforce "for" loop update clause moving the counter in the right direction.(for-direction) - * @author Aladdin-ADD - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { getStaticValue } = require("@eslint-community/eslint-utils"); - -//------------------------------------------------------------------------------ -// 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/latest/rules/for-direction" - }, - - fixable: null, - schema: [], - - messages: { - incorrectDirection: "The update clause in this loop moves the variable in the wrong direction." - } - }, - - create(context) { - const { sourceCode } = 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 the counter does not change or the direction is not clear - */ - function getRightDirection(update, dir) { - const staticValue = getStaticValue(update.right, sourceCode.getScope(update)); - - if (staticValue && ["bigint", "boolean", "number"].includes(typeof staticValue.value)) { - const sign = Math.sign(Number(staticValue.value)) || 0; // convert NaN to 0 - - return dir * sign; - } - return 0; - } - - /** - * 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.update) { - for (const counterPosition of ["left", "right"]) { - if (node.test[counterPosition].type !== "Identifier") { - continue; - } - - const counter = node.test[counterPosition].name; - const operator = node.test.operator; - const update = node.update; - - let wrongDirection; - - if (operator === "<" || operator === "<=") { - wrongDirection = counterPosition === "left" ? -1 : 1; - } else if (operator === ">" || operator === ">=") { - wrongDirection = counterPosition === "left" ? 1 : -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 deleted file mode 100644 index 33f7372..0000000 --- a/node_modules/eslint/lib/rules/func-call-spacing.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * @fileoverview Rule to control spacing within function calls - * @author Matt DuVall - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow spacing between function identifiers and their invocations", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index b9555d6..0000000 --- a/node_modules/eslint/lib/rules/func-name-matching.js +++ /dev/null @@ -1,253 +0,0 @@ -/** - * @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 >= 2015) { - 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/latest/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.languageOptions.ecmaVersion; - - /** - * 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 deleted file mode 100644 index 6990f0c..0000000 --- a/node_modules/eslint/lib/rules/func-names.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @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", - - defaultOptions: ["always", {}], - - docs: { - description: "Require or disallow named `function` expressions", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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[1].generators - ) { - return context.options[1].generators; - } - - return context.options[0]; - } - - /** - * 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 = sourceCode.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 deleted file mode 100644 index b6682d6..0000000 --- a/node_modules/eslint/lib/rules/func-style.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @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", - - defaultOptions: ["expression", { - allowArrowFunctions: false, - overrides: {} - }], - - docs: { - description: "Enforce the consistent use of either `function` declarations or expressions assigned to variables", - recommended: false, - url: "https://eslint.org/docs/latest/rules/func-style" - }, - - schema: [ - { - enum: ["declaration", "expression"] - }, - { - type: "object", - properties: { - allowArrowFunctions: { - type: "boolean" - }, - overrides: { - type: "object", - properties: { - namedExports: { - enum: ["declaration", "expression", "ignore"] - } - }, - additionalProperties: false - } - }, - additionalProperties: false - } - ], - - messages: { - expression: "Expected a function expression.", - declaration: "Expected a function declaration." - } - }, - - create(context) { - const [style, { allowArrowFunctions, overrides }] = context.options; - const enforceDeclarations = (style === "declaration"); - const { namedExports: exportFunctionStyle } = overrides; - const stack = []; - - const nodesToCheck = { - FunctionDeclaration(node) { - stack.push(false); - - if ( - !enforceDeclarations && - node.parent.type !== "ExportDefaultDeclaration" && - (typeof exportFunctionStyle === "undefined" || node.parent.type !== "ExportNamedDeclaration") - ) { - context.report({ node, messageId: "expression" }); - } - - if (node.parent.type === "ExportNamedDeclaration" && exportFunctionStyle === "expression") { - context.report({ node, messageId: "expression" }); - } - }, - "FunctionDeclaration:exit"() { - stack.pop(); - }, - - FunctionExpression(node) { - stack.push(false); - - if ( - enforceDeclarations && - node.parent.type === "VariableDeclarator" && - (typeof exportFunctionStyle === "undefined" || node.parent.parent.parent.type !== "ExportNamedDeclaration") - ) { - context.report({ node: node.parent, messageId: "declaration" }); - } - - if ( - node.parent.type === "VariableDeclarator" && node.parent.parent.parent.type === "ExportNamedDeclaration" && - exportFunctionStyle === "declaration" - ) { - context.report({ node: node.parent, messageId: "declaration" }); - } - }, - "FunctionExpression:exit"() { - stack.pop(); - }, - - "ThisExpression, Super"() { - if (stack.length > 0) { - stack[stack.length - 1] = true; - } - } - }; - - if (!allowArrowFunctions) { - nodesToCheck.ArrowFunctionExpression = function() { - stack.push(false); - }; - - nodesToCheck["ArrowFunctionExpression:exit"] = function(node) { - const hasThisOrSuperExpr = stack.pop(); - - if (!hasThisOrSuperExpr && node.parent.type === "VariableDeclarator") { - if ( - enforceDeclarations && - (typeof exportFunctionStyle === "undefined" || node.parent.parent.parent.type !== "ExportNamedDeclaration") - ) { - context.report({ node: node.parent, messageId: "declaration" }); - } - - if (node.parent.parent.parent.type === "ExportNamedDeclaration" && exportFunctionStyle === "declaration") { - 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 deleted file mode 100644 index 458399d..0000000 --- a/node_modules/eslint/lib/rules/function-call-argument-newline.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @fileoverview Rule to enforce line breaks between arguments of a function call - * @author Alexey Gonchar - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce line breaks between arguments of a function call", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - 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 deleted file mode 100644 index 86268e5..0000000 --- a/node_modules/eslint/lib/rules/function-paren-newline.js +++ /dev/null @@ -1,292 +0,0 @@ -/** - * @fileoverview enforce consistent line breaks inside function parentheses - * @author Teddy Katz - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent line breaks inside function parentheses", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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.at(-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.at(-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 deleted file mode 100644 index c633f97..0000000 --- a/node_modules/eslint/lib/rules/generator-star-spacing.js +++ /dev/null @@ -1,209 +0,0 @@ -/** - * @fileoverview Rule to check the spacing around the * in generator functions. - * @author Jamund Ferguson - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing around `*` operators in generator functions", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index f012876..0000000 --- a/node_modules/eslint/lib/rules/getter-return.js +++ /dev/null @@ -1,206 +0,0 @@ -/** - * @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 all segments in a set and returns true if any are reachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if any segment is reachable; false otherwise. - */ -function isAnySegmentReachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - return true; - } - } - - return false; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - defaultOptions: [{ - allowImplicit: false - }], - - docs: { - description: "Enforce `return` statements in getters", - recommended: true, - url: "https://eslint.org/docs/latest/rules/getter-return" - }, - - fixable: null, - - schema: [ - { - type: "object", - properties: { - allowImplicit: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - expected: "Expected to return a value in {{name}}.", - expectedAlways: "Expected {{name}} to always return a value." - } - }, - - create(context) { - const [{ allowImplicit }] = context.options; - const sourceCode = context.sourceCode; - - let funcInfo = { - upper: null, - codePath: null, - hasReturn: false, - shouldCheck: false, - node: null, - currentSegments: [] - }; - - /** - * 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 && - isAnySegmentReachable(funcInfo.currentSegments) - ) { - 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() or Reflect.defineProperty() - if (parent.parent.parent.type === "CallExpression") { - const callNode = parent.parent.parent.callee; - - if (astUtils.isSpecificMemberAccess(callNode, "Object", "defineProperty") || - astUtils.isSpecificMemberAccess(callNode, "Reflect", "defineProperty")) { - return true; - } - } - - // Object.defineProperties() or Object.create() - if (parent.parent.parent.type === "Property" && - parent.parent.parent.parent.type === "ObjectExpression" && - parent.parent.parent.parent.parent.type === "CallExpression") { - const callNode = parent.parent.parent.parent.parent.callee; - - return astUtils.isSpecificMemberAccess(callNode, "Object", "defineProperties") || - astUtils.isSpecificMemberAccess(callNode, "Object", "create"); - } - } - } - return false; - } - return { - - // Stacks this function's information. - onCodePathStart(codePath, node) { - funcInfo = { - upper: funcInfo, - codePath, - hasReturn: false, - shouldCheck: isGetter(node), - node, - currentSegments: new Set() - }; - }, - - // Pops this function's information. - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - onUnreachableCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - onCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - // Checks the return statement is valid. - ReturnStatement(node) { - if (funcInfo.shouldCheck) { - funcInfo.hasReturn = true; - - // if allowImplicit: false, should also check node.argument - if (!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 deleted file mode 100644 index deae9d2..0000000 --- a/node_modules/eslint/lib/rules/global-require.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @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]); - - if (references.length === 1) { - return references[0]; - } - - /* c8 ignore next */ - 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/latest/rules/global-require" - }, - - schema: [], - messages: { - unexpected: "Unexpected require()." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - CallExpression(node) { - const currentScope = sourceCode.getScope(node); - - if (node.callee.name === "require" && !isShadowed(currentScope, node.callee)) { - const isGoodRequire = sourceCode.getAncestors(node).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 deleted file mode 100644 index cd627b4..0000000 --- a/node_modules/eslint/lib/rules/grouped-accessor-pairs.js +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @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", - - defaultOptions: ["anyOrder"], - - docs: { - description: "Require grouped accessor pairs in object literals and classes", - recommended: false, - url: "https://eslint.org/docs/latest/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; - const sourceCode = context.sourceCode; - - /** - * 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) - } - }); - } - - /** - * 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 = []; - let found = false; - - for (let i = 0; i < nodes.length; i++) { - const node = nodes[i]; - - if (shouldCheck(node) && isAccessorKind(node)) { - - // Creates a new `AccessorData` object for the given getter or setter node. - const name = astUtils.getStaticPropertyName(node); - const key = (name !== null) ? name : sourceCode.getTokens(node.key); - - // Merges the given `AccessorData` object into the given accessors list. - for (let j = 0; j < accessors.length; j++) { - const accessor = accessors[j]; - - if (areEqualKeys(accessor.key, key)) { - accessor.getters.push(...node.kind === "get" ? [node] : []); - accessor.setters.push(...node.kind === "set" ? [node] : []); - found = true; - break; - } - } - if (!found) { - accessors.push({ - key, - getters: node.kind === "get" ? [node] : [], - setters: node.kind === "set" ? [node] : [] - }); - } - found = false; - } - } - - 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 deleted file mode 100644 index d6e70d0..0000000 --- a/node_modules/eslint/lib/rules/guard-for-in.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index ad84931..0000000 --- a/node_modules/eslint/lib/rules/handle-callback-err.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @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/latest/rules/handle-callback-err" - }, - - schema: [ - { - type: "string" - } - ], - messages: { - expected: "Expected error to be handled." - } - }, - - create(context) { - - const errorArgument = context.options[0] || "err"; - const sourceCode = context.sourceCode; - - /** - * 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 = sourceCode.getScope(node), - 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 deleted file mode 100644 index 6b7f561..0000000 --- a/node_modules/eslint/lib/rules/id-blacklist.js +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @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/latest/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(); - const sourceCode = context.sourceCode; - - 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(node) { - globalScope = sourceCode.getScope(node); - }, - - 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 deleted file mode 100644 index 5d394be..0000000 --- a/node_modules/eslint/lib/rules/id-denylist.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @fileoverview Rule that warns when identifier names that are - * specified in the configuration are used. - * @author Keith Cirkel (http://keithcirkel.co.uk) - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// 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", - - defaultOptions: [], - - docs: { - description: "Disallow specified identifiers", - recommended: false, - url: "https://eslint.org/docs/latest/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(); - const sourceCode = context.sourceCode; - - 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) { - - // Import attributes are defined by environments, so naming conventions shouldn't apply to them - if (astUtils.isImportAttributeKey(node)) { - return false; - } - - 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(node) { - globalScope = sourceCode.getScope(node); - }, - - [[ - "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 deleted file mode 100644 index 65b7570..0000000 --- a/node_modules/eslint/lib/rules/id-length.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * @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"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { getGraphemeCount } = require("../shared/string-utils"); -const { getModuleExportName, isImportAttributeKey } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - defaultOptions: [{ - exceptionPatterns: [], - exceptions: [], - min: 2, - properties: "always" - }], - - docs: { - description: "Enforce minimum and maximum identifier lengths", - recommended: false, - url: "https://eslint.org/docs/latest/rules/id-length" - }, - - schema: [ - { - type: "object", - properties: { - min: { - type: "integer" - }, - 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; - const { max: maxLength = Infinity, min: minLength } = options; - 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 && !isImportAttributeKey(node) && !parent.computed && parent.key.name === node.name; - }, - ImportSpecifier(parent, node) { - return ( - parent.local === node && - getModuleExportName(parent.imported) !== getModuleExportName(parent.local) - ); - }, - ImportDefaultSpecifier: true, - ImportNamespaceSpecifier: 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 nameLength = getGraphemeCount(name); - - const isShort = nameLength < minLength; - const isLong = nameLength > 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 deleted file mode 100644 index 76d774e..0000000 --- a/node_modules/eslint/lib/rules/id-match.js +++ /dev/null @@ -1,307 +0,0 @@ -/** - * @fileoverview Rule to flag non-matching identifiers - * @author Matthieu Larcher - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - defaultOptions: ["^.+$", { - classFields: false, - ignoreDestructuring: false, - onlyDeclarations: false, - properties: false - }], - - docs: { - description: "Require identifiers to match a specified regular expression", - recommended: false, - url: "https://eslint.org/docs/latest/rules/id-match" - }, - - schema: [ - { - type: "string" - }, - { - type: "object", - properties: { - properties: { - type: "boolean" - }, - classFields: { - type: "boolean" - }, - onlyDeclarations: { - type: "boolean" - }, - ignoreDestructuring: { - type: "boolean" - } - }, - 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, { - classFields: checkClassFields, - ignoreDestructuring, - onlyDeclarations, - properties: checkProperties - }] = context.options; - const regexp = new RegExp(pattern, "u"); - - const sourceCode = context.sourceCode; - 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(node) { - globalScope = sourceCode.getScope(node); - }, - - Identifier(node) { - const name = node.name, - parent = node.parent, - effectiveParent = (parent.type === "MemberExpression") ? parent.parent : parent; - - if (isReferenceToGlobalVariable(node) || astUtils.isImportAttributeKey(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 deleted file mode 100644 index 32f422c..0000000 --- a/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @fileoverview enforce the location of arrow function bodies - * @author Sharmila Jesupaul - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce the location of arrow function bodies", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 4adb423..0000000 --- a/node_modules/eslint/lib/rules/indent-legacy.js +++ /dev/null @@ -1,1126 +0,0 @@ -/** - * @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 -//------------------------------------------------------------------------------ -// this rule has known coverage issues, but it's deprecated and shouldn't be updated in the future anyway. -/* c8 ignore next */ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - docs: { - description: "Enforce consistent indentation", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - if (context.options.length) { - if (context.options[0] === "tab") { - indentSize = 1; - indentType = "tab"; - } else /* c8 ignore start */ if (typeof context.options[0] === "number") { - indentSize = context.options[0]; - indentType = "space"; - }/* c8 ignore stop */ - - 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.at(-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.at(-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.at(-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.at(-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 deleted file mode 100644 index bc812b1..0000000 --- a/node_modules/eslint/lib/rules/indent.js +++ /dev/null @@ -1,1803 +0,0 @@ -/** - * @fileoverview This rule sets a specific indentation style and width for your code - * - * @author Teddy Katz - * @author Vitaly Puzrin - * @author Gyandeep Singh - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -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 map that stores (key, value) pairs. The keys are numeric indices, and must be unique. - * This is intended to be a generic wrapper around a map with non-negative integer keys, so that the underlying implementation - * can easily be swapped out. - */ -class IndexMap { - - /** - * Creates an empty map - * @param {number} maxKey The maximum key - */ - constructor(maxKey) { - - // Initializing the array with the maximum expected size avoids dynamic reallocations that could degrade performance. - this._values = Array(maxKey + 1); - } - - /** - * Inserts an entry into the map. - * @param {number} key The entry's key - * @param {any} value The entry's value - * @returns {void} - */ - insert(key, value) { - this._values[key] = value; - } - - /** - * Finds the value of the entry with the largest key less than or equal to the provided key - * @param {number} key The provided key - * @returns {*|undefined} The value of the found entry, or undefined if no such entry exists. - */ - findLastNotAfter(key) { - const values = this._values; - - for (let index = key; index >= 0; index--) { - const value = values[index]; - - if (value) { - return value; - } - } - return void 0; - } - - /** - * 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) { - this._values.fill(void 0, start, end); - } -} - -/** - * 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 = new Map(); - const tokens = sourceCode.tokensAndComments; - - for (let i = 0; i < tokens.length; i++) { - const token = tokens[i]; - - if (!this.firstTokensByLineNumber.has(token.loc.start.line)) { - this.firstTokensByLineNumber.set(token.loc.start.line, token); - } - if (!this.firstTokensByLineNumber.has(token.loc.end.line) && sourceCode.text.slice(token.range[1] - token.loc.end.column, token.range[1]).trim()) { - this.firstTokensByLineNumber.set(token.loc.end.line, token); - } - } - } - - /** - * 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 - * @param {number} maxIndex The maximum end index of any token - */ - constructor(tokenInfo, indentSize, indentType, maxIndex) { - this._tokenInfo = tokenInfo; - this._indentSize = indentSize; - this._indentType = indentType; - - this._indexMap = new IndexMap(maxIndex); - this._indexMap.insert(0, { offset: 0, from: null, force: false }); - - this._lockedFirstTokens = new WeakMap(); - this._desiredIndentCache = new WeakMap(); - this._ignoredTokens = new WeakSet(); - } - - _getOffsetDescriptor(token) { - return this._indexMap.findLastNotAfter(token.range[0]); - } - - /** - * 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 map indexed by key. - */ - - const descriptorToInsert = { offset, from: fromToken, force }; - - const descriptorAfterRange = this._indexMap.findLastNotAfter(range[1]); - - 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 map. - this._indexMap.deleteRange(range[0] + 1, range[1]); - - // Insert a new node into the map for this range - this._indexMap.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._indexMap.insert(fromToken.range[0], fromTokenDescriptor); - this._indexMap.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._indexMap.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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent indentation", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - const tokenInfo = new TokenInfo(sourceCode); - const offsets = new OffsetStorage(tokenInfo, indentSize, indentType === "space" ? " " : "\t", sourceCode.text.length); - 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 = []; - - for (let i = 0; i < tokens.length; i++) { - const nextToken = tokens[i]; - - if (astUtils.isOpeningParenToken(nextToken)) { - parenStack.push(nextToken); - } else if (astUtils.isClosingParenToken(nextToken)) { - parenPairs.push({ left: parenStack.pop(), right: nextToken }); - } - } - - for (let i = parenPairs.length - 1; i >= 0; i--) { - const leftParen = parenPairs[i].left; - const rightParen = parenPairs[i].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.at(-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, WithStatement": 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) { - 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, WithStatement):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; - - // 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.at(-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.hasOwn(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.at(-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. - for (let i = 0; i < listenerCallQueue.length; i++) { - const nodeInfo = listenerCallQueue[i]; - - if (!ignoredNodes.has(nodeInfo.node)) { - 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 = new WeakMap(); - - for (let i = 0; i < sourceCode.ast.comments.length; i++) { - const comment = sourceCode.ast.comments[i]; - - const tokenOrCommentBefore = sourceCode.getTokenBefore(comment, { includeComments: true }); - const hasToken = precedingTokens.has(tokenOrCommentBefore) ? precedingTokens.get(tokenOrCommentBefore) : tokenOrCommentBefore; - - precedingTokens.set(comment, hasToken); - } - - for (let i = 1; i < sourceCode.lines.length + 1; i++) { - - if (!tokenInfo.firstTokensByLineNumber.has(i)) { - - // Don't check indentation on blank lines - continue; - } - - const firstTokenOfLine = tokenInfo.firstTokensByLineNumber.get(i); - - if (firstTokenOfLine.loc.start.line !== i) { - - // Don't check the indentation of multi-line tokens (e.g. template literals or block comments) twice. - continue; - } - - 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)) - ) { - continue; - } - } - - // If the token matches the expected indentation, don't report it. - if (validateTokenIndent(firstTokenOfLine, offsets.getDesiredIndent(firstTokenOfLine))) { - continue; - } - - // 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 deleted file mode 100644 index 5ff7b6f..0000000 --- a/node_modules/eslint/lib/rules/index.js +++ /dev/null @@ -1,305 +0,0 @@ -/** - * @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"), - "logical-assignment-operators": () => require("./logical-assignment-operators"), - "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-empty-static-block": () => require("./no-empty-static-block"), - "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-native-nonconstructor": () => require("./no-new-native-nonconstructor"), - "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-object-constructor": () => require("./no-object-constructor"), - "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-assignment": () => require("./no-useless-assignment"), - "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-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-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 deleted file mode 100644 index 3abe107..0000000 --- a/node_modules/eslint/lib/rules/init-declarations.js +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 3dcd5fa..0000000 --- a/node_modules/eslint/lib/rules/jsx-quotes.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @fileoverview A rule to ensure consistent quotes used in jsx syntax. - * @author Mathias Schreck - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce the consistent use of either double or single quotes in JSX attributes", - recommended: false, - url: "https://eslint.org/docs/latest/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 deleted file mode 100644 index aa8fd37..0000000 --- a/node_modules/eslint/lib/rules/key-spacing.js +++ /dev/null @@ -1,687 +0,0 @@ -/** - * @fileoverview Rule to specify spacing of object literal keys and values - * @author Brandon Mills - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { getGraphemeCount } = require("../shared/string-utils"); - -/** - * 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.at(-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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing between keys and values in object literal properties", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 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); - } - - /** - * Starting from the given 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 = getNextColon(node); - - return sourceCode.getTokenBefore(colonToken); - } - - /** - * Starting from the given node (a property.key node here) looks forward - * until it finds the first token after a colon punctuator and returns it. - * @param {ASTNode} node The node to start looking from. - * @returns {ASTNode} The first token after a colon punctuator. - */ - function getFirstTokenAfterColon(node) { - const colonToken = getNextColon(node); - - return sourceCode.getTokenAfter(colonToken); - } - - /** - * 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, - candidateValueStartLine = (isKeyValueProperty(candidate) ? getFirstTokenAfterColon(candidate.key) : candidate).loc.start.line; - - if (candidateValueStartLine - 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 && - candidateValueStartLine - 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; - } - - /** - * 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 getGraphemeCount(sourceCode.getText().slice(startToken.range[0], endToken.range[1])); - } - - /** - * 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 deleted file mode 100644 index 9d18441..0000000 --- a/node_modules/eslint/lib/rules/keyword-spacing.js +++ /dev/null @@ -1,640 +0,0 @@ -/** - * @fileoverview Rule to enforce spacing before and after keywords. - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after keywords", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - 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 deleted file mode 100644 index e7a7788..0000000 --- a/node_modules/eslint/lib/rules/line-comment-position.js +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @fileoverview Rule to enforce the position of line comments - * @author Alberto Rodríguez - * @deprecated in ESLint v9.3.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce position of line comments", - recommended: false, - url: "https://eslint.org/docs/latest/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.hasOwn(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.sourceCode; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index e59acca..0000000 --- a/node_modules/eslint/lib/rules/linebreak-style.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @fileoverview Rule to enforce a single linebreak style. - * @author Erik Mueller - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent linebreak style", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index 2a6e472..0000000 --- a/node_modules/eslint/lib/rules/lines-around-comment.js +++ /dev/null @@ -1,471 +0,0 @@ -/** - * @fileoverview Enforces empty lines around comments. - * @author Jamund Ferguson - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Return an array 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 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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require empty lines around comments", - recommended: false, - url: "https://eslint.org/docs/latest/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" - }, - afterHashbangComment: { - type: "boolean", - default: false - } - }, - 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.sourceCode; - - 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)) { - let parentStartNodeOrToken = parent; - - if (parent.type === "StaticBlock") { - parentStartNodeOrToken = sourceCode.getFirstToken(parent, { skip: 1 }); // opening brace of the static block - } else if (parent.type === "SwitchStatement") { - parentStartNodeOrToken = sourceCode.getTokenAfter(parent.discriminant, { - filter: astUtils.isOpeningBraceToken - }); // opening brace of the switch statement - } - - 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") || - isCommentAtParentStart(token, "SwitchStatement") - ); - } - - /** - * 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 - }); - } - } else if (token.type === "Shebang") { - if (options.afterHashbangComment) { - checkForEmptyLine(token, { - after: options.afterHashbangComment, - before: false - }); - } - } - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/lines-around-directive.js b/node_modules/eslint/lib/rules/lines-around-directive.js deleted file mode 100644 index fb6871d..0000000 --- a/node_modules/eslint/lib/rules/lines-around-directive.js +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @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/latest/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.sourceCode; - 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.at(-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.at(-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 deleted file mode 100644 index 5f36d46..0000000 --- a/node_modules/eslint/lib/rules/lines-between-class-members.js +++ /dev/null @@ -1,269 +0,0 @@ -/** - * @fileoverview Rule to check empty newline between class members - * @author 薛定谔的猫 - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Types of class members. - * Those have `test` method to check it matches to the given class member. - * @private - */ -const ClassMemberTypes = { - "*": { test: () => true }, - field: { test: node => node.type === "PropertyDefinition" }, - method: { test: node => node.type === "MethodDefinition" } -}; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow an empty line between class members", - recommended: false, - url: "https://eslint.org/docs/latest/rules/lines-between-class-members" - }, - - fixable: "whitespace", - - schema: [ - { - anyOf: [ - { - type: "object", - properties: { - enforce: { - type: "array", - items: { - type: "object", - properties: { - blankLine: { enum: ["always", "never"] }, - prev: { enum: ["method", "field", "*"] }, - next: { enum: ["method", "field", "*"] } - }, - additionalProperties: false, - required: ["blankLine", "prev", "next"] - }, - minItems: 1 - } - }, - additionalProperties: false, - required: ["enforce"] - }, - { - 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 configureList = typeof options[0] === "object" ? options[0].enforce : [{ blankLine: options[0], prev: "*", next: "*" }]; - const sourceCode = context.sourceCode; - - /** - * 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; - } - - /** - * Checks whether the given node matches the given type. - * @param {ASTNode} node The class member node to check. - * @param {string} type The class member type to check. - * @returns {boolean} `true` if the class member node matched the type. - * @private - */ - function match(node, type) { - return ClassMemberTypes[type].test(node); - } - - /** - * Finds the last matched configuration from the configureList. - * @param {ASTNode} prevNode The previous node to match. - * @param {ASTNode} nextNode The current node to match. - * @returns {string|null} Padding type or `null` if no matches were found. - * @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 configure.blankLine; - } - } - return null; - } - - 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); - const paddingType = getPaddingType(body[i], body[i + 1]); - - if (paddingType === "never" && isPadded) { - context.report({ - node: body[i + 1], - messageId: "never", - - fix(fixer) { - if (hasTokenInPadding) { - return null; - } - return fixer.replaceTextRange([beforePadding.range[1], afterPadding.range[0]], "\n"); - } - }); - } else if (paddingType === "always" && !skip && !isPadded) { - context.report({ - node: body[i + 1], - messageId: "always", - - fix(fixer) { - if (hasTokenInPadding) { - return null; - } - return fixer.insertTextAfter(curLineLastToken, "\n"); - } - }); - } - - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/logical-assignment-operators.js b/node_modules/eslint/lib/rules/logical-assignment-operators.js deleted file mode 100644 index c084c04..0000000 --- a/node_modules/eslint/lib/rules/logical-assignment-operators.js +++ /dev/null @@ -1,504 +0,0 @@ -/** - * @fileoverview Rule to replace assignment expressions with logical operator assignment - * @author Daniel Martens - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const astUtils = require("./utils/ast-utils.js"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const baseTypes = new Set(["Identifier", "Super", "ThisExpression"]); - -/** - * Returns true iff either "undefined" or a void expression (eg. "void 0") - * @param {ASTNode} expression Expression to check - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} True iff "undefined" or "void ..." - */ -function isUndefined(expression, scope) { - if (expression.type === "Identifier" && expression.name === "undefined") { - return astUtils.isReferenceToGlobalVariable(scope, expression); - } - - return expression.type === "UnaryExpression" && - expression.operator === "void" && - expression.argument.type === "Literal" && - expression.argument.value === 0; -} - -/** - * Returns true iff the reference is either an identifier or member expression - * @param {ASTNode} expression Expression to check - * @returns {boolean} True for identifiers and member expressions - */ -function isReference(expression) { - return (expression.type === "Identifier" && expression.name !== "undefined") || - expression.type === "MemberExpression"; -} - -/** - * Returns true iff the expression checks for nullish with loose equals. - * Examples: value == null, value == void 0 - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} True iff implicit nullish comparison - */ -function isImplicitNullishComparison(expression, scope) { - if (expression.type !== "BinaryExpression" || expression.operator !== "==") { - return false; - } - - const reference = isReference(expression.left) ? "left" : "right"; - const nullish = reference === "left" ? "right" : "left"; - - return isReference(expression[reference]) && - (astUtils.isNullLiteral(expression[nullish]) || isUndefined(expression[nullish], scope)); -} - -/** - * Condition with two equal comparisons. - * @param {ASTNode} expression Condition - * @returns {boolean} True iff matches ? === ? || ? === ? - */ -function isDoubleComparison(expression) { - return expression.type === "LogicalExpression" && - expression.operator === "||" && - expression.left.type === "BinaryExpression" && - expression.left.operator === "===" && - expression.right.type === "BinaryExpression" && - expression.right.operator === "==="; -} - -/** - * Returns true iff the expression checks for undefined and null. - * Example: value === null || value === undefined - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} True iff explicit nullish comparison - */ -function isExplicitNullishComparison(expression, scope) { - if (!isDoubleComparison(expression)) { - return false; - } - const leftReference = isReference(expression.left.left) ? "left" : "right"; - const leftNullish = leftReference === "left" ? "right" : "left"; - const rightReference = isReference(expression.right.left) ? "left" : "right"; - const rightNullish = rightReference === "left" ? "right" : "left"; - - return astUtils.isSameReference(expression.left[leftReference], expression.right[rightReference]) && - ((astUtils.isNullLiteral(expression.left[leftNullish]) && isUndefined(expression.right[rightNullish], scope)) || - (isUndefined(expression.left[leftNullish], scope) && astUtils.isNullLiteral(expression.right[rightNullish]))); -} - -/** - * Returns true for Boolean(arg) calls - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {boolean} Whether the expression is a boolean cast - */ -function isBooleanCast(expression, scope) { - return expression.type === "CallExpression" && - expression.callee.name === "Boolean" && - expression.arguments.length === 1 && - astUtils.isReferenceToGlobalVariable(scope, expression.callee); -} - -/** - * Returns true for: - * truthiness checks: value, Boolean(value), !!value - * falsiness checks: !value, !Boolean(value) - * nullish checks: value == null, value === undefined || value === null - * @param {ASTNode} expression Test condition - * @param {import('eslint-scope').Scope} scope Scope of the expression - * @returns {?{ reference: ASTNode, operator: '??'|'||'|'&&'}} Null if not a known existence - */ -function getExistence(expression, scope) { - const isNegated = expression.type === "UnaryExpression" && expression.operator === "!"; - const base = isNegated ? expression.argument : expression; - - switch (true) { - case isReference(base): - return { reference: base, operator: isNegated ? "||" : "&&" }; - case base.type === "UnaryExpression" && base.operator === "!" && isReference(base.argument): - return { reference: base.argument, operator: "&&" }; - case isBooleanCast(base, scope) && isReference(base.arguments[0]): - return { reference: base.arguments[0], operator: isNegated ? "||" : "&&" }; - case isImplicitNullishComparison(expression, scope): - return { reference: isReference(expression.left) ? expression.left : expression.right, operator: "??" }; - case isExplicitNullishComparison(expression, scope): - return { reference: isReference(expression.left.left) ? expression.left.left : expression.left.right, operator: "??" }; - default: return null; - } -} - -/** - * Returns true iff the node is inside a with block - * @param {ASTNode} node Node to check - * @returns {boolean} True iff passed node is inside a with block - */ -function isInsideWithBlock(node) { - if (node.type === "Program") { - return false; - } - - return node.parent.type === "WithStatement" && node.parent.body === node ? true : isInsideWithBlock(node.parent); -} - -/** - * Gets the leftmost operand of a consecutive logical expression. - * @param {SourceCode} sourceCode The ESLint source code object - * @param {LogicalExpression} node LogicalExpression - * @returns {Expression} Leftmost operand - */ -function getLeftmostOperand(sourceCode, node) { - let left = node.left; - - while (left.type === "LogicalExpression" && left.operator === node.operator) { - - if (astUtils.isParenthesised(sourceCode, left)) { - - /* - * It should have associativity, - * but ignore it if use parentheses to make the evaluation order clear. - */ - return left; - } - left = left.left; - } - return left; - -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Require or disallow logical assignment operator shorthand", - recommended: false, - url: "https://eslint.org/docs/latest/rules/logical-assignment-operators" - }, - - schema: { - type: "array", - oneOf: [{ - items: [ - { const: "always" }, - { - type: "object", - properties: { - enforceForIfStatements: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - minItems: 0, // 0 for allowing passing no options - maxItems: 2 - }, { - items: [{ const: "never" }], - minItems: 1, - maxItems: 1 - }] - }, - fixable: "code", - hasSuggestions: true, - messages: { - assignment: "Assignment (=) can be replaced with operator assignment ({{operator}}).", - useLogicalOperator: "Convert this assignment to use the operator {{ operator }}.", - logical: "Logical expression can be replaced with an assignment ({{ operator }}).", - convertLogical: "Replace this logical expression with an assignment with the operator {{ operator }}.", - if: "'if' statement can be replaced with a logical operator assignment with operator {{ operator }}.", - convertIf: "Replace this 'if' statement with a logical assignment with operator {{ operator }}.", - unexpected: "Unexpected logical operator assignment ({{operator}}) shorthand.", - separate: "Separate the logical assignment into an assignment with a logical operator." - } - }, - - create(context) { - const mode = context.options[0] === "never" ? "never" : "always"; - const checkIf = mode === "always" && context.options.length > 1 && context.options[1].enforceForIfStatements; - const sourceCode = context.sourceCode; - const isStrict = sourceCode.getScope(sourceCode.ast).isStrict; - - /** - * Returns false if the access could be a getter - * @param {ASTNode} node Assignment expression - * @returns {boolean} True iff the fix is safe - */ - function cannotBeGetter(node) { - return node.type === "Identifier" && - (isStrict || !isInsideWithBlock(node)); - } - - /** - * Check whether only a single property is accessed - * @param {ASTNode} node reference - * @returns {boolean} True iff a single property is accessed - */ - function accessesSingleProperty(node) { - if (!isStrict && isInsideWithBlock(node)) { - return node.type === "Identifier"; - } - - return node.type === "MemberExpression" && - baseTypes.has(node.object.type) && - (!node.computed || (node.property.type !== "MemberExpression" && node.property.type !== "ChainExpression")); - } - - /** - * Adds a fixer or suggestion whether on the fix is safe. - * @param {{ messageId: string, node: ASTNode }} descriptor Report descriptor without fix or suggest - * @param {{ messageId: string, fix: Function }} suggestion Adds the fix or the whole suggestion as only element in "suggest" to suggestion - * @param {boolean} shouldBeFixed Fix iff the condition is true - * @returns {Object} Descriptor with either an added fix or suggestion - */ - function createConditionalFixer(descriptor, suggestion, shouldBeFixed) { - if (shouldBeFixed) { - return { - ...descriptor, - fix: suggestion.fix - }; - } - - return { - ...descriptor, - suggest: [suggestion] - }; - } - - - /** - * Returns the operator token for assignments and binary expressions - * @param {ASTNode} node AssignmentExpression or BinaryExpression - * @returns {import('eslint').AST.Token} Operator token between the left and right expression - */ - function getOperatorToken(node) { - return sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator); - } - - if (mode === "never") { - return { - - // foo ||= bar - "AssignmentExpression"(assignment) { - if (!astUtils.isLogicalAssignmentOperator(assignment.operator)) { - return; - } - - const descriptor = { - messageId: "unexpected", - node: assignment, - data: { operator: assignment.operator } - }; - const suggestion = { - messageId: "separate", - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(assignment).length > 0) { - return; - } - - const operatorToken = getOperatorToken(assignment); - - // -> foo = bar - yield ruleFixer.replaceText(operatorToken, "="); - - const assignmentText = sourceCode.getText(assignment.left); - const operator = assignment.operator.slice(0, -1); - - // -> foo = foo || bar - yield ruleFixer.insertTextAfter(operatorToken, ` ${assignmentText} ${operator}`); - - const precedence = astUtils.getPrecedence(assignment.right) <= astUtils.getPrecedence({ type: "LogicalExpression", operator }); - - // ?? and || / && cannot be mixed but have same precedence - const mixed = assignment.operator === "??=" && astUtils.isLogicalExpression(assignment.right); - - if (!astUtils.isParenthesised(sourceCode, assignment.right) && (precedence || mixed)) { - - // -> foo = foo || (bar) - yield ruleFixer.insertTextBefore(assignment.right, "("); - yield ruleFixer.insertTextAfter(assignment.right, ")"); - } - } - }; - - context.report(createConditionalFixer(descriptor, suggestion, cannotBeGetter(assignment.left))); - } - }; - } - - return { - - // foo = foo || bar - "AssignmentExpression[operator='='][right.type='LogicalExpression']"(assignment) { - const leftOperand = getLeftmostOperand(sourceCode, assignment.right); - - if (!astUtils.isSameReference(assignment.left, leftOperand) - ) { - return; - } - - const descriptor = { - messageId: "assignment", - node: assignment, - data: { operator: `${assignment.right.operator}=` } - }; - const suggestion = { - messageId: "useLogicalOperator", - data: { operator: `${assignment.right.operator}=` }, - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(assignment).length > 0) { - return; - } - - // No need for parenthesis around the assignment based on precedence as the precedence stays the same even with changed operator - const assignmentOperatorToken = getOperatorToken(assignment); - - // -> foo ||= foo || bar - yield ruleFixer.insertTextBefore(assignmentOperatorToken, assignment.right.operator); - - // -> foo ||= bar - const logicalOperatorToken = getOperatorToken(leftOperand.parent); - const firstRightOperandToken = sourceCode.getTokenAfter(logicalOperatorToken); - - yield ruleFixer.removeRange([leftOperand.parent.range[0], firstRightOperandToken.range[0]]); - } - }; - - context.report(createConditionalFixer(descriptor, suggestion, cannotBeGetter(assignment.left))); - }, - - // foo || (foo = bar) - 'LogicalExpression[right.type="AssignmentExpression"][right.operator="="]'(logical) { - - // Right side has to be parenthesized, otherwise would be parsed as (foo || foo) = bar which is illegal - if (isReference(logical.left) && astUtils.isSameReference(logical.left, logical.right.left)) { - const descriptor = { - messageId: "logical", - node: logical, - data: { operator: `${logical.operator}=` } - }; - const suggestion = { - messageId: "convertLogical", - data: { operator: `${logical.operator}=` }, - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(logical).length > 0) { - return; - } - - const parentPrecedence = astUtils.getPrecedence(logical.parent); - const requiresOuterParenthesis = logical.parent.type !== "ExpressionStatement" && ( - parentPrecedence === -1 || - astUtils.getPrecedence({ type: "AssignmentExpression" }) < parentPrecedence - ); - - if (!astUtils.isParenthesised(sourceCode, logical) && requiresOuterParenthesis) { - yield ruleFixer.insertTextBefore(logical, "("); - yield ruleFixer.insertTextAfter(logical, ")"); - } - - // Also removes all opening parenthesis - yield ruleFixer.removeRange([logical.range[0], logical.right.range[0]]); // -> foo = bar) - - // Also removes all ending parenthesis - yield ruleFixer.removeRange([logical.right.range[1], logical.range[1]]); // -> foo = bar - - const operatorToken = getOperatorToken(logical.right); - - yield ruleFixer.insertTextBefore(operatorToken, logical.operator); // -> foo ||= bar - } - }; - const fix = cannotBeGetter(logical.left) || accessesSingleProperty(logical.left); - - context.report(createConditionalFixer(descriptor, suggestion, fix)); - } - }, - - // if (foo) foo = bar - "IfStatement[alternate=null]"(ifNode) { - if (!checkIf) { - return; - } - - const hasBody = ifNode.consequent.type === "BlockStatement"; - - if (hasBody && ifNode.consequent.body.length !== 1) { - return; - } - - const body = hasBody ? ifNode.consequent.body[0] : ifNode.consequent; - const scope = sourceCode.getScope(ifNode); - const existence = getExistence(ifNode.test, scope); - - if ( - body.type === "ExpressionStatement" && - body.expression.type === "AssignmentExpression" && - body.expression.operator === "=" && - existence !== null && - astUtils.isSameReference(existence.reference, body.expression.left) - ) { - const descriptor = { - messageId: "if", - node: ifNode, - data: { operator: `${existence.operator}=` } - }; - const suggestion = { - messageId: "convertIf", - data: { operator: `${existence.operator}=` }, - *fix(ruleFixer) { - if (sourceCode.getCommentsInside(ifNode).length > 0) { - return; - } - - const firstBodyToken = sourceCode.getFirstToken(body); - const prevToken = sourceCode.getTokenBefore(ifNode); - - if ( - prevToken !== null && - prevToken.value !== ";" && - prevToken.value !== "{" && - firstBodyToken.type !== "Identifier" && - firstBodyToken.type !== "Keyword" - ) { - - // Do not fix if the fixed statement could be part of the previous statement (eg. fn() if (a == null) (a) = b --> fn()(a) ??= b) - return; - } - - - const operatorToken = getOperatorToken(body.expression); - - yield ruleFixer.insertTextBefore(operatorToken, existence.operator); // -> if (foo) foo ||= bar - - yield ruleFixer.removeRange([ifNode.range[0], body.range[0]]); // -> foo ||= bar - - yield ruleFixer.removeRange([body.range[1], ifNode.range[1]]); // -> foo ||= bar, only present if "if" had a body - - const nextToken = sourceCode.getTokenAfter(body.expression); - - if (hasBody && (nextToken !== null && nextToken.value !== ";")) { - yield ruleFixer.insertTextAfter(ifNode, ";"); - } - } - }; - const shouldBeFixed = cannotBeGetter(existence.reference) || - (ifNode.test.type !== "LogicalExpression" && accessesSingleProperty(existence.reference)); - - context.report(createConditionalFixer(descriptor, suggestion, shouldBeFixed)); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/max-classes-per-file.js b/node_modules/eslint/lib/rules/max-classes-per-file.js deleted file mode 100644 index 241e060..0000000 --- a/node_modules/eslint/lib/rules/max-classes-per-file.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index e92c6b4..0000000 --- a/node_modules/eslint/lib/rules/max-depth.js +++ /dev/null @@ -1,156 +0,0 @@ -/** - * @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/latest/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.hasOwn(option, "maximum") || Object.hasOwn(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 deleted file mode 100644 index 15910d5..0000000 --- a/node_modules/eslint/lib/rules/max-len.js +++ /dev/null @@ -1,440 +0,0 @@ -/** - * @fileoverview Rule to check for max length on a line. - * @author Matt DuVall - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce a maximum line length", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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.at(-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"); - } - - /** - * - * reduce an array of AST nodes by line number, both start and end. - * @param {ASTNode[]} arr array of AST nodes - * @returns {Object} accululated AST nodes - */ - function groupArrayByLineNumber(arr) { - const obj = {}; - - for (let i = 0; i < arr.length; i++) { - const node = arr[i]; - - for (let j = node.loc.start.line; j <= node.loc.end.line; ++j) { - ensureArrayAndPush(obj, j, node); - } - } - return obj; - } - - /** - * 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.at(-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 = groupArrayByLineNumber(strings); - - const templateLiterals = getAllTemplateLiterals(); - const templateLiteralsByLine = groupArrayByLineNumber(templateLiterals); - - const regExpLiterals = getAllRegExpLiterals(); - const regExpLiteralsByLine = groupArrayByLineNumber(regExpLiterals); - - 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; - - // 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 deleted file mode 100644 index f981922..0000000 --- a/node_modules/eslint/lib/rules/max-lines-per-function.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @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/latest/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.sourceCode; - 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 deleted file mode 100644 index d821579..0000000 --- a/node_modules/eslint/lib/rules/max-lines.js +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @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/latest/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.hasOwn(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.sourceCode; - - /** - * 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.at(-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.at(-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 deleted file mode 100644 index 448c0bd..0000000 --- a/node_modules/eslint/lib/rules/max-nested-callbacks.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @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/latest/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.hasOwn(option, "maximum") || Object.hasOwn(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 deleted file mode 100644 index eb043ab..0000000 --- a/node_modules/eslint/lib/rules/max-params.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @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/latest/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.sourceCode; - const option = context.options[0]; - let numParams = 3; - - if ( - typeof option === "object" && - (Object.hasOwn(option, "maximum") || Object.hasOwn(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 deleted file mode 100644 index 4ad73a6..0000000 --- a/node_modules/eslint/lib/rules/max-statements-per-line.js +++ /dev/null @@ -1,199 +0,0 @@ -/** - * @fileoverview Specify the maximum number of statements allowed per line. - * @author Kenneth Williams - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce a maximum number of statements allowed per line", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode, - 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 deleted file mode 100644 index 96d5ea7..0000000 --- a/node_modules/eslint/lib/rules/max-statements.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * @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/latest/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.hasOwn(option, "maximum") || Object.hasOwn(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 deleted file mode 100644 index 098e054..0000000 --- a/node_modules/eslint/lib/rules/multiline-comment-style.js +++ /dev/null @@ -1,476 +0,0 @@ -/** - * @fileoverview enforce a particular style for multiline comments - * @author Teddy Katz - * @deprecated in ESLint v9.3.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "suggestion", - docs: { - description: "Enforce a particular style for multiline comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/multiline-comment-style" - }, - - fixable: "whitespace", - schema: { - anyOf: [ - { - type: "array", - items: [ - { - enum: ["starred-block", "bare-block"] - } - ], - additionalItems: false - }, - { - type: "array", - items: [ - { - enum: ["separate-lines"] - }, - { - type: "object", - properties: { - checkJSDoc: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - additionalItems: false - } - ] - }, - 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.sourceCode; - const option = context.options[0] || "starred-block"; - const params = context.options[1] || {}; - const checkJSDoc = !!params.checkJSDoc; - - //---------------------------------------------------------------------- - // 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.at(-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.at(-1).loc.end - }, - messageId: "expectedBlock", - fix(fixer) { - const range = [firstComment.range[0], commentGroup.at(-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.at(-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; - - const isJSDoc = isJSDocComment(commentGroup); - - if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) { - return; - } - - let commentLines = getCommentLines(commentGroup); - - if (isJSDoc) { - commentLines = commentLines.slice(1, commentLines.length - 1); - } - - 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.at(-1).loc.end - }, - messageId: "expectedBlock", - fix(fixer) { - return fixer.replaceTextRange( - [firstComment.range[0], commentGroup.at(-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.at(-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 deleted file mode 100644 index 8155dd7..0000000 --- a/node_modules/eslint/lib/rules/multiline-ternary.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @fileoverview Enforce newlines between operands of ternary expressions - * @author Kai Cataldo - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce newlines between operands of ternary expressions", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index c57997a..0000000 --- a/node_modules/eslint/lib/rules/new-cap.js +++ /dev/null @@ -1,257 +0,0 @@ -/** - * @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" -]; - -/** - * 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) { - const capIsNewExceptions = Array.from(new Set([...config.capIsNewExceptions, ...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/latest/rules/new-cap" - }, - - schema: [ - { - type: "object", - properties: { - newIsCap: { - type: "boolean" - }, - capIsNew: { - type: "boolean" - }, - newIsCapExceptions: { - type: "array", - items: { - type: "string" - } - }, - newIsCapExceptionPattern: { - type: "string" - }, - capIsNewExceptions: { - type: "array", - items: { - type: "string" - } - }, - capIsNewExceptionPattern: { - type: "string" - }, - properties: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - defaultOptions: [{ - capIsNew: true, - capIsNewExceptions: CAPS_ALLOWED, - newIsCap: true, - newIsCapExceptions: [], - properties: true - }], - - 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] = context.options; - const skipProperties = !config.properties; - - const newIsCapExceptions = 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.sourceCode; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index 1c5d21d..0000000 --- a/node_modules/eslint/lib/rules/new-parens.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @fileoverview Rule to flag when using constructor without parentheses - * @author Ilya Volodin - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce or disallow parentheses when invoking a constructor with no arguments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/new-parens" - }, - - fixable: "code", - schema: [ - { - enum: ["always", "never"] - } - ], - 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.sourceCode; - - 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 deleted file mode 100644 index 6e44764..0000000 --- a/node_modules/eslint/lib/rules/newline-after-var.js +++ /dev/null @@ -1,253 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - // 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", - 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.at(-1)}`); - } - }); - } - - // Token on the next line, or comment without blank line - if ( - mode === "always" && ( - !noNextLineToken || - hasNextLineComment && !hasBlankLineAfterComment(nextToken, nextLineNum) - ) - ) { - context.report({ - node, - messageId: "expected", - 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 deleted file mode 100644 index 21e9faf..0000000 --- a/node_modules/eslint/lib/rules/newline-before-return.js +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - //-------------------------------------------------------------------------- - // 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.at(-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 deleted file mode 100644 index 3124ac2..0000000 --- a/node_modules/eslint/lib/rules/newline-per-chained-call.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @fileoverview Rule to ensure newline per method call when chaining calls - * @author Rajendra Patil - * @author Burak Yigit Kaya - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require a newline after each call in a method chain", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index cc87285..0000000 --- a/node_modules/eslint/lib/rules/no-alert.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @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/latest/rules/no-alert" - }, - - schema: [], - - messages: { - unexpected: "Unexpected {{name}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - CallExpression(node) { - const callee = skipChainExpression(node.callee), - currentScope = sourceCode.getScope(node); - - // 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 deleted file mode 100644 index f56b687..0000000 --- a/node_modules/eslint/lib/rules/no-array-constructor.js +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @fileoverview Disallow construction of dense arrays using the Array constructor - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - getVariableByName, - isClosingParenToken, - isOpeningParenToken, - isStartOfExpressionStatement, - needsPrecedingSemicolon -} = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow `Array` constructors", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-array-constructor" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - preferLiteral: "The array literal notation [] is preferable.", - useLiteral: "Replace with an array literal.", - useLiteralAfterSemicolon: "Replace with an array literal, add preceding semicolon." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Gets the text between the calling parentheses of a CallExpression or NewExpression. - * @param {ASTNode} node A CallExpression or NewExpression node. - * @returns {string} The text between the calling parentheses, or an empty string if there are none. - */ - function getArgumentsText(node) { - const lastToken = sourceCode.getLastToken(node); - - if (!isClosingParenToken(lastToken)) { - return ""; - } - - let firstToken = node.callee; - - do { - firstToken = sourceCode.getTokenAfter(firstToken); - if (!firstToken || firstToken === lastToken) { - return ""; - } - } while (!isOpeningParenToken(firstToken)); - - return sourceCode.text.slice(firstToken.range[1], lastToken.range[0]); - } - - /** - * Disallow construction of dense arrays using the Array constructor - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - function check(node) { - if ( - node.callee.type !== "Identifier" || - node.callee.name !== "Array" || - node.arguments.length === 1 && - node.arguments[0].type !== "SpreadElement") { - return; - } - - const variable = getVariableByName(sourceCode.getScope(node), "Array"); - - /* - * Check if `Array` is a predefined global variable: predefined globals have no declarations, - * meaning that the `identifiers` list of the variable object is empty. - */ - if (variable && variable.identifiers.length === 0) { - const argsText = getArgumentsText(node); - let fixText; - let messageId; - - /* - * Check if the suggested change should include a preceding semicolon or not. - * Due to JavaScript's ASI rules, a missing semicolon may be inserted automatically - * before an expression like `Array()` or `new Array()`, but not when the expression - * is changed into an array literal like `[]`. - */ - if (isStartOfExpressionStatement(node) && needsPrecedingSemicolon(sourceCode, node)) { - fixText = `;[${argsText}]`; - messageId = "useLiteralAfterSemicolon"; - } else { - fixText = `[${argsText}]`; - messageId = "useLiteral"; - } - - context.report({ - node, - messageId: "preferLiteral", - suggest: [ - { - messageId, - fix: fixer => fixer.replaceText(node, fixText) - } - ] - }); - } - } - - 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 deleted file mode 100644 index ea6c851..0000000 --- a/node_modules/eslint/lib/rules/no-async-promise-executor.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @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/latest/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.sourceCode.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 deleted file mode 100644 index 20230de..0000000 --- a/node_modules/eslint/lib/rules/no-await-in-loop.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 7943266..0000000 --- a/node_modules/eslint/lib/rules/no-bitwise.js +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allow: [], - int32Hint: false - }], - - docs: { - description: "Disallow bitwise operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-bitwise" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { - enum: BITWISE_OPERATORS - }, - uniqueItems: true - }, - int32Hint: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected use of '{{operator}}'." - } - }, - - create(context) { - const [{ allow: allowed, int32Hint }] = context.options; - - /** - * 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 deleted file mode 100644 index 0b73c76..0000000 --- a/node_modules/eslint/lib/rules/no-buffer-constructor.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 3e61a8e..0000000 --- a/node_modules/eslint/lib/rules/no-caller.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 55f82e2..0000000 --- a/node_modules/eslint/lib/rules/no-case-declarations.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @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/latest/rules/no-case-declarations" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - addBrackets: "Add {} brackets around the case block.", - 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", - suggest: [ - { - messageId: "addBrackets", - fix: fixer => [ - fixer.insertTextBefore(node.consequent[0], "{ "), - fixer.insertTextAfter(node.consequent.at(-1), " }") - ] - } - ] - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-catch-shadow.js b/node_modules/eslint/lib/rules/no-catch-shadow.js deleted file mode 100644 index f9d8552..0000000 --- a/node_modules/eslint/lib/rules/no-catch-shadow.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @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/latest/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) { - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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 = sourceCode.getScope(node); - - /* - * 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 deleted file mode 100644 index 49f3b84..0000000 --- a/node_modules/eslint/lib/rules/no-class-assign.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @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/latest/rules/no-class-assign" - }, - - schema: [], - - messages: { - class: "'{{name}}' is a class." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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) { - sourceCode.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 deleted file mode 100644 index 42e4a37..0000000 --- a/node_modules/eslint/lib/rules/no-compare-neg-zero.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 6d4135d..0000000 --- a/node_modules/eslint/lib/rules/no-cond-assign.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @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", - - defaultOptions: ["except-parens"], - - docs: { - description: "Disallow assignment operators in conditional expressions", - recommended: true, - url: "https://eslint.org/docs/latest/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; - const sourceCode = context.sourceCode; - - /** - * 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 deleted file mode 100644 index 6fef187..0000000 --- a/node_modules/eslint/lib/rules/no-confusing-arrow.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @fileoverview A rule to warn against using arrow functions when they could be - * confused with comparisons - * @author Jxck - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Disallow arrow functions where they could be confused with comparisons", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - - /** - * 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 deleted file mode 100644 index 62dc169..0000000 --- a/node_modules/eslint/lib/rules/no-console.js +++ /dev/null @@ -1,208 +0,0 @@ -/** - * @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", - - defaultOptions: [{}], - - docs: { - description: "Disallow the use of `console`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-console" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - hasSuggestions: true, - - messages: { - unexpected: "Unexpected console statement.", - removeConsole: "Remove the console.{{ propertyName }}()." - } - }, - - create(context) { - const [{ allow: allowed = [] }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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) - ); - } - - /** - * Checks if removing the ExpressionStatement node will cause ASI to - * break. - * eg. - * foo() - * console.log(); - * [1, 2, 3].forEach(a => doSomething(a)) - * - * Removing the console.log(); statement should leave two statements, but - * here the two statements will become one because [ causes continuation after - * foo(). - * @param {ASTNode} node The ExpressionStatement node to check. - * @returns {boolean} `true` if ASI will break after removing the ExpressionStatement - * node. - */ - function maybeAsiHazard(node) { - const SAFE_TOKENS_BEFORE = /^[:;{]$/u; // One of :;{ - const UNSAFE_CHARS_AFTER = /^[-[(/+`]/u; // One of [(/+-` - - const tokenBefore = sourceCode.getTokenBefore(node); - const tokenAfter = sourceCode.getTokenAfter(node); - - return ( - Boolean(tokenAfter) && - UNSAFE_CHARS_AFTER.test(tokenAfter.value) && - tokenAfter.value !== "++" && - tokenAfter.value !== "--" && - Boolean(tokenBefore) && - !SAFE_TOKENS_BEFORE.test(tokenBefore.value) - ); - } - - /** - * Checks if the MemberExpression node's parent.parent.parent is a - * Program, BlockStatement, StaticBlock, or SwitchCase node. This check - * is necessary to avoid providing a suggestion that might cause a syntax error. - * - * eg. if (a) console.log(b), removing console.log() here will lead to a - * syntax error. - * if (a) { console.log(b) }, removing console.log() here is acceptable. - * - * Additionally, it checks if the callee of the CallExpression node is - * the node itself. - * - * eg. foo(console.log), cannot provide a suggestion here. - * @param {ASTNode} node The MemberExpression node to check. - * @returns {boolean} `true` if a suggestion can be provided for a node. - */ - function canProvideSuggestions(node) { - return ( - node.parent.type === "CallExpression" && - node.parent.callee === node && - node.parent.parent.type === "ExpressionStatement" && - astUtils.STATEMENT_LIST_PARENTS.has(node.parent.parent.parent.type) && - !maybeAsiHazard(node.parent.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; - - const propertyName = astUtils.getStaticPropertyName(node); - - context.report({ - node, - loc: node.loc, - messageId: "unexpected", - suggest: canProvideSuggestions(node) - ? [{ - messageId: "removeConsole", - data: { propertyName }, - fix(fixer) { - return fixer.remove(node.parent.parent); - } - }] - : [] - }); - } - - return { - "Program:exit"(node) { - const scope = sourceCode.getScope(node); - 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 deleted file mode 100644 index 0ceaf7e..0000000 --- a/node_modules/eslint/lib/rules/no-const-assign.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @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/latest/rules/no-const-assign" - }, - - schema: [], - - messages: { - const: "'{{name}}' is constant." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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") { - sourceCode.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 deleted file mode 100644 index bc8f073..0000000 --- a/node_modules/eslint/lib/rules/no-constant-binary-expression.js +++ /dev/null @@ -1,508 +0,0 @@ -/** - * @fileoverview Rule to flag constant comparisons and logical expressions that always/never short circuit - * @author Jordan Eldredge - */ - -"use strict"; - -const { isNullLiteral, isConstant, isReferenceToGlobalVariable, isLogicalAssignmentOperator, ECMASCRIPT_GLOBALS } = require("./utils/ast-utils"); - -const NUMERIC_OR_STRING_BINARY_OPERATORS = new Set(["+", "-", "*", "/", "%", "|", "^", "&", "**", "<<", ">>", ">>>"]); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * 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") - ); -} - -/** - * 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. - * @param {boolean} nonNullish if `true` then nullish values are not considered constant. - * @returns {boolean} Does `node` have constant nullishness? - */ -function hasConstantNullishness(scope, node, nonNullish) { - if (nonNullish && isNullOrUndefined(scope, node)) { - return false; - } - - 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 "LogicalExpression": { - return node.operator === "??" && hasConstantNullishness(scope, node.right, true); - } - case "AssignmentExpression": - if (node.operator === "=") { - return hasConstantNullishness(scope, node.right, nonNullish); - } - - /* - * 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.at(-1); - - return hasConstantNullishness(scope, last, nonNullish); - } - 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.at(-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.at(-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 constructors - * which return boxed values, a surprising gotcha' in JavaScript. - */ - return Object.hasOwn(ECMASCRIPT_GLOBALS, 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.at(-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 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, false)) || - (isStaticBoolean(scope, a) && hasConstantLooseBooleanComparison(scope, b)) - ) { - return b; - } - } else if (operator === "===" || operator === "!==") { - if ( - (isNullOrUndefined(scope, a) && hasConstantNullishness(scope, b, false)) || - (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: true, - url: "https://eslint.org/docs/latest/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) { - const sourceCode = context.sourceCode; - - return { - LogicalExpression(node) { - const { operator, left } = node; - const scope = sourceCode.getScope(node); - - if ((operator === "&&" || operator === "||") && isConstant(scope, left, true)) { - context.report({ node: left, messageId: "constantShortCircuit", data: { property: "truthiness", operator } }); - } else if (operator === "??" && hasConstantNullishness(scope, left, false)) { - context.report({ node: left, messageId: "constantShortCircuit", data: { property: "nullishness", operator } }); - } - }, - BinaryExpression(node) { - const scope = sourceCode.getScope(node); - 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 deleted file mode 100644 index 1514b54..0000000 --- a/node_modules/eslint/lib/rules/no-constant-condition.js +++ /dev/null @@ -1,162 +0,0 @@ -/** - * @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", - - defaultOptions: [{ checkLoops: "allExceptWhileTrue" }], - - docs: { - description: "Disallow constant expressions in conditions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-constant-condition" - }, - - schema: [ - { - type: "object", - properties: { - checkLoops: { - enum: ["all", "allExceptWhileTrue", "none", true, false] - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected constant condition." - } - }, - - create(context) { - const loopSetStack = []; - const sourceCode = context.sourceCode; - let [{ checkLoops }] = context.options; - - if (checkLoops === true) { - checkLoops = "all"; - } else if (checkLoops === false) { - checkLoops = "none"; - } - - 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(sourceCode.getScope(node), 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(sourceCode.getScope(node), 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 === "all" || checkLoops === "allExceptWhileTrue") { - trackConstantConditionLoop(node); - } - } - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - ConditionalExpression: reportIfConstant, - IfStatement: reportIfConstant, - WhileStatement(node) { - if (node.test.type === "Literal" && node.test.value === true && checkLoops === "allExceptWhileTrue") { - return; - } - - checkLoop(node); - }, - "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 deleted file mode 100644 index e9ef738..0000000 --- a/node_modules/eslint/lib/rules/no-constructor-return.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @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/latest/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.at(-1); - - if (!last.parent) { - return; - } - - if ( - last.parent.type === "MethodDefinition" && - last.parent.kind === "constructor" && - 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 deleted file mode 100644 index f6e484b..0000000 --- a/node_modules/eslint/lib/rules/no-continue.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index dc412fc..0000000 --- a/node_modules/eslint/lib/rules/no-control-regex.js +++ /dev/null @@ -1,138 +0,0 @@ -/** - * @fileoverview Rule to forbid control characters from regular expressions. - * @author Nicholas C. Zakas - */ - -"use strict"; - -const RegExpValidator = require("@eslint-community/regexpp").RegExpValidator; -const collector = new (class { - constructor() { - this._source = ""; - this._controlChars = []; - this._validator = new RegExpValidator(this); - } - - onPatternEnter() { - - /* - * `RegExpValidator` may parse the pattern twice in one `validatePattern`. - * So `this._controlChars` should be cleared here as well. - * - * For example, the `/(?\x1f)/` regex will parse the pattern twice. - * This is based on the content described in Annex B. - * If the regex contains a `GroupName` and the `u` flag is not used, `ParseText` will be called twice. - * See https://tc39.es/ecma262/2023/multipage/additional-ecmascript-features-for-web-browsers.html#sec-parsepattern-annexb - */ - 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"); - const vFlag = typeof flags === "string" && flags.includes("v"); - - this._controlChars = []; - this._source = regexpStr; - - try { - this._validator.validatePattern(regexpStr, void 0, void 0, { unicode: uFlag, unicodeSets: vFlag }); // 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/latest/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 deleted file mode 100644 index f698435..0000000 --- a/node_modules/eslint/lib/rules/no-debugger.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 126603c..0000000 --- a/node_modules/eslint/lib/rules/no-delete-var.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 208f840..0000000 --- a/node_modules/eslint/lib/rules/no-div-regex.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @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 equal signs explicitly at the beginning of regular expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-div-regex" - }, - - fixable: "code", - - schema: [], - - messages: { - unexpected: "A regular expression literal can be confused with '/='." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - 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 deleted file mode 100644 index c04ede5..0000000 --- a/node_modules/eslint/lib/rules/no-dupe-args.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @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/latest/rules/no-dupe-args" - }, - - schema: [], - - messages: { - unexpected: "Duplicate param '{{name}}'." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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 = sourceCode.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 deleted file mode 100644 index c335532..0000000 --- a/node_modules/eslint/lib/rules/no-dupe-class-members.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @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/latest/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.at(-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; - - 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 deleted file mode 100644 index 60f436d..0000000 --- a/node_modules/eslint/lib/rules/no-dupe-else-if.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 980b004..0000000 --- a/node_modules/eslint/lib/rules/no-dupe-keys.js +++ /dev/null @@ -1,142 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 839f357..0000000 --- a/node_modules/eslint/lib/rules/no-duplicate-case.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @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/latest/rules/no-duplicate-case" - }, - - schema: [], - - messages: { - unexpected: "Duplicate case label." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * 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 deleted file mode 100644 index 1bc52cf..0000000 --- a/node_modules/eslint/lib/rules/no-duplicate-imports.js +++ /dev/null @@ -1,293 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - includeExports: false - }], - - docs: { - description: "Disallow duplicate module imports", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-duplicate-imports" - }, - - schema: [ - { - type: "object", - properties: { - includeExports: { - type: "boolean" - } - }, - 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; - const 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 deleted file mode 100644 index d456181..0000000 --- a/node_modules/eslint/lib/rules/no-else-return.js +++ /dev/null @@ -1,404 +0,0 @@ -/** - * @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", - - defaultOptions: [{ allowElseIf: true }], - - docs: { - description: "Disallow `else` blocks after `return` statements in `if` statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-else-return" - }, - - schema: [{ - type: "object", - properties: { - allowElseIf: { - type: "boolean" - } - }, - additionalProperties: false - }], - - fixable: "code", - - messages: { - unexpected: "Unnecessary 'else' after 'return'." - } - }, - - create(context) { - const [{ allowElseIf }] = context.options; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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} elseNode The 'else' node - * @returns {void} - */ - function displayReport(elseNode) { - const currentScope = sourceCode.getScope(elseNode.parent); - - context.report({ - node: elseNode, - messageId: "unexpected", - fix(fixer) { - - if (!isSafeFromNameCollisions(elseNode, currentScope)) { - return null; - } - - const startToken = sourceCode.getFirstToken(elseNode); - const elseToken = sourceCode.getTokenBefore(startToken); - const source = sourceCode.getText(elseNode); - 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 = elseNode.parent.consequent.type !== "BlockStatement" && lastIfToken.value !== ";"; - const elseBlockUnsafe = /^[([/+`-]/u.test(firstTokenOfElseBlock.value); - - if (ifBlockMaybeUnsafe && elseBlockUnsafe) { - return null; - } - - const endToken = sourceCode.getLastToken(elseNode); - 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(elseNode) - .replaceTextRange([elseToken.range[0], elseNode.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.at(-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); - } - } - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index 5c84102..0000000 --- a/node_modules/eslint/lib/rules/no-empty-character-class.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @fileoverview Rule to flag the use of empty character classes in regular expressions - * @author Ian Christian Myers - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const parser = new RegExpParser(); -const QUICK_TEST_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/latest/rules/no-empty-character-class" - }, - - schema: [], - - messages: { - unexpected: "Empty class." - } - }, - - create(context) { - return { - "Literal[regex]"(node) { - const { pattern, flags } = node.regex; - - if (!QUICK_TEST_REGEX.test(pattern)) { - return; - } - - let regExpAST; - - try { - regExpAST = parser.parsePattern(pattern, 0, pattern.length, { - unicode: flags.includes("u"), - unicodeSets: flags.includes("v") - }); - } catch { - - // Ignore regular expressions that regexpp cannot parse - return; - } - - visitRegExpAST(regExpAST, { - onCharacterClassEnter(characterClass) { - if (!characterClass.negate && characterClass.elements.length === 0) { - 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 deleted file mode 100644 index 16e611b..0000000 --- a/node_modules/eslint/lib/rules/no-empty-function.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @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", - - defaultOptions: [{ allow: [] }], - - docs: { - description: "Disallow empty functions", - recommended: false, - url: "https://eslint.org/docs/latest/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 [{ allow }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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 (!allow.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 deleted file mode 100644 index eb81d8a..0000000 --- a/node_modules/eslint/lib/rules/no-empty-pattern.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @fileoverview Rule to disallow an empty pattern - * @author Alberto Rodríguez - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - defaultOptions: [{ - allowObjectPatternsAsParameters: false - }], - - docs: { - description: "Disallow empty destructuring patterns", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-empty-pattern" - }, - - schema: [ - { - type: "object", - properties: { - allowObjectPatternsAsParameters: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Unexpected empty {{type}} pattern." - } - }, - - create(context) { - const [{ allowObjectPatternsAsParameters }] = context.options; - - return { - ObjectPattern(node) { - - if (node.properties.length > 0) { - return; - } - - // Allow {} and {} = {} empty object patterns as parameters when allowObjectPatternsAsParameters is true - if ( - allowObjectPatternsAsParameters && - ( - astUtils.isFunction(node.parent) || - ( - node.parent.type === "AssignmentPattern" && - astUtils.isFunction(node.parent.parent) && - node.parent.right.type === "ObjectExpression" && - node.parent.right.properties.length === 0 - ) - ) - ) { - return; - } - - 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-static-block.js b/node_modules/eslint/lib/rules/no-empty-static-block.js deleted file mode 100644 index 558c4fa..0000000 --- a/node_modules/eslint/lib/rules/no-empty-static-block.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @fileoverview Rule to disallow empty static blocks. - * @author Sosuke Suzuki - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow empty static blocks", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-empty-static-block" - }, - - schema: [], - - messages: { - unexpected: "Unexpected empty static block." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - StaticBlock(node) { - if (node.body.length === 0) { - const closingBrace = sourceCode.getLastToken(node); - - if (sourceCode.getCommentsBefore(closingBrace).length === 0) { - context.report({ - node, - messageId: "unexpected" - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-empty.js b/node_modules/eslint/lib/rules/no-empty.js deleted file mode 100644 index b5df621..0000000 --- a/node_modules/eslint/lib/rules/no-empty.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @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: { - hasSuggestions: true, - type: "suggestion", - - defaultOptions: [{ - allowEmptyCatch: false - }], - - docs: { - description: "Disallow empty block statements", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-empty" - }, - - schema: [ - { - type: "object", - properties: { - allowEmptyCatch: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "Empty {{type}} statement.", - suggestComment: "Add comment inside empty {{type}} statement." - } - }, - - create(context) { - const [{ allowEmptyCatch }] = context.options; - const sourceCode = context.sourceCode; - - 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" }, - suggest: [ - { - messageId: "suggestComment", - data: { type: "block" }, - fix(fixer) { - const range = [node.range[0] + 1, node.range[1] - 1]; - - return fixer.replaceTextRange(range, " /* empty */ "); - } - } - ] - }); - }, - - 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 deleted file mode 100644 index 9252907..0000000 --- a/node_modules/eslint/lib/rules/no-eq-null.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index bb35d4e..0000000 --- a/node_modules/eslint/lib/rules/no-eval.js +++ /dev/null @@ -1,287 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowIndirect: false - }], - - docs: { - description: "Disallow the use of `eval()`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-eval" - }, - - schema: [ - { - type: "object", - properties: { - allowIndirect: { type: "boolean" } - }, - additionalProperties: false - } - ], - - messages: { - unexpected: "eval can be harmful." - } - }, - - create(context) { - const [{ allowIndirect }] = context.options; - const sourceCode = context.sourceCode; - let funcInfo = null; - - /** - * Pushes 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 = sourceCode.getScope(node).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 = sourceCode.getScope(node), - 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"(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index d0e9feb..0000000 --- a/node_modules/eslint/lib/rules/no-ex-assign.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @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/latest/rules/no-ex-assign" - }, - - schema: [], - - messages: { - unexpected: "Do not assign to the exception parameter." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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) { - sourceCode.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 deleted file mode 100644 index 7164c09..0000000 --- a/node_modules/eslint/lib/rules/no-extend-native.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * @fileoverview Rule to flag adding properties to native object's prototypes. - * @author David Nelson - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - defaultOptions: [{ exceptions: [] }], - - docs: { - description: "Disallow extending native types", - recommended: false, - url: "https://eslint.org/docs/latest/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 sourceCode = context.sourceCode; - const exceptions = new Set(context.options[0].exceptions); - const modifiedBuiltins = new Set( - Object.keys(astUtils.ECMASCRIPT_GLOBALS) - .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"(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index e1e72b0..0000000 --- a/node_modules/eslint/lib/rules/no-extra-bind.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @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/latest/rules/no-extra-bind" - }, - - schema: [], - fixable: "code", - - messages: { - unexpected: "The function binding is unnecessary." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - 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 deleted file mode 100644 index fc17e99..0000000 --- a/node_modules/eslint/lib/rules/no-extra-boolean-cast.js +++ /dev/null @@ -1,369 +0,0 @@ -/** - * @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-community/eslint-utils"); - -const precedence = astUtils.getPrecedence; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - defaultOptions: [{}], - - docs: { - description: "Disallow unnecessary boolean casts", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-extra-boolean-cast" - }, - - schema: [{ - anyOf: [ - { - type: "object", - properties: { - enforceForInnerExpressions: { - type: "boolean" - } - }, - additionalProperties: false - }, - - // deprecated - { - type: "object", - properties: { - enforceForLogicalOperands: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - }], - fixable: "code", - - messages: { - unexpectedCall: "Redundant Boolean call.", - unexpectedNegation: "Redundant double negation." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const [{ enforceForLogicalOperands, enforceForInnerExpressions }] = context.options; - - // 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"; - } - - /** - * 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); - } - - /* - * legacy behavior - enforceForLogicalOperands will only recurse on - * logical expressions, not on other contexts. - * enforceForInnerExpressions will recurse on logical expressions - * as well as the other recursive syntaxes. - */ - - if (enforceForLogicalOperands || enforceForInnerExpressions) { - if (node.parent.type === "LogicalExpression") { - if (node.parent.operator === "||" || node.parent.operator === "&&") { - return isInFlaggedContext(node.parent); - } - - // Check the right hand side of a `??` operator. - if (enforceForInnerExpressions && - node.parent.operator === "??" && - node.parent.right === node - ) { - return isInFlaggedContext(node.parent); - } - } - } - - if (enforceForInnerExpressions) { - if ( - node.parent.type === "ConditionalExpression" && - (node.parent.consequent === node || node.parent.alternate === node) - ) { - return isInFlaggedContext(node.parent); - } - - /* - * Check last expression only in a sequence, i.e. if ((1, 2, Boolean(3))) {}, since - * the others don't affect the result of the expression. - */ - if ( - node.parent.type === "SequenceExpression" && - node.parent.expressions.at(-1) === node - ) { - return isInFlaggedContext(node.parent); - } - - } - - return isInBooleanContext(node); - } - - - /** - * 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. - * @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": - case "SequenceExpression": - return false; - case "ConditionalExpression": - if (previousNode === parent.test) { - return precedence(node) <= precedence(parent); - } - if (previousNode === parent.consequent || previousNode === parent.alternate) { - return precedence(node) < precedence({ type: "AssignmentExpression" }); - } - - /* c8 ignore next */ - throw new Error("Ternary child must be test, consequent, or alternate."); - 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); - - /* c8 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 deleted file mode 100644 index 45ff441..0000000 --- a/node_modules/eslint/lib/rules/no-extra-label.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @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/latest/rules/no-extra-label" - }, - - schema: [], - fixable: "code", - - messages: { - unexpected: "This label '{{name}}' is unnecessary." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - 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 deleted file mode 100644 index 75c082b..0000000 --- a/node_modules/eslint/lib/rules/no-extra-parens.js +++ /dev/null @@ -1,1322 +0,0 @@ -/** - * @fileoverview Disallow parenthesising higher precedence subexpressions. - * @author Michael Ficarra - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const { isParenthesized: isParenthesizedRaw } = require("@eslint-community/eslint-utils"); -const astUtils = require("./utils/ast-utils.js"); - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow unnecessary parentheses", - recommended: false, - url: "https://eslint.org/docs/latest/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" }, - ternaryOperandBinaryExpressions: { 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" }, - allowParensAfterCommentPattern: { type: "string" } - }, - additionalProperties: false - } - ], - minItems: 0, - maxItems: 2 - } - ] - }, - - messages: { - unexpected: "Unnecessary parentheses around expression." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - 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 EXCEPT_COND_TERNARY = ALL_NODES && context.options[1] && context.options[1].ternaryOperandBinaryExpressions === 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 ALLOW_PARENS_AFTER_COMMENT_PATTERN = ALL_NODES && context.options[1] && context.options[1].allowParensAfterCommentPattern; - - 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"); - } - - /** - * Checks if a node is fixable. - * A node is fixable if removing a single pair of surrounding parentheses does not turn it - * into a directive after fixing other nodes. - * Almost all nodes are fixable, except if all of the following conditions are met: - * The node is a string Literal - * It has a single pair of parentheses - * It is the only child of an ExpressionStatement - * @param {ASTNode} node The node to evaluate. - * @returns {boolean} Whether or not the node is fixable. - * @private - */ - function isFixable(node) { - - // if it's not a string literal it can be autofixed - if (node.type !== "Literal" || typeof node.value !== "string") { - return true; - } - if (isParenthesisedTwice(node)) { - return true; - } - return !astUtils.isTopLevelExpressionStatement(node.parent); - } - - /** - * 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; - } - - if (ALLOW_PARENS_AFTER_COMMENT_PATTERN) { - const commentsBeforeLeftParenToken = sourceCode.getCommentsBefore(leftParenToken); - const totalCommentsBeforeLeftParenTokenCount = commentsBeforeLeftParenToken.length; - const ignorePattern = new RegExp(ALLOW_PARENS_AFTER_COMMENT_PATTERN, "u"); - - if ( - totalCommentsBeforeLeftParenTokenCount > 0 && - ignorePattern.test(commentsBeforeLeftParenToken[totalCommentsBeforeLeftParenTokenCount - 1].value) - ) { - return; - } - } - } - - /** - * Finishes reporting - * @returns {void} - * @private - */ - function finishReport() { - context.report({ - node, - loc: leftParenToken.loc, - messageId: "unexpected", - fix: isFixable(node) - ? 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) ? " " : "")); - } - : null - }); - } - - 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; - - /* c8 ignore start */ - if (currentNode === null) { - throw new Error("Nodes are not in the ancestor-descendant relationship."); - }/* c8 ignore stop */ - - 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; - } - - /** - * Checks if the left-hand side of an assignment is an identifier, the operator is one of - * `=`, `&&=`, `||=` or `??=` and the right-hand side is an anonymous class or function. - * - * As per https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation, an - * assignment involving one of the operators `=`, `&&=`, `||=` or `??=` where the right-hand - * side is an anonymous class or function and the left-hand side is an *unparenthesized* - * identifier has different semantics than other assignments. - * Specifically, when an expression like `foo = function () {}` is evaluated, `foo.name` - * will be set to the string "foo", i.e. the identifier name. The same thing does not happen - * when evaluating `(foo) = function () {}`. - * Since the parenthesizing of the identifier in the left-hand side is significant in this - * special case, the parentheses, if present, should not be flagged as unnecessary. - * @param {ASTNode} node an AssignmentExpression node. - * @returns {boolean} `true` if the left-hand side of the assignment is an identifier, the - * operator is one of `=`, `&&=`, `||=` or `??=` and the right-hand side is an anonymous - * class or function; otherwise, `false`. - */ - function isAnonymousFunctionAssignmentException({ left, operator, right }) { - if (left.type === "Identifier" && ["=", "&&=", "||=", "??="].includes(operator)) { - const rhsType = right.type; - - if (rhsType === "ArrowFunctionExpression") { - return true; - } - if ((rhsType === "FunctionExpression" || rhsType === "ClassExpression") && !right.id) { - return true; - } - } - 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) && - (!isAnonymousFunctionAssignmentException(node) || isParenthesisedTwice(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; - } - - const availableTypes = new Set(["BinaryExpression", "LogicalExpression"]); - - if ( - !(EXCEPT_COND_TERNARY && availableTypes.has(node.test.type)) && - !isCondAssignException(node) && - hasExcessParensWithPrecedence(node.test, precedence({ type: "LogicalExpression", operator: "||" })) - ) { - report(node.test); - } - - if ( - !(EXCEPT_COND_TERNARY && availableTypes.has(node.consequent.type)) && - hasExcessParensWithPrecedence(node.consequent, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { - report(node.consequent); - } - - if ( - !(EXCEPT_COND_TERNARY && availableTypes.has(node.alternate.type)) && - 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 deleted file mode 100644 index 1daf224..0000000 --- a/node_modules/eslint/lib/rules/no-extra-semi.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * @fileoverview Rule to flag use of unnecessary semicolons - * @author Nicholas C. Zakas - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Disallow unnecessary semicolons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-extra-semi" - }, - - fixable: "code", - schema: [], - - messages: { - unexpected: "Unnecessary semicolon." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Checks if a node or token is fixable. - * A node is fixable if it can be removed without turning a subsequent statement into a directive after fixing other nodes. - * @param {Token} nodeOrToken The node or token to check. - * @returns {boolean} Whether or not the node is fixable. - */ - function isFixable(nodeOrToken) { - const nextToken = sourceCode.getTokenAfter(nodeOrToken); - - if (!nextToken || nextToken.type !== "String") { - return true; - } - const stringNode = sourceCode.getNodeByRangeIndex(nextToken.range[0]); - - return !astUtils.isTopLevelExpressionStatement(stringNode.parent); - } - - /** - * 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: isFixable(nodeOrToken) - ? fixer => - - /* - * Expand the replacement range to include the surrounding - * tokens to avoid conflicting with semi. - * https://github.com/eslint/eslint/issues/7928 - */ - new FixTracker(fixer, context.sourceCode) - .retainSurroundingTokens(nodeOrToken) - .remove(nodeOrToken) - : null - }); - } - - /** - * 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 deleted file mode 100644 index 1057aae..0000000 --- a/node_modules/eslint/lib/rules/no-fallthrough.js +++ /dev/null @@ -1,218 +0,0 @@ -/** - * @fileoverview Rule to flag fall-through cases in switch statements. - * @author Matt DuVall - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { directivesPattern } = require("../shared/directives"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; - -/** - * Checks all segments in a set and returns true if any are reachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if any segment is reachable; false otherwise. - */ -function isAnySegmentReachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - return true; - } - } - - return false; -} - -/** - * Checks whether or not a given comment string is really a fallthrough comment and not an ESLint directive. - * @param {string} comment The comment string to check. - * @param {RegExp} fallthroughCommentPattern The regular expression used for checking for fallthrough comments. - * @returns {boolean} `true` if the comment string is truly a fallthrough comment. - */ -function isFallThroughComment(comment, fallthroughCommentPattern) { - return fallthroughCommentPattern.test(comment) && !directivesPattern.test(comment.trim()); -} - -/** - * 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 {null | object} the comment if the case has a valid fallthrough comment, otherwise null - */ -function getFallthroughComment(caseWhichFallsThrough, subsequentCase, context, fallthroughCommentPattern) { - const sourceCode = context.sourceCode; - - 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 && isFallThroughComment(commentInBlock.value, fallthroughCommentPattern)) { - return commentInBlock; - } - } - - const comment = sourceCode.getCommentsBefore(subsequentCase).pop(); - - if (comment && isFallThroughComment(comment.value, fallthroughCommentPattern)) { - return comment; - } - - return null; -} - -/** - * 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", - - defaultOptions: [{ - allowEmptyCase: false, - reportUnusedFallthroughComment: false - }], - - docs: { - description: "Disallow fallthrough of `case` statements", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-fallthrough" - }, - - schema: [ - { - type: "object", - properties: { - commentPattern: { - type: "string" - }, - allowEmptyCase: { - type: "boolean" - }, - reportUnusedFallthroughComment: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - messages: { - unusedFallthroughComment: "Found a comment that would permit fallthrough, but case cannot fall through.", - case: "Expected a 'break' statement before 'case'.", - default: "Expected a 'break' statement before 'default'." - } - }, - - create(context) { - const codePathSegments = []; - let currentCodePathSegments = new Set(); - const sourceCode = context.sourceCode; - const [{ allowEmptyCase, commentPattern, reportUnusedFallthroughComment }] = context.options; - const fallthroughCommentPattern = commentPattern - ? new RegExp(commentPattern, "u") - : DEFAULT_FALLTHROUGH_COMMENT; - - /* - * We need to use leading comments of the next SwitchCase node because - * trailing comments is wrong if semicolons are omitted. - */ - let previousCase = null; - - return { - - onCodePathStart() { - codePathSegments.push(currentCodePathSegments); - currentCodePathSegments = new Set(); - }, - - onCodePathEnd() { - currentCodePathSegments = codePathSegments.pop(); - }, - - onUnreachableCodePathSegmentStart(segment) { - currentCodePathSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - currentCodePathSegments.delete(segment); - }, - - onCodePathSegmentStart(segment) { - currentCodePathSegments.add(segment); - }, - - onCodePathSegmentEnd(segment) { - currentCodePathSegments.delete(segment); - }, - - - SwitchCase(node) { - - /* - * Checks whether or not there is a fallthrough comment. - * And reports the previous fallthrough node if that does not exist. - */ - - if (previousCase && previousCase.node.parent === node.parent) { - const previousCaseFallthroughComment = getFallthroughComment(previousCase.node, node, context, fallthroughCommentPattern); - - if (previousCase.isFallthrough && !(previousCaseFallthroughComment)) { - context.report({ - messageId: node.test ? "case" : "default", - node - }); - } else if (reportUnusedFallthroughComment && !previousCase.isSwitchExitReachable && previousCaseFallthroughComment) { - context.report({ - messageId: "unusedFallthroughComment", - node: previousCaseFallthroughComment - }); - } - - } - previousCase = 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. - */ - const isSwitchExitReachable = isAnySegmentReachable(currentCodePathSegments); - const isFallthrough = isSwitchExitReachable && (node.consequent.length > 0 || (!allowEmptyCase && hasBlankLinesBetween(node, nextToken))) && - node.parent.cases.at(-1) !== node; - - previousCase = { - node, - isSwitchExitReachable, - isFallthrough - }; - - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-floating-decimal.js b/node_modules/eslint/lib/rules/no-floating-decimal.js deleted file mode 100644 index 80e4994..0000000 --- a/node_modules/eslint/lib/rules/no-floating-decimal.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @fileoverview Rule to flag use of a leading/trailing decimal point in a numeric literal - * @author James Allardice - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Disallow leading or trailing decimal points in numeric literals", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - 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 deleted file mode 100644 index 8084af6..0000000 --- a/node_modules/eslint/lib/rules/no-func-assign.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @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/latest/rules/no-func-assign" - }, - - schema: [], - - messages: { - isAFunction: "'{{name}}' is a function." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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) { - sourceCode.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 deleted file mode 100644 index 0a6f65e..0000000 --- a/node_modules/eslint/lib/rules/no-global-assign.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * @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", - - defaultOptions: [{ exceptions: [] }], - - docs: { - description: "Disallow assignments to native objects or read-only global variables", - recommended: true, - url: "https://eslint.org/docs/latest/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 sourceCode = context.sourceCode; - const [{ exceptions }] = context.options; - - /** - * 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(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index e82638f..0000000 --- a/node_modules/eslint/lib/rules/no-implicit-coercion.js +++ /dev/null @@ -1,411 +0,0 @@ -/** - * @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 = ["~", "!!", "+", "- -", "-", "*"]; - -/** - * 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 given node logically represents multiplication by a fraction of `1`. - * For example, `a * 1` in `a * 1 / b` is technically multiplication by `1`, but the - * whole expression can be logically interpreted as `a * (1 / b)` rather than `(a * 1) / b`. - * @param {BinaryExpression} node A BinaryExpression node to check. - * @param {SourceCode} sourceCode The source code object. - * @returns {boolean} Whether or not the node is a multiplying by a fraction of `1`. - */ -function isMultiplyByFractionOfOne(node, sourceCode) { - return node.type === "BinaryExpression" && - node.operator === "*" && - (node.right.type === "Literal" && node.right.value === 1) && - node.parent.type === "BinaryExpression" && - node.parent.operator === "/" && - node.parent.left === node && - !astUtils.isParenthesised(sourceCode, node); -} - -/** - * 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: { - hasSuggestions: true, - type: "suggestion", - - docs: { - description: "Disallow shorthand type conversions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-implicit-coercion" - }, - - fixable: "code", - - schema: [{ - type: "object", - properties: { - boolean: { - type: "boolean" - }, - number: { - type: "boolean" - }, - string: { - type: "boolean" - }, - disallowTemplateShorthand: { - type: "boolean" - }, - allow: { - type: "array", - items: { - enum: ALLOWABLE_OPERATORS - }, - uniqueItems: true - } - }, - additionalProperties: false - }], - - defaultOptions: [{ - allow: [], - boolean: true, - disallowTemplateShorthand: false, - number: true, - string: true - }], - - messages: { - implicitCoercion: "Unexpected implicit coercion encountered. Use `{{recommendation}}` instead.", - useRecommendation: "Use `{{recommendation}}` instead." - } - }, - - create(context) { - const [options] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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} shouldSuggest Whether this report should offer a suggestion - * @param {bool} shouldFix Whether this report should fix the node - * @returns {void} - */ - function report(node, recommendation, shouldSuggest, shouldFix) { - - /** - * Fix function - * @param {RuleFixer} fixer The fixer to fix. - * @returns {Fix} The fix object. - */ - function fix(fixer) { - const tokenBefore = sourceCode.getTokenBefore(node); - - if ( - tokenBefore?.range[1] === node.range[0] && - !astUtils.canTokensBeAdjacent(tokenBefore, recommendation) - ) { - return fixer.replaceText(node, ` ${recommendation}`); - } - - return fixer.replaceText(node, recommendation); - } - - context.report({ - node, - messageId: "implicitCoercion", - data: { recommendation }, - fix(fixer) { - if (!shouldFix) { - return null; - } - - return fix(fixer); - }, - suggest: [ - { - messageId: "useRecommendation", - data: { recommendation }, - fix(fixer) { - if (shouldFix || !shouldSuggest) { - return null; - } - - return fix(fixer); - } - } - ] - }); - } - - return { - UnaryExpression(node) { - let operatorAllowed; - - // !!foo - operatorAllowed = options.allow.includes("!!"); - if (!operatorAllowed && options.boolean && isDoubleLogicalNegating(node)) { - const recommendation = `Boolean(${sourceCode.getText(node.argument.argument)})`; - const variable = astUtils.getVariableByName(sourceCode.getScope(node), "Boolean"); - const booleanExists = variable?.identifiers.length === 0; - - report(node, recommendation, true, booleanExists); - } - - // ~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, 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, false); - } - - // -(-foo) - operatorAllowed = options.allow.includes("- -"); - if (!operatorAllowed && options.number && node.operator === "-" && node.argument.type === "UnaryExpression" && node.argument.operator === "-" && !isNumeric(node.argument.argument)) { - const recommendation = `Number(${sourceCode.getText(node.argument.argument)})`; - - report(node, recommendation, true, false); - } - }, - - // Use `:exit` to prevent double reporting - "BinaryExpression:exit"(node) { - let operatorAllowed; - - // 1 * foo - operatorAllowed = options.allow.includes("*"); - const nonNumericOperand = !operatorAllowed && options.number && isMultiplyByOne(node) && !isMultiplyByFractionOfOne(node, sourceCode) && - getNonNumericOperand(node); - - if (nonNumericOperand) { - const recommendation = `Number(${sourceCode.getText(nonNumericOperand)})`; - - report(node, recommendation, true, false); - } - - // foo - 0 - operatorAllowed = options.allow.includes("-"); - if (!operatorAllowed && options.number && node.operator === "-" && node.right.type === "Literal" && node.right.value === 0 && !isNumeric(node.left)) { - const recommendation = `Number(${sourceCode.getText(node.left)})`; - - report(node, recommendation, true, false); - } - - // "" + foo - operatorAllowed = options.allow.includes("+"); - if (!operatorAllowed && options.string && isConcatWithEmptyString(node)) { - const recommendation = `String(${sourceCode.getText(getNonEmptyOperand(node))})`; - - report(node, recommendation, true, false); - } - }, - - 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, false); - } - }, - - 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, false); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-implicit-globals.js b/node_modules/eslint/lib/rules/no-implicit-globals.js deleted file mode 100644 index 0ed96e8..0000000 --- a/node_modules/eslint/lib/rules/no-implicit-globals.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - lexicalBindings: false - }], - - docs: { - description: "Disallow declarations in the global scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-implicit-globals" - }, - - schema: [{ - type: "object", - properties: { - lexicalBindings: { - type: "boolean" - } - }, - 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 [{ lexicalBindings: checkLexicalBindings }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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(node) { - const scope = sourceCode.getScope(node); - - 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; - } - - // Variables exported by "exported" block comments - if (variable.eslintExported) { - 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 deleted file mode 100644 index 9a84f8c..0000000 --- a/node_modules/eslint/lib/rules/no-implied-eval.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @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-community/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/latest/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; - const sourceCode = context.sourceCode; - - /** - * 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, sourceCode.getScope(node)); - 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"(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index c699886..0000000 --- a/node_modules/eslint/lib/rules/no-import-assign.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * @fileoverview Rule to flag updates of imported bindings. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const { findVariable } = require("@eslint-community/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/latest/rules/no-import-assign" - }, - - schema: [], - - messages: { - readonly: "'{{name}}' is read-only.", - readonlyMember: "The members of '{{name}}' are read-only." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - ImportDeclaration(node) { - const scope = sourceCode.getScope(node); - - for (const variable of sourceCode.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 deleted file mode 100644 index 439418c..0000000 --- a/node_modules/eslint/lib/rules/no-inline-comments.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @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", - - defaultOptions: [{}], - - docs: { - description: "Disallow inline comments after code", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - const [{ ignorePattern }] = context.options; - const customIgnoreRegExp = ignorePattern && new RegExp(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 deleted file mode 100644 index c90b9fa..0000000 --- a/node_modules/eslint/lib/rules/no-inner-declarations.js +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @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", - - defaultOptions: ["functions", { blockScopedFunctions: "allow" }], - - docs: { - description: "Disallow variable or `function` declarations in nested blocks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-inner-declarations" - }, - - schema: [ - { - enum: ["functions", "both"] - }, - { - type: "object", - properties: { - blockScopedFunctions: { - enum: ["allow", "disallow"] - } - }, - additionalProperties: false - } - ], - - messages: { - moveDeclToRoot: "Move {{type}} declaration to {{body}} root." - } - }, - - create(context) { - const both = context.options[0] === "both"; - const { blockScopedFunctions } = context.options[1]; - - const sourceCode = context.sourceCode; - const ecmaVersion = context.languageOptions.ecmaVersion; - - /** - * 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(node) { - const isInStrictCode = sourceCode.getScope(node).upper.isStrict; - - if (blockScopedFunctions === "allow" && ecmaVersion >= 2015 && isInStrictCode) { - return; - } - - check(node); - }, - VariableDeclaration(node) { - if (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 deleted file mode 100644 index 635bd66..0000000 --- a/node_modules/eslint/lib/rules/no-invalid-regexp.js +++ /dev/null @@ -1,211 +0,0 @@ -/** - * @fileoverview Validate strings passed to the RegExp constructor - * @author Michael Ficarra - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const RegExpValidator = require("@eslint-community/regexpp").RegExpValidator; -const validator = new RegExpValidator(); -const validFlags = "dgimsuvy"; -const undefined1 = void 0; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - defaultOptions: [{}], - - docs: { - description: "Disallow invalid regular expression strings in `RegExp` constructors", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-invalid-regexp" - }, - - schema: [{ - type: "object", - properties: { - allowConstructorFlags: { - type: "array", - items: { - type: "string" - } - } - }, - additionalProperties: false - }], - - messages: { - regexMessage: "{{message}}." - } - }, - - create(context) { - const [{ allowConstructorFlags }] = context.options; - let allowedFlags = []; - - if (allowConstructorFlags) { - const temp = allowConstructorFlags.join("").replace(new RegExp(`[${validFlags}]`, "gu"), ""); - - if (temp) { - allowedFlags = [...new Set(temp)]; - } - } - - /** - * Reports error with the provided message. - * @param {ASTNode} node The node holding the invalid RegExp - * @param {string} message The message to report. - * @returns {void} - */ - function report(node, message) { - context.report({ - node, - messageId: "regexMessage", - data: { message } - }); - } - - /** - * 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 {Object} flags The RegExp flags to validate. - * @param {boolean} [flags.unicode] The Unicode flag. - * @param {boolean} [flags.unicodeSets] The UnicodeSets flag. - * @returns {string|null} The syntax error. - */ - function validateRegExpPattern(pattern, flags) { - try { - validator.validatePattern(pattern, undefined1, undefined1, flags); - return null; - } catch (err) { - return err.message; - } - } - - /** - * Check syntax error in a given flags. - * @param {string|null} flags The RegExp flags to validate. - * @param {string|null} flagsToCheck The RegExp invalid flags. - * @param {string} allFlags all valid and allowed flags. - * @returns {string|null} The syntax error. - */ - function validateRegExpFlags(flags, flagsToCheck, allFlags) { - const duplicateFlags = []; - - if (typeof flagsToCheck === "string") { - for (const flag of flagsToCheck) { - if (allFlags.includes(flag)) { - duplicateFlags.push(flag); - } - } - } - - /* - * `regexpp` checks the combination of `u` and `v` flags when parsing `Pattern` according to `ecma262`, - * but this rule may check only the flag when the pattern is unidentifiable, so check it here. - * https://tc39.es/ecma262/multipage/text-processing.html#sec-parsepattern - */ - if (flags && flags.includes("u") && flags.includes("v")) { - return "Regex 'u' and 'v' flags cannot be used together"; - } - - if (duplicateFlags.length > 0) { - return `Duplicate flags ('${duplicateFlags.join("")}') supplied to RegExp constructor`; - } - - if (!flagsToCheck) { - return null; - } - - return `Invalid flags supplied to RegExp constructor '${flagsToCheck}'`; - } - - return { - "CallExpression, NewExpression"(node) { - if (node.callee.type !== "Identifier" || node.callee.name !== "RegExp") { - return; - } - - const flags = getFlags(node); - let flagsToCheck = flags; - const allFlags = allowedFlags.length > 0 ? validFlags.split("").concat(allowedFlags) : validFlags.split(""); - - if (flags) { - allFlags.forEach(flag => { - flagsToCheck = flagsToCheck.replace(flag, ""); - }); - } - - let message = validateRegExpFlags(flags, flagsToCheck, allFlags); - - if (message) { - report(node, message); - return; - } - - if (!isString(node.arguments[0])) { - return; - } - - const pattern = node.arguments[0].value; - - message = ( - - // If flags are unknown, report the regex only if its pattern is invalid both with and without the "u" flag - flags === null - ? ( - validateRegExpPattern(pattern, { unicode: true, unicodeSets: false }) && - validateRegExpPattern(pattern, { unicode: false, unicodeSets: true }) && - validateRegExpPattern(pattern, { unicode: false, unicodeSets: false }) - ) - : validateRegExpPattern(pattern, { unicode: flags.includes("u"), unicodeSets: flags.includes("v") }) - ); - - if (message) { - report(node, message); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-invalid-this.js b/node_modules/eslint/lib/rules/no-invalid-this.js deleted file mode 100644 index 0a7b9e4..0000000 --- a/node_modules/eslint/lib/rules/no-invalid-this.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @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", - - defaultOptions: [{ capIsConstructor: true }], - - docs: { - description: "Disallow use of `this` in contexts where the value of `this` is `undefined`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-invalid-this" - }, - - schema: [ - { - type: "object", - properties: { - capIsConstructor: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedThis: "Unexpected 'this'." - } - }, - - create(context) { - const [{ capIsConstructor }] = context.options; - const stack = [], - sourceCode = context.sourceCode; - - /** - * 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.at(-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 = sourceCode.getScope(node); - const features = context.languageOptions.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: !sourceCode.getScope(node).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 deleted file mode 100644 index 3069db1..0000000 --- a/node_modules/eslint/lib/rules/no-irregular-whitespace.js +++ /dev/null @@ -1,278 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - skipComments: false, - skipJSXText: false, - skipRegExps: false, - skipStrings: true, - skipTemplates: false - }], - - docs: { - description: "Disallow irregular whitespace", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-irregular-whitespace" - }, - - schema: [ - { - type: "object", - properties: { - skipComments: { - type: "boolean" - }, - skipStrings: { - type: "boolean" - }, - skipTemplates: { - type: "boolean" - }, - skipRegExps: { - type: "boolean" - }, - skipJSXText: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - noIrregularWhitespace: "Irregular whitespace not allowed." - } - }, - - create(context) { - const [{ - skipComments, - skipStrings, - skipRegExps, - skipTemplates, - skipJSXText - }] = context.options; - - const sourceCode = context.sourceCode; - const commentNodes = sourceCode.getAllComments(); - - // Module store of errors that we have found - let errors = []; - - /** - * 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 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 removeInvalidNodeErrorsInLiteral(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 JSX 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 removeInvalidNodeErrorsInJSXText(node) { - if (ALL_IRREGULARS.test(node.raw)) { - 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.Literal = removeInvalidNodeErrorsInLiteral; - nodes.TemplateElement = skipTemplates ? removeInvalidNodeErrorsInTemplateLiteral : noop; - nodes.JSXText = skipJSXText ? removeInvalidNodeErrorsInJSXText : 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 deleted file mode 100644 index dcd9683..0000000 --- a/node_modules/eslint/lib/rules/no-iterator.js +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index bf33cd1..0000000 --- a/node_modules/eslint/lib/rules/no-label-var.js +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @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/latest/rules/no-label-var" - }, - - schema: [], - - messages: { - identifierClashWithLabel: "Found identifier with same name as label." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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 = sourceCode.getScope(node); - - /* - * 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 deleted file mode 100644 index 3860bf8..0000000 --- a/node_modules/eslint/lib/rules/no-labels.js +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowLoop: false, - allowSwitch: false - }], - - docs: { - description: "Disallow labeled statements", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-labels" - }, - - schema: [ - { - type: "object", - properties: { - allowLoop: { - type: "boolean" - }, - allowSwitch: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedLabel: "Unexpected labeled statement.", - unexpectedLabelInBreak: "Unexpected label in break statement.", - unexpectedLabelInContinue: "Unexpected label in continue statement." - } - }, - - create(context) { - const [{ allowLoop, allowSwitch }] = context.options; - 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; - } - - /* c8 ignore next */ - 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 deleted file mode 100644 index 2e27089..0000000 --- a/node_modules/eslint/lib/rules/no-lone-blocks.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - * @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/latest/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; - const sourceCode = context.sourceCode; - - /** - * 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. - * @param {ASTNode} node The current node to check. - * @returns {void} - */ - function markLoneBlock(node) { - if (loneBlocks.length === 0) { - return; - } - - const block = node.parent; - - if (loneBlocks.at(-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.languageOptions.ecmaVersion >= 2015) { - ruleDef = { - BlockStatement(node) { - if (isLoneBlock(node)) { - loneBlocks.push(node); - } - }, - "BlockStatement:exit"(node) { - if (loneBlocks.length > 0 && loneBlocks.at(-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 !== "var") { - markLoneBlock(node); - } - }; - - ruleDef.FunctionDeclaration = function(node) { - if (sourceCode.getScope(node).isStrict) { - markLoneBlock(node); - } - }; - - 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 deleted file mode 100644 index bec9f02..0000000 --- a/node_modules/eslint/lib/rules/no-lonely-if.js +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @fileoverview Rule to disallow if as the only statement in an else block - * @author Brandon Mills - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-lonely-if" - }, - - schema: [], - fixable: "code", - - messages: { - unexpectedLonelyIf: "Unexpected if as the only statement in an else block." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - IfStatement(node) { - const parent = node.parent, - grandparent = parent.parent; - - if (parent && parent.type === "BlockStatement" && - parent.body.length === 1 && !astUtils.areBracesNecessary(parent, sourceCode) && - 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 deleted file mode 100644 index ba372db..0000000 --- a/node_modules/eslint/lib/rules/no-loop-func.js +++ /dev/null @@ -1,238 +0,0 @@ -/** - * @fileoverview Rule to flag creation of function inside a loop - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - - -/** - * 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; -} - - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-loop-func" - }, - - schema: [], - - messages: { - unsafeRefs: "Function declared in a loop contains unsafe references to variable(s) {{ varNames }}." - } - }, - - create(context) { - - const SKIPPED_IIFE_NODES = new Set(); - const sourceCode = context.sourceCode; - - /** - * Gets the containing loop node of a specified node. - * - * We don't need to check nested functions, so this ignores those, with the exception of IIFE. - * `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 need to check nested functions only in case of IIFE. - if (SKIPPED_IIFE_NODES.has(parent)) { - break; - } - - 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); - } - - /** - * 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 = sourceCode.getScope(node).through; - - // Check if the function is not asynchronous or a generator function - if (!(node.async || node.generator)) { - if (isIIFE(node)) { - - const isFunctionExpression = node.type === "FunctionExpression"; - - // Check if the function is referenced elsewhere in the code - const isFunctionReferenced = isFunctionExpression && node.id ? references.some(r => r.identifier.name === node.id.name) : false; - - if (!isFunctionReferenced) { - SKIPPED_IIFE_NODES.add(node); - return; - } - } - } - - const unsafeRefs = references.filter(r => r.resolved && !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 deleted file mode 100644 index c50d8a8..0000000 --- a/node_modules/eslint/lib/rules/no-loss-of-precision.js +++ /dev/null @@ -1,214 +0,0 @@ -/** - * @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/latest/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; - - 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[0]}.${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) { - for (let i = 0; i < numberAsString.length; i++) { - if (numberAsString[i] !== "0") { - return numberAsString.slice(i); - } - } - return numberAsString; - } - - /** - * Returns the number stripped of trailing zeros - * @param {string} numberAsString the string representation of the number - * @returns {string} the stripped string - */ - function removeTrailingZeros(numberAsString) { - for (let i = numberAsString.length - 1; i >= 0; i--) { - if (numberAsString[i] !== "0") { - return numberAsString.slice(0, i + 1); - } - } - return numberAsString; - } - - /** - * Converts an integer 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 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.slice(1); - 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 deleted file mode 100644 index f48a62d..0000000 --- a/node_modules/eslint/lib/rules/no-magic-numbers.js +++ /dev/null @@ -1,243 +0,0 @@ -/** - * @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/latest/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 - }, - ignoreClassFieldInitialValues: { - 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, - ignoreClassFieldInitialValues = !!config.ignoreClassFieldInitialValues; - - 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 number is the initial value of a class field. - * @param {ASTNode} fullNumberNode `Literal` or `UnaryExpression` full number node - * @returns {boolean} true if the number is the initial value of a class field. - */ - function isClassFieldInitialValue(fullNumberNode) { - const parent = fullNumberNode.parent; - - return parent.type === "PropertyDefinition" && parent.value === 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)) || - (ignoreClassFieldInitialValues && isClassFieldInitialValue(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 deleted file mode 100644 index d10e081..0000000 --- a/node_modules/eslint/lib/rules/no-misleading-character-class.js +++ /dev/null @@ -1,537 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -const { - CALL, - CONSTRUCT, - ReferenceTracker, - getStaticValue, - getStringIfConstant -} = require("@eslint-community/eslint-utils"); -const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp"); -const { isCombiningCharacter, isEmojiModifier, isRegionalIndicatorSymbol, isSurrogatePair } = require("./utils/unicode"); -const astUtils = require("./utils/ast-utils.js"); -const { isValidWithUnicodeFlag } = require("./utils/regular-expressions"); -const { parseStringLiteral, parseTemplateToken } = require("./utils/char-source"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * @typedef {import('@eslint-community/regexpp').AST.Character} Character - * @typedef {import('@eslint-community/regexpp').AST.CharacterClassElement} CharacterClassElement - */ - -/** - * 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 {CharacterClassElement[]} nodes The node list to iterate character sequences. - * @returns {IterableIterator} The list of character sequences. - */ -function *iterateCharacterSequence(nodes) { - - /** @type {Character[]} */ - let seq = []; - - for (const node of nodes) { - switch (node.type) { - case "Character": - seq.push(node); - break; - - case "CharacterClassRange": - seq.push(node.min); - yield seq; - seq = [node.max]; - break; - - case "CharacterSet": - case "CharacterClass": // [[]] nesting character class - case "ClassStringDisjunction": // \q{...} - case "ExpressionCharacterClass": // [A--B] - if (seq.length > 0) { - yield seq; - seq = []; - } - break; - - // no default - } - } - - if (seq.length > 0) { - yield seq; - } -} - -/** - * Checks whether the given character node is a Unicode code point escape or not. - * @param {Character} char the character node to check. - * @returns {boolean} `true` if the character node is a Unicode code point escape. - */ -function isUnicodeCodePointEscape(char) { - return /^\\u\{[\da-f]+\}$/iu.test(char.raw); -} - -/** - * Each function returns matched characters if it detects that kind of problem. - * @type {Record IterableIterator>} - */ -const findCharacterSequences = { - *surrogatePairWithoutUFlag(chars) { - for (const [index, char] of chars.entries()) { - const previous = chars[index - 1]; - - if ( - previous && char && - isSurrogatePair(previous.value, char.value) && - !isUnicodeCodePointEscape(previous) && - !isUnicodeCodePointEscape(char) - ) { - yield [previous, char]; - } - } - }, - - *surrogatePair(chars) { - for (const [index, char] of chars.entries()) { - const previous = chars[index - 1]; - - if ( - previous && char && - isSurrogatePair(previous.value, char.value) && - ( - isUnicodeCodePointEscape(previous) || - isUnicodeCodePointEscape(char) - ) - ) { - yield [previous, char]; - } - } - }, - - *combiningClass(chars, unfilteredChars) { - - /* - * When `allowEscape` is `true`, a combined character should only be allowed if the combining mark appears as an escape sequence. - * This means that the base character should be considered even if it's escaped. - */ - for (const [index, char] of chars.entries()) { - const previous = unfilteredChars[index - 1]; - - if ( - previous && char && - isCombiningCharacter(char.value) && - !isCombiningCharacter(previous.value) - ) { - yield [previous, char]; - } - } - }, - - *emojiModifier(chars) { - for (const [index, char] of chars.entries()) { - const previous = chars[index - 1]; - - if ( - previous && char && - isEmojiModifier(char.value) && - !isEmojiModifier(previous.value) - ) { - yield [previous, char]; - } - } - }, - - *regionalIndicatorSymbol(chars) { - for (const [index, char] of chars.entries()) { - const previous = chars[index - 1]; - - if ( - previous && char && - isRegionalIndicatorSymbol(char.value) && - isRegionalIndicatorSymbol(previous.value) - ) { - yield [previous, char]; - } - } - }, - - *zwj(chars) { - let sequence = null; - - for (const [index, char] of chars.entries()) { - const previous = chars[index - 1]; - const next = chars[index + 1]; - - if ( - previous && char && next && - char.value === 0x200d && - previous.value !== 0x200d && - next.value !== 0x200d - ) { - if (sequence) { - if (sequence.at(-1) === previous) { - sequence.push(char, next); // append to the sequence - } else { - yield sequence; - sequence = chars.slice(index - 1, index + 2); - } - } else { - sequence = chars.slice(index - 1, index + 2); - } - } - } - - if (sequence) { - yield sequence; - } - } -}; - -const kinds = Object.keys(findCharacterSequences); - -/** - * Gets the value of the given node if it's a static value other than a regular expression object, - * or the node's `regex` property. - * The purpose of this method is to provide a replacement for `getStaticValue` in environments where certain regular expressions cannot be evaluated. - * A known example is Node.js 18 which does not support the `v` flag. - * Calling `getStaticValue` on a regular expression node with the `v` flag on Node.js 18 always returns `null`. - * A limitation of this method is that it can only detect a regular expression if the specified node is itself a regular expression literal node. - * @param {ASTNode | undefined} node The node to be inspected. - * @param {Scope} initialScope Scope to start finding variables. This function tries to resolve identifier references which are in the given scope. - * @returns {{ value: any } | { regex: { pattern: string, flags: string } } | null} The static value of the node, or `null`. - */ -function getStaticValueOrRegex(node, initialScope) { - if (!node) { - return null; - } - if (node.type === "Literal" && node.regex) { - return { regex: node.regex }; - } - - const staticValue = getStaticValue(node, initialScope); - - if (staticValue?.value instanceof RegExp) { - return null; - } - return staticValue; -} - -/** - * Checks whether a specified regexpp character is represented as an acceptable escape sequence. - * This function requires the source text of the character to be known. - * @param {Character} char Character to check. - * @param {string} charSource Source text of the character to check. - * @returns {boolean} Whether the specified regexpp character is represented as an acceptable escape sequence. - */ -function checkForAcceptableEscape(char, charSource) { - if (!charSource.startsWith("\\")) { - return false; - } - const match = /(?<=^\\+).$/su.exec(charSource); - - return match?.[0] !== String.fromCodePoint(char.value); -} - -/** - * Checks whether a specified regexpp character is represented as an acceptable escape sequence. - * This function works with characters that are produced by a string or template literal. - * It requires the source text and the CodeUnit list of the literal to be known. - * @param {Character} char Character to check. - * @param {string} nodeSource Source text of the string or template literal that produces the character. - * @param {CodeUnit[]} codeUnits List of CodeUnit objects of the literal that produces the character. - * @returns {boolean} Whether the specified regexpp character is represented as an acceptable escape sequence. - */ -function checkForAcceptableEscapeInString(char, nodeSource, codeUnits) { - const firstIndex = char.start; - const lastIndex = char.end - 1; - const start = codeUnits[firstIndex].start; - const end = codeUnits[lastIndex].end; - const charSource = nodeSource.slice(start, end); - - return checkForAcceptableEscape(char, charSource); -} - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-misleading-character-class" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - allowEscape: { - type: "boolean", - default: false - } - }, - additionalProperties: false - } - ], - - messages: { - surrogatePairWithoutUFlag: "Unexpected surrogate pair in character class. Use 'u' flag.", - surrogatePair: "Unexpected surrogate pair in character class.", - 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 allowEscape = context.options[0]?.allowEscape; - const sourceCode = context.sourceCode; - const parser = new RegExpParser(); - const checkedPatternNodes = new Set(); - - /** - * 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, - { - unicode: flags.includes("u"), - unicodeSets: flags.includes("v") - } - ); - } catch { - - // Ignore regular expressions with syntax errors - return; - } - - let codeUnits = null; - - /** - * Checks whether a specified regexpp character is represented as an acceptable escape sequence. - * For the purposes of this rule, an escape sequence is considered acceptable if it consists of one or more backslashes followed by the character being escaped. - * @param {Character} char Character to check. - * @returns {boolean} Whether the specified regexpp character is represented as an acceptable escape sequence. - */ - function isAcceptableEscapeSequence(char) { - if (node.type === "Literal" && node.regex) { - return checkForAcceptableEscape(char, char.raw); - } - if (node.type === "Literal" && typeof node.value === "string") { - const nodeSource = node.raw; - - codeUnits ??= parseStringLiteral(nodeSource); - - return checkForAcceptableEscapeInString(char, nodeSource, codeUnits); - } - if (astUtils.isStaticTemplateLiteral(node)) { - const nodeSource = sourceCode.getText(node); - - codeUnits ??= parseTemplateToken(nodeSource); - - return checkForAcceptableEscapeInString(char, nodeSource, codeUnits); - } - return false; - } - - const foundKindMatches = new Map(); - - visitRegExpAST(patternNode, { - onCharacterClassEnter(ccNode) { - for (const unfilteredChars of iterateCharacterSequence(ccNode.elements)) { - let chars; - - if (allowEscape) { - - // Replace escape sequences with null to avoid having them flagged. - chars = unfilteredChars.map(char => (isAcceptableEscapeSequence(char) ? null : char)); - } else { - chars = unfilteredChars; - } - for (const kind of kinds) { - const matches = findCharacterSequences[kind](chars, unfilteredChars); - - if (foundKindMatches.has(kind)) { - foundKindMatches.get(kind).push(...matches); - } else { - foundKindMatches.set(kind, [...matches]); - } - } - } - } - }); - - /** - * Finds the report loc(s) for a range of matches. - * Only literals and expression-less templates generate granular errors. - * @param {Character[][]} matches Lists of individual characters being reported on. - * @returns {Location[]} locs for context.report. - * @see https://github.com/eslint/eslint/pull/17515 - */ - function getNodeReportLocations(matches) { - if (!astUtils.isStaticTemplateLiteral(node) && node.type !== "Literal") { - return matches.length ? [node.loc] : []; - } - return matches.map(chars => { - const firstIndex = chars[0].start; - const lastIndex = chars.at(-1).end - 1; - let start; - let end; - - if (node.type === "TemplateLiteral") { - const source = sourceCode.getText(node); - const offset = node.range[0]; - - codeUnits ??= parseTemplateToken(source); - start = offset + codeUnits[firstIndex].start; - end = offset + codeUnits[lastIndex].end; - } else if (typeof node.value === "string") { // String Literal - const source = node.raw; - const offset = node.range[0]; - - codeUnits ??= parseStringLiteral(source); - start = offset + codeUnits[firstIndex].start; - end = offset + codeUnits[lastIndex].end; - } else { // RegExp Literal - const offset = node.range[0] + 1; // Add 1 to skip the leading slash. - - start = offset + firstIndex; - end = offset + lastIndex + 1; - } - - return { - start: sourceCode.getLocFromIndex(start), - end: sourceCode.getLocFromIndex(end) - }; - }); - } - - for (const [kind, matches] of foundKindMatches) { - let suggest; - - if (kind === "surrogatePairWithoutUFlag") { - suggest = [{ - messageId: "suggestUnicodeFlag", - fix: unicodeFixer - }]; - } - - const locs = getNodeReportLocations(matches); - - for (const loc of locs) { - context.report({ - node, - loc, - messageId: kind, - suggest - }); - } - } - } - - return { - "Literal[regex]"(node) { - if (checkedPatternNodes.has(node)) { - return; - } - verify(node, node.regex.pattern, node.regex.flags, fixer => { - if (!isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, node.regex.pattern)) { - return null; - } - - return fixer.insertTextAfter(node, "u"); - }); - }, - "Program"(node) { - const scope = sourceCode.getScope(node); - 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: refNode } of tracker.iterateGlobalReferences({ - RegExp: { [CALL]: true, [CONSTRUCT]: true } - })) { - let pattern, flags; - const [patternNode, flagsNode] = refNode.arguments; - const evaluatedPattern = getStaticValueOrRegex(patternNode, scope); - - if (!evaluatedPattern) { - continue; - } - if (flagsNode) { - if (evaluatedPattern.regex) { - pattern = evaluatedPattern.regex.pattern; - checkedPatternNodes.add(patternNode); - } else { - pattern = String(evaluatedPattern.value); - } - flags = getStringIfConstant(flagsNode, scope); - } else { - if (evaluatedPattern.regex) { - continue; - } - pattern = String(evaluatedPattern.value); - flags = ""; - } - - if (typeof flags === "string") { - verify(patternNode, pattern, flags, fixer => { - - if (!isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, pattern)) { - return null; - } - - if (refNode.arguments.length === 1) { - const penultimateToken = sourceCode.getLastToken(refNode, { 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 deleted file mode 100644 index 6b6f736..0000000 --- a/node_modules/eslint/lib/rules/no-mixed-operators.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * @fileoverview Rule to disallow mixed binary operators. - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Disallow mixed binary operators", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 9e7b803..0000000 --- a/node_modules/eslint/lib/rules/no-mixed-requires.js +++ /dev/null @@ -1,238 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 18e6114..0000000 --- a/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @fileoverview Disallow mixed spaces and tabs for indentation - * @author Jary Niebur - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow mixed spaces and tabs for indentation", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-mixed-spaces-and-tabs" - }, - - schema: [ - { - enum: ["smart-tabs", true, false] - } - ], - - messages: { - mixedSpacesAndTabs: "Mixed spaces and tabs." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - 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 deleted file mode 100644 index 6e45592..0000000 --- a/node_modules/eslint/lib/rules/no-multi-assign.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - ignoreNonDeclaration: false - }], - - docs: { - description: "Disallow use of chained assignment expressions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-multi-assign" - }, - - schema: [{ - type: "object", - properties: { - ignoreNonDeclaration: { - type: "boolean" - } - }, - additionalProperties: false - }], - - messages: { - unexpectedChain: "Unexpected chained assignment." - } - }, - - create(context) { - const [{ ignoreNonDeclaration }] = context.options; - const selectors = [ - "VariableDeclarator > AssignmentExpression.init", - "PropertyDefinition > AssignmentExpression.value" - ]; - - if (!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 deleted file mode 100644 index bc90ee5..0000000 --- a/node_modules/eslint/lib/rules/no-multi-spaces.js +++ /dev/null @@ -1,141 +0,0 @@ -/** - * @fileoverview Disallow use of multiple spaces. - * @author Nicholas C. Zakas - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow multiple spaces", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 8011729..0000000 --- a/node_modules/eslint/lib/rules/no-multi-str.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index b597138..0000000 --- a/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @fileoverview Disallows multiple blank lines. - * implementation adapted from the no-trailing-spaces rule. - * @author Greg Cochard - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow multiple empty lines", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - // Swallow the final newline, as some editors add it automatically and we don't want it to cause an issue - const allLines = sourceCode.lines.at(-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 deleted file mode 100644 index e3fed44..0000000 --- a/node_modules/eslint/lib/rules/no-native-reassign.js +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @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/latest/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) || []; - const sourceCode = context.sourceCode; - - /** - * 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(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index 3cb7590..0000000 --- a/node_modules/eslint/lib/rules/no-negated-condition.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 7a50be7..0000000 --- a/node_modules/eslint/lib/rules/no-negated-in-lhs.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index faf8041..0000000 --- a/node_modules/eslint/lib/rules/no-nested-ternary.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index d58b2d7..0000000 --- a/node_modules/eslint/lib/rules/no-new-func.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @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/latest/rules/no-new-func" - }, - - schema: [], - - messages: { - noFunctionConstructor: "The Function constructor is eval." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - const variable = globalScope.set.get("Function"); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(ref => { - const idNode = ref.identifier; - const { parent } = idNode; - let evalNode; - - if (parent) { - if (idNode === parent.callee && ( - parent.type === "NewExpression" || - parent.type === "CallExpression" - )) { - evalNode = parent; - } else if ( - parent.type === "MemberExpression" && - idNode === 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-native-nonconstructor.js b/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js deleted file mode 100644 index 699390d..0000000 --- a/node_modules/eslint/lib/rules/no-new-native-nonconstructor.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @fileoverview Rule to disallow use of the new operator with global non-constructor functions - * @author Sosuke Suzuki - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const nonConstructorGlobalFunctionNames = ["Symbol", "BigInt"]; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow `new` operators with global non-constructor functions", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-new-native-nonconstructor" - }, - - schema: [], - - messages: { - noNewNonconstructor: "`{{name}}` cannot be called as a constructor." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - for (const nonConstructorName of nonConstructorGlobalFunctionNames) { - const variable = globalScope.set.get(nonConstructorName); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(ref => { - const idNode = ref.identifier; - const parent = idNode.parent; - - if (parent && parent.type === "NewExpression" && parent.callee === idNode) { - context.report({ - node: idNode, - messageId: "noNewNonconstructor", - data: { name: nonConstructorName } - }); - } - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-object.js b/node_modules/eslint/lib/rules/no-new-object.js deleted file mode 100644 index 06275f4..0000000 --- a/node_modules/eslint/lib/rules/no-new-object.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @fileoverview A rule to disallow calls to the Object constructor - * @author Matt DuVall - * @deprecated in ESLint v8.50.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 `Object` constructors", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-object" - }, - - deprecated: true, - - replacedBy: [ - "no-object-constructor" - ], - - schema: [], - - messages: { - preferLiteral: "The object literal notation {} is preferable." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - NewExpression(node) { - const variable = astUtils.getVariableByName( - sourceCode.getScope(node), - 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 deleted file mode 100644 index 6abfc17..0000000 --- a/node_modules/eslint/lib/rules/no-new-require.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 85f9e62..0000000 --- a/node_modules/eslint/lib/rules/no-new-symbol.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @fileoverview Rule to disallow use of the new operator with the `Symbol` object - * @author Alberto Rodríguez - * @deprecated in ESLint v9.0.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow `new` operators with the `Symbol` object", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-new-symbol" - }, - - deprecated: true, - - replacedBy: [ - "no-new-native-nonconstructor" - ], - - schema: [], - - messages: { - noNewSymbol: "`Symbol` cannot be called as a constructor." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - const variable = globalScope.set.get("Symbol"); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(ref => { - const idNode = ref.identifier; - const parent = idNode.parent; - - if (parent && parent.type === "NewExpression" && parent.callee === idNode) { - context.report({ - node: idNode, - messageId: "noNewSymbol" - }); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new-wrappers.js b/node_modules/eslint/lib/rules/no-new-wrappers.js deleted file mode 100644 index 5050a98..0000000 --- a/node_modules/eslint/lib/rules/no-new-wrappers.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @fileoverview Rule to flag when using constructor for wrapper objects - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { getVariableByName } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-new-wrappers" - }, - - schema: [], - - messages: { - noConstructor: "Do not use {{fn}} as a constructor." - } - }, - - create(context) { - const { sourceCode } = context; - - return { - - NewExpression(node) { - const wrapperObjects = ["String", "Number", "Boolean"]; - const { name } = node.callee; - - if (wrapperObjects.includes(name)) { - const variable = getVariableByName(sourceCode.getScope(node), name); - - if (variable && variable.identifiers.length === 0) { - context.report({ - node, - messageId: "noConstructor", - data: { fn: name } - }); - } - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-new.js b/node_modules/eslint/lib/rules/no-new.js deleted file mode 100644 index 9e20bad..0000000 --- a/node_modules/eslint/lib/rules/no-new.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 5939390..0000000 --- a/node_modules/eslint/lib/rules/no-nonoctal-decimal-escape.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index ee767ea..0000000 --- a/node_modules/eslint/lib/rules/no-obj-calls.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @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-community/eslint-utils"); -const getPropertyName = require("./utils/ast-utils").getStaticPropertyName; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect", "Intl"]; - -/** - * 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/latest/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) { - - const sourceCode = context.sourceCode; - - return { - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const traceMap = {}; - - for (const g of nonCallableGlobals) { - traceMap[g] = { - [CALL]: true, - [CONSTRUCT]: true - }; - } - - for (const { node: refNode, path } of tracker.iterateGlobalReferences(traceMap)) { - const name = getReportNodeName(refNode.callee); - const ref = path[0]; - const messageId = name === ref ? "unexpectedCall" : "unexpectedRefCall"; - - context.report({ node: refNode, messageId, data: { name, ref } }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-object-constructor.js b/node_modules/eslint/lib/rules/no-object-constructor.js deleted file mode 100644 index 8875ec2..0000000 --- a/node_modules/eslint/lib/rules/no-object-constructor.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @fileoverview Rule to disallow calls to the `Object` constructor without an argument - * @author Francesco Trotta - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - getVariableByName, - isArrowToken, - isStartOfExpressionStatement, - needsPrecedingSemicolon -} = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow calls to the `Object` constructor without an argument", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-object-constructor" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - preferLiteral: "The object literal notation {} is preferable.", - useLiteral: "Replace with '{{replacement}}'.", - useLiteralAfterSemicolon: "Replace with '{{replacement}}', add preceding semicolon." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * Determines whether or not an object literal that replaces a specified node needs to be enclosed in parentheses. - * @param {ASTNode} node The node to be replaced. - * @returns {boolean} Whether or not parentheses around the object literal are required. - */ - function needsParentheses(node) { - if (isStartOfExpressionStatement(node)) { - return true; - } - - const prevToken = sourceCode.getTokenBefore(node); - - if (prevToken && isArrowToken(prevToken)) { - return true; - } - - return false; - } - - /** - * Reports on nodes where the `Object` constructor is called without arguments. - * @param {ASTNode} node The node to evaluate. - * @returns {void} - */ - function check(node) { - if (node.callee.type !== "Identifier" || node.callee.name !== "Object" || node.arguments.length) { - return; - } - - const variable = getVariableByName(sourceCode.getScope(node), "Object"); - - if (variable && variable.identifiers.length === 0) { - let replacement; - let fixText; - let messageId = "useLiteral"; - - if (needsParentheses(node)) { - replacement = "({})"; - if (needsPrecedingSemicolon(sourceCode, node)) { - fixText = ";({})"; - messageId = "useLiteralAfterSemicolon"; - } else { - fixText = "({})"; - } - } else { - replacement = fixText = "{}"; - } - - context.report({ - node, - messageId: "preferLiteral", - suggest: [ - { - messageId, - data: { replacement }, - fix: fixer => fixer.replaceText(node, fixText) - } - ] - }); - } - } - - return { - CallExpression: check, - NewExpression: check - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-octal-escape.js b/node_modules/eslint/lib/rules/no-octal-escape.js deleted file mode 100644 index 6924d54..0000000 --- a/node_modules/eslint/lib/rules/no-octal-escape.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index dc02769..0000000 --- a/node_modules/eslint/lib/rules/no-octal.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 607cafd..0000000 --- a/node_modules/eslint/lib/rules/no-param-reassign.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * @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/latest/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 || []; - const sourceCode = context.sourceCode; - - /** - * 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) { - sourceCode.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 deleted file mode 100644 index 2e4a3a2..0000000 --- a/node_modules/eslint/lib/rules/no-path-concat.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 7c91ebe..0000000 --- a/node_modules/eslint/lib/rules/no-plusplus.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowForLoopAfterthoughts: false - }], - - docs: { - description: "Disallow the unary operators `++` and `--`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-plusplus" - }, - - schema: [ - { - type: "object", - properties: { - allowForLoopAfterthoughts: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedUnaryOp: "Unary operator '{{operator}}' used." - } - }, - - create(context) { - const [{ allowForLoopAfterthoughts }] = context.options; - - 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 deleted file mode 100644 index 8dac648..0000000 --- a/node_modules/eslint/lib/rules/no-process-env.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index fa398a7..0000000 --- a/node_modules/eslint/lib/rules/no-process-exit.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index a056f6d..0000000 --- a/node_modules/eslint/lib/rules/no-promise-executor-return.js +++ /dev/null @@ -1,263 +0,0 @@ -/** - * @fileoverview Rule to disallow returning values from Promise executor functions - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { findVariable } = require("@eslint-community/eslint-utils"); -const astUtils = require("./utils/ast-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)); -} - -/** - * Checks if the given node is a void expression. - * @param {ASTNode} node The node to check. - * @returns {boolean} - `true` if the node is a void expression - */ -function expressionIsVoid(node) { - return node.type === "UnaryExpression" && node.operator === "void"; -} - -/** - * Fixes the linting error by prepending "void " to the given node - * @param {Object} sourceCode context given by context.sourceCode - * @param {ASTNode} node The node to fix. - * @param {Object} fixer The fixer object provided by ESLint. - * @returns {Array} - An array of fix objects to apply to the node. - */ -function voidPrependFixer(sourceCode, node, fixer) { - - const requiresParens = - - // prepending `void ` will fail if the node has a lower precedence than void - astUtils.getPrecedence(node) < astUtils.getPrecedence({ type: "UnaryExpression", operator: "void" }) && - - // check if there are parentheses around the node to avoid redundant parentheses - !astUtils.isParenthesised(sourceCode, node); - - // avoid parentheses issues - const returnOrArrowToken = sourceCode.getTokenBefore( - node, - node.parent.type === "ArrowFunctionExpression" - ? astUtils.isArrowToken - - // isReturnToken - : token => token.type === "Keyword" && token.value === "return" - ); - - const firstToken = sourceCode.getTokenAfter(returnOrArrowToken); - - const prependSpace = - - // is return token, as => allows void to be adjacent - returnOrArrowToken.value === "return" && - - // If two tokens (return and "(") are adjacent - returnOrArrowToken.range[1] === firstToken.range[0]; - - return [ - fixer.insertTextBefore(firstToken, `${prependSpace ? " " : ""}void ${requiresParens ? "(" : ""}`), - fixer.insertTextAfter(node, requiresParens ? ")" : "") - ]; -} - -/** - * Fixes the linting error by `wrapping {}` around the given node's body. - * @param {Object} sourceCode context given by context.sourceCode - * @param {ASTNode} node The node to fix. - * @param {Object} fixer The fixer object provided by ESLint. - * @returns {Array} - An array of fix objects to apply to the node. - */ -function curlyWrapFixer(sourceCode, node, fixer) { - - // https://github.com/eslint/eslint/pull/17282#issuecomment-1592795923 - const arrowToken = sourceCode.getTokenBefore(node.body, astUtils.isArrowToken); - const firstToken = sourceCode.getTokenAfter(arrowToken); - const lastToken = sourceCode.getLastToken(node); - - return [ - fixer.insertTextBefore(firstToken, "{"), - fixer.insertTextAfter(lastToken, "}") - ]; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - defaultOptions: [{ - allowVoid: false - }], - - docs: { - description: "Disallow returning values from Promise executor functions", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-promise-executor-return" - }, - - hasSuggestions: true, - - schema: [{ - type: "object", - properties: { - allowVoid: { - type: "boolean" - } - }, - additionalProperties: false - }], - - messages: { - returnsValue: "Return values from promise executor functions cannot be read.", - - // arrow and function suggestions - prependVoid: "Prepend `void` to the expression.", - - // only arrow suggestions - wrapBraces: "Wrap the expression in `{}`." - } - }, - - create(context) { - let funcInfo = null; - const sourceCode = context.sourceCode; - const [{ allowVoid }] = context.options; - - return { - - onCodePathStart(_, node) { - funcInfo = { - upper: funcInfo, - shouldCheck: - functionTypesToCheck.has(node.type) && - isPromiseExecutor(node, sourceCode.getScope(node)) - }; - - if (// Is a Promise executor - funcInfo.shouldCheck && - node.type === "ArrowFunctionExpression" && - node.expression && - - // Except void - !(allowVoid && expressionIsVoid(node.body)) - ) { - const suggest = []; - - // prevent useless refactors - if (allowVoid) { - suggest.push({ - messageId: "prependVoid", - fix(fixer) { - return voidPrependFixer(sourceCode, node.body, fixer); - } - }); - } - - // Do not suggest wrapping an unnamed FunctionExpression in braces as that would be invalid syntax. - if (!(node.body.type === "FunctionExpression" && !node.body.id)) { - suggest.push({ - messageId: "wrapBraces", - fix(fixer) { - return curlyWrapFixer(sourceCode, node, fixer); - } - }); - } - - context.report({ - node: node.body, - messageId: "returnsValue", - suggest - }); - } - }, - - onCodePathEnd() { - funcInfo = funcInfo.upper; - }, - - ReturnStatement(node) { - if (!(funcInfo.shouldCheck && node.argument)) { - return; - } - - // node is `return ` - if (!allowVoid) { - context.report({ node, messageId: "returnsValue" }); - return; - } - - if (expressionIsVoid(node.argument)) { - return; - } - - // allowVoid && !expressionIsVoid - context.report({ - node, - messageId: "returnsValue", - suggest: [{ - messageId: "prependVoid", - fix(fixer) { - return voidPrependFixer(sourceCode, node.argument, fixer); - } - }] - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-proto.js b/node_modules/eslint/lib/rules/no-proto.js deleted file mode 100644 index 28320d5..0000000 --- a/node_modules/eslint/lib/rules/no-proto.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index b61e585..0000000 --- a/node_modules/eslint/lib/rules/no-prototype-builtins.js +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @fileoverview Rule to disallow use of Object.prototype builtins on objects - * @author Andrew Levine - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Returns true if the node or any of the objects - * to the left of it in the member/call chain is optional. - * - * e.g. `a?.b`, `a?.b.c`, `a?.()`, `a()?.()` - * @param {ASTNode} node The expression to check - * @returns {boolean} `true` if there is a short-circuiting optional `?.` - * in the same option chain to the left of this call or member expression, - * or the node itself is an optional call or member `?.`. - */ -function isAfterOptional(node) { - let leftNode; - - if (node.type === "MemberExpression") { - leftNode = node.object; - } else if (node.type === "CallExpression") { - leftNode = node.callee; - } else { - return false; - } - if (node.optional) { - return true; - } - return isAfterOptional(leftNode); -} - - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-prototype-builtins" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - prototypeBuildIn: "Do not access Object.prototype method '{{prop}}' from target object.", - callObjectPrototype: "Call Object.prototype.{{prop}} explicitly." - } - }, - - 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, - suggest: [ - { - messageId: "callObjectPrototype", - data: { prop: propName }, - fix(fixer) { - const sourceCode = context.sourceCode; - - /* - * A call after an optional chain (e.g. a?.b.hasOwnProperty(c)) - * must be fixed manually because the call can be short-circuited - */ - if (isAfterOptional(node)) { - return null; - } - - /* - * A call on a ChainExpression (e.g. (a?.hasOwnProperty)(c)) will trigger - * no-unsafe-optional-chaining which should be fixed before this suggestion - */ - if (node.callee.type === "ChainExpression") { - return null; - } - - const objectVariable = astUtils.getVariableByName(sourceCode.getScope(node), "Object"); - - /* - * We can't use Object if the global Object was shadowed, - * or Object does not exist in the global scope for some reason - */ - if (!objectVariable || objectVariable.scope.type !== "global" || objectVariable.defs.length > 0) { - return null; - } - - let objectText = sourceCode.getText(callee.object); - - if (astUtils.getPrecedence(callee.object) <= astUtils.getPrecedence({ type: "SequenceExpression" })) { - objectText = `(${objectText})`; - } - - const openParenToken = sourceCode.getTokenAfter( - node.callee, - astUtils.isOpeningParenToken - ); - const isEmptyParameters = node.arguments.length === 0; - const delim = isEmptyParameters ? "" : ", "; - const fixes = [ - fixer.replaceText(callee, `Object.prototype.${propName}.call`), - fixer.insertTextAfter(openParenToken, objectText + delim) - ]; - - return fixes; - } - } - ] - }); - } - } - - return { - CallExpression: disallowBuiltIns - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-redeclare.js b/node_modules/eslint/lib/rules/no-redeclare.js deleted file mode 100644 index 94a3c21..0000000 --- a/node_modules/eslint/lib/rules/no-redeclare.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @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", - - defaultOptions: [{ builtinGlobals: true }], - - docs: { - description: "Disallow variable redeclaration", - recommended: true, - url: "https://eslint.org/docs/latest/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" } - }, - additionalProperties: false - } - ] - }, - - create(context) { - const [{ builtinGlobals }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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 (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 = sourceCode.getScope(node); - - /* - * 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(node) { - const scope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index cb25010..0000000 --- a/node_modules/eslint/lib/rules/no-regex-spaces.js +++ /dev/null @@ -1,197 +0,0 @@ -/** - * @fileoverview Rule to count multiple spaces in regular expressions - * @author Matt DuVall - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const regexpp = require("@eslint-community/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/latest/rules/no-regex-spaces" - }, - - schema: [], - fixable: "code", - - messages: { - multipleSpaces: "Spaces are hard to count. Use {{{length}}}." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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, { unicode: flags.includes("u"), unicodeSets: flags.includes("v") }); - } 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 = sourceCode.getScope(node); - const regExpVar = astUtils.getVariableByName(scope, "RegExp"); - const shadowed = regExpVar && regExpVar.defs.length > 0; - const patternNode = node.arguments[0]; - - 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; - let flags; - - if (node.arguments.length < 2) { - - // It has no flags. - flags = ""; - } else { - const flagsNode = node.arguments[1]; - - if (isString(flagsNode)) { - flags = flagsNode.value; - } else { - - // The flags cannot be determined. - return; - } - } - - 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 deleted file mode 100644 index 8da2f2d..0000000 --- a/node_modules/eslint/lib/rules/no-restricted-exports.js +++ /dev/null @@ -1,204 +0,0 @@ -/** - * @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/latest/rules/no-restricted-exports" - }, - - schema: [{ - anyOf: [ - { - type: "object", - properties: { - restrictedNamedExports: { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - }, - restrictedNamedExportsPattern: { type: "string" } - }, - additionalProperties: false - }, - { - type: "object", - properties: { - restrictedNamedExports: { - type: "array", - items: { - type: "string", - pattern: "^(?!default$)" - }, - uniqueItems: true - }, - restrictedNamedExportsPattern: { type: "string" }, - restrictDefaultExports: { - type: "object", - properties: { - - // Allow/Disallow `export default foo; export default 42; export default function foo() {}` format - direct: { - type: "boolean" - }, - - // Allow/Disallow `export { foo as default };` declarations - named: { - type: "boolean" - }, - - // Allow/Disallow `export { default } from "mod"; export { default as default } from "mod";` declarations - defaultFrom: { - type: "boolean" - }, - - // Allow/Disallow `export { foo as default } from "mod";` declarations - namedFrom: { - type: "boolean" - }, - - // Allow/Disallow `export * as default from "mod"`; declarations - namespaceFrom: { - type: "boolean" - } - }, - additionalProperties: false - } - }, - additionalProperties: false - } - ] - }], - - messages: { - restrictedNamed: "'{{name}}' is restricted from being used as an exported name.", - restrictedDefault: "Exporting 'default' is restricted." - } - }, - - create(context) { - - const restrictedNames = new Set(context.options[0] && context.options[0].restrictedNamedExports); - const restrictedNamePattern = context.options[0] && context.options[0].restrictedNamedExportsPattern; - const restrictDefaultExports = context.options[0] && context.options[0].restrictDefaultExports; - const sourceCode = context.sourceCode; - - /** - * 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); - - let matchesRestrictedNamePattern = false; - - if (restrictedNamePattern && name !== "default") { - const patternRegex = new RegExp(restrictedNamePattern, "u"); - - matchesRestrictedNamePattern = patternRegex.test(name); - } - - if (matchesRestrictedNamePattern || restrictedNames.has(name)) { - context.report({ - node, - messageId: "restrictedNamed", - data: { name } - }); - return; - } - - if (name === "default") { - if (node.parent.type === "ExportAllDeclaration") { - if (restrictDefaultExports && restrictDefaultExports.namespaceFrom) { - context.report({ - node, - messageId: "restrictedDefault" - }); - } - - } else { // ExportSpecifier - const isSourceSpecified = !!node.parent.parent.source; - const specifierLocalName = astUtils.getModuleExportName(node.parent.local); - - if (!isSourceSpecified && restrictDefaultExports && restrictDefaultExports.named) { - context.report({ - node, - messageId: "restrictedDefault" - }); - return; - } - - if (isSourceSpecified && restrictDefaultExports) { - if ( - (specifierLocalName === "default" && restrictDefaultExports.defaultFrom) || - (specifierLocalName !== "default" && restrictDefaultExports.namedFrom) - ) { - context.report({ - node, - messageId: "restrictedDefault" - }); - } - } - } - } - } - - return { - ExportAllDeclaration(node) { - if (node.exported) { - checkExportedName(node.exported); - } - }, - - ExportDefaultDeclaration(node) { - if (restrictDefaultExports && restrictDefaultExports.direct) { - context.report({ - node, - messageId: "restrictedDefault" - }); - } - }, - - ExportNamedDeclaration(node) { - const declaration = node.declaration; - - if (declaration) { - if (declaration.type === "FunctionDeclaration" || declaration.type === "ClassDeclaration") { - checkExportedName(declaration.id); - } else if (declaration.type === "VariableDeclaration") { - sourceCode.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 deleted file mode 100644 index 060d50a..0000000 --- a/node_modules/eslint/lib/rules/no-restricted-globals.js +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @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/latest/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) { - - const sourceCode = context.sourceCode; - - // 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.hasOwn(restrictedGlobalMessages, name); - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - - // 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 deleted file mode 100644 index 5fd4744..0000000 --- a/node_modules/eslint/lib/rules/no-restricted-imports.js +++ /dev/null @@ -1,563 +0,0 @@ -/** - * @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" - } - }, - allowImportNames: { - type: "array", - items: { - type: "string" - } - } - }, - additionalProperties: false, - required: ["name"], - not: { required: ["importNames", "allowImportNames"] } - } - ] - }, - uniqueItems: true -}; - -const arrayOfStringsOrObjectPatterns = { - anyOf: [ - { - type: "array", - items: { - type: "string" - }, - uniqueItems: true - }, - { - type: "array", - items: { - type: "object", - properties: { - importNames: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - }, - allowImportNames: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - }, - group: { - type: "array", - items: { - type: "string" - }, - minItems: 1, - uniqueItems: true - }, - regex: { - type: "string" - }, - importNamePattern: { - type: "string" - }, - allowImportNamePattern: { - type: "string" - }, - message: { - type: "string", - minLength: 1 - }, - caseSensitive: { - type: "boolean" - } - }, - additionalProperties: false, - not: { - anyOf: [ - { required: ["importNames", "allowImportNames"] }, - { required: ["importNamePattern", "allowImportNamePattern"] }, - { required: ["importNames", "allowImportNamePattern"] }, - { required: ["importNamePattern", "allowImportNames"] }, - { required: ["allowImportNames", "allowImportNamePattern"] } - ] - }, - oneOf: [ - { required: ["group"] }, - { required: ["regex"] } - ] - }, - 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/latest/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}}", - - patternAndImportName: "'{{importName}}' import from '{{importSource}}' 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 - patternAndImportNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}", - - patternAndEverything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern.", - - patternAndEverythingWithRegexImportName: "* import is invalid because import name matching '{{importNames}}' pattern from '{{importSource}}' is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - patternAndEverythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - patternAndEverythingWithRegexImportNameAndCustomMessage: "* import is invalid because import name matching '{{importNames}}' pattern from '{{importSource}}' is restricted from being used. {{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}}", - - allowedImportName: "'{{importName}}' import from '{{importSource}}' is restricted because only '{{allowedImportNames}}' import(s) is/are allowed.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - allowedImportNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted because only '{{allowedImportNames}}' import(s) is/are allowed. {{customMessage}}", - - everythingWithAllowImportNames: "* import is invalid because only '{{allowedImportNames}}' from '{{importSource}}' is/are allowed.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - everythingWithAllowImportNamesAndCustomMessage: "* import is invalid because only '{{allowedImportNames}}' from '{{importSource}}' is/are allowed. {{customMessage}}", - - allowedImportNamePattern: "'{{importName}}' import from '{{importSource}}' is restricted because only imports that match the pattern '{{allowedImportNamePattern}}' are allowed from '{{importSource}}'.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - allowedImportNamePatternWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted because only imports that match the pattern '{{allowedImportNamePattern}}' are allowed from '{{importSource}}'. {{customMessage}}", - - everythingWithAllowedImportNamePattern: "* import is invalid because only imports that match the pattern '{{allowedImportNamePattern}}' from '{{importSource}}' are allowed.", - // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period - everythingWithAllowedImportNamePatternWithCustomMessage: "* import is invalid because only imports that match the pattern '{{allowedImportNamePattern}}' from '{{importSource}}' are allowed. {{customMessage}}" - }, - - schema: { - anyOf: [ - arrayOfStringsOrObjects, - { - type: "array", - items: [{ - type: "object", - properties: { - paths: arrayOfStringsOrObjects, - patterns: arrayOfStringsOrObjectPatterns - }, - additionalProperties: false - }], - additionalItems: false - } - ] - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const options = Array.isArray(context.options) ? context.options : []; - const isPathAndPatternsObject = - typeof options[0] === "object" && - (Object.hasOwn(options[0], "paths") || Object.hasOwn(options[0], "patterns")); - - const restrictedPaths = (isPathAndPatternsObject ? options[0].paths : context.options) || []; - const groupedRestrictedPaths = restrictedPaths.reduce((memo, importSource) => { - const path = typeof importSource === "string" - ? importSource - : importSource.name; - - if (!memo[path]) { - memo[path] = []; - } - - if (typeof importSource === "string") { - memo[path].push({}); - } else { - memo[path].push({ - message: importSource.message, - importNames: importSource.importNames, - allowImportNames: importSource.allowImportNames - }); - } - return memo; - }, Object.create(null)); - - // 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, regex, message, caseSensitive, importNames, importNamePattern, allowImportNames, allowImportNamePattern }) => ( - { - ...(group ? { matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group) } : {}), - ...(typeof regex === "string" ? { regexMatcher: new RegExp(regex, caseSensitive ? "u" : "iu") } : {}), - customMessage: message, - importNames, - importNamePattern, - allowImportNames, - allowImportNamePattern - } - ) - ); - - // 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.hasOwn(groupedRestrictedPaths, importSource)) { - return; - } - - groupedRestrictedPaths[importSource].forEach(restrictedPathEntry => { - const customMessage = restrictedPathEntry.message; - const restrictedImportNames = restrictedPathEntry.importNames; - const allowedImportNames = restrictedPathEntry.allowImportNames; - - if (!restrictedImportNames && !allowedImportNames) { - context.report({ - node, - messageId: customMessage ? "pathWithCustomMessage" : "path", - data: { - importSource, - customMessage - } - }); - - return; - } - - importNames.forEach((specifiers, importName) => { - if (importName === "*") { - const [specifier] = specifiers; - - if (restrictedImportNames) { - context.report({ - node, - messageId: customMessage ? "everythingWithCustomMessage" : "everything", - loc: specifier.loc, - data: { - importSource, - importNames: restrictedImportNames, - customMessage - } - }); - } else if (allowedImportNames) { - context.report({ - node, - messageId: customMessage ? "everythingWithAllowImportNamesAndCustomMessage" : "everythingWithAllowImportNames", - loc: specifier.loc, - data: { - importSource, - allowedImportNames, - customMessage - } - }); - } - - return; - } - - if (restrictedImportNames && restrictedImportNames.includes(importName)) { - specifiers.forEach(specifier => { - context.report({ - node, - messageId: customMessage ? "importNameWithCustomMessage" : "importName", - loc: specifier.loc, - data: { - importSource, - customMessage, - importName - } - }); - }); - } - - if (allowedImportNames && !allowedImportNames.includes(importName)) { - specifiers.forEach(specifier => { - context.report({ - node, - loc: specifier.loc, - messageId: customMessage ? "allowedImportNameWithCustomMessage" : "allowedImportName", - data: { - importSource, - customMessage, - importName, - allowedImportNames - } - }); - }); - } - }); - }); - } - - /** - * Report a restricted path specifically for patterns. - * @param {node} node representing the restricted path reference - * @param {Object} group contains an Ignore instance for paths, the customMessage to show on failure, - * and any restricted import names that have been specified in the config - * @param {Map} importNames Map of import names that are being imported - * @returns {void} - * @private - */ - function reportPathForPatterns(node, group, importNames) { - const importSource = node.source.value.trim(); - - const customMessage = group.customMessage; - const restrictedImportNames = group.importNames; - const restrictedImportNamePattern = group.importNamePattern ? new RegExp(group.importNamePattern, "u") : null; - const allowedImportNames = group.allowImportNames; - const allowedImportNamePattern = group.allowImportNamePattern ? new RegExp(group.allowImportNamePattern, "u") : null; - - /** - * If we are not restricting to any specific import names and just the pattern itself, - * report the error and move on - */ - if (!restrictedImportNames && !allowedImportNames && !restrictedImportNamePattern && !allowedImportNamePattern) { - context.report({ - node, - messageId: customMessage ? "patternWithCustomMessage" : "patterns", - data: { - importSource, - customMessage - } - }); - return; - } - - importNames.forEach((specifiers, importName) => { - if (importName === "*") { - const [specifier] = specifiers; - - if (restrictedImportNames) { - context.report({ - node, - messageId: customMessage ? "patternAndEverythingWithCustomMessage" : "patternAndEverything", - loc: specifier.loc, - data: { - importSource, - importNames: restrictedImportNames, - customMessage - } - }); - } else if (allowedImportNames) { - context.report({ - node, - messageId: customMessage ? "everythingWithAllowImportNamesAndCustomMessage" : "everythingWithAllowImportNames", - loc: specifier.loc, - data: { - importSource, - allowedImportNames, - customMessage - } - }); - } else if (allowedImportNamePattern) { - context.report({ - node, - messageId: customMessage ? "everythingWithAllowedImportNamePatternWithCustomMessage" : "everythingWithAllowedImportNamePattern", - loc: specifier.loc, - data: { - importSource, - allowedImportNamePattern, - customMessage - } - }); - } else { - context.report({ - node, - messageId: customMessage ? "patternAndEverythingWithRegexImportNameAndCustomMessage" : "patternAndEverythingWithRegexImportName", - loc: specifier.loc, - data: { - importSource, - importNames: restrictedImportNamePattern, - customMessage - } - }); - } - - return; - } - - if ( - (restrictedImportNames && restrictedImportNames.includes(importName)) || - (restrictedImportNamePattern && restrictedImportNamePattern.test(importName)) - ) { - specifiers.forEach(specifier => { - context.report({ - node, - messageId: customMessage ? "patternAndImportNameWithCustomMessage" : "patternAndImportName", - loc: specifier.loc, - data: { - importSource, - customMessage, - importName - } - }); - }); - } - - if (allowedImportNames && !allowedImportNames.includes(importName)) { - specifiers.forEach(specifier => { - context.report({ - node, - messageId: customMessage ? "allowedImportNameWithCustomMessage" : "allowedImportName", - loc: specifier.loc, - data: { - importSource, - customMessage, - importName, - allowedImportNames - } - }); - }); - } else if (allowedImportNamePattern && !allowedImportNamePattern.test(importName)) { - specifiers.forEach(specifier => { - context.report({ - node, - messageId: customMessage ? "allowedImportNamePatternWithCustomMessage" : "allowedImportNamePattern", - loc: specifier.loc, - data: { - importSource, - customMessage, - importName, - allowedImportNamePattern - } - }); - }); - } - }); - } - - /** - * 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.regexMatcher ? group.regexMatcher.test(importSource) : 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, importNames); - } - }); - } - - 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 deleted file mode 100644 index d36f2d2..0000000 --- a/node_modules/eslint/lib/rules/no-restricted-modules.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @fileoverview Restrict usage of specified node modules. - * @author Christian Schulz - * @deprecated in ESLint v7.0.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// 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/latest/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.hasOwn(options[0], "paths") || Object.hasOwn(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 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 (astUtils.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.hasOwn(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 deleted file mode 100644 index acd178a..0000000 --- a/node_modules/eslint/lib/rules/no-restricted-properties.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * @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/latest/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 - } - }); - } - } - - return { - MemberExpression(node) { - checkPropertyAccess(node, node.object && node.object.name, astUtils.getStaticPropertyName(node)); - }, - ObjectPattern(node) { - let objectName = null; - - if (node.parent.type === "VariableDeclarator") { - if (node.parent.init && node.parent.init.type === "Identifier") { - objectName = node.parent.init.name; - } - } else if (node.parent.type === "AssignmentExpression" || node.parent.type === "AssignmentPattern") { - if (node.parent.right.type === "Identifier") { - objectName = node.parent.right.name; - } - } - - node.properties.forEach(property => { - checkPropertyAccess(node, objectName, astUtils.getStaticPropertyName(property)); - }); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-restricted-syntax.js b/node_modules/eslint/lib/rules/no-restricted-syntax.js deleted file mode 100644 index 930882c..0000000 --- a/node_modules/eslint/lib/rules/no-restricted-syntax.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 7c1f00e..0000000 --- a/node_modules/eslint/lib/rules/no-return-assign.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @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", - - defaultOptions: ["except-parens"], - - docs: { - description: "Disallow assignment operators in `return` statements", - recommended: false, - url: "https://eslint.org/docs/latest/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"; - const sourceCode = context.sourceCode; - - 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 deleted file mode 100644 index 0c29741..0000000 --- a/node_modules/eslint/lib/rules/no-return-await.js +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @fileoverview Disallows unnecessary `return await` - * @author Jordan Harband - * @deprecated in ESLint v8.46.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - hasSuggestions: true, - type: "suggestion", - - docs: { - description: "Disallow unnecessary `return await`", - - recommended: false, - - url: "https://eslint.org/docs/latest/rules/no-return-await" - }, - - fixable: null, - - deprecated: true, - - replacedBy: [], - - schema: [ - ], - - messages: { - removeAwait: "Remove redundant `await`.", - 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.sourceCode.getFirstToken(node), - loc: node.loc, - messageId: "redundantUseOfAwait", - suggest: [ - { - messageId: "removeAwait", - fix(fixer) { - const sourceCode = context.sourceCode; - const [awaitToken, tokenAfterAwait] = sourceCode.getFirstTokens(node, 2); - - const areAwaitAndAwaitedExpressionOnTheSameLine = awaitToken.loc.start.line === tokenAfterAwait.loc.start.line; - - if (!areAwaitAndAwaitedExpressionOnTheSameLine) { - return null; - } - - const [startOfAwait, endOfAwait] = awaitToken.range; - - const characterAfterAwait = sourceCode.text[endOfAwait]; - const trimLength = characterAfterAwait === " " ? 1 : 0; - - const range = [startOfAwait, endOfAwait + trimLength]; - - return fixer.removeRange(range); - } - } - ] - - }); - } - - /** - * 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.at(-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 deleted file mode 100644 index 1d16bde..0000000 --- a/node_modules/eslint/lib/rules/no-script-url.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 91b928e..0000000 --- a/node_modules/eslint/lib/rules/no-self-assign.js +++ /dev/null @@ -1,184 +0,0 @@ -/** - * @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", - - defaultOptions: [{ props: true }], - - docs: { - description: "Disallow assignments where both sides are exactly the same", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-self-assign" - }, - - schema: [ - { - type: "object", - properties: { - props: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - selfAssignment: "'{{name}}' is assigned to itself." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const [{ props }] = 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 deleted file mode 100644 index 3b076eb..0000000 --- a/node_modules/eslint/lib/rules/no-self-compare.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @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/latest/rules/no-self-compare" - }, - - schema: [], - - messages: { - comparingToSelf: "Comparing to itself is potentially pointless." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * 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 deleted file mode 100644 index 5843b7a..0000000 --- a/node_modules/eslint/lib/rules/no-sequences.js +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @fileoverview Rule to flag use of comma operator - * @author Brandon Mills - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow comma operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-sequences" - }, - - schema: [{ - type: "object", - properties: { - allowInParentheses: { - type: "boolean" - } - }, - additionalProperties: false - }], - - defaultOptions: [{ - allowInParentheses: true - }], - - messages: { - unexpectedCommaExpression: "Unexpected use of comma operator." - } - }, - - create(context) { - const [{ allowInParentheses }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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 (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 deleted file mode 100644 index a5abaaa..0000000 --- a/node_modules/eslint/lib/rules/no-setter-return.js +++ /dev/null @@ -1,226 +0,0 @@ -/** - * @fileoverview Rule to disallow returning values from setters - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const { findVariable } = require("@eslint-community/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/latest/rules/no-setter-return" - }, - - schema: [], - - messages: { - returnsValue: "Setter cannot return a value." - } - }, - - create(context) { - let funcInfo = null; - const sourceCode = context.sourceCode; - - /** - * 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(sourceCode.getScope(node)); - - 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 deleted file mode 100644 index 29560ff..0000000 --- a/node_modules/eslint/lib/rules/no-shadow-restricted-names.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @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/latest/rules/no-shadow-restricted-names" - }, - - schema: [], - - messages: { - shadowingRestrictedName: "Shadowing of global property '{{name}}'." - } - }, - - create(context) { - - - const RESTRICTED = new Set(["undefined", "NaN", "Infinity", "arguments", "eval"]); - const sourceCode = context.sourceCode; - - return { - "VariableDeclaration, :function, CatchClause"(node) { - for (const variable of sourceCode.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 deleted file mode 100644 index 67e9695..0000000 --- a/node_modules/eslint/lib/rules/no-shadow.js +++ /dev/null @@ -1,342 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allow: [], - builtinGlobals: false, - hoist: "functions", - ignoreOnInitialization: false - }], - - docs: { - description: "Disallow variable declarations from shadowing variables declared in the outer scope", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-shadow" - }, - - schema: [ - { - type: "object", - properties: { - builtinGlobals: { type: "boolean" }, - hoist: { enum: ["all", "functions", "never"] }, - allow: { - type: "array", - items: { - type: "string" - } - }, - ignoreOnInitialization: { type: "boolean" } - }, - 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 [{ - builtinGlobals, - hoist, - allow, - ignoreOnInitialization - }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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 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"}. - (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 || (builtinGlobals && "writeable" in shadowed)) && - !isOnInitializer(variable, shadowed) && - !(ignoreOnInitialization && isInitPatternNode(variable, shadowed)) && - !(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"(node) { - const globalScope = sourceCode.getScope(node); - 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 deleted file mode 100644 index d79c184..0000000 --- a/node_modules/eslint/lib/rules/no-spaced-func.js +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 6d24842..0000000 --- a/node_modules/eslint/lib/rules/no-sparse-arrays.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @fileoverview Disallow sparse arrays - * @author Nicholas C. Zakas - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow sparse arrays", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-sparse-arrays" - }, - - schema: [], - - messages: { - unexpectedSparseArray: "Unexpected comma in middle of array." - } - }, - - create(context) { - - - //-------------------------------------------------------------------------- - // Public - //-------------------------------------------------------------------------- - - return { - - ArrayExpression(node) { - if (!node.elements.includes(null)) { - return; - } - - const { sourceCode } = context; - let commaToken; - - for (const [index, element] of node.elements.entries()) { - if (index === node.elements.length - 1 && element) { - return; - } - - commaToken = sourceCode.getTokenAfter( - element ?? commaToken ?? sourceCode.getFirstToken(node), - astUtils.isCommaToken - ); - - if (element) { - continue; - } - - context.report({ - node, - loc: commaToken.loc, - messageId: "unexpectedSparseArray" - }); - } - } - - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/no-sync.js b/node_modules/eslint/lib/rules/no-sync.js deleted file mode 100644 index 8f79a36..0000000 --- a/node_modules/eslint/lib/rules/no-sync.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 8581e19..0000000 --- a/node_modules/eslint/lib/rules/no-tabs.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @fileoverview Rule to check for tabs inside a file - * @author Gyandeep Singh - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const tabRegex = /\t+/gu; -const anyNonWhitespaceRegex = /\S/u; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow all tabs", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-tabs" - }, - schema: [{ - type: "object", - properties: { - allowIndentationTabs: { - type: "boolean", - default: false - } - }, - additionalProperties: false - }], - - messages: { - unexpectedTab: "Unexpected tab character." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - 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 deleted file mode 100644 index 92b4c1c..0000000 --- a/node_modules/eslint/lib/rules/no-template-curly-in-string.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 4d43c7e..0000000 --- a/node_modules/eslint/lib/rules/no-ternary.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 01e355a..0000000 --- a/node_modules/eslint/lib/rules/no-this-before-super.js +++ /dev/null @@ -1,363 +0,0 @@ -/** - * @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" - ); -} - -/* - * Information for each code path segment. - * - superCalled: The flag which shows `super()` called in all code paths. - * - invalidNodes: The array of invalid ThisExpression and Super nodes. - */ -/** - * - */ -class SegmentInfo { - - /** - * Indicates whether `super()` is called in all code paths. - * @type {boolean} - */ - superCalled = false; - - /** - * The array of invalid ThisExpression and Super nodes. - * @type {ASTNode[]} - */ - invalidNodes = []; -} - -//------------------------------------------------------------------------------ -// 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/latest/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; - - /** @type {Record} */ - 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); - } - - /** - * Determines if every segment in a set has been called. - * @param {Set} segments The segments to search. - * @returns {boolean} True if every segment has been called; false otherwise. - */ - function isEverySegmentCalled(segments) { - for (const segment of segments) { - if (!isCalled(segment)) { - return false; - } - } - - return true; - } - - /** - * Checks whether or not this is before `super()` is called. - * @returns {boolean} `true` if this is before `super()` is called. - */ - function isBeforeCallOfSuper() { - return ( - isInConstructorOfDerivedClass() && - !isEverySegmentCalled(funcInfo.currentSegments) - ); - } - - /** - * 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.currentSegments; - - for (const segment of segments) { - if (segment.reachable) { - segInfoMap[segment.id].invalidNodes.push(node); - } - } - } - - /** - * Sets the current segment as `super` was called. - * @returns {void} - */ - function setSuperCalled() { - const segments = funcInfo.currentSegments; - - for (const segment of segments) { - 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, - currentSegments: new Set() - }; - } else { - funcInfo = { - upper: funcInfo, - isConstructor: false, - hasExtends: false, - codePath, - currentSegments: new Set() - }; - } - }, - - /** - * 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; - } - - /** - * A collection of nodes to avoid duplicate reports. - * @type {Set} - */ - const reported = new Set(); - - codePath.traverseSegments((segment, controller) => { - const info = segInfoMap[segment.id]; - const invalidNodes = info.invalidNodes - .filter( - - /* - * Avoid duplicate reports. - * When there is a `finally`, invalidNodes may contain already reported node. - */ - node => !reported.has(node) - ); - - for (const invalidNode of invalidNodes) { - reported.add(invalidNode); - - 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) { - funcInfo.currentSegments.add(segment); - - if (!isInConstructorOfDerivedClass()) { - return; - } - - // Initialize info. - segInfoMap[segment.id] = { - superCalled: ( - segment.prevSegments.length > 0 && - segment.prevSegments.every(isCalled) - ), - invalidNodes: [] - }; - }, - - onUnreachableCodePathSegmentStart(segment) { - funcInfo.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - onCodePathSegmentEnd(segment) { - funcInfo.currentSegments.delete(segment); - }, - - /** - * 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] ?? new SegmentInfo(); - - if (info.superCalled) { - controller.skip(); - } else if ( - segment.prevSegments.length > 0 && - segment.prevSegments.every(isCalled) - ) { - info.superCalled = true; - } - - segInfoMap[segment.id] = info; - } - ); - }, - - /** - * 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 deleted file mode 100644 index 07a0df6..0000000 --- a/node_modules/eslint/lib/rules/no-throw-literal.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index c188b1f..0000000 --- a/node_modules/eslint/lib/rules/no-trailing-spaces.js +++ /dev/null @@ -1,192 +0,0 @@ -/** - * @fileoverview Disallow trailing spaces at the end of lines. - * @author Nodeca Team - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow trailing whitespace at the end of lines", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - 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; - - 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; - } - - const 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 deleted file mode 100644 index be19d6f..0000000 --- a/node_modules/eslint/lib/rules/no-undef-init.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @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/latest/rules/no-undef-init" - }, - - schema: [], - fixable: "code", - - messages: { - unnecessaryUndefinedInit: "It's not necessary to initialize '{{name}}' to undefined." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - return { - - VariableDeclarator(node) { - const name = sourceCode.getText(node.id), - init = node.init && node.init.name, - scope = sourceCode.getScope(node), - 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 deleted file mode 100644 index b11a3d4..0000000 --- a/node_modules/eslint/lib/rules/no-undef.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - typeof: false - }], - - docs: { - description: "Disallow the use of undeclared variables unless mentioned in `/*global */` comments", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-undef" - }, - - schema: [ - { - type: "object", - properties: { - typeof: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - messages: { - undef: "'{{name}}' is not defined." - } - }, - - create(context) { - const [{ typeof: considerTypeOf }] = context.options; - const sourceCode = context.sourceCode; - - return { - "Program:exit"(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index 8f47ca1..0000000 --- a/node_modules/eslint/lib/rules/no-undefined.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @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/latest/rules/no-undefined" - }, - - schema: [], - - messages: { - unexpectedUndefined: "Unexpected use of undefined." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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"(node) { - const globalScope = sourceCode.getScope(node); - - 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 deleted file mode 100644 index 7247f0e..0000000 --- a/node_modules/eslint/lib/rules/no-underscore-dangle.js +++ /dev/null @@ -1,339 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allow: [], - allowAfterSuper: false, - allowAfterThis: false, - allowAfterThisConstructor: false, - allowFunctionParams: true, - allowInArrayDestructuring: true, - allowInObjectDestructuring: true, - enforceInClassFields: false, - enforceInMethodNames: false - }], - - docs: { - description: "Disallow dangling underscores in identifiers", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-underscore-dangle" - }, - - schema: [ - { - type: "object", - properties: { - allow: { - type: "array", - items: { - type: "string" - } - }, - allowAfterThis: { - type: "boolean" - }, - allowAfterSuper: { - type: "boolean" - }, - allowAfterThisConstructor: { - type: "boolean" - }, - enforceInMethodNames: { - type: "boolean" - }, - allowFunctionParams: { - type: "boolean" - }, - enforceInClassFields: { - type: "boolean" - }, - allowInArrayDestructuring: { - type: "boolean" - }, - allowInObjectDestructuring: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedUnderscore: "Unexpected dangling '_' in '{{identifier}}'." - } - }, - - create(context) { - const [{ - allow, - allowAfterSuper, - allowAfterThis, - allowAfterThisConstructor, - allowFunctionParams, - allowInArrayDestructuring, - allowInObjectDestructuring, - enforceInClassFields, - enforceInMethodNames - }] = context.options; - const sourceCode = context.sourceCode; - - //------------------------------------------------------------------------- - // 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 allow.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) { - sourceCode.getDeclaredVariables(node).forEach(variable => { - const definition = variable.defs.find(def => def.node === node); - const identifierNode = definition.name; - const identifier = identifierNode.name; - let parent = identifierNode.parent; - - while (!["VariableDeclarator", "ArrayPattern", "ObjectPattern"].includes(parent.type)) { - parent = parent.parent; - } - - if ( - hasDanglingUnderscore(identifier) && - !isSpecialCaseIdentifierInVariableExpression(identifier) && - !isAllowed(identifier) && - !(allowInArrayDestructuring && parent.type === "ArrayPattern") && - !(allowInObjectDestructuring && parent.type === "ObjectPattern") - ) { - 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 deleted file mode 100644 index 810c08b..0000000 --- a/node_modules/eslint/lib/rules/no-unexpected-multiline.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 768a155..0000000 --- a/node_modules/eslint/lib/rules/no-unmodified-loop-condition.js +++ /dev/null @@ -1,360 +0,0 @@ -/** - * @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/latest/rules/no-unmodified-loop-condition" - }, - - schema: [], - - messages: { - loopConditionNotModified: "'{{name}}' is not modified in this loop." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - 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"(node) { - const queue = [sourceCode.getScope(node)]; - - 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 deleted file mode 100644 index 3d3dad0..0000000 --- a/node_modules/eslint/lib/rules/no-unneeded-ternary.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @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", - - defaultOptions: [{ defaultAssignment: true }], - - docs: { - description: "Disallow ternary operators when simpler alternatives exist", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-unneeded-ternary" - }, - - schema: [ - { - type: "object", - properties: { - defaultAssignment: { - type: "boolean" - } - }, - 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 [{ defaultAssignment }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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.hasOwn(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 deleted file mode 100644 index f5507ec..0000000 --- a/node_modules/eslint/lib/rules/no-unreachable-loop.js +++ /dev/null @@ -1,187 +0,0 @@ -/** - * @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"]; - -/** - * Checks all segments in a set and returns true if any are reachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if any segment is reachable; false otherwise. - */ -function isAnySegmentReachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - return true; - } - } - - return false; -} - -/** - * 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", - - defaultOptions: [{ ignore: [] }], - - docs: { - description: "Disallow loops with a body that allows only one iteration", - recommended: false, - url: "https://eslint.org/docs/latest/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 [{ ignore: ignoredLoopTypes }] = context.options; - const loopTypesToCheck = getDifference(allLoopTypes, ignoredLoopTypes), - loopSelector = loopTypesToCheck.join(","), - loopsByTargetSegments = new Map(), - loopsToReport = new Set(); - - const codePathSegments = []; - let currentCodePathSegments = new Set(); - - return { - - onCodePathStart() { - codePathSegments.push(currentCodePathSegments); - currentCodePathSegments = new Set(); - }, - - onCodePathEnd() { - currentCodePathSegments = codePathSegments.pop(); - }, - - onUnreachableCodePathSegmentStart(segment) { - currentCodePathSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - currentCodePathSegments.delete(segment); - }, - - onCodePathSegmentEnd(segment) { - currentCodePathSegments.delete(segment); - }, - - onCodePathSegmentStart(segment, node) { - - currentCodePathSegments.add(segment); - - 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); - } - }, - - [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 (isAnySegmentReachable(currentCodePathSegments)) { - loopsToReport.add(node); - } - }, - - - "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 deleted file mode 100644 index 0cf750e..0000000 --- a/node_modules/eslint/lib/rules/no-unreachable.js +++ /dev/null @@ -1,293 +0,0 @@ -/** - * @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 all segments in a set and returns true if all are unreachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if all segments are unreachable; false otherwise. - */ -function areAllSegmentsUnreachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - return false; - } - } - - return true; -} - -/** - * 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/latest/rules/no-unreachable" - }, - - schema: [], - - messages: { - unreachableCode: "Unreachable code." - } - }, - - create(context) { - - /** @type {ConstructorInfo | null} */ - let constructorInfo = null; - - /** @type {ConsecutiveRange} */ - const range = new ConsecutiveRange(context.sourceCode); - - /** @type {Array>} */ - const codePathSegments = []; - - /** @type {Set} */ - let currentCodePathSegments = new Set(); - - /** - * 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" || areAllSegmentsUnreachable(currentCodePathSegments))) { - - // 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() { - codePathSegments.push(currentCodePathSegments); - currentCodePathSegments = new Set(); - }, - - onCodePathEnd() { - currentCodePathSegments = codePathSegments.pop(); - }, - - onUnreachableCodePathSegmentStart(segment) { - currentCodePathSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - currentCodePathSegments.delete(segment); - }, - - onCodePathSegmentEnd(segment) { - currentCodePathSegments.delete(segment); - }, - - onCodePathSegmentStart(segment) { - currentCodePathSegments.add(segment); - }, - - // 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 deleted file mode 100644 index ebd2432..0000000 --- a/node_modules/eslint/lib/rules/no-unsafe-finally.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 10f4a53..0000000 --- a/node_modules/eslint/lib/rules/no-unsafe-negation.js +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - enforceForOrderingRelations: false - }], - - docs: { - description: "Disallow negating the left operand of relational operators", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unsafe-negation" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - enforceForOrderingRelations: { - type: "boolean" - } - }, - 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.sourceCode; - const [{ enforceForOrderingRelations }] = context.options; - - 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 deleted file mode 100644 index c5d1f99..0000000 --- a/node_modules/eslint/lib/rules/no-unsafe-optional-chaining.js +++ /dev/null @@ -1,207 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - disallowArithmeticOperators: false - }], - - docs: { - description: "Disallow use of optional chaining in contexts where the `undefined` value is not allowed", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining" - }, - schema: [{ - type: "object", - properties: { - disallowArithmeticOperators: { - type: "boolean" - } - }, - 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 [{ disallowArithmeticOperators }] = context.options; - - /** - * 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.at(-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 deleted file mode 100644 index fd1437c..0000000 --- a/node_modules/eslint/lib/rules/no-unused-expressions.js +++ /dev/null @@ -1,190 +0,0 @@ -/** - * @fileoverview Flag expressions in statement position that do not side effect - * @author Michael Ficarra - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-unused-expressions" - }, - - schema: [ - { - type: "object", - properties: { - allowShortCircuit: { - type: "boolean" - }, - allowTernary: { - type: "boolean" - }, - allowTaggedTemplates: { - type: "boolean" - }, - enforceForJSX: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - defaultOptions: [{ - allowShortCircuit: false, - allowTernary: false, - allowTaggedTemplates: false, - enforceForJSX: false - }], - - messages: { - unusedExpression: "Expected an assignment or function call and instead saw an expression." - } - }, - - create(context) { - const [{ - allowShortCircuit, - allowTernary, - allowTaggedTemplates, - enforceForJSX - }] = context.options; - - /** - * 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 - * @returns {boolean} whether the given node is considered a directive in its current position - */ - function isDirective(node) { - - /** - * https://tc39.es/ecma262/#directive-prologue - * - * Only `FunctionBody`, `ScriptBody` and `ModuleBody` can have directive prologue. - * Class static blocks do not have directive prologue. - */ - return astUtils.isTopLevelExpressionStatement(node) && directives(node.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.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 deleted file mode 100644 index be06b32..0000000 --- a/node_modules/eslint/lib/rules/no-unused-labels.js +++ /dev/null @@ -1,143 +0,0 @@ -/** - * @fileoverview Rule to disallow unused 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 unused labels", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-unused-labels" - }, - - schema: [], - - fixable: "code", - - messages: { - unused: "'{{name}}:' is defined but never used." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - 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 - }; - } - - /** - * Checks if a `LabeledStatement` node is fixable. - * For a node to be fixable, there must be no comments between the label and the body. - * Furthermore, is must be possible to remove the label without turning the body statement into a - * directive after other fixes are applied. - * @param {ASTNode} node The node to evaluate. - * @returns {boolean} Whether or not the node is fixable. - */ - function isFixable(node) { - - /* - * 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 false; - } - - // Looking for the node's deepest ancestor which is not a `LabeledStatement`. - let ancestor = node.parent; - - while (ancestor.type === "LabeledStatement") { - ancestor = ancestor.parent; - } - - if (ancestor.type === "Program" || - (ancestor.type === "BlockStatement" && astUtils.isFunction(ancestor.parent))) { - const { body } = node; - - if (body.type === "ExpressionStatement" && - ((body.expression.type === "Literal" && typeof body.expression.value === "string") || - astUtils.isStaticTemplateLiteral(body.expression))) { - return false; // potential directive - } - } - return true; - } - - /** - * 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: isFixable(node) ? fixer => fixer.removeRange([node.range[0], node.body.range[0]]) : 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 deleted file mode 100644 index bc05cd2..0000000 --- a/node_modules/eslint/lib/rules/no-unused-private-class-members.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @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: true, - url: "https://eslint.org/docs/latest/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 deleted file mode 100644 index 6045492..0000000 --- a/node_modules/eslint/lib/rules/no-unused-vars.js +++ /dev/null @@ -1,881 +0,0 @@ -/** - * @fileoverview Rule to flag declared but unused variables - * @author Ilya Volodin - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** - * A simple name for the types of variables that this rule supports - * @typedef {'array-destructure'|'catch-clause'|'parameter'|'variable'} VariableType - */ - -/** - * 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. - */ - -/** - * Bag of data used for formatting the `usedIgnoredVar` lint message. - * @typedef {Object} UsedIgnoredVarMessageData - * @property {string} varName The name of the unused var. - * @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/latest/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" - }, - ignoreClassWithStaticInitBlock: { - type: "boolean" - }, - reportUsedIgnorePattern: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - } - ], - - messages: { - unusedVar: "'{{varName}}' is {{action}} but never used{{additional}}.", - usedIgnoredVar: "'{{varName}}' is marked as ignored but is used{{additional}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - const REST_PROPERTY_TYPE = /^(?:RestElement|(?:Experimental)?RestProperty)$/u; - - const config = { - vars: "all", - args: "after-used", - ignoreRestSiblings: false, - caughtErrors: "all", - ignoreClassWithStaticInitBlock: false, - reportUsedIgnorePattern: false - }; - - 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; - config.ignoreClassWithStaticInitBlock = firstOption.ignoreClassWithStaticInitBlock || config.ignoreClassWithStaticInitBlock; - config.reportUsedIgnorePattern = firstOption.reportUsedIgnorePattern || config.reportUsedIgnorePattern; - - 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"); - } - } - } - - /** - * Determines what variable type a def is. - * @param {Object} def the declaration to check - * @returns {VariableType} a simple name for the types of variables that this rule supports - */ - function defToVariableType(def) { - - /* - * This `destructuredArrayIgnorePattern` error report works differently from the catch - * clause and parameter error reports. _Both_ the `varsIgnorePattern` and the - * `destructuredArrayIgnorePattern` will be checked for array destructuring. However, - * for the purposes of the report, the currently defined behavior is to only inform the - * user of the `destructuredArrayIgnorePattern` if it's present (regardless of the fact - * that the `varsIgnorePattern` would also apply). If it's not present, the user will be - * informed of the `varsIgnorePattern`, assuming that's present. - */ - if (config.destructuredArrayIgnorePattern && def.name.parent.type === "ArrayPattern") { - return "array-destructure"; - } - - switch (def.type) { - case "CatchClause": - return "catch-clause"; - case "Parameter": - return "parameter"; - default: - return "variable"; - } - } - - /** - * Gets a given variable's description and configured ignore pattern - * based on the provided variableType - * @param {VariableType} variableType a simple name for the types of variables that this rule supports - * @throws {Error} (Unreachable) - * @returns {[string | undefined, string | undefined]} the given variable's description and - * ignore pattern - */ - function getVariableDescription(variableType) { - let pattern; - let variableDescription; - - switch (variableType) { - case "array-destructure": - pattern = config.destructuredArrayIgnorePattern; - variableDescription = "elements of array destructuring"; - break; - - case "catch-clause": - pattern = config.caughtErrorsIgnorePattern; - variableDescription = "caught errors"; - break; - - case "parameter": - pattern = config.argsIgnorePattern; - variableDescription = "args"; - break; - - case "variable": - pattern = config.varsIgnorePattern; - variableDescription = "vars"; - break; - - default: - throw new Error(`Unexpected variable type: ${variableType}`); - } - - if (pattern) { - pattern = pattern.toString(); - } - - return [variableDescription, pattern]; - } - - /** - * 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 def = unusedVar.defs && unusedVar.defs[0]; - let additionalMessageData = ""; - - if (def) { - const [variableDescription, pattern] = getVariableDescription(defToVariableType(def)); - - if (pattern && variableDescription) { - additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`; - } - } - - return { - varName: unusedVar.name, - action: "defined", - additional: additionalMessageData - }; - } - - /** - * 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 && unusedVar.defs[0]; - let additionalMessageData = ""; - - if (def) { - const [variableDescription, pattern] = getVariableDescription(defToVariableType(def)); - - if (pattern && variableDescription) { - additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`; - } - } - - return { - varName: unusedVar.name, - action: "assigned a value", - additional: additionalMessageData - }; - } - - /** - * Generate the warning message about a variable being used even though - * it is marked as being ignored. - * @param {Variable} variable eslint-scope variable object - * @param {VariableType} variableType a simple name for the types of variables that this rule supports - * @returns {UsedIgnoredVarMessageData} The message data to be used with - * this used ignored variable. - */ - function getUsedIgnoredMessageData(variable, variableType) { - const [variableDescription, pattern] = getVariableDescription(variableType); - - let additionalMessageData = ""; - - if (pattern && variableDescription) { - additionalMessageData = `. Used ${variableDescription} must not match ${pattern}`; - } - - return { - varName: variable.name, - additional: additionalMessageData - }; - } - - //-------------------------------------------------------------------------- - // 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.at(-1).type); - } - - /** - * Determines if a variable has a sibling rest property - * @param {Variable} variable eslint-scope variable object. - * @returns {boolean} True if the variable has a sibling rest property, 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.at(-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.at(-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) && - !astUtils.isLogicalAssignmentOperator(parent.operator) - ) || - ( - 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) { - if (variable.eslintUsed) { - return true; - } - - const functionNodes = getFunctionDefinitions(variable); - const 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 = sourceCode.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 - if (scope.functionExpressionScope) { - continue; - } - - // skip variables marked with markVariableAsUsed() - if (!config.reportUsedIgnorePattern && 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) - ) { - if (config.reportUsedIgnorePattern && isUsedVariable(variable)) { - context.report({ - node: def.name, - messageId: "usedIgnoredVar", - data: getUsedIgnoredMessageData(variable, "array-destructure") - }); - } - - continue; - } - - if (type === "ClassName") { - const hasStaticBlock = def.node.body.body.some(node => node.type === "StaticBlock"); - - if (config.ignoreClassWithStaticInitBlock && hasStaticBlock) { - continue; - } - } - - // skip catch variables - if (type === "CatchClause") { - if (config.caughtErrors === "none") { - continue; - } - - // skip ignored parameters - if (config.caughtErrorsIgnorePattern && config.caughtErrorsIgnorePattern.test(def.name.name)) { - if (config.reportUsedIgnorePattern && isUsedVariable(variable)) { - context.report({ - node: def.name, - messageId: "usedIgnoredVar", - data: getUsedIgnoredMessageData(variable, "catch-clause") - }); - } - - continue; - } - } else 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)) { - if (config.reportUsedIgnorePattern && isUsedVariable(variable)) { - context.report({ - node: def.name, - messageId: "usedIgnoredVar", - data: getUsedIgnoredMessageData(variable, "parameter") - }); - } - - 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)) { - if (config.reportUsedIgnorePattern && isUsedVariable(variable)) { - context.report({ - node: def.name, - messageId: "usedIgnoredVar", - data: getUsedIgnoredMessageData(variable, "variable") - }); - } - - 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(sourceCode.getScope(programNode), []); - - 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.at(-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 deleted file mode 100644 index 59510d8..0000000 --- a/node_modules/eslint/lib/rules/no-use-before-define.js +++ /dev/null @@ -1,350 +0,0 @@ -/** - * @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) { - if (typeof options === "object" && options !== null) { - return options; - } - - const functions = - typeof options === "string" - ? options !== "nofunc" - : true; - - return { functions, classes: true, variables: true, allowNamedExports: false }; -} - -/** - * 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 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/latest/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 - } - ] - } - ], - - defaultOptions: [{ - classes: true, - functions: true, - variables: true, - allowNamedExports: false - }], - - messages: { - usedBeforeDefined: "'{{name}}' was used before it was defined." - } - }, - - create(context) { - const options = parseOptions(context.options[0]); - const sourceCode = context.sourceCode; - - /** - * 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(node) { - checkReferencesInScope(sourceCode.getScope(node)); - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-assignment.js b/node_modules/eslint/lib/rules/no-useless-assignment.js deleted file mode 100644 index cac8ba1..0000000 --- a/node_modules/eslint/lib/rules/no-useless-assignment.js +++ /dev/null @@ -1,566 +0,0 @@ -/** - * @fileoverview A rule to disallow unnecessary assignments`. - * @author Yosuke Ota - */ - -"use strict"; - -const { findVariable } = require("@eslint-community/eslint-utils"); - -//------------------------------------------------------------------------------ -// Types -//------------------------------------------------------------------------------ - -/** @typedef {import("estree").Node} ASTNode */ -/** @typedef {import("estree").Pattern} Pattern */ -/** @typedef {import("estree").Identifier} Identifier */ -/** @typedef {import("estree").VariableDeclarator} VariableDeclarator */ -/** @typedef {import("estree").AssignmentExpression} AssignmentExpression */ -/** @typedef {import("estree").UpdateExpression} UpdateExpression */ -/** @typedef {import("estree").Expression} Expression */ -/** @typedef {import("eslint-scope").Scope} Scope */ -/** @typedef {import("eslint-scope").Variable} Variable */ -/** @typedef {import("../linter/code-path-analysis/code-path")} CodePath */ -/** @typedef {import("../linter/code-path-analysis/code-path-segment")} CodePathSegment */ - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Extract identifier from the given pattern node used on the left-hand side of the assignment. - * @param {Pattern} pattern The pattern node to extract identifier - * @returns {Iterable} The extracted identifier - */ -function *extractIdentifiersFromPattern(pattern) { - switch (pattern.type) { - case "Identifier": - yield pattern; - return; - case "ObjectPattern": - for (const property of pattern.properties) { - yield* extractIdentifiersFromPattern(property.type === "Property" ? property.value : property); - } - return; - case "ArrayPattern": - for (const element of pattern.elements) { - if (!element) { - continue; - } - yield* extractIdentifiersFromPattern(element); - } - return; - case "RestElement": - yield* extractIdentifiersFromPattern(pattern.argument); - return; - case "AssignmentPattern": - yield* extractIdentifiersFromPattern(pattern.left); - - // no default - } -} - - -/** - * Checks whether the given identifier node is evaluated after the assignment identifier. - * @param {AssignmentInfo} assignment The assignment info. - * @param {Identifier} identifier The identifier to check. - * @returns {boolean} `true` if the given identifier node is evaluated after the assignment identifier. - */ -function isIdentifierEvaluatedAfterAssignment(assignment, identifier) { - if (identifier.range[0] < assignment.identifier.range[1]) { - return false; - } - if ( - assignment.expression && - assignment.expression.range[0] <= identifier.range[0] && - identifier.range[1] <= assignment.expression.range[1] - ) { - - /* - * The identifier node is in an expression that is evaluated before the assignment. - * e.g. x = id; - * ^^ identifier to check - * ^ assignment identifier - */ - return false; - } - - /* - * e.g. - * x = 42; id; - * ^^ identifier to check - * ^ assignment identifier - * let { x, y = id } = obj; - * ^^ identifier to check - * ^ assignment identifier - */ - return true; -} - -/** - * Checks whether the given identifier node is used between the assigned identifier and the equal sign. - * - * e.g. let { x, y = x } = obj; - * ^ identifier to check - * ^ assigned identifier - * @param {AssignmentInfo} assignment The assignment info. - * @param {Identifier} identifier The identifier to check. - * @returns {boolean} `true` if the given identifier node is used between the assigned identifier and the equal sign. - */ -function isIdentifierUsedBetweenAssignedAndEqualSign(assignment, identifier) { - if (!assignment.expression) { - return false; - } - return ( - assignment.identifier.range[1] <= identifier.range[0] && - identifier.range[1] <= assignment.expression.range[0] - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - docs: { - description: "Disallow variable assignments when the value is not used", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-assignment" - }, - - schema: [], - - messages: { - unnecessaryAssignment: "This assigned value is not used in subsequent statements." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * @typedef {Object} ScopeStack - * @property {CodePath} codePath The code path of this scope stack. - * @property {Scope} scope The scope of this scope stack. - * @property {ScopeStack} upper The upper scope stack. - * @property {Record} segments The map of ScopeStackSegmentInfo. - * @property {Set} currentSegments The current CodePathSegments. - * @property {Map} assignments The map of list of AssignmentInfo for each variable. - */ - /** - * @typedef {Object} ScopeStackSegmentInfo - * @property {CodePathSegment} segment The code path segment. - * @property {Identifier|null} first The first identifier that appears within the segment. - * @property {Identifier|null} last The last identifier that appears within the segment. - * `first` and `last` are used to determine whether an identifier exists within the segment position range. - * Since it is used as a range of segments, we should originally hold all nodes, not just identifiers, - * but since the only nodes to be judged are identifiers, it is sufficient to have a range of identifiers. - */ - /** - * @typedef {Object} AssignmentInfo - * @property {Variable} variable The variable that is assigned. - * @property {Identifier} identifier The identifier that is assigned. - * @property {VariableDeclarator|AssignmentExpression|UpdateExpression} node The node where the variable was updated. - * @property {Expression|null} expression The expression that is evaluated before the assignment. - * @property {CodePathSegment[]} segments The code path segments where the assignment was made. - */ - - /** @type {ScopeStack} */ - let scopeStack = null; - - /** @type {Set} */ - const codePathStartScopes = new Set(); - - /** - * Gets the scope of code path start from given scope - * @param {Scope} scope The initial scope - * @returns {Scope} The scope of code path start - * @throws {Error} Unexpected error - */ - function getCodePathStartScope(scope) { - let target = scope; - - while (target) { - if (codePathStartScopes.has(target)) { - return target; - } - target = target.upper; - } - - // Should be unreachable - return null; - } - - /** - * Verify the given scope stack. - * @param {ScopeStack} target The scope stack to verify. - * @returns {void} - */ - function verify(target) { - - /** - * Checks whether the given identifier is used in the segment. - * @param {CodePathSegment} segment The code path segment. - * @param {Identifier} identifier The identifier to check. - * @returns {boolean} `true` if the identifier is used in the segment. - */ - function isIdentifierUsedInSegment(segment, identifier) { - const segmentInfo = target.segments[segment.id]; - - return ( - segmentInfo.first && - segmentInfo.last && - segmentInfo.first.range[0] <= identifier.range[0] && - identifier.range[1] <= segmentInfo.last.range[1] - ); - } - - /** - * Verifies whether the given assignment info is an used assignment. - * Report if it is an unused assignment. - * @param {AssignmentInfo} targetAssignment The assignment info to verify. - * @param {AssignmentInfo[]} allAssignments The list of all assignment info for variables. - * @returns {void} - */ - function verifyAssignmentIsUsed(targetAssignment, allAssignments) { - - /** - * @typedef {Object} SubsequentSegmentData - * @property {CodePathSegment} segment The code path segment - * @property {AssignmentInfo} [assignment] The first occurrence of the assignment within the segment. - * There is no need to check if the variable is used after this assignment, - * as the value it was assigned will be used. - */ - - /** - * Information used in `getSubsequentSegments()`. - * To avoid unnecessary iterations, cache information that has already been iterated over, - * and if additional iterations are needed, start iterating from the retained position. - */ - const subsequentSegmentData = { - - /** - * Cache of subsequent segment information list that have already been iterated. - * @type {SubsequentSegmentData[]} - */ - results: [], - - /** - * Subsequent segments that have already been iterated on. Used to avoid infinite loops. - * @type {Set} - */ - subsequentSegments: new Set(), - - /** - * Unexplored code path segment. - * If additional iterations are needed, consume this information and iterate. - * @type {CodePathSegment[]} - */ - queueSegments: targetAssignment.segments.flatMap(segment => segment.nextSegments) - }; - - - /** - * Gets the subsequent segments from the segment of - * the assignment currently being validated (targetAssignment). - * @returns {Iterable} the subsequent segments - */ - function *getSubsequentSegments() { - yield* subsequentSegmentData.results; - - while (subsequentSegmentData.queueSegments.length > 0) { - const nextSegment = subsequentSegmentData.queueSegments.shift(); - - if (subsequentSegmentData.subsequentSegments.has(nextSegment)) { - continue; - } - subsequentSegmentData.subsequentSegments.add(nextSegment); - - const assignmentInSegment = allAssignments - .find(otherAssignment => ( - otherAssignment.segments.includes(nextSegment) && - !isIdentifierUsedBetweenAssignedAndEqualSign(otherAssignment, targetAssignment.identifier) - )); - - if (!assignmentInSegment) { - - /* - * Stores the next segment to explore. - * If `assignmentInSegment` exists, - * we are guarding it because we don't need to explore the next segment. - */ - subsequentSegmentData.queueSegments.push(...nextSegment.nextSegments); - } - - /** @type {SubsequentSegmentData} */ - const result = { - segment: nextSegment, - assignment: assignmentInSegment - }; - - subsequentSegmentData.results.push(result); - yield result; - } - } - - - const readReferences = targetAssignment.variable.references.filter(reference => reference.isRead()); - - if (!readReferences.length) { - - /* - * It is not just an unnecessary assignment, but an unnecessary (unused) variable - * and thus should not be reported by this rule because it is reported by `no-unused-vars`. - */ - return; - } - - /** - * Other assignment on the current segment and after current assignment. - */ - const otherAssignmentAfterTargetAssignment = allAssignments - .find(assignment => { - if ( - assignment === targetAssignment || - assignment.segments.length && assignment.segments.every(segment => !targetAssignment.segments.includes(segment)) - ) { - return false; - } - if (isIdentifierEvaluatedAfterAssignment(targetAssignment, assignment.identifier)) { - return true; - } - if ( - assignment.expression && - assignment.expression.range[0] <= targetAssignment.identifier.range[0] && - targetAssignment.identifier.range[1] <= assignment.expression.range[1] - ) { - - /* - * The target assignment is in an expression that is evaluated before the assignment. - * e.g. x=(x=1); - * ^^^ targetAssignment - * ^^^^^^^ assignment - */ - return true; - } - - return false; - }); - - for (const reference of readReferences) { - - /* - * If the scope of the reference is outside the current code path scope, - * we cannot track whether this assignment is not used. - * For example, it can also be called asynchronously. - */ - if (target.scope !== getCodePathStartScope(reference.from)) { - return; - } - - // Checks if it is used in the same segment as the target assignment. - if ( - isIdentifierEvaluatedAfterAssignment(targetAssignment, reference.identifier) && - ( - isIdentifierUsedBetweenAssignedAndEqualSign(targetAssignment, reference.identifier) || - targetAssignment.segments.some(segment => isIdentifierUsedInSegment(segment, reference.identifier)) - ) - ) { - - if ( - otherAssignmentAfterTargetAssignment && - isIdentifierEvaluatedAfterAssignment(otherAssignmentAfterTargetAssignment, reference.identifier) - ) { - - // There was another assignment before the reference. Therefore, it has not been used yet. - continue; - } - - // Uses in statements after the written identifier. - return; - } - - if (otherAssignmentAfterTargetAssignment) { - - /* - * The assignment was followed by another assignment in the same segment. - * Therefore, there is no need to check the next segment. - */ - continue; - } - - // Check subsequent segments. - for (const subsequentSegment of getSubsequentSegments()) { - if (isIdentifierUsedInSegment(subsequentSegment.segment, reference.identifier)) { - if ( - subsequentSegment.assignment && - isIdentifierEvaluatedAfterAssignment(subsequentSegment.assignment, reference.identifier) - ) { - - // There was another assignment before the reference. Therefore, it has not been used yet. - continue; - } - - // It is used - return; - } - } - } - context.report({ - node: targetAssignment.identifier, - messageId: "unnecessaryAssignment" - }); - } - - // Verify that each assignment in the code path is used. - for (const assignments of target.assignments.values()) { - assignments.sort((a, b) => a.identifier.range[0] - b.identifier.range[0]); - for (const assignment of assignments) { - verifyAssignmentIsUsed(assignment, assignments); - } - } - } - - return { - onCodePathStart(codePath, node) { - const scope = sourceCode.getScope(node); - - scopeStack = { - upper: scopeStack, - codePath, - scope, - segments: Object.create(null), - currentSegments: new Set(), - assignments: new Map() - }; - codePathStartScopes.add(scopeStack.scope); - }, - onCodePathEnd() { - verify(scopeStack); - - scopeStack = scopeStack.upper; - }, - onCodePathSegmentStart(segment) { - const segmentInfo = { segment, first: null, last: null }; - - scopeStack.segments[segment.id] = segmentInfo; - scopeStack.currentSegments.add(segment); - }, - onCodePathSegmentEnd(segment) { - scopeStack.currentSegments.delete(segment); - }, - Identifier(node) { - for (const segment of scopeStack.currentSegments) { - const segmentInfo = scopeStack.segments[segment.id]; - - if (!segmentInfo.first) { - segmentInfo.first = node; - } - segmentInfo.last = node; - } - }, - ":matches(VariableDeclarator[init!=null], AssignmentExpression, UpdateExpression):exit"(node) { - if (scopeStack.currentSegments.size === 0) { - - // Ignore unreachable segments - return; - } - - const assignments = scopeStack.assignments; - - let pattern; - let expression = null; - - if (node.type === "VariableDeclarator") { - pattern = node.id; - expression = node.init; - } else if (node.type === "AssignmentExpression") { - pattern = node.left; - expression = node.right; - } else { // UpdateExpression - pattern = node.argument; - } - - for (const identifier of extractIdentifiersFromPattern(pattern)) { - const scope = sourceCode.getScope(identifier); - - /** @type {Variable} */ - const variable = findVariable(scope, identifier); - - if (!variable) { - continue; - } - - // We don't know where global variables are used. - if (variable.scope.type === "global" && variable.defs.length === 0) { - continue; - } - - /* - * If the scope of the variable is outside the current code path scope, - * we cannot track whether this assignment is not used. - */ - if (scopeStack.scope !== getCodePathStartScope(variable.scope)) { - continue; - } - - // Variables marked by `markVariableAsUsed()` or - // exported by "exported" block comment. - if (variable.eslintUsed) { - continue; - } - - // Variables exported by ESM export syntax - if (variable.scope.type === "module") { - if ( - variable.defs - .some(def => ( - (def.type === "Variable" && def.parent.parent.type === "ExportNamedDeclaration") || - ( - def.type === "FunctionName" && - ( - def.node.parent.type === "ExportNamedDeclaration" || - def.node.parent.type === "ExportDefaultDeclaration" - ) - ) || - ( - def.type === "ClassName" && - ( - def.node.parent.type === "ExportNamedDeclaration" || - def.node.parent.type === "ExportDefaultDeclaration" - ) - ) - )) - ) { - continue; - } - if (variable.references.some(reference => reference.identifier.parent.type === "ExportSpecifier")) { - - // It have `export { ... }` reference. - continue; - } - } - - let list = assignments.get(variable); - - if (!list) { - list = []; - assignments.set(variable, list); - } - list.push({ - variable, - identifier, - node, - expression, - segments: [...scopeStack.currentSegments] - }); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-backreference.js b/node_modules/eslint/lib/rules/no-useless-backreference.js deleted file mode 100644 index d41a898..0000000 --- a/node_modules/eslint/lib/rules/no-useless-backreference.js +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @fileoverview Rule to disallow useless backreferences in regular expressions - * @author Milos Djermanovic - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { CALL, CONSTRUCT, ReferenceTracker, getStringIfConstant } = require("@eslint-community/eslint-utils"); -const { RegExpParser, visitRegExpAST } = require("@eslint-community/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/latest/rules/no-useless-backreference" - }, - - schema: [], - - messages: { - nested: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} from within that group.", - forward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which appears later in the pattern.", - backward: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which appears before in the same lookbehind.", - disjunctive: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which is in another alternative.", - intoNegativeLookaround: "Backreference '{{ bref }}' will be ignored. It references group '{{ group }}'{{ otherGroups }} which is in a negative lookaround." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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, { unicode: flags.includes("u"), unicodeSets: flags.includes("v") }); - } catch { - - // Ignore regular expressions with syntax errors - return; - } - - visitRegExpAST(regExpAST, { - onBackreferenceEnter(bref) { - const groups = [bref.resolved].flat(), - brefPath = getPathToRoot(bref); - - const problems = groups.map(group => { - const groupPath = getPathToRoot(group); - - if (brefPath.includes(group)) { - - // group is bref's ancestor => bref is nested ('nested reference') => group hasn't matched yet when bref starts to match. - return { - messageId: "nested", - group - }; - } - - - // 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 (groupCut.at(-1).type === "Alternative") { - - // group's and bref's ancestor nodes below the lowest common ancestor are sibling alternatives => they're disjunctive. - return { - messageId: "disjunctive", - group - }; - } - if (!isMatchingBackward && bref.end <= group.start) { - - // bref is left, group is right ('forward reference') => group hasn't matched yet when bref starts to match. - return { - messageId: "forward", - group - }; - } - if (isMatchingBackward && group.end <= bref.start) { - - // the opposite of the previous when the regex is matching backward in a lookbehind context. - return { - messageId: "backward", - group - }; - } - 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. - return { - messageId: "intoNegativeLookaround", - group - }; - } - - return null; - }); - - if (problems.length === 0 || problems.some(problem => !problem)) { - - // If there are no problems or no problems with any group then do not report it. - return; - } - - let problemsToReport; - - // Gets problems that appear in the same disjunction. - const problemsInSameDisjunction = problems.filter(problem => problem.messageId !== "disjunctive"); - - if (problemsInSameDisjunction.length) { - - // Only report problems that appear in the same disjunction. - problemsToReport = problemsInSameDisjunction; - } else { - - // If all groups appear in different disjunctions, report it. - problemsToReport = problems; - } - - const [{ messageId, group }, ...other] = problemsToReport; - let otherGroups = ""; - - if (other.length === 1) { - otherGroups = " and another group"; - } else if (other.length > 1) { - otherGroups = ` and other ${other.length} groups`; - } - context.report({ - node, - messageId, - data: { - bref: bref.raw, - group: group.raw, - otherGroups - } - }); - } - }); - } - - return { - "Literal[regex]"(node) { - const { pattern, flags } = node.regex; - - checkRegex(node, pattern, flags); - }, - Program(node) { - const scope = sourceCode.getScope(node), - tracker = new ReferenceTracker(scope), - traceMap = { - RegExp: { - [CALL]: true, - [CONSTRUCT]: true - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) { - const [patternNode, flagsNode] = refNode.arguments, - pattern = getStringIfConstant(patternNode, scope), - flags = getStringIfConstant(flagsNode, scope); - - if (typeof pattern === "string") { - checkRegex(refNode, pattern, flags || ""); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/no-useless-call.js b/node_modules/eslint/lib/rules/no-useless-call.js deleted file mode 100644 index dea2b47..0000000 --- a/node_modules/eslint/lib/rules/no-useless-call.js +++ /dev/null @@ -1,90 +0,0 @@ -/** - * @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/latest/rules/no-useless-call" - }, - - schema: [], - - messages: { - unnecessaryCall: "Unnecessary '.{{name}}()'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - 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 deleted file mode 100644 index e02013d..0000000 --- a/node_modules/eslint/lib/rules/no-useless-catch.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 11dbd9d..0000000 --- a/node_modules/eslint/lib/rules/no-useless-computed-key.js +++ /dev/null @@ -1,174 +0,0 @@ -/** - * @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": - if (node.parent.type === "ObjectExpression") { - return value !== "__proto__"; - } - return true; - - case "PropertyDefinition": - if (node.static) { - return value !== "constructor" && value !== "prototype"; - } - - return value !== "constructor"; - - case "MethodDefinition": - if (node.static) { - return value !== "prototype"; - } - - return value !== "constructor"; - - /* c8 ignore next */ - default: - throw new Error(`Unexpected node type: ${node.type}`); - } - -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - defaultOptions: [{ - enforceForClassMembers: true - }], - - docs: { - description: "Disallow unnecessary computed property keys in objects and classes", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-computed-key" - }, - - schema: [{ - type: "object", - properties: { - enforceForClassMembers: { - type: "boolean" - } - }, - additionalProperties: false - }], - fixable: "code", - - messages: { - unnecessarilyComputedProperty: "Unnecessarily computed property [{{property}}] found." - } - }, - create(context) { - const sourceCode = context.sourceCode; - const [{ enforceForClassMembers }] = context.options; - - /** - * 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 deleted file mode 100644 index c566c62..0000000 --- a/node_modules/eslint/lib/rules/no-useless-concat.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @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/latest/rules/no-useless-concat" - }, - - schema: [], - - messages: { - unexpectedConcat: "Unexpected string concatenation of literals." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - 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 deleted file mode 100644 index 2c063ca..0000000 --- a/node_modules/eslint/lib/rules/no-useless-constructor.js +++ /dev/null @@ -1,205 +0,0 @@ -/** - * @fileoverview Rule to flag the use of redundant constructors in classes. - * @author Alberto Rodríguez - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// 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/latest/rules/no-useless-constructor" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - noUselessConstructor: "Useless constructor.", - removeConstructor: "Remove the 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", - suggest: [ - { - messageId: "removeConstructor", - *fix(fixer) { - const nextToken = context.sourceCode.getTokenAfter(node); - const addSemiColon = nextToken.type === "Punctuator" && nextToken.value === "[" && astUtils.needsPrecedingSemicolon(context.sourceCode, node); - - yield fixer.replaceText(node, addSemiColon ? ";" : ""); - } - } - ] - }); - } - } - - 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 deleted file mode 100644 index 0e0f6f0..0000000 --- a/node_modules/eslint/lib/rules/no-useless-escape.js +++ /dev/null @@ -1,333 +0,0 @@ -/** - * @fileoverview Look for useless escapes in strings and regexes - * @author Onur Temizkan - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); -const { RegExpParser, visitRegExpAST } = require("@eslint-community/regexpp"); - -/** - * @typedef {import('@eslint-community/regexpp').AST.CharacterClass} CharacterClass - * @typedef {import('@eslint-community/regexpp').AST.ExpressionCharacterClass} ExpressionCharacterClass - */ -//------------------------------------------------------------------------------ -// 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")); - -/* - * Set of characters that require escaping in character classes in `unicodeSets` mode. - * ( ) [ ] { } / - \ | are ClassSetSyntaxCharacter - */ -const REGEX_CLASSSET_CHARACTER_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set("q/[{}|()-")); - -/* - * A single character set of ClassSetReservedDoublePunctuator. - * && !! ## $$ %% ** ++ ,, .. :: ;; << == >> ?? @@ ^^ `` ~~ are ClassSetReservedDoublePunctuator - */ -const REGEX_CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR = new Set("!#$%&*+,.:;<=>?@^`~"); - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Disallow unnecessary escape characters", - recommended: true, - url: "https://eslint.org/docs/latest/rules/no-useless-escape" - }, - - hasSuggestions: true, - - messages: { - unnecessaryEscape: "Unnecessary escape character: \\{{character}}.", - removeEscape: "Remove the `\\`. This maintains the current functionality.", - removeEscapeDoNotKeepSemantics: "Remove the `\\` if it was inserted by mistake.", - escapeBackslash: "Replace the `\\` with `\\\\` to include the actual backslash character." - }, - - schema: [] - }, - - create(context) { - const sourceCode = context.sourceCode; - const parser = new RegExpParser(); - - /** - * 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) - * @param {boolean} [disableEscapeBackslashSuggest] `true` if escapeBackslash suggestion should be turned off. - * @returns {void} - */ - function report(node, startOffset, character, disableEscapeBackslashSuggest) { - 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: [ - { - - // Removing unnecessary `\` characters in a directive is not guaranteed to maintain functionality. - messageId: astUtils.isDirective(node.parent) - ? "removeEscapeDoNotKeepSemantics" : "removeEscape", - fix(fixer) { - return fixer.removeRange(range); - } - }, - ...disableEscapeBackslashSuggest - ? [] - : [ - { - 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 the escape character in given regexp is unnecessary. - * @private - * @param {ASTNode} node node to validate. - * @returns {void} - */ - function validateRegExp(node) { - const { pattern, flags } = node.regex; - let patternNode; - const unicode = flags.includes("u"); - const unicodeSets = flags.includes("v"); - - try { - patternNode = parser.parsePattern(pattern, 0, pattern.length, { unicode, unicodeSets }); - } catch { - - // Ignore regular expressions with syntax errors - return; - } - - /** @type {(CharacterClass | ExpressionCharacterClass)[]} */ - const characterClassStack = []; - - visitRegExpAST(patternNode, { - onCharacterClassEnter: characterClassNode => characterClassStack.unshift(characterClassNode), - onCharacterClassLeave: () => characterClassStack.shift(), - onExpressionCharacterClassEnter: characterClassNode => characterClassStack.unshift(characterClassNode), - onExpressionCharacterClassLeave: () => characterClassStack.shift(), - onCharacterEnter(characterNode) { - if (!characterNode.raw.startsWith("\\")) { - - // It's not an escaped character. - return; - } - - const escapedChar = characterNode.raw.slice(1); - - if (escapedChar !== String.fromCodePoint(characterNode.value)) { - - // It's a valid escape. - return; - } - let allowedEscapes; - - if (characterClassStack.length) { - allowedEscapes = unicodeSets ? REGEX_CLASSSET_CHARACTER_ESCAPES : REGEX_GENERAL_ESCAPES; - } else { - allowedEscapes = REGEX_NON_CHARCLASS_ESCAPES; - } - if (allowedEscapes.has(escapedChar)) { - return; - } - - const reportedIndex = characterNode.start + 1; - let disableEscapeBackslashSuggest = false; - - if (characterClassStack.length) { - const characterClassNode = characterClassStack[0]; - - if (escapedChar === "^") { - - /* - * 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. - */ - if (characterClassNode.start + 1 === characterNode.start) { - - return; - } - } - if (!unicodeSets) { - if (escapedChar === "-") { - - /* - * 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. - */ - if (characterClassNode.start + 1 !== characterNode.start && characterNode.end !== characterClassNode.end - 1) { - - return; - } - } - } else { // unicodeSets mode - if (REGEX_CLASS_SET_RESERVED_DOUBLE_PUNCTUATOR.has(escapedChar)) { - - // Escaping is valid if it is a ClassSetReservedDoublePunctuator. - if (pattern[characterNode.end] === escapedChar) { - return; - } - if (pattern[characterNode.start - 1] === escapedChar) { - if (escapedChar !== "^") { - return; - } - - // If the previous character is a `negate` caret(`^`), escape to caret is unnecessary. - - if (!characterClassNode.negate) { - return; - } - const negateCaretIndex = characterClassNode.start + 1; - - if (negateCaretIndex < characterNode.start - 1) { - return; - } - } - } - - if (characterNode.parent.type === "ClassIntersection" || characterNode.parent.type === "ClassSubtraction") { - disableEscapeBackslashSuggest = true; - } - } - } - - report( - node, - reportedIndex, - escapedChar, - disableEscapeBackslashSuggest - ); - } - }); - } - - /** - * 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) { - validateRegExp(node); - } - - } - - 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 deleted file mode 100644 index 2bde823..0000000 --- a/node_modules/eslint/lib/rules/no-useless-rename.js +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - ignoreDestructuring: false, - ignoreImport: false, - ignoreExport: false - }], - - docs: { - description: "Disallow renaming import, export, and destructured assignments to the same name", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-useless-rename" - }, - - fixable: "code", - - schema: [ - { - type: "object", - properties: { - ignoreDestructuring: { type: "boolean" }, - ignoreImport: { type: "boolean" }, - ignoreExport: { type: "boolean" } - }, - additionalProperties: false - } - ], - - messages: { - unnecessarilyRenamed: "{{type}} {{name}} unnecessarily renamed." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const [{ ignoreDestructuring, ignoreImport, ignoreExport }] = context.options; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index 1f85cdb..0000000 --- a/node_modules/eslint/lib/rules/no-useless-return.js +++ /dev/null @@ -1,369 +0,0 @@ -/** - * @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; -} - -/** - * Checks all segments in a set and returns true if any are reachable. - * @param {Set} segments The segments to check. - * @returns {boolean} True if any segment is reachable; false otherwise. - */ -function isAnySegmentReachable(segments) { - - for (const segment of segments) { - if (segment.reachable) { - 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/latest/rules/no-useless-return" - }, - - fixable: "code", - schema: [], - - messages: { - unnecessaryReturn: "Unnecessary return statement." - } - }, - - create(context) { - const segmentInfoMap = new WeakMap(); - const sourceCode = context.sourceCode; - 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; - } - - if (segmentInfoMap.has(segment)) { - 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. - * @param {Set} usedUnreachableSegments A set of segments that have already been traversed in this call. - * @returns {void} - */ - function markReturnStatementsOnSegmentAsUsed(segment, usedUnreachableSegments) { - if (!segment.reachable) { - usedUnreachableSegments.add(segment); - segment.allPrevSegments - .filter(isReturned) - .filter(prevSegment => !usedUnreachableSegments.has(prevSegment)) - .forEach(prevSegment => markReturnStatementsOnSegmentAsUsed(prevSegment, usedUnreachableSegments)); - return; - } - - const info = segmentInfoMap.get(segment); - - if (!info) { - return; - } - - info.uselessReturns = info.uselessReturns.filter(node => { - if (scopeInfo.traversedTryBlockStatements && scopeInfo.traversedTryBlockStatements.length > 0) { - const returnInitialRange = node.range[0]; - const returnFinalRange = node.range[1]; - - const areBlocksInRange = scopeInfo.traversedTryBlockStatements.some(tryBlockStatement => { - const blockInitialRange = tryBlockStatement.range[0]; - const blockFinalRange = tryBlockStatement.range[1]; - - return ( - returnInitialRange >= blockInitialRange && - returnFinalRange <= blockFinalRange - ); - }); - - if (areBlocksInRange) { - return true; - } - } - - remove(scopeInfo.uselessReturns, node); - return false; - }); - } - - /** - * 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 - .currentSegments - .forEach(segment => markReturnStatementsOnSegmentAsUsed(segment, new Set())); - } - - //---------------------------------------------------------------------- - // Public - //---------------------------------------------------------------------- - - return { - - // Makes and pushes a new scope information. - onCodePathStart(codePath) { - scopeInfo = { - upper: scopeInfo, - uselessReturns: [], - traversedTryBlockStatements: [], - codePath, - currentSegments: new Set() - }; - }, - - // 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) { - scopeInfo.currentSegments.add(segment); - - const info = { - uselessReturns: getUselessReturns([], segment.allPrevSegments), - returned: false - }; - - // Stores the info. - segmentInfoMap.set(segment, info); - }, - - onUnreachableCodePathSegmentStart(segment) { - scopeInfo.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - scopeInfo.currentSegments.delete(segment); - }, - - onCodePathSegmentEnd(segment) { - scopeInfo.currentSegments.delete(segment); - }, - - // 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). - !isAnySegmentReachable(scopeInfo.currentSegments) - ) { - return; - } - - for (const segment of scopeInfo.currentSegments) { - const info = segmentInfoMap.get(segment); - - if (info) { - info.uselessReturns.push(node); - info.returned = true; - } - } - scopeInfo.uselessReturns.push(node); - }, - - "TryStatement > BlockStatement.block:exit"(node) { - scopeInfo.traversedTryBlockStatements.push(node); - }, - - "TryStatement:exit"() { - scopeInfo.traversedTryBlockStatements.pop(); - }, - - /* - * 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 deleted file mode 100644 index d45a91a..0000000 --- a/node_modules/eslint/lib/rules/no-var.js +++ /dev/null @@ -1,334 +0,0 @@ -/** - * @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; - } - } - - /* c8 ignore next */ - 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) || - (!astUtils.isFunction(node) && 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/latest/rules/no-var" - }, - - schema: [], - fixable: "code", - - messages: { - unexpectedVar: "Unexpected var, use let or const instead." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * 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 = sourceCode.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 = sourceCode.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 deleted file mode 100644 index 1f643f2..0000000 --- a/node_modules/eslint/lib/rules/no-void.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowAsStatement: false - }], - - docs: { - description: "Disallow `void` operators", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-void" - }, - - messages: { - noVoid: "Expected 'undefined' and instead saw 'void'." - }, - - schema: [ - { - type: "object", - properties: { - allowAsStatement: { - type: "boolean" - } - }, - additionalProperties: false - } - ] - }, - - create(context) { - const [{ allowAsStatement }] = context.options; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index 628f5a2..0000000 --- a/node_modules/eslint/lib/rules/no-warning-comments.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - location: "start", - terms: ["todo", "fixme", "xxx"] - }], - - docs: { - description: "Disallow specified warning terms in comments", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-warning-comments" - }, - - schema: [ - { - type: "object", - properties: { - terms: { - type: "array", - items: { - type: "string" - } - }, - location: { - enum: ["start", "anywhere"] - }, - decoration: { - type: "array", - items: { - type: "string", - pattern: "^\\S$" - }, - minItems: 1, - uniqueItems: true - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedComment: "Unexpected '{{matchedTerm}}' comment: '{{comment}}'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - const [{ decoration, location, terms: warningTerms }] = context.options; - const escapedDecoration = escapeRegExp(decoration ? decoration.join("") : ""); - const 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); - - /* - * When matching at the start, ignore leading whitespace, and - * there's no need to worry about word boundaries. - * - * These expressions for the prefix and suffix are designed as follows: - * ^ handles any terms at the beginning of a comment. - * e.g. terms ["TODO"] matches `//TODO something` - * $ handles any terms at the end of a comment - * e.g. terms ["TODO"] matches `// something TODO` - * \b handles terms preceded/followed by word boundary - * e.g. terms: ["!FIX", "FIX!"] matches `// FIX!something` or `// something!FIX` - * terms: ["FIX"] matches `// FIX!` or `// !FIX`, but not `// fixed or affix` - * - * For location start: - * [\s]* handles optional leading spaces - * e.g. terms ["TODO"] matches `// TODO something` - * [\s\*]* (where "\*" is the escaped string of decoration) - * handles optional leading spaces or decoration characters (for "start" location only) - * e.g. terms ["TODO"] matches `/**** TODO something ... ` - */ - const wordBoundary = "\\b"; - - let prefix = ""; - - if (location === "start") { - prefix = `^[\\s${escapedDecoration}]*`; - } else if (/^\w/u.test(term)) { - prefix = wordBoundary; - } - - const suffix = /\w$/u.test(term) ? wordBoundary : ""; - const flags = "iu"; // Case-insensitive with Unicode case folding. - - /* - * For location "start", the typical regex is: - * /^[\s]*ESCAPED_TERM\b/iu. - * Or if decoration characters are specified (e.g. "*"), then any of - * those characters may appear in any order at the start: - * /^[\s\*]*ESCAPED_TERM\b/iu. - * - * For location "anywhere" the typical regex is - * /\bESCAPED_TERM\b/iu - * - * If it starts or ends with non-word character, the prefix and suffix are empty, respectively. - */ - return new RegExp(`${prefix}${escaped}${suffix}`, flags); - } - - 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 deleted file mode 100644 index 94a166e..0000000 --- a/node_modules/eslint/lib/rules/no-whitespace-before-property.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @fileoverview Rule to disallow whitespace before properties - * @author Kai Cataldo - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Disallow whitespace before properties", - recommended: false, - url: "https://eslint.org/docs/latest/rules/no-whitespace-before-property" - }, - - fixable: "whitespace", - schema: [], - - messages: { - unexpectedWhitespace: "Unexpected whitespace before property {{propName}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index 0fb2c45..0000000 --- a/node_modules/eslint/lib/rules/no-with.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 811b32b..0000000 --- a/node_modules/eslint/lib/rules/nonblock-statement-body-position.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @fileoverview enforce the location of single-line statements - * @author Teddy Katz - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -const POSITION_SCHEMA = { enum: ["beside", "below", "any"] }; - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce the location of single-line statements", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - //---------------------------------------------------------------------- - // 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 deleted file mode 100644 index 176694b..0000000 --- a/node_modules/eslint/lib/rules/object-curly-newline.js +++ /dev/null @@ -1,324 +0,0 @@ -/** - * @fileoverview Rule to require or disallow line breaks inside braces. - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent line breaks after opening and before closing braces", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 6cb0b0f..0000000 --- a/node_modules/eslint/lib/rules/object-curly-spacing.js +++ /dev/null @@ -1,311 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of object literals. - * @author Jamund Ferguson - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing inside braces", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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.sourceCode.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.sourceCode.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.at(-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.at(-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.at(-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 deleted file mode 100644 index 8a08676..0000000 --- a/node_modules/eslint/lib/rules/object-property-newline.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @fileoverview Rule to enforce placing object properties on separate lines. - * @author Vitor Balocco - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce placing object properties on separate lines", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - return { - ObjectExpression(node) { - if (allowSameLine) { - if (node.properties.length > 1) { - const firstTokenOfFirstProperty = sourceCode.getFirstToken(node.properties[0]); - const lastTokenOfLastProperty = sourceCode.getLastToken(node.properties.at(-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 deleted file mode 100644 index f035bbe..0000000 --- a/node_modules/eslint/lib/rules/object-shorthand.js +++ /dev/null @@ -1,521 +0,0 @@ -/** - * @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/latest/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" - }, - methodsIgnorePattern: { - type: "string" - }, - 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 METHODS_IGNORE_PATTERN = PARAMS.methodsIgnorePattern - ? new RegExp(PARAMS.methodsIgnorePattern, "u") - : null; - const AVOID_QUOTES = PARAMS.avoidQuotes; - const AVOID_EXPLICIT_RETURN_ARROWS = !!PARAMS.avoidExplicitReturnArrows; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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]); - - // First token should not be `async` - const firstValueToken = sourceCode.getFirstToken(node.value, { - skip: node.value.async ? 1 : 0 - }); - - const sliceStart = firstValueToken.range[0]; - const sliceEnd = sourceCode.getTokenBefore(arrowToken).range[1]; - const shouldAddParens = node.value.params.length === 1 && node.value.params[0].range[0] === sliceStart; - - const oldParamText = sourceCode.text.slice(sliceStart, sliceEnd); - const newParamText = shouldAddParens ? `(${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. - * @param {ASTNode} node The node representing the function. - * @returns {void} - */ - function enterFunction(node) { - lexicalScopeStack.unshift(new Set()); - sourceCode.getScope(node).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 (METHODS_IGNORE_PATTERN) { - const propertyName = astUtils.getStaticPropertyName(node); - - if (propertyName !== null && METHODS_IGNORE_PATTERN.test(propertyName)) { - 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) { - - // x: /* */ x - // x: (/* */ x) - if (sourceCode.getCommentsInside(node).length > 0) { - return null; - } - - 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) { - - // "x": /* */ x - // "x": (/* */ x) - if (sourceCode.getCommentsInside(node).length > 0) { - return null; - } - - 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 deleted file mode 100644 index 340eac1..0000000 --- a/node_modules/eslint/lib/rules/one-var-declaration-per-line.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @fileoverview Rule to check multiple var declarations per line - * @author Alberto Rodríguez - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Require or disallow newlines around variable declarations", - recommended: false, - url: "https://eslint.org/docs/latest/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 deleted file mode 100644 index ba461a4..0000000 --- a/node_modules/eslint/lib/rules/one-var.js +++ /dev/null @@ -1,567 +0,0 @@ -/** - * @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/latest/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.hasOwn(mode, "uninitialized")) { - options.var.uninitialized = mode.uninitialized; - options.let.uninitialized = mode.uninitialized; - options.const.uninitialized = mode.uninitialized; - } - if (Object.hasOwn(mode, "initialized")) { - options.var.initialized = mode.initialized; - options.let.initialized = mode.initialized; - options.const.initialized = mode.initialized; - } - } - - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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.at(-1); - } else if (statementType === "let") { - currentScope = blockStack.at(-1).let; - } else if (statementType === "const") { - currentScope = blockStack.at(-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 deleted file mode 100644 index 412c97f..0000000 --- a/node_modules/eslint/lib/rules/operator-assignment.js +++ /dev/null @@ -1,211 +0,0 @@ -/** - * @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", - - defaultOptions: ["always"], - - docs: { - description: "Require or disallow assignment operator shorthand where possible", - recommended: false, - url: "https://eslint.org/docs/latest/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 never = context.options[0] === "never"; - const sourceCode = context.sourceCode; - - /** - * 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: !never ? verify : prohibit - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/operator-linebreak.js b/node_modules/eslint/lib/rules/operator-linebreak.js deleted file mode 100644 index 3065e66..0000000 --- a/node_modules/eslint/lib/rules/operator-linebreak.js +++ /dev/null @@ -1,253 +0,0 @@ -/** - * @fileoverview Operator linebreak - enforces operator linebreak style of two types: after and before - * @author Benoît Zugmeyer - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent linebreak style for operators", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - //-------------------------------------------------------------------------- - // 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 deleted file mode 100644 index d0c0454..0000000 --- a/node_modules/eslint/lib/rules/padded-blocks.js +++ /dev/null @@ -1,310 +0,0 @@ -/** - * @fileoverview A rule to ensure blank lines within blocks. - * @author Mathias Schreck - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow padding within blocks", - recommended: false, - url: "https://eslint.org/docs/latest/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.hasOwn(typeOptions, "blocks")) { - options.blocks = typeOptions.blocks === "always"; - } - if (Object.hasOwn(typeOptions, "switches")) { - options.switches = typeOptions.switches === "always"; - } - if (Object.hasOwn(typeOptions, "classes")) { - options.classes = typeOptions.classes === "always"; - } - } - - if (Object.hasOwn(exceptOptions, "allowSingleLineBlocks")) { - options.allowSingleLineBlocks = exceptOptions.allowSingleLineBlocks === true; - } - - const sourceCode = context.sourceCode; - - /** - * 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; - - /* c8 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.hasOwn(options, "switches")) { - rule.SwitchStatement = function(node) { - if (node.cases.length === 0) { - return; - } - checkPadding(node); - }; - } - - if (Object.hasOwn(options, "blocks")) { - rule.BlockStatement = function(node) { - if (node.body.length === 0) { - return; - } - checkPadding(node); - }; - rule.StaticBlock = rule.BlockStatement; - } - - if (Object.hasOwn(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 deleted file mode 100644 index 084651b..0000000 --- a/node_modules/eslint/lib/rules/padding-line-between-statements.js +++ /dev/null @@ -1,590 +0,0 @@ -/** - * @fileoverview Rule to require or disallow newlines between statements - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"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" - ); -} - -/** - * 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.sourceCode.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.sourceCode; - 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: astUtils.isDirective - }, - expression: { - test: node => node.type === "ExpressionStatement" && !astUtils.isDirective(node) - }, - iife: { - test: isIIFEStatement - }, - "multiline-block-like": { - test: (node, sourceCode) => - node.loc.start.line !== node.loc.end.line && - isBlockLikeStatement(sourceCode, node) - }, - "multiline-expression": { - test: node => - node.loc.start.line !== node.loc.end.line && - node.type === "ExpressionStatement" && - !astUtils.isDirective(node) - }, - - "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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow padding lines between statements", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index ef2ea7b..0000000 --- a/node_modules/eslint/lib/rules/prefer-arrow-callback.js +++ /dev/null @@ -1,378 +0,0 @@ -/** - * @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; - } - } - - /* c8 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; - } - - /* c8 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", - - defaultOptions: [{ allowNamedFunctions: false, allowUnboundThis: true }], - - docs: { - description: "Require using arrow functions for callbacks", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-arrow-callback" - }, - - schema: [ - { - type: "object", - properties: { - allowNamedFunctions: { - type: "boolean" - }, - allowUnboundThis: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - preferArrowCallback: "Unexpected function expression." - } - }, - - create(context) { - const [{ allowNamedFunctions, allowUnboundThis }] = context.options; - const sourceCode = context.sourceCode; - - /* - * {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.at(-1); - - if (info) { - info.this = true; - } - }, - - Super() { - const info = stack.at(-1); - - if (info) { - info.super = true; - } - }, - - MetaProperty(node) { - const info = stack.at(-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 = sourceCode.getDeclaredVariables(node)[0]; - - if (isFunctionName(nameVar) && nameVar.references.length > 0) { - return; - } - - // Skip if it's using arguments. - const variable = getVariableOfArguments(sourceCode.getScope(node)); - - 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); - const tokenBeforeBody = sourceCode.getTokenBefore(node.body); - - 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.insertTextAfter(tokenBeforeBody, " =>"); - - // 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 deleted file mode 100644 index b495fcc..0000000 --- a/node_modules/eslint/lib/rules/prefer-const.js +++ /dev/null @@ -1,505 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - destructuring: "any", - ignoreReadBeforeAssign: false - }], - - docs: { - description: "Require `const` declarations for variables that are never reassigned after declared", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-const" - }, - - fixable: "code", - - schema: [ - { - type: "object", - properties: { - destructuring: { enum: ["any", "all"] }, - ignoreReadBeforeAssign: { type: "boolean" } - }, - additionalProperties: false - } - ], - messages: { - useConst: "'{{name}}' is never reassigned. Use 'const' instead." - } - }, - - create(context) { - const [{ destructuring, ignoreReadBeforeAssign }] = context.options; - const shouldMatchAnyDestructuredVariable = destructuring !== "all"; - const sourceCode = context.sourceCode; - 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; - - let totalDeclarationsCount = 0; - - varDeclParent.declarations.forEach(declaration => { - if (declaration.id.type === "ObjectPattern") { - totalDeclarationsCount += declaration.id.properties.length; - } else if (declaration.id.type === "ArrayPattern") { - totalDeclarationsCount += declaration.id.elements.length; - } else { - totalDeclarationsCount += 1; - } - }); - - shouldFix = shouldFix && (reportCount === totalDeclarationsCount); - } - } - - 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(...sourceCode.getDeclaredVariables(node)); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-destructuring.js b/node_modules/eslint/lib/rules/prefer-destructuring.js deleted file mode 100644 index c6075c5..0000000 --- a/node_modules/eslint/lib/rules/prefer-destructuring.js +++ /dev/null @@ -1,301 +0,0 @@ -/** - * @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/latest/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.sourceCode; - - // 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 deleted file mode 100644 index 6d807f9..0000000 --- a/node_modules/eslint/lib/rules/prefer-exponentiation-operator.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * @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-community/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 parentPrecedence = astUtils.getPrecedence(parent); - const needsParens = ( - parent.type === "ClassDeclaration" || - ( - parent.type.endsWith("Expression") && - (parentPrecedence === -1 || parentPrecedence >= 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/latest/rules/prefer-exponentiation-operator" - }, - - schema: [], - fixable: "code", - - messages: { - useExponentiation: "Use the '**' operator instead of 'Math.pow'." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * 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(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const trackMap = { - Math: { - pow: { [CALL]: true } - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) { - report(refNode); - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-named-capture-group.js b/node_modules/eslint/lib/rules/prefer-named-capture-group.js deleted file mode 100644 index a82ee1f..0000000 --- a/node_modules/eslint/lib/rules/prefer-named-capture-group.js +++ /dev/null @@ -1,178 +0,0 @@ -/** - * @fileoverview Rule to enforce requiring named capture groups in regular expression. - * @author Pig Fang - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - CALL, - CONSTRUCT, - ReferenceTracker, - getStringIfConstant -} = require("@eslint-community/eslint-utils"); -const regexpp = require("@eslint-community/regexpp"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const parser = new regexpp.RegExpParser(); - -/** - * Creates fixer suggestions for the regex, if statically determinable. - * @param {number} groupStart Starting index of the regex group. - * @param {string} pattern The regular expression pattern to be checked. - * @param {string} rawText Source text of the regexNode. - * @param {ASTNode} regexNode AST node which contains the regular expression. - * @returns {Array} Fixer suggestions for the regex, if statically determinable. - */ -function suggestIfPossible(groupStart, pattern, rawText, regexNode) { - switch (regexNode.type) { - case "Literal": - if (typeof regexNode.value === "string" && rawText.includes("\\")) { - return null; - } - break; - case "TemplateLiteral": - if (regexNode.expressions.length || rawText.slice(1, -1) !== pattern) { - return null; - } - break; - default: - return null; - } - - const start = regexNode.range[0] + groupStart + 2; - - return [ - { - fix(fixer) { - const existingTemps = pattern.match(/temp\d+/gu) || []; - const highestTempCount = existingTemps.reduce( - (previous, next) => - Math.max(previous, Number(next.slice("temp".length))), - 0 - ); - - return fixer.insertTextBeforeRange( - [start, start], - `?` - ); - }, - messageId: "addGroupName" - }, - { - fix(fixer) { - return fixer.insertTextBeforeRange( - [start, start], - "?:" - ); - }, - messageId: "addNonCapture" - } - ]; -} - -//------------------------------------------------------------------------------ -// 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/latest/rules/prefer-named-capture-group" - }, - - hasSuggestions: true, - - schema: [], - - messages: { - addGroupName: "Add name to capture group.", - addNonCapture: "Convert group to non-capturing.", - required: "Capture group '{{group}}' should be converted to a named or non-capturing group." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - /** - * Function to check regular expression. - * @param {string} pattern The regular expression pattern to be checked. - * @param {ASTNode} node AST node which contains the regular expression or a call/new expression. - * @param {ASTNode} regexNode AST node which contains the regular expression. - * @param {string|null} flags The regular expression flags to be checked. - * @returns {void} - */ - function checkRegex(pattern, node, regexNode, flags) { - let ast; - - try { - ast = parser.parsePattern(pattern, 0, pattern.length, { - unicode: Boolean(flags && flags.includes("u")), - unicodeSets: Boolean(flags && flags.includes("v")) - }); - } catch { - - // ignore regex syntax errors - return; - } - - regexpp.visitRegExpAST(ast, { - onCapturingGroupEnter(group) { - if (!group.name) { - const rawText = sourceCode.getText(regexNode); - const suggest = suggestIfPossible(group.start, pattern, rawText, regexNode); - - context.report({ - node, - messageId: "required", - data: { - group: group.raw - }, - suggest - }); - } - } - }); - } - - return { - Literal(node) { - if (node.regex) { - checkRegex(node.regex.pattern, node, node, node.regex.flags); - } - }, - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const traceMap = { - RegExp: { - [CALL]: true, - [CONSTRUCT]: true - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) { - const regex = getStringIfConstant(refNode.arguments[0]); - const flags = getStringIfConstant(refNode.arguments[1]); - - if (regex) { - checkRegex(regex, refNode, refNode.arguments[0], flags); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/node_modules/eslint/lib/rules/prefer-numeric-literals.js deleted file mode 100644 index 118d6dc..0000000 --- a/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * @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/latest/rules/prefer-numeric-literals" - }, - - schema: [], - - messages: { - useLiteral: "Use {{system}} literals instead of {{functionName}}()." - }, - - fixable: "code" - }, - - create(context) { - const sourceCode = context.sourceCode; - - //---------------------------------------------------------------------- - // 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 deleted file mode 100644 index 97ea64f..0000000 --- a/node_modules/eslint/lib/rules/prefer-object-has-own.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @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/latest/rules/prefer-object-has-own" - }, - schema: [], - messages: { - useHasOwn: "Use 'Object.hasOwn()' instead of 'Object.prototype.hasOwnProperty.call()'." - }, - fixable: "code" - }, - create(context) { - - const sourceCode = context.sourceCode; - - 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 = sourceCode.getScope(node); - const variable = astUtils.getVariableByName(scope, "Object"); - - if ( - calleePropertyName === "call" && - objectPropertyName === "hasOwnProperty" && - isObject && - variable && variable.scope.type === "global" - ) { - context.report({ - node, - messageId: "useHasOwn", - fix(fixer) { - - 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 deleted file mode 100644 index 60b0c31..0000000 --- a/node_modules/eslint/lib/rules/prefer-object-spread.js +++ /dev/null @@ -1,298 +0,0 @@ -/** - * @fileoverview Prefers object spread property over Object.assign - * @author Sharmila Jesupaul - */ - -"use strict"; - -const { CALL, ReferenceTracker } = require("@eslint-community/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/latest/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.sourceCode; - - return { - Program(node) { - const scope = sourceCode.getScope(node); - 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: refNode } of tracker.iterateGlobalReferences(trackMap)) { - if ( - refNode.arguments.length >= 1 && - refNode.arguments[0].type === "ObjectExpression" && - !hasArraySpread(refNode) && - !( - refNode.arguments.length > 1 && - hasArgumentsWithAccessors(refNode) - ) - ) { - const messageId = refNode.arguments.length === 1 - ? "useLiteralMessage" - : "useSpreadMessage"; - const fix = defineFixer(refNode, sourceCode); - - context.report({ node: refNode, 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 deleted file mode 100644 index 276b422..0000000 --- a/node_modules/eslint/lib/rules/prefer-promise-reject-errors.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowEmptyReject: false - }], - - docs: { - description: "Require using Error objects as Promise rejection reasons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-promise-reject-errors" - }, - - fixable: null, - - schema: [ - { - type: "object", - properties: { - allowEmptyReject: { type: "boolean" } - }, - additionalProperties: false - } - ], - - messages: { - rejectAnError: "Expected the Promise rejection reason to be an Error." - } - }, - - create(context) { - - const [{ allowEmptyReject }] = context.options; - const sourceCode = context.sourceCode; - - //---------------------------------------------------------------------- - // 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 && allowEmptyReject) { - 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" - ) { - sourceCode.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 deleted file mode 100644 index 7da4523..0000000 --- a/node_modules/eslint/lib/rules/prefer-reflect.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @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/latest/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.hasOwn(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 deleted file mode 100644 index f760102..0000000 --- a/node_modules/eslint/lib/rules/prefer-regex-literals.js +++ /dev/null @@ -1,510 +0,0 @@ -/** - * @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-community/eslint-utils"); -const { RegExpValidator, visitRegExpAST, RegExpParser } = require("@eslint-community/regexpp"); -const { canTokensBeAdjacent } = require("./utils/ast-utils"); -const { REGEXPP_LATEST_ECMA_VERSION } = require("./utils/regular-expressions"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * 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.hasOwn(node, "regex"); -} - -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", - - defaultOptions: [{ - disallowRedundantWrapping: false - }], - - docs: { - description: "Disallow use of the `RegExp` constructor in favor of regular expression literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/prefer-regex-literals" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - disallowRedundantWrapping: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - unexpectedRegExp: "Use a regular expression literal instead of the 'RegExp' constructor.", - replaceWithLiteral: "Replace with an equivalent regular expression literal.", - replaceWithLiteralAndFlags: "Replace with an equivalent regular expression literal with flags '{{ flags }}'.", - replaceWithIntendedLiteralAndFlags: "Replace with a regular expression literal with flags '{{ flags }}'.", - 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 }] = context.options; - const sourceCode = context.sourceCode; - - /** - * 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 = sourceCode.getScope(node); - 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) && - astUtils.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 (astUtils.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) || - astUtils.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 {number} ecmaVersion The ecmaVersion to convert. - * @returns {import("@eslint-community/regexpp/ecma-versions").EcmaVersion} The resulting ecmaVersion compatible for regexpp. - */ - function getRegexppEcmaVersion(ecmaVersion) { - if (ecmaVersion <= 5) { - return 5; - } - return Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION); - } - - const regexppEcmaVersion = getRegexppEcmaVersion(context.languageOptions.ecmaVersion); - - /** - * 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; - } - } - - /** - * Checks whether the given regex and flags are valid for the ecma version or not. - * @param {string} pattern The regex pattern to check. - * @param {string | undefined} flags The regex flags to check. - * @returns {boolean} True if the given regex pattern and flags are valid for the ecma version. - */ - function isValidRegexForEcmaVersion(pattern, flags) { - const validator = new RegExpValidator({ ecmaVersion: regexppEcmaVersion }); - - try { - validator.validatePattern(pattern, 0, pattern.length, { - unicode: flags ? flags.includes("u") : false, - unicodeSets: flags ? flags.includes("v") : false - }); - if (flags) { - validator.validateFlags(flags); - } - return true; - } catch { - return false; - } - } - - /** - * Checks whether two given regex flags contain the same flags or not. - * @param {string} flagsA The regex flags. - * @param {string} flagsB The regex flags. - * @returns {boolean} True if two regex flags contain same flags. - */ - function areFlagsEqual(flagsA, flagsB) { - return [...flagsA].sort().join("") === [...flagsB].sort().join(""); - } - - - /** - * Merges two regex flags. - * @param {string} flagsA The regex flags. - * @param {string} flagsB The regex flags. - * @returns {string} The merged regex flags. - */ - function mergeRegexFlags(flagsA, flagsB) { - const flagsSet = new Set([ - ...flagsA, - ...flagsB - ]); - - return [...flagsSet].join(""); - } - - /** - * Checks whether a give node can be fixed to the given regex pattern and flags. - * @param {ASTNode} node The node to check. - * @param {string} pattern The regex pattern to check. - * @param {string} flags The regex flags - * @returns {boolean} True if a node can be fixed to the given regex pattern and flags. - */ - function canFixTo(node, pattern, flags) { - const tokenBefore = sourceCode.getTokenBefore(node); - - return sourceCode.getCommentsInside(node).length === 0 && - (!tokenBefore || validPrecedingTokens.has(tokenBefore.value)) && - isValidRegexForEcmaVersion(pattern, flags); - } - - /** - * Returns a safe output code considering the before and after tokens. - * @param {ASTNode} node The regex node. - * @param {string} newRegExpValue The new regex expression value. - * @returns {string} The output code. - */ - function getSafeOutput(node, newRegExpValue) { - const tokenBefore = sourceCode.getTokenBefore(node); - const tokenAfter = sourceCode.getTokenAfter(node); - - return (tokenBefore && !canTokensBeAdjacent(tokenBefore, newRegExpValue) && tokenBefore.range[1] === node.range[0] ? " " : "") + - newRegExpValue + - (tokenAfter && !canTokensBeAdjacent(newRegExpValue, tokenAfter) && node.range[1] === tokenAfter.range[0] ? " " : ""); - - } - - return { - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const traceMap = { - RegExp: { - [CALL]: true, - [CONSTRUCT]: true - } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(traceMap)) { - if (disallowRedundantWrapping && isUnnecessarilyWrappedRegexLiteral(refNode)) { - const regexNode = refNode.arguments[0]; - - if (refNode.arguments.length === 2) { - const suggests = []; - - const argFlags = getStringValue(refNode.arguments[1]) || ""; - - if (canFixTo(refNode, regexNode.regex.pattern, argFlags)) { - suggests.push({ - messageId: "replaceWithLiteralAndFlags", - pattern: regexNode.regex.pattern, - flags: argFlags - }); - } - - const literalFlags = regexNode.regex.flags || ""; - const mergedFlags = mergeRegexFlags(literalFlags, argFlags); - - if ( - !areFlagsEqual(mergedFlags, argFlags) && - canFixTo(refNode, regexNode.regex.pattern, mergedFlags) - ) { - suggests.push({ - messageId: "replaceWithIntendedLiteralAndFlags", - pattern: regexNode.regex.pattern, - flags: mergedFlags - }); - } - - context.report({ - node: refNode, - messageId: "unexpectedRedundantRegExpWithFlags", - suggest: suggests.map(({ flags, pattern, messageId }) => ({ - messageId, - data: { - flags - }, - fix(fixer) { - return fixer.replaceText(refNode, getSafeOutput(refNode, `/${pattern}/${flags}`)); - } - })) - }); - } else { - const outputs = []; - - if (canFixTo(refNode, regexNode.regex.pattern, regexNode.regex.flags)) { - outputs.push(sourceCode.getText(regexNode)); - } - - - context.report({ - node: refNode, - messageId: "unexpectedRedundantRegExp", - suggest: outputs.map(output => ({ - messageId: "replaceWithLiteral", - fix(fixer) { - return fixer.replaceText( - refNode, - getSafeOutput(refNode, output) - ); - } - })) - }); - } - } else if (hasOnlyStaticStringArguments(refNode)) { - let regexContent = getStringValue(refNode.arguments[0]); - let noFix = false; - let flags; - - if (refNode.arguments[1]) { - flags = getStringValue(refNode.arguments[1]); - } - - if (!canFixTo(refNode, regexContent, flags)) { - noFix = true; - } - - if (!/^[-a-zA-Z0-9\\[\](){} \t\r\n\v\f!@#$%^&*+^_=/~`.> 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 deleted file mode 100644 index fe26eed..0000000 --- a/node_modules/eslint/lib/rules/quote-props.js +++ /dev/null @@ -1,310 +0,0 @@ -/** - * @fileoverview Rule to flag non-quoted property names in object literals. - * @author Mathias Bynens - * @deprecated in ESLint v8.53.0 - */ -"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: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Require quotes around object literal property names", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - - /** - * 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 deleted file mode 100644 index 17d97dd..0000000 --- a/node_modules/eslint/lib/rules/quotes.js +++ /dev/null @@ -1,350 +0,0 @@ -/** - * @fileoverview A rule to choose between single and double quote marks - * @author Matt DuVall , Brandon Payton - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce the consistent use of either backticks, double, or single quotes", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 not surrounded by - * parentheses. - * @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" && - !astUtils.isParenthesised(sourceCode, node.expression) - ); - } - - /** - * Checks whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue. - * @see {@link 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 a specified node is either part of, or immediately follows a (possibly empty) directive prologue. - * @private - */ - function isExpressionInOrJustAfterDirectivePrologue(node) { - if (!astUtils.isTopLevelExpressionStatement(node.parent)) { - return false; - } - const block = node.parent.parent; - - // 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 !astUtils.isParenthesised(sourceCode, node) && isExpressionInOrJustAfterDirectivePrologue(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 (astUtils.isTopLevelExpressionStatement(node.parent) && !astUtils.isParenthesised(sourceCode, node)) { - - /* - * TemplateLiterals aren't actually directives, but 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 deleted file mode 100644 index 6d37d18..0000000 --- a/node_modules/eslint/lib/rules/radix.js +++ /dev/null @@ -1,200 +0,0 @@ -/** - * @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", - - defaultOptions: [MODE_ALWAYS], - - docs: { - description: "Enforce the consistent use of the radix argument when using `parseInt()`", - recommended: false, - url: "https://eslint.org/docs/latest/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; - const sourceCode = context.sourceCode; - - /** - * 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 tokens = sourceCode.getTokens(node); - const lastToken = tokens.at(-1); // Parenthesis. - const secondToLastToken = tokens.at(-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"(node) { - const scope = sourceCode.getScope(node); - let variable; - - // Check `parseInt()` - variable = astUtils.getVariableByName(scope, "parseInt"); - if (variable && !isShadowed(variable)) { - variable.references.forEach(reference => { - const idNode = reference.identifier; - - if (astUtils.isCallee(idNode)) { - checkArguments(idNode.parent); - } - }); - } - - // Check `Number.parseInt()` - variable = astUtils.getVariableByName(scope, "Number"); - if (variable && !isShadowed(variable)) { - variable.references.forEach(reference => { - const parentNode = reference.identifier.parent; - const maybeCallee = parentNode.parent.type === "ChainExpression" - ? parentNode.parent - : parentNode; - - if (isParseIntMethod(parentNode) && 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 deleted file mode 100644 index 5de58f7..0000000 --- a/node_modules/eslint/lib/rules/require-atomic-updates.js +++ /dev/null @@ -1,334 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowProperties: false - }], - - docs: { - description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`", - recommended: false, - url: "https://eslint.org/docs/latest/rules/require-atomic-updates" - }, - - fixable: null, - - schema: [{ - type: "object", - properties: { - allowProperties: { - type: "boolean" - } - }, - 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; - - const sourceCode = context.sourceCode; - const assignmentReferences = new Map(); - const segmentInfo = new SegmentInfo(); - let stack = null; - - return { - onCodePathStart(codePath, node) { - const scope = sourceCode.getScope(node); - const shouldVerify = - scope.type === "function" && - (scope.block.async || scope.block.generator); - - stack = { - upper: stack, - codePath, - referenceMap: shouldVerify ? createReferenceMap(scope) : null, - currentSegments: new Set() - }; - }, - onCodePathEnd() { - stack = stack.upper; - }, - - // Initialize the segment information. - onCodePathSegmentStart(segment) { - segmentInfo.initialize(segment); - stack.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentStart(segment) { - stack.currentSegments.add(segment); - }, - - onUnreachableCodePathSegmentEnd(segment) { - stack.currentSegments.delete(segment); - }, - - onCodePathSegmentEnd(segment) { - stack.currentSegments.delete(segment); - }, - - - // Handle references to prepare verification. - Identifier(node) { - const { 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(stack.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) { - - // referenceMap exists if this is in a resumable function scope. - if (!stack.referenceMap) { - return; - } - - // Mark the read variables on this code path as outdated. - if (node.type === "AwaitExpression" || node.type === "YieldExpression") { - segmentInfo.makeOutdated(stack.currentSegments); - } - - // Verify. - const references = assignmentReferences.get(node); - - if (references) { - assignmentReferences.delete(node); - - for (const reference of references) { - const variable = reference.resolved; - - if (segmentInfo.isOutdated(stack.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 deleted file mode 100644 index 2a5159d..0000000 --- a/node_modules/eslint/lib/rules/require-await.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * @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/latest/rules/require-await" - }, - - schema: [], - - messages: { - missingAwait: "{{name}} has no 'await' expression.", - removeAsync: "Remove 'async'." - }, - - hasSuggestions: true - }, - - create(context) { - const sourceCode = context.sourceCode; - 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)) { - - /* - * If the function belongs to a method definition or - * property, then the function's range may not include the - * `async` keyword and we should look at the parent instead. - */ - const nodeWithAsyncKeyword = - (node.parent.type === "MethodDefinition" && node.parent.value === node) || - (node.parent.type === "Property" && node.parent.method && node.parent.value === node) - ? node.parent - : node; - - const asyncToken = sourceCode.getFirstToken(nodeWithAsyncKeyword, token => token.value === "async"); - const asyncRange = [asyncToken.range[0], sourceCode.getTokenAfter(asyncToken, { includeComments: true }).range[0]]; - - /* - * Removing the `async` keyword can cause parsing errors if the current - * statement is relying on automatic semicolon insertion. If ASI is currently - * being used, then we should replace the `async` keyword with a semicolon. - */ - const nextToken = sourceCode.getTokenAfter(asyncToken); - const addSemiColon = - nextToken.type === "Punctuator" && - (nextToken.value === "[" || nextToken.value === "(") && - (nodeWithAsyncKeyword.type === "MethodDefinition" || astUtils.isStartOfExpressionStatement(nodeWithAsyncKeyword)) && - astUtils.needsPrecedingSemicolon(sourceCode, nodeWithAsyncKeyword); - - context.report({ - node, - loc: astUtils.getFunctionHeadLoc(node, sourceCode), - messageId: "missingAwait", - data: { - name: capitalizeFirstLetter( - astUtils.getFunctionNameWithKind(node) - ) - }, - suggest: [{ - messageId: "removeAsync", - fix: fixer => fixer.replaceTextRange(asyncRange, addSemiColon ? ";" : "") - }] - }); - } - - 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-unicode-regexp.js b/node_modules/eslint/lib/rules/require-unicode-regexp.js deleted file mode 100644 index 48fe568..0000000 --- a/node_modules/eslint/lib/rules/require-unicode-regexp.js +++ /dev/null @@ -1,210 +0,0 @@ -/** - * @fileoverview Rule to enforce the use of `u` flag on RegExp. - * @author Toru Nagashima - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - CALL, - CONSTRUCT, - ReferenceTracker, - getStringIfConstant -} = require("@eslint-community/eslint-utils"); -const astUtils = require("./utils/ast-utils.js"); -const { isValidWithUnicodeFlag } = require("./utils/regular-expressions"); - -/** - * Checks whether the flag configuration should be treated as a missing flag. - * @param {"u"|"v"|undefined} requireFlag A particular flag to require - * @param {string} flags The regex flags - * @returns {boolean} Whether the flag configuration results in a missing flag. - */ -function checkFlags(requireFlag, flags) { - let missingFlag; - - if (requireFlag === "v") { - missingFlag = !flags.includes("v"); - } else if (requireFlag === "u") { - missingFlag = !flags.includes("u"); - } else { - missingFlag = !flags.includes("u") && !flags.includes("v"); - } - - return missingFlag; -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "suggestion", - - docs: { - description: "Enforce the use of `u` or `v` flag on RegExp", - recommended: false, - url: "https://eslint.org/docs/latest/rules/require-unicode-regexp" - }, - - hasSuggestions: true, - - messages: { - addUFlag: "Add the 'u' flag.", - addVFlag: "Add the 'v' flag.", - requireUFlag: "Use the 'u' flag.", - requireVFlag: "Use the 'v' flag." - }, - - schema: [ - { - type: "object", - properties: { - requireFlag: { - enum: ["u", "v"] - } - }, - additionalProperties: false - } - ] - }, - - create(context) { - - const sourceCode = context.sourceCode; - - const { - requireFlag - } = context.options[0] ?? {}; - - return { - "Literal[regex]"(node) { - const flags = node.regex.flags || ""; - - const missingFlag = checkFlags(requireFlag, flags); - - if (missingFlag) { - context.report({ - messageId: requireFlag === "v" ? "requireVFlag" : "requireUFlag", - node, - suggest: isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, node.regex.pattern, requireFlag) - ? [ - { - fix(fixer) { - const replaceFlag = requireFlag ?? "u"; - const regex = sourceCode.getText(node); - const slashPos = regex.lastIndexOf("/"); - - if (requireFlag) { - const flag = requireFlag === "u" ? "v" : "u"; - - if (regex.includes(flag, slashPos)) { - return fixer.replaceText( - node, - regex.slice(0, slashPos) + - regex.slice(slashPos).replace(flag, requireFlag) - ); - } - } - - return fixer.insertTextAfter(node, replaceFlag); - }, - messageId: requireFlag === "v" ? "addVFlag" : "addUFlag" - } - ] - : null - }); - } - }, - - Program(node) { - const scope = sourceCode.getScope(node); - const tracker = new ReferenceTracker(scope); - const trackMap = { - RegExp: { [CALL]: true, [CONSTRUCT]: true } - }; - - for (const { node: refNode } of tracker.iterateGlobalReferences(trackMap)) { - const [patternNode, flagsNode] = refNode.arguments; - - if (patternNode && patternNode.type === "SpreadElement") { - continue; - } - const pattern = getStringIfConstant(patternNode, scope); - const flags = getStringIfConstant(flagsNode, scope); - - let missingFlag = !flagsNode; - - if (typeof flags === "string") { - missingFlag = checkFlags(requireFlag, flags); - } - - if (missingFlag) { - context.report({ - messageId: requireFlag === "v" ? "requireVFlag" : "requireUFlag", - node: refNode, - suggest: typeof pattern === "string" && isValidWithUnicodeFlag(context.languageOptions.ecmaVersion, pattern, requireFlag) - ? [ - { - fix(fixer) { - const replaceFlag = requireFlag ?? "u"; - - if (flagsNode) { - if ((flagsNode.type === "Literal" && typeof flagsNode.value === "string") || flagsNode.type === "TemplateLiteral") { - const flagsNodeText = sourceCode.getText(flagsNode); - const flag = requireFlag === "u" ? "v" : "u"; - - if (flags.includes(flag)) { - - // Avoid replacing "u" in escapes like `\uXXXX` - if (flagsNode.type === "Literal" && flagsNode.raw.includes("\\")) { - return null; - } - - // Avoid replacing "u" in expressions like "`${regularFlags}g`" - if (flagsNode.type === "TemplateLiteral" && ( - flagsNode.expressions.length || - flagsNode.quasis.some(({ value: { raw } }) => raw.includes("\\")) - )) { - return null; - } - - return fixer.replaceText(flagsNode, flagsNodeText.replace(flag, replaceFlag)); - } - - return fixer.replaceText(flagsNode, [ - flagsNodeText.slice(0, flagsNodeText.length - 1), - flagsNodeText.slice(flagsNodeText.length - 1) - ].join(replaceFlag)); - } - - // We intentionally don't suggest concatenating + "u" to non-literals - return null; - } - - const penultimateToken = sourceCode.getLastToken(refNode, { skip: 1 }); // skip closing parenthesis - - return fixer.insertTextAfter( - penultimateToken, - astUtils.isCommaToken(penultimateToken) - ? ` "${replaceFlag}",` - : `, "${replaceFlag}"` - ); - }, - messageId: requireFlag === "v" ? "addVFlag" : "addUFlag" - } - ] - : null - }); - } - } - } - }; - } -}; diff --git a/node_modules/eslint/lib/rules/require-yield.js b/node_modules/eslint/lib/rules/require-yield.js deleted file mode 100644 index f801af0..0000000 --- a/node_modules/eslint/lib/rules/require-yield.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @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/latest/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() { - - 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 deleted file mode 100644 index 287e56f..0000000 --- a/node_modules/eslint/lib/rules/rest-spread-spacing.js +++ /dev/null @@ -1,123 +0,0 @@ -/** - * @fileoverview Enforce spacing between rest and spread operators and their expressions. - * @author Kai Cataldo - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce spacing between rest and spread operators and their expressions", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode, - 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 deleted file mode 100644 index 35a49d2..0000000 --- a/node_modules/eslint/lib/rules/semi-spacing.js +++ /dev/null @@ -1,248 +0,0 @@ -/** - * @fileoverview Validates spacing before and after semicolon - * @author Mathias Schreck - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before and after semicolons", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 11caaf0..0000000 --- a/node_modules/eslint/lib/rules/semi-style.js +++ /dev/null @@ -1,158 +0,0 @@ -/** - * @fileoverview Rule to enforce location of semicolons. - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"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.at(-1) === node; // before `}` or etc. -} - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce location of semicolons", - recommended: false, - url: "https://eslint.org/docs/latest/rules/semi-style" - }, - - schema: [{ enum: ["last", "first"] }], - fixable: "whitespace", - - messages: { - expectedSemiColon: "Expected this semicolon to be at {{pos}}." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - 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 deleted file mode 100644 index 01586b8..0000000 --- a/node_modules/eslint/lib/rules/semi.js +++ /dev/null @@ -1,438 +0,0 @@ -/** - * @fileoverview Rule to flag missing semicolons. - * @author Nicholas C. Zakas - * @deprecated in ESLint v8.53.0 - */ -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow semicolons instead of ASI", - recommended: false, - url: "https://eslint.org/docs/latest/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" }, - omitLastInOneLineClassBody: { 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 exceptOneLineClassBody = Boolean(options && options.omitLastInOneLineClassBody); - const beforeStatementContinuationChars = options && options.beforeStatementContinuationChars || "any"; - const sourceCode = context.sourceCode; - - //-------------------------------------------------------------------------- - // 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 the last item in a one-liner `ClassBody` node. - * ClassBody 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 ClassBody. - */ - function isLastInOneLinerClassBody(node) { - const parent = node.parent; - const nextToken = sourceCode.getTokenAfter(node); - - if (!nextToken || nextToken.value !== "}") { - return false; - } - - if (parent.type === "ClassBody") { - return parent.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)); - const oneLinerClassBody = (exceptOneLineClassBody && isLastInOneLinerClassBody(node)); - const oneLinerBlockOrClassBody = oneLinerBlock || oneLinerClassBody; - - if (isSemi && oneLinerBlockOrClassBody) { - report(node, true); - } else if (!isSemi && !oneLinerBlockOrClassBody) { - 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 deleted file mode 100644 index 9a1113a..0000000 --- a/node_modules/eslint/lib/rules/sort-imports.js +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - allowSeparatedGroups: false, - ignoreCase: false, - ignoreDeclarationSort: false, - ignoreMemberSort: false, - memberSyntaxSortOrder: ["none", "all", "multiple", "single"] - }], - - docs: { - description: "Enforce sorted import declarations within modules", - recommended: false, - url: "https://eslint.org/docs/latest/rules/sort-imports" - }, - - schema: [ - { - type: "object", - properties: { - ignoreCase: { - type: "boolean" - }, - memberSyntaxSortOrder: { - type: "array", - items: { - enum: ["none", "all", "multiple", "single"] - }, - uniqueItems: true, - minItems: 4, - maxItems: 4 - }, - ignoreDeclarationSort: { - type: "boolean" - }, - ignoreMemberSort: { - type: "boolean" - }, - allowSeparatedGroups: { - type: "boolean" - } - }, - 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 [{ - ignoreCase, - ignoreDeclarationSort, - ignoreMemberSort, - memberSyntaxSortOrder, - allowSeparatedGroups - }] = context.options; - const sourceCode = context.sourceCode; - 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.at(-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 deleted file mode 100644 index c8429ad..0000000 --- a/node_modules/eslint/lib/rules/sort-keys.js +++ /dev/null @@ -1,236 +0,0 @@ -/** - * @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", - - defaultOptions: ["asc", { - allowLineSeparatedGroups: false, - caseSensitive: true, - ignoreComputedKeys: false, - minKeys: 2, - natural: false - }], - - docs: { - description: "Require object keys to be sorted", - recommended: false, - url: "https://eslint.org/docs/latest/rules/sort-keys" - }, - - schema: [ - { - enum: ["asc", "desc"] - }, - { - type: "object", - properties: { - caseSensitive: { - type: "boolean" - }, - natural: { - type: "boolean" - }, - minKeys: { - type: "integer", - minimum: 2 - }, - allowLineSeparatedGroups: { - type: "boolean" - }, - ignoreComputedKeys: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - messages: { - sortKeys: "Expected object keys to be in {{natural}}{{insensitive}}{{order}}ending order. '{{thisName}}' should be before '{{prevName}}'." - } - }, - - create(context) { - const [order, { caseSensitive, natural, minKeys, allowLineSeparatedGroups, ignoreComputedKeys }] = context.options; - const insensitive = !caseSensitive; - const isValidOrder = isValidOrders[ - order + (insensitive ? "I" : "") + (natural ? "N" : "") - ]; - - // The stack to save the previous property's name for each object literals. - let stack = null; - const sourceCode = context.sourceCode; - - return { - ObjectExpression(node) { - stack = { - upper: stack, - prevNode: null, - prevBlankLine: false, - 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; - } - - if (ignoreComputedKeys && node.computed) { - stack.prevName = null; // reset sort - return; - } - - const prevName = stack.prevName; - const numKeys = stack.numKeys; - const thisName = getPropertyName(node); - - // Get tokens between current node and previous node - const tokens = stack.prevNode && sourceCode - .getTokensBetween(stack.prevNode, node, { includeComments: true }); - - let isBlankLineBetweenNodes = stack.prevBlankLine; - - if (tokens) { - - // check blank line between tokens - tokens.forEach((token, index) => { - const previousToken = tokens[index - 1]; - - if (previousToken && (token.loc.start.line - previousToken.loc.end.line > 1)) { - isBlankLineBetweenNodes = true; - } - }); - - // check blank line between the current node and the last token - if (!isBlankLineBetweenNodes && (node.loc.start.line - tokens.at(-1).loc.end.line > 1)) { - isBlankLineBetweenNodes = true; - } - - // check blank line between the first token and the previous node - if (!isBlankLineBetweenNodes && (tokens[0].loc.start.line - stack.prevNode.loc.end.line > 1)) { - isBlankLineBetweenNodes = true; - } - } - - stack.prevNode = node; - - if (thisName !== null) { - stack.prevName = thisName; - } - - if (allowLineSeparatedGroups && isBlankLineBetweenNodes) { - stack.prevBlankLine = thisName === null; - return; - } - - 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 deleted file mode 100644 index 985f47f..0000000 --- a/node_modules/eslint/lib/rules/sort-vars.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @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", - - defaultOptions: [{ - ignoreCase: false - }], - - docs: { - description: "Require variables within the same declaration block to be sorted", - recommended: false, - url: "https://eslint.org/docs/latest/rules/sort-vars" - }, - - schema: [ - { - type: "object", - properties: { - ignoreCase: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - fixable: "code", - - messages: { - sortVars: "Variables within the same declaration block should be sorted alphabetically." - } - }, - - create(context) { - const [{ ignoreCase }] = context.options; - const sourceCode = context.sourceCode; - - 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.at(-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 deleted file mode 100644 index a4a5449..0000000 --- a/node_modules/eslint/lib/rules/space-before-blocks.js +++ /dev/null @@ -1,204 +0,0 @@ -/** - * @fileoverview A rule to ensure whitespace before blocks. - * @author Mathias Schreck - * @deprecated in ESLint v8.53.0 - */ - -"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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before blocks", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 575a159..0000000 --- a/node_modules/eslint/lib/rules/space-before-function-paren.js +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @fileoverview Rule to validate spacing before function paren. - * @author Mathias Schreck - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before `function` definition opening parenthesis", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index d15a643..0000000 --- a/node_modules/eslint/lib/rules/space-in-parens.js +++ /dev/null @@ -1,285 +0,0 @@ -/** - * @fileoverview Disallows or enforces spaces inside of parentheses. - * @author Jonathan Rajavuori - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing inside parentheses", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 4007101..0000000 --- a/node_modules/eslint/lib/rules/space-infix-ops.js +++ /dev/null @@ -1,198 +0,0 @@ -/** - * @fileoverview Require spaces around infix operators - * @author Michael Ficarra - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -const { isEqToken } = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require spacing around infix operators", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index ab6c3cb..0000000 --- a/node_modules/eslint/lib/rules/space-unary-ops.js +++ /dev/null @@ -1,324 +0,0 @@ -/** - * @fileoverview This rule should require or disallow spaces before or after unary operations. - * @author Marcin Kumorek - * @deprecated in ESLint v8.53.0 - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce consistent spacing before or after unary operators", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - //-------------------------------------------------------------------------- - // 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.hasOwn(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 deleted file mode 100644 index 90ac703..0000000 --- a/node_modules/eslint/lib/rules/spaced-comment.js +++ /dev/null @@ -1,385 +0,0 @@ -/** - * @fileoverview Source code for spaced-comments rule - * @author Gyandeep Singh - * @deprecated in ESLint v8.53.0 - */ -"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: { - deprecated: true, - replacedBy: [], - type: "suggestion", - - docs: { - description: "Enforce consistent spacing after the `//` or `/*` in a comment", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - // 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 deleted file mode 100644 index 198bf85..0000000 --- a/node_modules/eslint/lib/rules/strict.js +++ /dev/null @@ -1,278 +0,0 @@ -/** - * @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", - - defaultOptions: ["safe"], - - docs: { - description: "Require or disallow strict mode directives", - recommended: false, - url: "https://eslint.org/docs/latest/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; - - if (ecmaFeatures.impliedStrict) { - mode = "implied"; - } else if (mode === "safe") { - mode = ecmaFeatures.globalReturn || context.languageOptions.sourceType === "commonjs" ? "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.at(-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 deleted file mode 100644 index 3ea63ca..0000000 --- a/node_modules/eslint/lib/rules/switch-colon-spacing.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @fileoverview Rule to enforce spacing around colons of switch statements. - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Enforce spacing around colons of switch statements", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 4528f09..0000000 --- a/node_modules/eslint/lib/rules/symbol-description.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @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/latest/rules/symbol-description" - }, - fixable: null, - schema: [], - messages: { - expected: "Expected Symbol to have a description." - } - }, - - create(context) { - - const sourceCode = context.sourceCode; - - /** - * 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"(node) { - const scope = sourceCode.getScope(node); - const variable = astUtils.getVariableByName(scope, "Symbol"); - - if (variable && variable.defs.length === 0) { - variable.references.forEach(reference => { - const idNode = reference.identifier; - - if (astUtils.isCallee(idNode)) { - checkArgument(idNode.parent); - } - }); - } - } - }; - - } -}; diff --git a/node_modules/eslint/lib/rules/template-curly-spacing.js b/node_modules/eslint/lib/rules/template-curly-spacing.js deleted file mode 100644 index 1f8cc34..0000000 --- a/node_modules/eslint/lib/rules/template-curly-spacing.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * @fileoverview Rule to enforce spacing around embedded expressions of template strings - * @author Toru Nagashima - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow spacing around embedded expressions of template strings", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - 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 deleted file mode 100644 index 52e0bcf..0000000 --- a/node_modules/eslint/lib/rules/template-tag-spacing.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @fileoverview Rule to check spacing between template tags and their literals - * @author Jonathan Wilsson - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow spacing between template tags and their literals", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 15c7ad7..0000000 --- a/node_modules/eslint/lib/rules/unicode-bom.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @fileoverview Require or disallow Unicode BOM - * @author Andrew Johnston - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "layout", - - defaultOptions: ["never"], - - docs: { - description: "Require or disallow Unicode byte order mark (BOM)", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode, - location = { column: 0, line: 1 }; - const [requireBOM] = context.options; - - 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 deleted file mode 100644 index 046b912..0000000 --- a/node_modules/eslint/lib/rules/use-isnan.js +++ /dev/null @@ -1,237 +0,0 @@ -/** - * @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) { - if (!node) { - return false; - } - - const nodeToCheck = node.type === "SequenceExpression" - ? node.expressions.at(-1) - : node; - - return ( - astUtils.isSpecificId(nodeToCheck, "NaN") || - astUtils.isSpecificMemberAccess(nodeToCheck, "Number", "NaN") - ); -} - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - hasSuggestions: true, - type: "problem", - - docs: { - description: "Require calls to `isNaN()` when checking for `NaN`", - recommended: true, - url: "https://eslint.org/docs/latest/rules/use-isnan" - }, - - schema: [ - { - type: "object", - properties: { - enforceForSwitchCase: { - type: "boolean" - }, - enforceForIndexOf: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - defaultOptions: [{ - enforceForIndexOf: false, - enforceForSwitchCase: true - }], - - 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.", - replaceWithIsNaN: "Replace with Number.isNaN.", - replaceWithCastingAndIsNaN: "Replace with Number.isNaN and cast to a Number.", - replaceWithFindIndex: "Replace with Array.prototype.{{ methodName }}." - } - }, - - create(context) { - - const [{ enforceForIndexOf, enforceForSwitchCase }] = context.options; - const sourceCode = context.sourceCode; - - const fixableOperators = new Set(["==", "===", "!=", "!=="]); - const castableOperators = new Set(["==", "!="]); - - /** - * Get a fixer for a binary expression that compares to NaN. - * @param {ASTNode} node The node to fix. - * @param {function(string): string} wrapValue A function that wraps the compared value with a fix. - * @returns {function(Fixer): Fix} The fixer function. - */ - function getBinaryExpressionFixer(node, wrapValue) { - return fixer => { - const comparedValue = isNaNIdentifier(node.left) ? node.right : node.left; - const shouldWrap = comparedValue.type === "SequenceExpression"; - const shouldNegate = node.operator[0] === "!"; - - const negation = shouldNegate ? "!" : ""; - let comparedValueText = sourceCode.getText(comparedValue); - - if (shouldWrap) { - comparedValueText = `(${comparedValueText})`; - } - - const fixedValue = wrapValue(comparedValueText); - - return fixer.replaceText(node, `${negation}${fixedValue}`); - }; - } - - /** - * 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)) - ) { - const suggestedFixes = []; - const NaNNode = isNaNIdentifier(node.left) ? node.left : node.right; - - const isSequenceExpression = NaNNode.type === "SequenceExpression"; - const isSuggestable = fixableOperators.has(node.operator) && !isSequenceExpression; - const isCastable = castableOperators.has(node.operator); - - if (isSuggestable) { - suggestedFixes.push({ - messageId: "replaceWithIsNaN", - fix: getBinaryExpressionFixer(node, value => `Number.isNaN(${value})`) - }); - - if (isCastable) { - suggestedFixes.push({ - messageId: "replaceWithCastingAndIsNaN", - fix: getBinaryExpressionFixer(node, value => `Number.isNaN(Number(${value}))`) - }); - } - } - - context.report({ - node, - messageId: "comparisonWithNaN", - suggest: suggestedFixes - }); - } - } - - /** - * 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 <= 2 && - isNaNIdentifier(node.arguments[0]) - ) { - - /* - * To retain side effects, it's essential to address `NaN` beforehand, which - * is not possible with fixes like `arr.findIndex(Number.isNaN)`. - */ - const isSuggestable = node.arguments[0].type !== "SequenceExpression" && !node.arguments[1]; - const suggestedFixes = []; - - if (isSuggestable) { - const shouldWrap = callee.computed; - const findIndexMethod = methodName === "indexOf" ? "findIndex" : "findLastIndex"; - const propertyName = shouldWrap ? `"${findIndexMethod}"` : findIndexMethod; - - suggestedFixes.push({ - messageId: "replaceWithFindIndex", - data: { methodName: findIndexMethod }, - fix: fixer => [ - fixer.replaceText(callee.property, propertyName), - fixer.replaceText(node.arguments[0], "Number.isNaN") - ] - }); - } - - context.report({ - node, - messageId: "indexOfNaN", - data: { methodName }, - suggest: suggestedFixes - }); - } - } - } - - 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 deleted file mode 100644 index 7a93da1..0000000 --- a/node_modules/eslint/lib/rules/utils/ast-utils.js +++ /dev/null @@ -1,2476 +0,0 @@ -/** - * @fileoverview Common utils for AST. - * @author Gyandeep Singh - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { KEYS: eslintVisitorKeys } = require("eslint-visitor-keys"); -const esutils = require("esutils"); -const espree = require("espree"); -const escapeRegExp = require("escape-string-regexp"); -const { - breakableTypePattern, - createGlobalLinebreakMatcher, - lineBreakPattern, - shebangPattern -} = require("../../shared/ast-utils"); -const globals = require("../../../conf/globals"); -const { LATEST_ECMA_VERSION } = require("../../../conf/ecma-version"); - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u; -const anyLoopPattern = /^(?:DoWhile|For|ForIn|ForOf|While)Statement$/u; -const arrayMethodWithThisArgPattern = /^(?:every|filter|find(?:Last)?(?:Index)?|flatMap|forEach|map|some)$/u; -const arrayOrTypedArrayPattern = /Array$/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(["&&=", "||=", "??="]); - -/** - * All builtin global variables defined in the latest ECMAScript specification. - * @type {Record} Key is the name of the variable. Value is `true` if the variable is considered writable, `false` otherwise. - */ -const ECMASCRIPT_GLOBALS = globals[`es${LATEST_ECMA_VERSION}`]; - -/** - * 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 expects a function as a first argument, and `thisArg` as a second argument. - * @param {ASTNode} node A node to check. - * @returns {boolean} Whether or not the node is a method which expects a function as a first argument, and `thisArg` as a second argument. - */ -function isMethodWhichHasThisArg(node) { - return isSpecificMemberAccess(node, null, arrayMethodWithThisArgPattern); -} - -/** - * 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.at(-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; -} - -/** - * Checks whether a node is an ExpressionStatement at the top level of a file or function body. - * A top-level ExpressionStatement node is a directive if it contains a single unparenthesized - * string literal and if it occurs either as the first sibling or immediately after another - * directive. - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether or not the node is an ExpressionStatement at the top level of a - * file or function body. - */ -function isTopLevelExpressionStatement(node) { - if (node.type !== "ExpressionStatement") { - return false; - } - const parent = node.parent; - - return parent.type === "Program" || (parent.type === "BlockStatement" && isFunction(parent.parent)); - -} - -/** - * Check whether the given node is a part of a directive prologue or not. - * @param {ASTNode} node The node to check. - * @returns {boolean} `true` if the node is a part of directive prologue. - */ -function isDirective(node) { - return node.type === "ExpressionStatement" && typeof node.directive === "string"; -} - -/** - * Tests if a node appears at the beginning of an ancestor ExpressionStatement node. - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether the node appears at the beginning of an ancestor ExpressionStatement node. - */ -function isStartOfExpressionStatement(node) { - const start = node.range[0]; - let ancestor = node; - - while ((ancestor = ancestor.parent) && ancestor.range[0] === start) { - if (ancestor.type === "ExpressionStatement") { - return true; - } - } - return false; -} - -/** - * Determines whether an opening parenthesis `(`, bracket `[` or backtick ``` ` ``` needs to be preceded by a semicolon. - * This opening parenthesis or bracket should be at the start of an `ExpressionStatement`, a `MethodDefinition` or at - * the start of the body of an `ArrowFunctionExpression`. - * @type {(sourceCode: SourceCode, node: ASTNode) => boolean} - * @param {SourceCode} sourceCode The source code object. - * @param {ASTNode} node A node at the position where an opening parenthesis or bracket will be inserted. - * @returns {boolean} Whether a semicolon is required before the opening parenthesis or bracket. - */ -let needsPrecedingSemicolon; - -{ - const BREAK_OR_CONTINUE = new Set(["BreakStatement", "ContinueStatement"]); - - // Declaration types that cannot be continued by a punctuator when ending with a string Literal that is a direct child. - const DECLARATIONS = new Set(["ExportAllDeclaration", "ExportNamedDeclaration", "ImportDeclaration"]); - - const IDENTIFIER_OR_KEYWORD = new Set(["Identifier", "Keyword"]); - - // Keywords that can immediately precede an ExpressionStatement node, mapped to the their node types. - const NODE_TYPES_BY_KEYWORD = { - __proto__: null, - break: "BreakStatement", - continue: "ContinueStatement", - debugger: "DebuggerStatement", - do: "DoWhileStatement", - else: "IfStatement", - return: "ReturnStatement", - yield: "YieldExpression" - }; - - /* - * Before an opening parenthesis, postfix `++` and `--` always trigger ASI; - * the tokens `:`, `;`, `{` and `=>` don't expect a semicolon, as that would count as an empty statement. - */ - const PUNCTUATORS = new Set([":", ";", "{", "=>", "++", "--"]); - - /* - * Statements that can contain an `ExpressionStatement` after a closing parenthesis. - * DoWhileStatement is an exception in that it always triggers ASI after the closing parenthesis. - */ - const STATEMENTS = new Set([ - "DoWhileStatement", - "ForInStatement", - "ForOfStatement", - "ForStatement", - "IfStatement", - "WhileStatement", - "WithStatement" - ]); - - needsPrecedingSemicolon = - function(sourceCode, node) { - const prevToken = sourceCode.getTokenBefore(node); - - if (!prevToken || prevToken.type === "Punctuator" && PUNCTUATORS.has(prevToken.value)) { - return false; - } - - const prevNode = sourceCode.getNodeByRangeIndex(prevToken.range[0]); - - if (isClosingParenToken(prevToken)) { - return !STATEMENTS.has(prevNode.type); - } - - if (isClosingBraceToken(prevToken)) { - return ( - prevNode.type === "BlockStatement" && prevNode.parent.type === "FunctionExpression" && prevNode.parent.parent.type !== "MethodDefinition" || - prevNode.type === "ClassBody" && prevNode.parent.type === "ClassExpression" || - prevNode.type === "ObjectExpression" - ); - } - - if (IDENTIFIER_OR_KEYWORD.has(prevToken.type)) { - if (BREAK_OR_CONTINUE.has(prevNode.parent.type)) { - return false; - } - - const keyword = prevToken.value; - const nodeType = NODE_TYPES_BY_KEYWORD[keyword]; - - return prevNode.type !== nodeType; - } - - if (prevToken.type === "String") { - return !DECLARATIONS.has(prevNode.parent.type); - } - - return true; - }; -} - -/** - * Checks if a node is used as an import attribute key, either in a static or dynamic import. - * @param {ASTNode} node The node to check. - * @returns {boolean} Whether the node is used as an import attribute key. - */ -function isImportAttributeKey(node) { - const { parent } = node; - - // static import/re-export - if (parent.type === "ImportAttribute" && parent.key === node) { - return true; - } - - // dynamic import - if ( - parent.type === "Property" && - !parent.computed && - (parent.key === node || parent.value === node && parent.shorthand && !parent.method) && - parent.parent.type === "ObjectExpression" - ) { - const objectExpression = parent.parent; - const objectExpressionParent = objectExpression.parent; - - if ( - objectExpressionParent.type === "ImportExpression" && - objectExpressionParent.options === objectExpression - ) { - return true; - } - - // nested key - if ( - objectExpressionParent.type === "Property" && - objectExpressionParent.value === objectExpression - ) { - return isImportAttributeKey(objectExpressionParent.key); - } - } - - return false; -} - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -module.exports = { - COMMENTS_IGNORE_PATTERN, - LINEBREAKS, - LINEBREAK_MATCHER: lineBreakPattern, - SHEBANG_MATCHER: shebangPattern, - STATEMENT_LIST_PARENTS, - ECMASCRIPT_GLOBALS, - - /** - * 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.at(-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; - } - } - - /* c8 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: - if (node.type in eslintVisitorKeys) { - return 20; - } - - /* - * if the node is not a standard node that we know about, then assume it has the lowest precedence - * this will mean that rules will wrap unknown nodes in parentheses where applicable instead of - * unwrapping them and potentially changing the meaning of the code or introducing a syntax error. - */ - return -1; - } - }, - - /** - * 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; - let end; - - 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.at(-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.at(-1); - if (comments.length) { - const lastComment = comments.at(-1); - - if (!leftToken || lastComment.range[0] > leftToken.range[0]) { - leftToken = lastComment; - } - } - } else { - leftToken = leftValue; - } - - /* - * If a hashbang comment was passed as a token object from SourceCode, - * its type will be "Shebang" because of the way ESLint itself handles hashbangs. - * If a hashbang comment was passed in a string and then tokenized in this function, - * its type will be "Hashbang" because of the way Espree tokenizes hashbangs. - */ - if (leftToken.type === "Shebang" || leftToken.type === "Hashbang") { - 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 (!rightToken || 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); - }, - - /** - * 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. - */ - isStaticTemplateLiteral(node) { - return node.type === "TemplateLiteral" && node.expressions.length === 0; - }, - - /** - * 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. - * @param {SourceCode} sourceCode The source code - * @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. - */ - areBracesNecessary(node, sourceCode) { - - /** - * Determines if the given node is a lexical declaration (let, const, function, or class) - * @param {ASTNode} nodeToCheck The node to check - * @returns {boolean} True if the node is a lexical declaration - * @private - */ - function isLexicalDeclaration(nodeToCheck) { - if (nodeToCheck.type === "VariableDeclaration") { - return nodeToCheck.kind === "const" || nodeToCheck.kind === "let"; - } - - return nodeToCheck.type === "FunctionDeclaration" || nodeToCheck.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} nodeToCheck The node to check. - * @returns {boolean} `true` if the node is followed by an `else` keyword token. - */ - function isFollowedByElseKeyword(nodeToCheck) { - const nextToken = sourceCode.getTokenAfter(nodeToCheck); - - return Boolean(nextToken) && isElseKeywordToken(nextToken); - } - - /** - * 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} nodeToCheck 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(nodeToCheck) { - switch (nodeToCheck.type) { - case "IfStatement": - if (!nodeToCheck.alternate) { - return true; - } - return hasUnsafeIf(nodeToCheck.alternate); - case "ForStatement": - case "ForInStatement": - case "ForOfStatement": - case "LabeledStatement": - case "WithStatement": - case "WhileStatement": - return hasUnsafeIf(nodeToCheck.body); - default: - return false; - } - } - - const statement = node.body[0]; - - return isLexicalDeclaration(statement) || - hasUnsafeIf(statement) && isFollowedByElseKeyword(node); - }, - - isReferenceToGlobalVariable, - isLogicalExpression, - isCoalesceExpression, - isMixedLogicalAndCoalesceExpressions, - isNullLiteral, - getStaticStringValue, - getStaticPropertyName, - skipChainExpression, - isSpecificId, - isSpecificMemberAccess, - equalLiteralValue, - isSameReference, - isLogicalAssignmentOperator, - getSwitchCaseColonToken, - getModuleExportName, - isConstant, - isTopLevelExpressionStatement, - isDirective, - isStartOfExpressionStatement, - needsPrecedingSemicolon, - isImportAttributeKey -}; diff --git a/node_modules/eslint/lib/rules/utils/char-source.js b/node_modules/eslint/lib/rules/utils/char-source.js deleted file mode 100644 index 7073862..0000000 --- a/node_modules/eslint/lib/rules/utils/char-source.js +++ /dev/null @@ -1,240 +0,0 @@ -/** - * @fileoverview Utility functions to locate the source text of each code unit in the value of a string literal or template token. - * @author Francesco Trotta - */ - -"use strict"; - -/** - * Represents a code unit produced by the evaluation of a JavaScript common token like a string - * literal or template token. - */ -class CodeUnit { - constructor(start, source) { - this.start = start; - this.source = source; - } - - get end() { - return this.start + this.length; - } - - get length() { - return this.source.length; - } -} - -/** - * An object used to keep track of the position in a source text where the next characters will be read. - */ -class TextReader { - constructor(source) { - this.source = source; - this.pos = 0; - } - - /** - * Advances the reading position of the specified number of characters. - * @param {number} length Number of characters to advance. - * @returns {void} - */ - advance(length) { - this.pos += length; - } - - /** - * Reads characters from the source. - * @param {number} [offset=0] The offset where reading starts, relative to the current position. - * @param {number} [length=1] Number of characters to read. - * @returns {string} A substring of source characters. - */ - read(offset = 0, length = 1) { - const start = offset + this.pos; - - return this.source.slice(start, start + length); - } -} - -const SIMPLE_ESCAPE_SEQUENCES = -{ __proto__: null, b: "\b", f: "\f", n: "\n", r: "\r", t: "\t", v: "\v" }; - -/** - * Reads a hex escape sequence. - * @param {TextReader} reader The reader should be positioned on the first hexadecimal digit. - * @param {number} length The number of hexadecimal digits. - * @returns {string} A code unit. - */ -function readHexSequence(reader, length) { - const str = reader.read(0, length); - const charCode = parseInt(str, 16); - - reader.advance(length); - return String.fromCharCode(charCode); -} - -/** - * Reads a Unicode escape sequence. - * @param {TextReader} reader The reader should be positioned after the "u". - * @returns {string} A code unit. - */ -function readUnicodeSequence(reader) { - const regExp = /\{(?[\dA-Fa-f]+)\}/uy; - - regExp.lastIndex = reader.pos; - const match = regExp.exec(reader.source); - - if (match) { - const codePoint = parseInt(match.groups.hexDigits, 16); - - reader.pos = regExp.lastIndex; - return String.fromCodePoint(codePoint); - } - return readHexSequence(reader, 4); -} - -/** - * Reads an octal escape sequence. - * @param {TextReader} reader The reader should be positioned after the first octal digit. - * @param {number} maxLength The maximum number of octal digits. - * @returns {string} A code unit. - */ -function readOctalSequence(reader, maxLength) { - const [octalStr] = reader.read(-1, maxLength).match(/^[0-7]+/u); - - reader.advance(octalStr.length - 1); - const octal = parseInt(octalStr, 8); - - return String.fromCharCode(octal); -} - -/** - * Reads an escape sequence or line continuation. - * @param {TextReader} reader The reader should be positioned on the backslash. - * @returns {string} A string of zero, one or two code units. - */ -function readEscapeSequenceOrLineContinuation(reader) { - const char = reader.read(1); - - reader.advance(2); - const unitChar = SIMPLE_ESCAPE_SEQUENCES[char]; - - if (unitChar) { - return unitChar; - } - switch (char) { - case "x": - return readHexSequence(reader, 2); - case "u": - return readUnicodeSequence(reader); - case "\r": - if (reader.read() === "\n") { - reader.advance(1); - } - - // fallthrough - case "\n": - case "\u2028": - case "\u2029": - return ""; - case "0": - case "1": - case "2": - case "3": - return readOctalSequence(reader, 3); - case "4": - case "5": - case "6": - case "7": - return readOctalSequence(reader, 2); - default: - return char; - } -} - -/** - * Reads an escape sequence or line continuation and generates the respective `CodeUnit` elements. - * @param {TextReader} reader The reader should be positioned on the backslash. - * @returns {Generator} Zero, one or two `CodeUnit` elements. - */ -function *mapEscapeSequenceOrLineContinuation(reader) { - const start = reader.pos; - const str = readEscapeSequenceOrLineContinuation(reader); - const end = reader.pos; - const source = reader.source.slice(start, end); - - switch (str.length) { - case 0: - break; - case 1: - yield new CodeUnit(start, source); - break; - default: - yield new CodeUnit(start, source); - yield new CodeUnit(start, source); - break; - } -} - -/** - * Parses a string literal. - * @param {string} source The string literal to parse, including the delimiting quotes. - * @returns {CodeUnit[]} A list of code units produced by the string literal. - */ -function parseStringLiteral(source) { - const reader = new TextReader(source); - const quote = reader.read(); - - reader.advance(1); - const codeUnits = []; - - for (;;) { - const char = reader.read(); - - if (char === quote) { - break; - } - if (char === "\\") { - codeUnits.push(...mapEscapeSequenceOrLineContinuation(reader)); - } else { - codeUnits.push(new CodeUnit(reader.pos, char)); - reader.advance(1); - } - } - return codeUnits; -} - -/** - * Parses a template token. - * @param {string} source The template token to parse, including the delimiting sequences `` ` ``, `${` and `}`. - * @returns {CodeUnit[]} A list of code units produced by the template token. - */ -function parseTemplateToken(source) { - const reader = new TextReader(source); - - reader.advance(1); - const codeUnits = []; - - for (;;) { - const char = reader.read(); - - if (char === "`" || char === "$" && reader.read(1) === "{") { - break; - } - if (char === "\\") { - codeUnits.push(...mapEscapeSequenceOrLineContinuation(reader)); - } else { - let unitSource; - - if (char === "\r" && reader.read(1) === "\n") { - unitSource = "\r\n"; - } else { - unitSource = char; - } - codeUnits.push(new CodeUnit(reader.pos, unitSource)); - reader.advance(unitSource.length); - } - } - return codeUnits; -} - -module.exports = { parseStringLiteral, parseTemplateToken }; diff --git a/node_modules/eslint/lib/rules/utils/fix-tracker.js b/node_modules/eslint/lib/rules/utils/fix-tracker.js deleted file mode 100644 index 589870b..0000000 --- a/node_modules/eslint/lib/rules/utils/fix-tracker.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * @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 deleted file mode 100644 index 3fbb777..0000000 --- a/node_modules/eslint/lib/rules/utils/keywords.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @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 deleted file mode 100644 index 3fa5d83..0000000 --- a/node_modules/eslint/lib/rules/utils/lazy-loading-rule-map.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @fileoverview `Map` to load rules lazily. - * @author Toru Nagashima - */ -"use strict"; - -const debug = require("debug")("eslint:rules"); - -/** @typedef {import("../../shared/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/regular-expressions.js b/node_modules/eslint/lib/rules/utils/regular-expressions.js deleted file mode 100644 index 82fdd9b..0000000 --- a/node_modules/eslint/lib/rules/utils/regular-expressions.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @fileoverview Common utils for regular expressions. - * @author Josh Goldberg - * @author Toru Nagashima - */ - -"use strict"; - -const { RegExpValidator } = require("@eslint-community/regexpp"); - -const REGEXPP_LATEST_ECMA_VERSION = 2025; - -/** - * Checks if the given regular expression pattern would be valid with the `u` flag. - * @param {number} ecmaVersion ECMAScript version to parse in. - * @param {string} pattern The regular expression pattern to verify. - * @param {"u"|"v"} flag The type of Unicode flag - * @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(ecmaVersion, pattern, flag = "u") { - if (flag === "u" && ecmaVersion <= 5) { // ecmaVersion <= 5 doesn't support the 'u' flag - return false; - } - if (flag === "v" && ecmaVersion <= 2023) { - return false; - } - - const validator = new RegExpValidator({ - ecmaVersion: Math.min(ecmaVersion, REGEXPP_LATEST_ECMA_VERSION) - }); - - try { - validator.validatePattern(pattern, void 0, void 0, flag === "u" ? { - unicode: /* uFlag = */ true - } : { - unicodeSets: true - }); - } catch { - return false; - } - - return true; -} - -module.exports = { - isValidWithUnicodeFlag, - REGEXPP_LATEST_ECMA_VERSION -}; diff --git a/node_modules/eslint/lib/rules/utils/unicode/index.js b/node_modules/eslint/lib/rules/utils/unicode/index.js deleted file mode 100644 index d35d812..0000000 --- a/node_modules/eslint/lib/rules/utils/unicode/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @author Toru Nagashima - */ -"use strict"; - -const isCombiningCharacter = require("./is-combining-character"); -const isEmojiModifier = require("./is-emoji-modifier"); -const isRegionalIndicatorSymbol = require("./is-regional-indicator-symbol"); -const isSurrogatePair = require("./is-surrogate-pair"); - -module.exports = { - isCombiningCharacter, - isEmojiModifier, - isRegionalIndicatorSymbol, - isSurrogatePair -}; 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 deleted file mode 100644 index 0498b99..0000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-combining-character.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @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 deleted file mode 100644 index 1bd5f55..0000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-emoji-modifier.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @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 deleted file mode 100644 index c48ed46..0000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-regional-indicator-symbol.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @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 deleted file mode 100644 index b8e5c1c..0000000 --- a/node_modules/eslint/lib/rules/utils/unicode/is-surrogate-pair.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @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-typeof.js b/node_modules/eslint/lib/rules/valid-typeof.js deleted file mode 100644 index eff4d94..0000000 --- a/node_modules/eslint/lib/rules/valid-typeof.js +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @fileoverview Ensures that the results of typeof are compared against a valid string - * @author Ian Christian Myers - */ -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - type: "problem", - - defaultOptions: [{ - requireStringLiterals: false - }], - - docs: { - description: "Enforce comparing `typeof` expressions against valid strings", - recommended: true, - url: "https://eslint.org/docs/latest/rules/valid-typeof" - }, - - hasSuggestions: true, - - schema: [ - { - type: "object", - properties: { - requireStringLiterals: { - type: "boolean" - } - }, - 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 sourceCode = context.sourceCode; - const [{ requireStringLiterals }] = context.options; - - 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(node) { - globalScope = sourceCode.getScope(node); - }, - - UnaryExpression(node) { - if (isTypeofExpression(node)) { - const { parent } = node; - - if (parent.type === "BinaryExpression" && OPERATORS.has(parent.operator)) { - const sibling = parent.left === node ? parent.right : parent.left; - - if (sibling.type === "Literal" || astUtils.isStaticTemplateLiteral(sibling)) { - 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 deleted file mode 100644 index 81f5d62..0000000 --- a/node_modules/eslint/lib/rules/vars-on-top.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * @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/latest/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 deleted file mode 100644 index 5180710..0000000 --- a/node_modules/eslint/lib/rules/wrap-iife.js +++ /dev/null @@ -1,207 +0,0 @@ -/** - * @fileoverview Rule to flag when IIFE is not wrapped in parens - * @author Ilya Volodin - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const astUtils = require("./utils/ast-utils"); -const eslintUtils = require("@eslint-community/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: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require parentheses around immediate `function` invocations", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - /** - * 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 deleted file mode 100644 index 9e2808d..0000000 --- a/node_modules/eslint/lib/rules/wrap-regex.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @fileoverview Rule to flag when regex literals are not wrapped in parens - * @author Matt DuVall - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require parenthesis around regex literals", - recommended: false, - url: "https://eslint.org/docs/latest/rules/wrap-regex" - }, - - schema: [], - fixable: "code", - - messages: { - requireParens: "Wrap the regexp literal in parens to disambiguate the slash." - } - }, - - create(context) { - const sourceCode = context.sourceCode; - - 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 { parent } = node; - - if (parent.type === "MemberExpression" && parent.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 deleted file mode 100644 index 5cf3804..0000000 --- a/node_modules/eslint/lib/rules/yield-star-spacing.js +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @fileoverview Rule to check the spacing around the * in yield* expressions. - * @author Bryan Smith - * @deprecated in ESLint v8.53.0 - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Rule Definition -//------------------------------------------------------------------------------ - -/** @type {import('../shared/types').Rule} */ -module.exports = { - meta: { - deprecated: true, - replacedBy: [], - type: "layout", - - docs: { - description: "Require or disallow spacing around the `*` in `yield*` expressions", - recommended: false, - url: "https://eslint.org/docs/latest/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.sourceCode; - - 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 deleted file mode 100644 index af73e8e..0000000 --- a/node_modules/eslint/lib/rules/yoda.js +++ /dev/null @@ -1,350 +0,0 @@ -/** - * @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 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) || astUtils.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 (astUtils.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", - - defaultOptions: ["never", { - exceptRange: false, - onlyEquality: false - }], - - docs: { - description: 'Require or disallow "Yoda" conditions', - recommended: false, - url: "https://eslint.org/docs/latest/rules/yoda" - }, - - schema: [ - { - enum: ["always", "never"] - }, - { - type: "object", - properties: { - exceptRange: { - type: "boolean" - }, - onlyEquality: { - type: "boolean" - } - }, - additionalProperties: false - } - ], - - fixable: "code", - messages: { - expected: - "Expected literal to be on the {{expectedSide}} side of {{operator}}." - } - }, - - create(context) { - const [when, { exceptRange, onlyEquality }] = context.options; - const always = when === "always"; - const sourceCode = context.sourceCode; - - /** - * 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(node.parent)) - ) { - 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/services/parser-service.js b/node_modules/eslint/lib/services/parser-service.js deleted file mode 100644 index c138b83..0000000 --- a/node_modules/eslint/lib/services/parser-service.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @fileoverview ESLint Parser - * @author Nicholas C. Zakas - */ -/* eslint class-methods-use-this: off -- Anticipate future constructor arguments. */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef {import("../linter/vfile.js").VFile} VFile */ -/** @typedef {import("@eslint/core").Language} Language */ -/** @typedef {import("@eslint/core").LanguageOptions} LanguageOptions */ - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * The parser for ESLint. - */ -class ParserService { - - /** - * Parses the given file synchronously. - * @param {VFile} file The file to parse. - * @param {{language:Language,languageOptions:LanguageOptions}} config The configuration to use. - * @returns {Object} An object with the parsed source code or errors. - * @throws {Error} If the parser returns a promise. - */ - parseSync(file, config) { - - const { language, languageOptions } = config; - const result = language.parse(file, { languageOptions }); - - if (typeof result.then === "function") { - throw new Error("Unsupported: Language parser returned a promise."); - } - - if (result.ok) { - return { - ok: true, - sourceCode: language.createSourceCode(file, result, { languageOptions }) - }; - } - - // if we made it to here there was an error - return { - ok: false, - errors: result.errors.map(error => ({ - ruleId: null, - nodeType: null, - fatal: true, - severity: 2, - message: `Parsing error: ${error.message}`, - line: error.line, - column: error.column - })) - }; - } -} - -module.exports = { ParserService }; diff --git a/node_modules/eslint/lib/services/processor-service.js b/node_modules/eslint/lib/services/processor-service.js deleted file mode 100644 index 403b97c..0000000 --- a/node_modules/eslint/lib/services/processor-service.js +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @fileoverview ESLint Processor Service - * @author Nicholas C. Zakas - */ -/* eslint class-methods-use-this: off -- Anticipate future constructor arguments. */ - -"use strict"; - -//----------------------------------------------------------------------------- -// Requirements -//----------------------------------------------------------------------------- - -const path = require("node:path"); -const { VFile } = require("../linter/vfile.js"); - -//----------------------------------------------------------------------------- -// Types -//----------------------------------------------------------------------------- - -/** @typedef {import("../shared/types.js").LintMessage} LintMessage */ -/** @typedef {import("../linter/vfile.js").VFile} VFile */ -/** @typedef {import("@eslint/core").Language} Language */ -/** @typedef {import("@eslint/core").LanguageOptions} LanguageOptions */ -/** @typedef {import("eslint").Linter.Processor} Processor */ - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -/** - * The service that applies processors to files. - */ -class ProcessorService { - - /** - * Preprocesses the given file synchronously. - * @param {VFile} file The file to preprocess. - * @param {{processor:Processor}} config The configuration to use. - * @returns {{ok:boolean, files?: Array, errors?: Array}} An array of preprocessed files or errors. - * @throws {Error} If the preprocessor returns a promise. - */ - preprocessSync(file, config) { - - const { processor } = config; - let blocks; - - try { - blocks = processor.preprocess(file.rawBody, file.path); - } catch (ex) { - - // If the message includes a leading line number, strip it: - const message = `Preprocessing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; - - return { - ok: false, - errors: [ - { - ruleId: null, - fatal: true, - severity: 2, - message, - line: ex.lineNumber, - column: ex.column, - nodeType: null - } - ] - }; - } - - if (typeof blocks.then === "function") { - throw new Error("Unsupported: Preprocessor returned a promise."); - } - - return { - ok: true, - files: blocks.map((block, i) => { - - // Legacy behavior: return the block as a string - if (typeof block === "string") { - return block; - } - - const filePath = path.join(file.path, `${i}_${block.filename}`); - - return new VFile(filePath, block.text, { - physicalPath: file.physicalPath - }); - }) - }; - - } - - /** - * Postprocesses the given messages synchronously. - * @param {VFile} file The file to postprocess. - * @param {LintMessage[][]} messages The messages to postprocess. - * @param {{processor:Processor}} config The configuration to use. - * @returns {LintMessage[]} The postprocessed messages. - */ - postprocessSync(file, messages, config) { - - const { processor } = config; - - return processor.postprocess(messages, file.path); - } - -} - -module.exports = { ProcessorService }; diff --git a/node_modules/eslint/lib/shared/ajv.js b/node_modules/eslint/lib/shared/ajv.js deleted file mode 100644 index f4f6a62..0000000 --- a/node_modules/eslint/lib/shared/ajv.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @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/assert.js b/node_modules/eslint/lib/shared/assert.js deleted file mode 100644 index 00bbe07..0000000 --- a/node_modules/eslint/lib/shared/assert.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @fileoverview Assertion utilities equivalent to the Node.js node:asserts module. - * @author Josh Goldberg - */ - -"use strict"; - -/** - * Throws an error if the input is not truthy. - * @param {unknown} value The input that is checked for being truthy. - * @param {string} message Message to throw if the input is not truthy. - * @returns {void} - * @throws {Error} When the condition is not truthy. - */ -function ok(value, message = "Assertion failed.") { - if (!value) { - throw new Error(message); - } -} - - -module.exports = ok; diff --git a/node_modules/eslint/lib/shared/ast-utils.js b/node_modules/eslint/lib/shared/ast-utils.js deleted file mode 100644 index 4ebd49c..0000000 --- a/node_modules/eslint/lib/shared/ast-utils.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @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/deep-merge-arrays.js b/node_modules/eslint/lib/shared/deep-merge-arrays.js deleted file mode 100644 index d34149d..0000000 --- a/node_modules/eslint/lib/shared/deep-merge-arrays.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @fileoverview Applies default rule options - * @author JoshuaKGoldberg - */ - -"use strict"; - -/** - * Check if the variable contains an object strictly rejecting arrays - * @param {unknown} value an object - * @returns {boolean} Whether value is an object - */ -function isObjectNotArray(value) { - return typeof value === "object" && value !== null && !Array.isArray(value); -} - -/** - * Deeply merges second on top of first, creating a new {} object if needed. - * @param {T} first Base, default value. - * @param {U} second User-specified value. - * @returns {T | U | (T & U)} Merged equivalent of second on top of first. - */ -function deepMergeObjects(first, second) { - if (second === void 0) { - return first; - } - - if (!isObjectNotArray(first) || !isObjectNotArray(second)) { - return second; - } - - const result = { ...first, ...second }; - - for (const key of Object.keys(second)) { - if (Object.prototype.propertyIsEnumerable.call(first, key)) { - result[key] = deepMergeObjects(first[key], second[key]); - } - } - - return result; -} - -/** - * Deeply merges second on top of first, creating a new [] array if needed. - * @param {T[]} first Base, default values. - * @param {U[]} second User-specified values. - * @returns {(T | U | (T & U))[]} Merged equivalent of second on top of first. - */ -function deepMergeArrays(first, second) { - if (!first || !second) { - return second || first || []; - } - - return [ - ...first.map((value, i) => deepMergeObjects(value, i < second.length ? second[i] : void 0)), - ...second.slice(first.length) - ]; -} - -module.exports = { deepMergeArrays }; diff --git a/node_modules/eslint/lib/shared/directives.js b/node_modules/eslint/lib/shared/directives.js deleted file mode 100644 index ff67b00..0000000 --- a/node_modules/eslint/lib/shared/directives.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @fileoverview Common utils for directives. - * - * This file contains only shared items for directives. - * If you make a utility for rules, please see `../rules/utils/ast-utils.js`. - * - * @author gfyoung - */ -"use strict"; - -const directivesPattern = /^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u; - -module.exports = { - directivesPattern -}; diff --git a/node_modules/eslint/lib/shared/flags.js b/node_modules/eslint/lib/shared/flags.js deleted file mode 100644 index 464835b..0000000 --- a/node_modules/eslint/lib/shared/flags.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @fileoverview Shared flags for ESLint. - */ - -"use strict"; - -/** - * The set of flags that change ESLint behavior with a description. - * @type {Map} - */ -const activeFlags = new Map([ - ["test_only", "Used only for testing."], - ["unstable_config_lookup_from_file", "Look up eslint.config.js from the file being linted."], - ["unstable_ts_config", "Enable TypeScript configuration files."] -]); - -/** - * The set of flags that used to be active but no longer have an effect. - * @type {Map} - */ -const inactiveFlags = new Map([ - ["test_only_old", "Used only for testing."] -]); - -module.exports = { - activeFlags, - inactiveFlags -}; diff --git a/node_modules/eslint/lib/shared/logging.js b/node_modules/eslint/lib/shared/logging.js deleted file mode 100644 index 9310e58..0000000 --- a/node_modules/eslint/lib/shared/logging.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @fileoverview Handle logging for ESLint - * @author Gyandeep Singh - */ - -"use strict"; - -/* eslint no-console: "off" -- Logging util */ - -/* c8 ignore next */ -module.exports = { - - /** - * Cover for console.info - * @param {...any} args The elements to log. - * @returns {void} - */ - info(...args) { - console.log(...args); - }, - - /** - * Cover for console.warn - * @param {...any} args The elements to log. - * @returns {void} - */ - warn(...args) { - console.warn(...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/runtime-info.js b/node_modules/eslint/lib/shared/runtime-info.js deleted file mode 100644 index 29de6fc..0000000 --- a/node_modules/eslint/lib/shared/runtime-info.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * @fileoverview Utility to get information about the execution environment. - * @author Kai Cataldo - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const path = require("node:path"); -const spawn = require("cross-spawn"); -const os = require("node: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", pkg]; - - 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 = { - __esModule: true, // Indicate intent for imports, remove ambiguity for Knip (see: https://github.com/eslint/eslint/pull/18005#discussion_r1484422616) - environment, - version -}; diff --git a/node_modules/eslint/lib/shared/serialization.js b/node_modules/eslint/lib/shared/serialization.js deleted file mode 100644 index 69f5710..0000000 --- a/node_modules/eslint/lib/shared/serialization.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @fileoverview Serialization utils. - * @author Bryan Mishkin - */ - -"use strict"; - -/** - * Check if a value is a primitive or plain object created by the Object constructor. - * @param {any} val the value to check - * @returns {boolean} true if so - * @private - */ -function isSerializablePrimitiveOrPlainObject(val) { - return ( - val === null || - typeof val === "string" || - typeof val === "boolean" || - typeof val === "number" || - (typeof val === "object" && val.constructor === Object) || - Array.isArray(val) - ); -} - -/** - * Check if a value is serializable. - * Functions or objects like RegExp cannot be serialized by JSON.stringify(). - * Inspired by: https://stackoverflow.com/questions/30579940/reliable-way-to-check-if-objects-is-serializable-in-javascript - * @param {any} val the value - * @returns {boolean} true if the value is serializable - */ -function isSerializable(val) { - if (!isSerializablePrimitiveOrPlainObject(val)) { - return false; - } - if (typeof val === "object") { - for (const property in val) { - if (Object.hasOwn(val, property)) { - if (!isSerializablePrimitiveOrPlainObject(val[property])) { - return false; - } - if (typeof val[property] === "object") { - if (!isSerializable(val[property])) { - return false; - } - } - } - } - } - return true; -} - -module.exports = { - isSerializable -}; diff --git a/node_modules/eslint/lib/shared/severity.js b/node_modules/eslint/lib/shared/severity.js deleted file mode 100644 index 6b21469..0000000 --- a/node_modules/eslint/lib/shared/severity.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @fileoverview Helpers for severity values (e.g. normalizing different types). - * @author Bryan Mishkin - */ - -"use strict"; - -/** - * Convert severity value of different types to a string. - * @param {string|number} severity severity value - * @throws error if severity is invalid - * @returns {string} severity string - */ -function normalizeSeverityToString(severity) { - if ([2, "2", "error"].includes(severity)) { - return "error"; - } - if ([1, "1", "warn"].includes(severity)) { - return "warn"; - } - if ([0, "0", "off"].includes(severity)) { - return "off"; - } - throw new Error(`Invalid severity value: ${severity}`); -} - -/** - * Convert severity value of different types to a number. - * @param {string|number} severity severity value - * @throws error if severity is invalid - * @returns {number} severity number - */ -function normalizeSeverityToNumber(severity) { - if ([2, "2", "error"].includes(severity)) { - return 2; - } - if ([1, "1", "warn"].includes(severity)) { - return 1; - } - if ([0, "0", "off"].includes(severity)) { - return 0; - } - throw new Error(`Invalid severity value: ${severity}`); -} - -module.exports = { - normalizeSeverityToString, - normalizeSeverityToNumber -}; diff --git a/node_modules/eslint/lib/shared/stats.js b/node_modules/eslint/lib/shared/stats.js deleted file mode 100644 index c5d4d18..0000000 --- a/node_modules/eslint/lib/shared/stats.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @fileoverview Provides helper functions to start/stop the time measurements - * that are provided by the ESLint 'stats' option. - * @author Mara Kiefer - */ -"use strict"; - -/** - * Start time measurement - * @returns {[number, number]} t variable for tracking time - */ -function startTime() { - return process.hrtime(); -} - -/** - * End time measurement - * @param {[number, number]} t Variable for tracking time - * @returns {number} The measured time in milliseconds - */ -function endTime(t) { - const time = process.hrtime(t); - - return time[0] * 1e3 + time[1] / 1e6; -} - -module.exports = { - startTime, - endTime -}; diff --git a/node_modules/eslint/lib/shared/string-utils.js b/node_modules/eslint/lib/shared/string-utils.js deleted file mode 100644 index 31d0df9..0000000 --- a/node_modules/eslint/lib/shared/string-utils.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @fileoverview Utilities to operate on strings. - * @author Stephen Wade - */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -// eslint-disable-next-line no-control-regex -- intentionally including control characters -const ASCII_REGEX = /^[\u0000-\u007f]*$/u; - -/** @type {Intl.Segmenter | undefined} */ -let segmenter; - -//------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * 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); -} - -/** - * Counts graphemes in a given string. - * @param {string} value A string to count graphemes. - * @returns {number} The number of graphemes in `value`. - */ -function getGraphemeCount(value) { - if (ASCII_REGEX.test(value)) { - return value.length; - } - - segmenter ??= new Intl.Segmenter("en-US"); // en-US locale should be supported everywhere - let graphemeCount = 0; - - // eslint-disable-next-line no-unused-vars -- for-of needs a variable - for (const unused of segmenter.segment(value)) { - graphemeCount++; - } - - return graphemeCount; -} - -module.exports = { - upperCaseFirst, - getGraphemeCount -}; diff --git a/node_modules/eslint/lib/shared/text-table.js b/node_modules/eslint/lib/shared/text-table.js deleted file mode 100644 index ddd137d..0000000 --- a/node_modules/eslint/lib/shared/text-table.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @fileoverview Optimized version of the `text-table` npm module to improve performance by replacing inefficient regex-based - * whitespace trimming with a modern built-in method. - * - * This modification addresses a performance issue reported in https://github.com/eslint/eslint/issues/18709 - * - * The `text-table` module is published under the MIT License. For the original source, refer to: - * https://www.npmjs.com/package/text-table. - */ - -/* - * - * 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. - */ - -"use strict"; - -module.exports = function(rows_, opts) { - const hsep = " "; - const align = opts.align; - const stringLength = opts.stringLength; - - const sizes = rows_.reduce((acc, row) => { - row.forEach((c, ix) => { - const n = stringLength(c); - - if (!acc[ix] || n > acc[ix]) { - acc[ix] = n; - } - }); - return acc; - }, []); - - return rows_ - .map(row => - row - .map((c, ix) => { - const n = sizes[ix] - stringLength(c) || 0; - const s = Array(Math.max(n + 1, 1)).join(" "); - - if (align[ix] === "r") { - return s + c; - } - - return c + s; - }) - .join(hsep) - .trimEnd()) - .join("\n"); -}; diff --git a/node_modules/eslint/lib/shared/traverser.js b/node_modules/eslint/lib/shared/traverser.js deleted file mode 100644 index 38b4e21..0000000 --- a/node_modules/eslint/lib/shared/traverser.js +++ /dev/null @@ -1,195 +0,0 @@ -/** - * @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 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 deleted file mode 100644 index f12c369..0000000 --- a/node_modules/eslint/lib/shared/types.js +++ /dev/null @@ -1,251 +0,0 @@ -/** - * @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|14|15|16|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024|2025} [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} [messageId] The ID of the message in the rule's meta. - * @property {(string|null)} nodeType Type of node - * @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} [messageId] The ID of the message in the rule's meta. - * @property {(string|null)} nodeType Type of node - * @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 {Array} [defaultOptions] Default options for the rule. - * @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 {Stats} [stats] The performance statistics collected with the `stats` flag. - * @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. - */ - -/** - * Performance statistics - * @typedef {Object} Stats - * @property {number} fixPasses The number of times ESLint has applied at least one fix after linting. - * @property {Times} times The times spent on (parsing, fixing, linting) a file. - */ - -/** - * Performance Times for each ESLint pass - * @typedef {Object} Times - * @property {TimePass[]} passes Time passes - */ - -/** - * @typedef {Object} TimePass - * @property {ParseTime} parse The parse object containing all parse time information. - * @property {Record} [rules] The rules object containing all lint time information for each rule. - * @property {FixTime} fix The parse object containing all fix time information. - * @property {number} total The total time that is spent on (parsing, fixing, linting) a file. - */ -/** - * @typedef {Object} ParseTime - * @property {number} total The total time that is spent when parsing a file. - */ -/** - * @typedef {Object} RuleTime - * @property {number} total The total time that is spent on a rule. - */ -/** - * @typedef {Object} FixTime - * @property {number} total The total time that is spent on applying fixes to the code. - */ - -/** - * Information provided when the maximum warning threshold is exceeded. - * @typedef {Object} MaxWarningsExceeded - * @property {number} maxWarnings Number of warnings to trigger nonzero exit code. - * @property {number} foundWarnings Number of warnings found while linting. - */ - -/** - * Metadata about results for formatters. - * @typedef {Object} ResultsMeta - * @property {MaxWarningsExceeded} [maxWarningsExceeded] Present if the maxWarnings threshold was exceeded. - */ - -/** - * A formatter function. - * @callback FormatterFunction - * @param {LintResult[]} results The list of linting results. - * @param {{cwd: string, maxWarningsExceeded?: MaxWarningsExceeded, rulesMeta: Record}} context A context object. - * @returns {string | Promise} Formatted text. - */ diff --git a/node_modules/eslint/lib/types/index.d.ts b/node_modules/eslint/lib/types/index.d.ts deleted file mode 100644 index 1576548..0000000 --- a/node_modules/eslint/lib/types/index.d.ts +++ /dev/null @@ -1,1683 +0,0 @@ -/** - * @fileoverview This file contains the core types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import * as ESTree from "estree"; -import { Language } from "@eslint/core"; -import { JSONSchema4 } from "json-schema"; -import { LegacyESLint } from "./use-at-your-own-risk.js"; - -export namespace AST { - type TokenType = - | "Boolean" - | "Null" - | "Identifier" - | "Keyword" - | "Punctuator" - | "JSXIdentifier" - | "JSXText" - | "Numeric" - | "String" - | "RegularExpression"; - - interface Token { - type: TokenType; - value: string; - range: Range; - loc: SourceLocation; - } - - interface SourceLocation { - start: ESTree.Position; - end: ESTree.Position; - } - - type Range = [number, number]; - - interface Program extends ESTree.Program { - comments: ESTree.Comment[]; - tokens: Token[]; - loc: SourceLocation; - range: Range; - } -} - -export namespace Scope { - interface ScopeManager { - scopes: Scope[]; - globalScope: Scope | null; - - acquire(node: ESTree.Node, inner?: boolean): Scope | null; - - getDeclaredVariables(node: ESTree.Node): Variable[]; - } - - interface Scope { - type: - | "block" - | "catch" - | "class" - | "for" - | "function" - | "function-expression-name" - | "global" - | "module" - | "switch" - | "with" - | "TDZ"; - isStrict: boolean; - upper: Scope | null; - childScopes: Scope[]; - variableScope: Scope; - block: ESTree.Node; - variables: Variable[]; - set: Map; - references: Reference[]; - through: Reference[]; - functionExpressionScope: boolean; - } - - interface Variable { - name: string; - scope: Scope; - identifiers: ESTree.Identifier[]; - references: Reference[]; - defs: Definition[]; - } - - interface Reference { - identifier: ESTree.Identifier; - from: Scope; - resolved: Variable | null; - writeExpr: ESTree.Node | null; - init: boolean; - - isWrite(): boolean; - - isRead(): boolean; - - isWriteOnly(): boolean; - - isReadOnly(): boolean; - - isReadWrite(): boolean; - } - - type DefinitionType = - | { type: "CatchClause"; node: ESTree.CatchClause; parent: null } - | { type: "ClassName"; node: ESTree.ClassDeclaration | ESTree.ClassExpression; parent: null } - | { type: "FunctionName"; node: ESTree.FunctionDeclaration | ESTree.FunctionExpression; parent: null } - | { type: "ImplicitGlobalVariable"; node: ESTree.Program; parent: null } - | { - type: "ImportBinding"; - node: ESTree.ImportSpecifier | ESTree.ImportDefaultSpecifier | ESTree.ImportNamespaceSpecifier; - parent: ESTree.ImportDeclaration; - } - | { - type: "Parameter"; - node: ESTree.FunctionDeclaration | ESTree.FunctionExpression | ESTree.ArrowFunctionExpression; - parent: null; - } - | { type: "TDZ"; node: any; parent: null } - | { type: "Variable"; node: ESTree.VariableDeclarator; parent: ESTree.VariableDeclaration }; - - type Definition = DefinitionType & { name: ESTree.Identifier }; -} - -// #region SourceCode - -export class SourceCode { - text: string; - ast: AST.Program; - lines: string[]; - hasBOM: boolean; - parserServices: SourceCode.ParserServices; - scopeManager: Scope.ScopeManager; - visitorKeys: SourceCode.VisitorKeys; - - constructor(text: string, ast: AST.Program); - constructor(config: SourceCode.Config); - - static splitLines(text: string): string[]; - - getText(node?: ESTree.Node, beforeCount?: number, afterCount?: number): string; - - getLines(): string[]; - - getAllComments(): ESTree.Comment[]; - - getAncestors(node: ESTree.Node): ESTree.Node[]; - - getDeclaredVariables(node: ESTree.Node): Scope.Variable[]; - - getJSDocComment(node: ESTree.Node): ESTree.Comment | null; - - getNodeByRangeIndex(index: number): ESTree.Node | null; - - isSpaceBetweenTokens(first: AST.Token, second: AST.Token): boolean; - - getLocFromIndex(index: number): ESTree.Position; - - getIndexFromLoc(location: ESTree.Position): number; - - // Inherited methods from TokenStore - // --------------------------------- - - getTokenByRangeStart(offset: number, options?: { includeComments: false }): AST.Token | null; - getTokenByRangeStart(offset: number, options: { includeComments: boolean }): AST.Token | ESTree.Comment | null; - - getFirstToken: SourceCode.UnaryNodeCursorWithSkipOptions; - - getFirstTokens: SourceCode.UnaryNodeCursorWithCountOptions; - - getLastToken: SourceCode.UnaryNodeCursorWithSkipOptions; - - getLastTokens: SourceCode.UnaryNodeCursorWithCountOptions; - - getTokenBefore: SourceCode.UnaryCursorWithSkipOptions; - - getTokensBefore: SourceCode.UnaryCursorWithCountOptions; - - getTokenAfter: SourceCode.UnaryCursorWithSkipOptions; - - getTokensAfter: SourceCode.UnaryCursorWithCountOptions; - - getFirstTokenBetween: SourceCode.BinaryCursorWithSkipOptions; - - getFirstTokensBetween: SourceCode.BinaryCursorWithCountOptions; - - getLastTokenBetween: SourceCode.BinaryCursorWithSkipOptions; - - getLastTokensBetween: SourceCode.BinaryCursorWithCountOptions; - - getTokensBetween: SourceCode.BinaryCursorWithCountOptions; - - getTokens: - & ((node: ESTree.Node, beforeCount?: number, afterCount?: number) => AST.Token[]) - & SourceCode.UnaryNodeCursorWithCountOptions; - - commentsExistBetween( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - ): boolean; - - getCommentsBefore(nodeOrToken: ESTree.Node | AST.Token): ESTree.Comment[]; - - getCommentsAfter(nodeOrToken: ESTree.Node | AST.Token): ESTree.Comment[]; - - getCommentsInside(node: ESTree.Node): ESTree.Comment[]; - - getScope(node: ESTree.Node): Scope.Scope; - - isSpaceBetween( - first: ESTree.Node | AST.Token, - second: ESTree.Node | AST.Token, - ): boolean; - - markVariableAsUsed(name: string, refNode?: ESTree.Node): boolean; -} - -export namespace SourceCode { - interface Config { - text: string; - ast: AST.Program; - parserServices?: ParserServices | undefined; - scopeManager?: Scope.ScopeManager | undefined; - visitorKeys?: VisitorKeys | undefined; - } - - type ParserServices = any; - - interface VisitorKeys { - [nodeType: string]: string[]; - } - - interface UnaryNodeCursorWithSkipOptions { - ( - node: ESTree.Node, - options: - | ((token: AST.Token) => token is T) - | { - filter: (token: AST.Token) => token is T; - includeComments?: false | undefined; - skip?: number | undefined; - }, - ): T | null; - ( - node: ESTree.Node, - options: { - filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T; - includeComments: boolean; - skip?: number | undefined; - }, - ): T | null; - ( - node: ESTree.Node, - options?: - | { - filter?: ((token: AST.Token) => boolean) | undefined; - includeComments?: false | undefined; - skip?: number | undefined; - } - | ((token: AST.Token) => boolean) - | number, - ): AST.Token | null; - ( - node: ESTree.Node, - options: { - filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined; - includeComments: boolean; - skip?: number | undefined; - }, - ): AST.Token | ESTree.Comment | null; - } - - interface UnaryNodeCursorWithCountOptions { - ( - node: ESTree.Node, - options: - | ((token: AST.Token) => token is T) - | { - filter: (token: AST.Token) => token is T; - includeComments?: false | undefined; - count?: number | undefined; - }, - ): T[]; - ( - node: ESTree.Node, - options: { - filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T; - includeComments: boolean; - count?: number | undefined; - }, - ): T[]; - ( - node: ESTree.Node, - options?: - | { - filter?: ((token: AST.Token) => boolean) | undefined; - includeComments?: false | undefined; - count?: number | undefined; - } - | ((token: AST.Token) => boolean) - | number, - ): AST.Token[]; - ( - node: ESTree.Node, - options: { - filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined; - includeComments: boolean; - count?: number | undefined; - }, - ): Array; - } - - interface UnaryCursorWithSkipOptions { - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options: - | ((token: AST.Token) => token is T) - | { - filter: (token: AST.Token) => token is T; - includeComments?: false | undefined; - skip?: number | undefined; - }, - ): T | null; - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T; - includeComments: boolean; - skip?: number | undefined; - }, - ): T | null; - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options?: - | { - filter?: ((token: AST.Token) => boolean) | undefined; - includeComments?: false | undefined; - skip?: number | undefined; - } - | ((token: AST.Token) => boolean) - | number, - ): AST.Token | null; - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined; - includeComments: boolean; - skip?: number | undefined; - }, - ): AST.Token | ESTree.Comment | null; - } - - interface UnaryCursorWithCountOptions { - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options: - | ((token: AST.Token) => token is T) - | { - filter: (token: AST.Token) => token is T; - includeComments?: false | undefined; - count?: number | undefined; - }, - ): T[]; - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T; - includeComments: boolean; - count?: number | undefined; - }, - ): T[]; - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options?: - | { - filter?: ((token: AST.Token) => boolean) | undefined; - includeComments?: false | undefined; - count?: number | undefined; - } - | ((token: AST.Token) => boolean) - | number, - ): AST.Token[]; - ( - node: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined; - includeComments: boolean; - count?: number | undefined; - }, - ): Array; - } - - interface BinaryCursorWithSkipOptions { - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options: - | ((token: AST.Token) => token is T) - | { - filter: (token: AST.Token) => token is T; - includeComments?: false | undefined; - skip?: number | undefined; - }, - ): T | null; - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T; - includeComments: boolean; - skip?: number | undefined; - }, - ): T | null; - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options?: - | { - filter?: ((token: AST.Token) => boolean) | undefined; - includeComments?: false | undefined; - skip?: number | undefined; - } - | ((token: AST.Token) => boolean) - | number, - ): AST.Token | null; - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined; - includeComments: boolean; - skip?: number | undefined; - }, - ): AST.Token | ESTree.Comment | null; - } - - interface BinaryCursorWithCountOptions { - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options: - | ((token: AST.Token) => token is T) - | { - filter: (token: AST.Token) => token is T; - includeComments?: false | undefined; - count?: number | undefined; - }, - ): T[]; - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter: (tokenOrComment: AST.Token | ESTree.Comment) => tokenOrComment is T; - includeComments: boolean; - count?: number | undefined; - }, - ): T[]; - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options?: - | { - filter?: ((token: AST.Token) => boolean) | undefined; - includeComments?: false | undefined; - count?: number | undefined; - } - | ((token: AST.Token) => boolean) - | number, - ): AST.Token[]; - ( - left: ESTree.Node | AST.Token | ESTree.Comment, - right: ESTree.Node | AST.Token | ESTree.Comment, - options: { - filter?: ((token: AST.Token | ESTree.Comment) => boolean) | undefined; - includeComments: boolean; - count?: number | undefined; - }, - ): Array; - } -} - -// #endregion - -export namespace Rule { - interface RuleModule { - create(context: RuleContext): RuleListener; - meta?: RuleMetaData | undefined; - } - - type NodeTypes = ESTree.Node["type"]; - interface NodeListener { - ArrayExpression?: ((node: ESTree.ArrayExpression & NodeParentExtension) => void) | undefined; - "ArrayExpression:exit"?: ((node: ESTree.ArrayExpression & NodeParentExtension) => void) | undefined; - ArrayPattern?: ((node: ESTree.ArrayPattern & NodeParentExtension) => void) | undefined; - "ArrayPattern:exit"?: ((node: ESTree.ArrayPattern & NodeParentExtension) => void) | undefined; - ArrowFunctionExpression?: ((node: ESTree.ArrowFunctionExpression & NodeParentExtension) => void) | undefined; - "ArrowFunctionExpression:exit"?: - | ((node: ESTree.ArrowFunctionExpression & NodeParentExtension) => void) - | undefined; - AssignmentExpression?: ((node: ESTree.AssignmentExpression & NodeParentExtension) => void) | undefined; - "AssignmentExpression:exit"?: ((node: ESTree.AssignmentExpression & NodeParentExtension) => void) | undefined; - AssignmentPattern?: ((node: ESTree.AssignmentPattern & NodeParentExtension) => void) | undefined; - "AssignmentPattern:exit"?: ((node: ESTree.AssignmentPattern & NodeParentExtension) => void) | undefined; - AwaitExpression?: ((node: ESTree.AwaitExpression & NodeParentExtension) => void) | undefined; - "AwaitExpression:exit"?: ((node: ESTree.AwaitExpression & NodeParentExtension) => void) | undefined; - BinaryExpression?: ((node: ESTree.BinaryExpression & NodeParentExtension) => void) | undefined; - "BinaryExpression:exit"?: ((node: ESTree.BinaryExpression & NodeParentExtension) => void) | undefined; - BlockStatement?: ((node: ESTree.BlockStatement & NodeParentExtension) => void) | undefined; - "BlockStatement:exit"?: ((node: ESTree.BlockStatement & NodeParentExtension) => void) | undefined; - BreakStatement?: ((node: ESTree.BreakStatement & NodeParentExtension) => void) | undefined; - "BreakStatement:exit"?: ((node: ESTree.BreakStatement & NodeParentExtension) => void) | undefined; - CallExpression?: ((node: ESTree.CallExpression & NodeParentExtension) => void) | undefined; - "CallExpression:exit"?: ((node: ESTree.CallExpression & NodeParentExtension) => void) | undefined; - CatchClause?: ((node: ESTree.CatchClause & NodeParentExtension) => void) | undefined; - "CatchClause:exit"?: ((node: ESTree.CatchClause & NodeParentExtension) => void) | undefined; - ChainExpression?: ((node: ESTree.ChainExpression & NodeParentExtension) => void) | undefined; - "ChainExpression:exit"?: ((node: ESTree.ChainExpression & NodeParentExtension) => void) | undefined; - ClassBody?: ((node: ESTree.ClassBody & NodeParentExtension) => void) | undefined; - "ClassBody:exit"?: ((node: ESTree.ClassBody & NodeParentExtension) => void) | undefined; - ClassDeclaration?: ((node: ESTree.ClassDeclaration & NodeParentExtension) => void) | undefined; - "ClassDeclaration:exit"?: ((node: ESTree.ClassDeclaration & NodeParentExtension) => void) | undefined; - ClassExpression?: ((node: ESTree.ClassExpression & NodeParentExtension) => void) | undefined; - "ClassExpression:exit"?: ((node: ESTree.ClassExpression & NodeParentExtension) => void) | undefined; - ConditionalExpression?: ((node: ESTree.ConditionalExpression & NodeParentExtension) => void) | undefined; - "ConditionalExpression:exit"?: ((node: ESTree.ConditionalExpression & NodeParentExtension) => void) | undefined; - ContinueStatement?: ((node: ESTree.ContinueStatement & NodeParentExtension) => void) | undefined; - "ContinueStatement:exit"?: ((node: ESTree.ContinueStatement & NodeParentExtension) => void) | undefined; - DebuggerStatement?: ((node: ESTree.DebuggerStatement & NodeParentExtension) => void) | undefined; - "DebuggerStatement:exit"?: ((node: ESTree.DebuggerStatement & NodeParentExtension) => void) | undefined; - DoWhileStatement?: ((node: ESTree.DoWhileStatement & NodeParentExtension) => void) | undefined; - "DoWhileStatement:exit"?: ((node: ESTree.DoWhileStatement & NodeParentExtension) => void) | undefined; - EmptyStatement?: ((node: ESTree.EmptyStatement & NodeParentExtension) => void) | undefined; - "EmptyStatement:exit"?: ((node: ESTree.EmptyStatement & NodeParentExtension) => void) | undefined; - ExportAllDeclaration?: ((node: ESTree.ExportAllDeclaration & NodeParentExtension) => void) | undefined; - "ExportAllDeclaration:exit"?: ((node: ESTree.ExportAllDeclaration & NodeParentExtension) => void) | undefined; - ExportDefaultDeclaration?: ((node: ESTree.ExportDefaultDeclaration & NodeParentExtension) => void) | undefined; - "ExportDefaultDeclaration:exit"?: - | ((node: ESTree.ExportDefaultDeclaration & NodeParentExtension) => void) - | undefined; - ExportNamedDeclaration?: ((node: ESTree.ExportNamedDeclaration & NodeParentExtension) => void) | undefined; - "ExportNamedDeclaration:exit"?: - | ((node: ESTree.ExportNamedDeclaration & NodeParentExtension) => void) - | undefined; - ExportSpecifier?: ((node: ESTree.ExportSpecifier & NodeParentExtension) => void) | undefined; - "ExportSpecifier:exit"?: ((node: ESTree.ExportSpecifier & NodeParentExtension) => void) | undefined; - ExpressionStatement?: ((node: ESTree.ExpressionStatement & NodeParentExtension) => void) | undefined; - "ExpressionStatement:exit"?: ((node: ESTree.ExpressionStatement & NodeParentExtension) => void) | undefined; - ForInStatement?: ((node: ESTree.ForInStatement & NodeParentExtension) => void) | undefined; - "ForInStatement:exit"?: ((node: ESTree.ForInStatement & NodeParentExtension) => void) | undefined; - ForOfStatement?: ((node: ESTree.ForOfStatement & NodeParentExtension) => void) | undefined; - "ForOfStatement:exit"?: ((node: ESTree.ForOfStatement & NodeParentExtension) => void) | undefined; - ForStatement?: ((node: ESTree.ForStatement & NodeParentExtension) => void) | undefined; - "ForStatement:exit"?: ((node: ESTree.ForStatement & NodeParentExtension) => void) | undefined; - FunctionDeclaration?: ((node: ESTree.FunctionDeclaration & NodeParentExtension) => void) | undefined; - "FunctionDeclaration:exit"?: ((node: ESTree.FunctionDeclaration & NodeParentExtension) => void) | undefined; - FunctionExpression?: ((node: ESTree.FunctionExpression & NodeParentExtension) => void) | undefined; - "FunctionExpression:exit"?: ((node: ESTree.FunctionExpression & NodeParentExtension) => void) | undefined; - Identifier?: ((node: ESTree.Identifier & NodeParentExtension) => void) | undefined; - "Identifier:exit"?: ((node: ESTree.Identifier & NodeParentExtension) => void) | undefined; - IfStatement?: ((node: ESTree.IfStatement & NodeParentExtension) => void) | undefined; - "IfStatement:exit"?: ((node: ESTree.IfStatement & NodeParentExtension) => void) | undefined; - ImportDeclaration?: ((node: ESTree.ImportDeclaration & NodeParentExtension) => void) | undefined; - "ImportDeclaration:exit"?: ((node: ESTree.ImportDeclaration & NodeParentExtension) => void) | undefined; - ImportDefaultSpecifier?: ((node: ESTree.ImportDefaultSpecifier & NodeParentExtension) => void) | undefined; - "ImportDefaultSpecifier:exit"?: - | ((node: ESTree.ImportDefaultSpecifier & NodeParentExtension) => void) - | undefined; - ImportExpression?: ((node: ESTree.ImportExpression & NodeParentExtension) => void) | undefined; - "ImportExpression:exit"?: ((node: ESTree.ImportExpression & NodeParentExtension) => void) | undefined; - ImportNamespaceSpecifier?: ((node: ESTree.ImportNamespaceSpecifier & NodeParentExtension) => void) | undefined; - "ImportNamespaceSpecifier:exit"?: - | ((node: ESTree.ImportNamespaceSpecifier & NodeParentExtension) => void) - | undefined; - ImportSpecifier?: ((node: ESTree.ImportSpecifier & NodeParentExtension) => void) | undefined; - "ImportSpecifier:exit"?: ((node: ESTree.ImportSpecifier & NodeParentExtension) => void) | undefined; - LabeledStatement?: ((node: ESTree.LabeledStatement & NodeParentExtension) => void) | undefined; - "LabeledStatement:exit"?: ((node: ESTree.LabeledStatement & NodeParentExtension) => void) | undefined; - Literal?: ((node: ESTree.Literal & NodeParentExtension) => void) | undefined; - "Literal:exit"?: ((node: ESTree.Literal & NodeParentExtension) => void) | undefined; - LogicalExpression?: ((node: ESTree.LogicalExpression & NodeParentExtension) => void) | undefined; - "LogicalExpression:exit"?: ((node: ESTree.LogicalExpression & NodeParentExtension) => void) | undefined; - MemberExpression?: ((node: ESTree.MemberExpression & NodeParentExtension) => void) | undefined; - "MemberExpression:exit"?: ((node: ESTree.MemberExpression & NodeParentExtension) => void) | undefined; - MetaProperty?: ((node: ESTree.MetaProperty & NodeParentExtension) => void) | undefined; - "MetaProperty:exit"?: ((node: ESTree.MetaProperty & NodeParentExtension) => void) | undefined; - MethodDefinition?: ((node: ESTree.MethodDefinition & NodeParentExtension) => void) | undefined; - "MethodDefinition:exit"?: ((node: ESTree.MethodDefinition & NodeParentExtension) => void) | undefined; - NewExpression?: ((node: ESTree.NewExpression & NodeParentExtension) => void) | undefined; - "NewExpression:exit"?: ((node: ESTree.NewExpression & NodeParentExtension) => void) | undefined; - ObjectExpression?: ((node: ESTree.ObjectExpression & NodeParentExtension) => void) | undefined; - "ObjectExpression:exit"?: ((node: ESTree.ObjectExpression & NodeParentExtension) => void) | undefined; - ObjectPattern?: ((node: ESTree.ObjectPattern & NodeParentExtension) => void) | undefined; - "ObjectPattern:exit"?: ((node: ESTree.ObjectPattern & NodeParentExtension) => void) | undefined; - PrivateIdentifier?: ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) | undefined; - "PrivateIdentifier:exit"?: ((node: ESTree.PrivateIdentifier & NodeParentExtension) => void) | undefined; - Program?: ((node: ESTree.Program) => void) | undefined; - "Program:exit"?: ((node: ESTree.Program) => void) | undefined; - Property?: ((node: ESTree.Property & NodeParentExtension) => void) | undefined; - "Property:exit"?: ((node: ESTree.Property & NodeParentExtension) => void) | undefined; - PropertyDefinition?: ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) | undefined; - "PropertyDefinition:exit"?: ((node: ESTree.PropertyDefinition & NodeParentExtension) => void) | undefined; - RestElement?: ((node: ESTree.RestElement & NodeParentExtension) => void) | undefined; - "RestElement:exit"?: ((node: ESTree.RestElement & NodeParentExtension) => void) | undefined; - ReturnStatement?: ((node: ESTree.ReturnStatement & NodeParentExtension) => void) | undefined; - "ReturnStatement:exit"?: ((node: ESTree.ReturnStatement & NodeParentExtension) => void) | undefined; - SequenceExpression?: ((node: ESTree.SequenceExpression & NodeParentExtension) => void) | undefined; - "SequenceExpression:exit"?: ((node: ESTree.SequenceExpression & NodeParentExtension) => void) | undefined; - SpreadElement?: ((node: ESTree.SpreadElement & NodeParentExtension) => void) | undefined; - "SpreadElement:exit"?: ((node: ESTree.SpreadElement & NodeParentExtension) => void) | undefined; - StaticBlock?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined; - "StaticBlock:exit"?: ((node: ESTree.StaticBlock & NodeParentExtension) => void) | undefined; - Super?: ((node: ESTree.Super & NodeParentExtension) => void) | undefined; - "Super:exit"?: ((node: ESTree.Super & NodeParentExtension) => void) | undefined; - SwitchCase?: ((node: ESTree.SwitchCase & NodeParentExtension) => void) | undefined; - "SwitchCase:exit"?: ((node: ESTree.SwitchCase & NodeParentExtension) => void) | undefined; - SwitchStatement?: ((node: ESTree.SwitchStatement & NodeParentExtension) => void) | undefined; - "SwitchStatement:exit"?: ((node: ESTree.SwitchStatement & NodeParentExtension) => void) | undefined; - TaggedTemplateExpression?: ((node: ESTree.TaggedTemplateExpression & NodeParentExtension) => void) | undefined; - "TaggedTemplateExpression:exit"?: - | ((node: ESTree.TaggedTemplateExpression & NodeParentExtension) => void) - | undefined; - TemplateElement?: ((node: ESTree.TemplateElement & NodeParentExtension) => void) | undefined; - "TemplateElement:exit"?: ((node: ESTree.TemplateElement & NodeParentExtension) => void) | undefined; - TemplateLiteral?: ((node: ESTree.TemplateLiteral & NodeParentExtension) => void) | undefined; - "TemplateLiteral:exit"?: ((node: ESTree.TemplateLiteral & NodeParentExtension) => void) | undefined; - ThisExpression?: ((node: ESTree.ThisExpression & NodeParentExtension) => void) | undefined; - "ThisExpression:exit"?: ((node: ESTree.ThisExpression & NodeParentExtension) => void) | undefined; - ThrowStatement?: ((node: ESTree.ThrowStatement & NodeParentExtension) => void) | undefined; - "ThrowStatement:exit"?: ((node: ESTree.ThrowStatement & NodeParentExtension) => void) | undefined; - TryStatement?: ((node: ESTree.TryStatement & NodeParentExtension) => void) | undefined; - "TryStatement:exit"?: ((node: ESTree.TryStatement & NodeParentExtension) => void) | undefined; - UnaryExpression?: ((node: ESTree.UnaryExpression & NodeParentExtension) => void) | undefined; - "UnaryExpression:exit"?: ((node: ESTree.UnaryExpression & NodeParentExtension) => void) | undefined; - UpdateExpression?: ((node: ESTree.UpdateExpression & NodeParentExtension) => void) | undefined; - "UpdateExpression:exit"?: ((node: ESTree.UpdateExpression & NodeParentExtension) => void) | undefined; - VariableDeclaration?: ((node: ESTree.VariableDeclaration & NodeParentExtension) => void) | undefined; - "VariableDeclaration:exit"?: ((node: ESTree.VariableDeclaration & NodeParentExtension) => void) | undefined; - VariableDeclarator?: ((node: ESTree.VariableDeclarator & NodeParentExtension) => void) | undefined; - "VariableDeclarator:exit"?: ((node: ESTree.VariableDeclarator & NodeParentExtension) => void) | undefined; - WhileStatement?: ((node: ESTree.WhileStatement & NodeParentExtension) => void) | undefined; - "WhileStatement:exit"?: ((node: ESTree.WhileStatement & NodeParentExtension) => void) | undefined; - WithStatement?: ((node: ESTree.WithStatement & NodeParentExtension) => void) | undefined; - "WithStatement:exit"?: ((node: ESTree.WithStatement & NodeParentExtension) => void) | undefined; - YieldExpression?: ((node: ESTree.YieldExpression & NodeParentExtension) => void) | undefined; - "YieldExpression:exit"?: ((node: ESTree.YieldExpression & NodeParentExtension) => void) | undefined; - } - - interface NodeParentExtension { - parent: Node; - } - type Node = ESTree.Node & NodeParentExtension; - - interface RuleListener extends NodeListener { - onCodePathStart?(codePath: CodePath, node: Node): void; - - onCodePathEnd?(codePath: CodePath, node: Node): void; - - onCodePathSegmentStart?(segment: CodePathSegment, node: Node): void; - - onCodePathSegmentEnd?(segment: CodePathSegment, node: Node): void; - - onCodePathSegmentLoop?(fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node): void; - - [key: string]: - | ((codePath: CodePath, node: Node) => void) - | ((segment: CodePathSegment, node: Node) => void) - | ((fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node) => void) - | ((node: Node) => void) - | NodeListener[keyof NodeListener] - | undefined; - } - - type CodePathOrigin = "program" | "function" | "class-field-initializer" | "class-static-block"; - - interface CodePath { - id: string; - origin: CodePathOrigin; - initialSegment: CodePathSegment; - finalSegments: CodePathSegment[]; - returnedSegments: CodePathSegment[]; - thrownSegments: CodePathSegment[]; - upper: CodePath | null; - childCodePaths: CodePath[]; - } - - interface CodePathSegment { - id: string; - nextSegments: CodePathSegment[]; - prevSegments: CodePathSegment[]; - reachable: boolean; - } - - interface RuleMetaData { - /** Properties often used for documentation generation and tooling. */ - docs?: { - /** Provides a short description of the rule. Commonly used when generating lists of rules. */ - description?: string | undefined; - /** Historically used by some plugins that divide rules into categories in their documentation. */ - category?: string | undefined; - /** Historically used by some plugins to indicate a rule belongs in their `recommended` configuration. */ - recommended?: boolean | undefined; - /** Specifies the URL at which the full documentation can be accessed. Code editors often use this to provide a helpful link on highlighted rule violations. */ - url?: string | undefined; - } | undefined; - /** Violation and suggestion messages. */ - messages?: { [messageId: string]: string } | undefined; - /** - * Specifies if the `--fix` option on the command line automatically fixes problems reported by the rule. - * Mandatory for fixable rules. - */ - fixable?: "code" | "whitespace" | undefined; - /** - * Specifies the [options](https://eslint.org/docs/latest/extend/custom-rules#options-schemas) - * so ESLint can prevent invalid [rule configurations](https://eslint.org/docs/latest/use/configure/rules#configuring-rules). - * Mandatory for rules with options. - */ - schema?: JSONSchema4 | JSONSchema4[] | false | undefined; - - /** Any default options to be recursively merged on top of any user-provided options. */ - defaultOptions?: unknown[]; - - /** Indicates whether the rule has been deprecated. Omit if not deprecated. */ - deprecated?: boolean | undefined; - /** The name of the rule(s) this rule was replaced by, if it was deprecated. */ - replacedBy?: readonly string[]; - - /** - * Indicates the type of rule: - * - `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve. - * - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed. - * - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, - * all the parts of the program that determine how the code looks rather than how it executes. - * These rules work on parts of the code that aren’t specified in the AST. - */ - type?: "problem" | "suggestion" | "layout" | undefined; - /** - * Specifies whether the rule can return suggestions (defaults to `false` if omitted). - * Mandatory for rules that provide suggestions. - */ - hasSuggestions?: boolean | undefined; - } - - interface RuleContext { - id: string; - options: any[]; - settings: { [name: string]: any }; - parserPath: string | undefined; - languageOptions: Linter.LanguageOptions; - parserOptions: Linter.ParserOptions; - cwd: string; - filename: string; - physicalFilename: string; - sourceCode: SourceCode; - - getAncestors(): ESTree.Node[]; - - getDeclaredVariables(node: ESTree.Node): Scope.Variable[]; - - /** @deprecated Use property `filename` directly instead */ - getFilename(): string; - - /** @deprecated Use property `physicalFilename` directly instead */ - getPhysicalFilename(): string; - - /** @deprecated Use property `cwd` directly instead */ - getCwd(): string; - - getScope(): Scope.Scope; - - /** @deprecated Use property `sourceCode` directly instead */ - getSourceCode(): SourceCode; - - markVariableAsUsed(name: string): boolean; - - report(descriptor: ReportDescriptor): void; - } - - type ReportFixer = (fixer: RuleFixer) => null | Fix | IterableIterator | Fix[]; - - interface ReportDescriptorOptionsBase { - data?: { [key: string]: string }; - - fix?: null | ReportFixer; - } - - interface SuggestionReportOptions { - data?: { [key: string]: string }; - - fix: ReportFixer; - } - - type SuggestionDescriptorMessage = { desc: string } | { messageId: string }; - type SuggestionReportDescriptor = SuggestionDescriptorMessage & SuggestionReportOptions; - - interface ReportDescriptorOptions extends ReportDescriptorOptionsBase { - suggest?: SuggestionReportDescriptor[] | null | undefined; - } - - type ReportDescriptor = ReportDescriptorMessage & ReportDescriptorLocation & ReportDescriptorOptions; - type ReportDescriptorMessage = { message: string } | { messageId: string }; - type ReportDescriptorLocation = - | { node: ESTree.Node } - | { loc: AST.SourceLocation | { line: number; column: number } }; - - interface RuleFixer { - insertTextAfter(nodeOrToken: ESTree.Node | AST.Token, text: string): Fix; - - insertTextAfterRange(range: AST.Range, text: string): Fix; - - insertTextBefore(nodeOrToken: ESTree.Node | AST.Token, text: string): Fix; - - insertTextBeforeRange(range: AST.Range, text: string): Fix; - - remove(nodeOrToken: ESTree.Node | AST.Token): Fix; - - removeRange(range: AST.Range): Fix; - - replaceText(nodeOrToken: ESTree.Node | AST.Token, text: string): Fix; - - replaceTextRange(range: AST.Range, text: string): Fix; - } - - interface Fix { - range: AST.Range; - text: string; - } -} - -// #region Linter - -export class Linter { - static readonly version: string; - - version: string; - - constructor(options?: { cwd?: string | undefined; configType?: "flat" | "eslintrc" }); - - verify( - code: SourceCode | string, - config: Linter.LegacyConfig | Linter.Config | Linter.Config[], - filename?: string, - ): Linter.LintMessage[]; - verify( - code: SourceCode | string, - config: Linter.LegacyConfig | Linter.Config | Linter.Config[], - options: Linter.LintOptions, - ): Linter.LintMessage[]; - - verifyAndFix( - code: string, - config: Linter.LegacyConfig | Linter.Config | Linter.Config[], - filename?: string, - ): Linter.FixReport; - verifyAndFix( - code: string, - config: Linter.LegacyConfig | Linter.Config | Linter.Config[], - options: Linter.FixOptions, - ): Linter.FixReport; - - getSourceCode(): SourceCode; - - defineRule(name: string, rule: Rule.RuleModule): void; - - defineRules(rules: { [name: string]: Rule.RuleModule }): void; - - getRules(): Map; - - defineParser(name: string, parser: Linter.Parser): void; - - getTimes(): Linter.Stats["times"]; - - getFixPassCount(): Linter.Stats["fixPasses"]; -} - -export namespace Linter { - /** - * The numeric severity level for a rule. - * - * - `0` means off. - * - `1` means warn. - * - `2` means error. - * - * @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities) - */ - type Severity = 0 | 1 | 2; - - /** - * The human readable severity level for a rule. - * - * @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities) - */ - type StringSeverity = "off" | "warn" | "error"; - - /** - * The numeric or human readable severity level for a rule. - * - * @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities) - */ - type RuleSeverity = Severity | StringSeverity; - - /** - * An array containing the rule severity level, followed by the rule options. - * - * @see [Rules](https://eslint.org/docs/latest/use/configure/rules) - */ - type RuleSeverityAndOptions = [RuleSeverity, ...Partial]; - - /** - * The severity level for the rule or an array containing the rule severity level, followed by the rule options. - * - * @see [Rules](https://eslint.org/docs/latest/use/configure/rules) - */ - type RuleEntry = RuleSeverity | RuleSeverityAndOptions; - - /** - * The rules config object is a key/value map of rule names and their severity and options. - */ - interface RulesRecord { - [rule: string]: RuleEntry; - } - - /** - * A configuration object that may have a `rules` block. - */ - interface HasRules { - rules?: Partial | undefined; - } - - /** - * The ECMAScript version of the code being linted. - */ - type EcmaVersion = - | 3 - | 5 - | 6 - | 7 - | 8 - | 9 - | 10 - | 11 - | 12 - | 13 - | 14 - | 15 - | 16 - | 2015 - | 2016 - | 2017 - | 2018 - | 2019 - | 2020 - | 2021 - | 2022 - | 2023 - | 2024 - | 2025 - | "latest"; - - /** - * The type of JavaScript source code. - */ - type SourceType = "script" | "module" | "commonjs"; - - /** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ - interface BaseConfig - extends HasRules { - $schema?: string | undefined; - - /** - * An environment provides predefined global variables. - * - * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments) - */ - env?: { [name: string]: boolean } | undefined; - - /** - * Extending configuration files. - * - * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files) - */ - extends?: string | string[] | undefined; - - /** - * Specifying globals. - * - * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals) - */ - globals?: Linter.Globals | undefined; - - /** - * Disable processing of inline comments. - * - * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments) - */ - noInlineConfig?: boolean | undefined; - - /** - * Overrides can be used to use a differing configuration for matching sub-directories and files. - * - * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work) - */ - overrides?: Array> | undefined; - - /** - * Parser. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated) - */ - parser?: string | undefined; - - /** - * Parser options. - * - * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers) - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - parserOptions?: ParserOptions | undefined; - - /** - * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use. - * - * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins) - */ - plugins?: string[] | undefined; - - /** - * Specifying processor. - * - * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor) - */ - processor?: string | undefined; - - /** - * Report unused eslint-disable comments as warning. - * - * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments) - */ - reportUnusedDisableDirectives?: boolean | undefined; - - /** - * Settings. - * - * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings) - */ - settings?: { [name: string]: any } | undefined; - } - - /** - * The overwrites that apply more differing configuration to specific files or directories. - */ - interface ConfigOverride extends BaseConfig { - /** - * The glob patterns for excluded files. - */ - excludedFiles?: string | string[] | undefined; - - /** - * The glob patterns for target files. - */ - files: string | string[]; - } - - /** - * ESLint legacy configuration. - * - * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/) - */ - // https://github.com/eslint/eslint/blob/v8.57.0/conf/config-schema.js - interface LegacyConfig - extends BaseConfig { - /** - * Tell ESLint to ignore specific files and directories. - * - * @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files) - */ - ignorePatterns?: string | string[] | undefined; - - /** - * @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files) - */ - root?: boolean | undefined; - } - - /** - * Parser options. - * - * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options) - */ - interface ParserOptions { - /** - * Accepts any valid ECMAScript version number or `'latest'`: - * - * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or - * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or - * - `'latest'` - * - * When it's a version or a year, the value must be a number - so do not include the `es` prefix. - * - * Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default - * - * @default 5 - */ - ecmaVersion?: EcmaVersion | undefined; - - /** - * The type of JavaScript source code. Possible values are "script" for - * traditional script files, "module" for ECMAScript modules (ESM), and - * "commonjs" for CommonJS files. - * - * @default 'script' - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - sourceType?: SourceType | undefined; - - /** - * An object indicating which additional language features you'd like to use. - * - * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options - */ - ecmaFeatures?: { - globalReturn?: boolean | undefined; - impliedStrict?: boolean | undefined; - jsx?: boolean | undefined; - experimentalObjectRestSpread?: boolean | undefined; - [key: string]: any; - } | undefined; - [key: string]: any; - } - - interface LintOptions { - filename?: string | undefined; - preprocess?: ((code: string) => string[]) | undefined; - postprocess?: ((problemLists: LintMessage[][]) => LintMessage[]) | undefined; - filterCodeBlock?: boolean | undefined; - disableFixes?: boolean | undefined; - allowInlineConfig?: boolean | undefined; - reportUnusedDisableDirectives?: boolean | undefined; - } - - interface LintSuggestion { - desc: string; - fix: Rule.Fix; - messageId?: string | undefined; - } - - interface LintMessage { - column: number; - line: number; - endColumn?: number | undefined; - endLine?: number | undefined; - ruleId: string | null; - message: string; - messageId?: string | undefined; - /** - * @deprecated `nodeType` is deprecated and will be removed in the next major version. - */ - nodeType?: string | undefined; - fatal?: true | undefined; - severity: Exclude; - fix?: Rule.Fix | undefined; - suggestions?: LintSuggestion[] | undefined; - } - - interface LintSuppression { - kind: string; - justification: string; - } - - interface SuppressedLintMessage extends LintMessage { - suppressions: LintSuppression[]; - } - - interface FixOptions extends LintOptions { - fix?: boolean | undefined; - } - - interface FixReport { - fixed: boolean; - output: string; - messages: LintMessage[]; - } - - // Temporarily loosen type for just flat config files (see #68232) - type NonESTreeParser = - & Omit - & ({ - parse(text: string, options?: any): unknown; - } | { - parseForESLint(text: string, options?: any): Omit & { - ast: unknown; - scopeManager?: unknown; - }; - }); - - type ESTreeParser = - & ESLint.ObjectMetaProperties - & ( - | { parse(text: string, options?: any): AST.Program } - | { parseForESLint(text: string, options?: any): ESLintParseResult } - ); - - type Parser = NonESTreeParser | ESTreeParser; - - interface ESLintParseResult { - ast: AST.Program; - parserServices?: SourceCode.ParserServices | undefined; - scopeManager?: Scope.ScopeManager | undefined; - visitorKeys?: SourceCode.VisitorKeys | undefined; - } - - interface ProcessorFile { - text: string; - filename: string; - } - - // https://eslint.org/docs/latest/extend/plugins#processors-in-plugins - interface Processor extends ESLint.ObjectMetaProperties { - supportsAutofix?: boolean | undefined; - preprocess?(text: string, filename: string): T[]; - postprocess?(messages: LintMessage[][], filename: string): LintMessage[]; - } - - interface Config { - /** - * An string to identify the configuration object. Used in error messages and - * inspection tools. - */ - name?: string; - - /** - * An array of glob patterns indicating the files that the configuration - * object should apply to. If not specified, the configuration object applies - * to all files - */ - files?: Array; - - /** - * An array of glob patterns indicating the files that the configuration - * object should not apply to. If not specified, the configuration object - * applies to all files matched by files - */ - ignores?: string[]; - - /** - * The name of the language used for linting. This is used to determine the - * parser and other language-specific settings. - * @since 9.7.0 - */ - language?: string; - - /** - * An object containing settings related to how JavaScript is configured for - * linting. - */ - languageOptions?: LanguageOptions; - - /** - * An object containing settings related to the linting process - */ - linterOptions?: LinterOptions; - - /** - * Either an object containing preprocess() and postprocess() methods or a - * string indicating the name of a processor inside of a plugin - * (i.e., "pluginName/processorName"). - */ - processor?: string | Processor; - - /** - * An object containing a name-value mapping of plugin names to plugin objects. - * When files is specified, these plugins are only available to the matching files. - */ - plugins?: Record; - - /** - * An object containing the configured rules. When files or ignores are specified, - * these rule configurations are only available to the matching files. - */ - rules?: Partial; - - /** - * An object containing name-value pairs of information that should be - * available to all rules. - */ - settings?: Record; - } - - /** @deprecated Use `Config` instead of `FlatConfig` */ - type FlatConfig = Config; - - type GlobalConf = boolean | "off" | "readable" | "readonly" | "writable" | "writeable"; - - interface Globals { - [name: string]: GlobalConf; - } - - interface LanguageOptions { - /** - * The version of ECMAScript to support. May be any year (i.e., 2022) or - * version (i.e., 5). Set to "latest" for the most recent supported version. - * @default "latest" - */ - ecmaVersion?: EcmaVersion | undefined; - - /** - * The type of JavaScript source code. Possible values are "script" for - * traditional script files, "module" for ECMAScript modules (ESM), and - * "commonjs" for CommonJS files. (default: "module" for .js and .mjs - * files; "commonjs" for .cjs files) - */ - sourceType?: SourceType | undefined; - - /** - * An object specifying additional objects that should be added to the - * global scope during linting. - */ - globals?: Globals | undefined; - - /** - * An object containing a parse() or parseForESLint() method. - * If not configured, the default ESLint parser (Espree) will be used. - */ - parser?: Parser | undefined; - - /** - * An object specifying additional options that are passed directly to the - * parser() method on the parser. The available options are parser-dependent - */ - parserOptions?: Linter.ParserOptions | undefined; - } - - interface LinterOptions { - /** - * A boolean value indicating if inline configuration is allowed. - */ - noInlineConfig?: boolean; - - /** - * A severity value indicating if and how unused disable directives should be - * tracked and reported. - */ - reportUnusedDisableDirectives?: Severity | StringSeverity | boolean; - } - - interface Stats { - /** - * The number of times ESLint has applied at least one fix after linting. - */ - fixPasses: number; - - /** - * The times spent on (parsing, fixing, linting) a file, where the linting refers to the timing information for each rule. - */ - times: { passes: TimePass[] }; - } - - interface TimePass { - parse: { total: number }; - rules?: Record; - fix: { total: number }; - total: number; - } -} - -// #endregion - -// #region ESLint - -export class ESLint { - static configType: "flat"; - - static readonly version: string; - - /** - * The default configuration that ESLint uses internally. This is provided for tooling that wants to calculate configurations using the same defaults as ESLint. - * Keep in mind that the default configuration may change from version to version, so you shouldn't rely on any particular keys or values to be present. - */ - static readonly defaultConfig: Linter.Config[]; - - static outputFixes(results: ESLint.LintResult[]): Promise; - - static getErrorResults(results: ESLint.LintResult[]): ESLint.LintResult[]; - - constructor(options?: ESLint.Options); - - lintFiles(patterns: string | string[]): Promise; - - lintText( - code: string, - options?: { filePath?: string | undefined; warnIgnored?: boolean | undefined }, - ): Promise; - - getRulesMetaForResults(results: ESLint.LintResult[]): ESLint.LintResultData["rulesMeta"]; - - hasFlag(flag: string): boolean; - - calculateConfigForFile(filePath: string): Promise; - - findConfigFile(): Promise; - - isPathIgnored(filePath: string): Promise; - - loadFormatter(nameOrPath?: string): Promise; -} - -export namespace ESLint { - type ConfigData = Omit< - Linter.LegacyConfig, - "$schema" - >; - - interface Environment { - globals?: Linter.Globals | undefined; - parserOptions?: Linter.ParserOptions | undefined; - } - - interface ObjectMetaProperties { - /** @deprecated Use `meta.name` instead. */ - name?: string | undefined; - - /** @deprecated Use `meta.version` instead. */ - version?: string | undefined; - - meta?: { - name?: string | undefined; - version?: string | undefined; - }; - } - - interface Plugin extends ObjectMetaProperties { - configs?: Record | undefined; - environments?: Record | undefined; - languages?: Record | undefined; - processors?: Record | undefined; - rules?: Record | undefined; - } - - type FixType = "directive" | "problem" | "suggestion" | "layout"; - - type CacheStrategy = "content" | "metadata"; - - interface Options { - // File enumeration - cwd?: string | undefined; - errorOnUnmatchedPattern?: boolean | undefined; - globInputPaths?: boolean | undefined; - ignore?: boolean | undefined; - ignorePatterns?: string[] | null | undefined; - passOnNoPatterns?: boolean | undefined; - warnIgnored?: boolean | undefined; - - // Linting - allowInlineConfig?: boolean | undefined; - baseConfig?: Linter.Config | Linter.Config[] | null | undefined; - overrideConfig?: Linter.Config | Linter.Config[] | null | undefined; - overrideConfigFile?: string | boolean | undefined; - plugins?: Record | null | undefined; - ruleFilter?: ((arg: { ruleId: string; severity: Exclude }) => boolean) | undefined; - stats?: boolean | undefined; - - // Autofix - fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined; - fixTypes?: FixType[] | undefined; - - // Cache-related - cache?: boolean | undefined; - cacheLocation?: string | undefined; - cacheStrategy?: CacheStrategy | undefined; - - // Other Options - flags?: string[] | undefined; - } - - interface LegacyOptions { - // File enumeration - cwd?: string | undefined; - errorOnUnmatchedPattern?: boolean | undefined; - extensions?: string[] | undefined; - globInputPaths?: boolean | undefined; - ignore?: boolean | undefined; - ignorePath?: string | undefined; - - // Linting - allowInlineConfig?: boolean | undefined; - baseConfig?: Linter.LegacyConfig | undefined; - overrideConfig?: Linter.LegacyConfig | undefined; - overrideConfigFile?: string | undefined; - plugins?: Record | undefined; - reportUnusedDisableDirectives?: Linter.StringSeverity | undefined; - resolvePluginsRelativeTo?: string | undefined; - rulePaths?: string[] | undefined; - useEslintrc?: boolean | undefined; - - // Autofix - fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined; - fixTypes?: FixType[] | undefined; - - // Cache-related - cache?: boolean | undefined; - cacheLocation?: string | undefined; - cacheStrategy?: CacheStrategy | undefined; - - // Other Options - flags?: string[] | undefined; - } - - interface LintResult { - filePath: string; - messages: Linter.LintMessage[]; - suppressedMessages: Linter.SuppressedLintMessage[]; - errorCount: number; - fatalErrorCount: number; - warningCount: number; - fixableErrorCount: number; - fixableWarningCount: number; - output?: string | undefined; - source?: string | undefined; - stats?: Linter.Stats | undefined; - usedDeprecatedRules: DeprecatedRuleUse[]; - } - - interface MaxWarningsExceeded { - - /** - * Number of warnings to trigger nonzero exit code. - */ - maxWarnings: number; - - /** - * Number of warnings found while linting. - */ - foundWarnings: number; - } - - interface LintResultData { - cwd: string; - maxWarningsExceeded?: MaxWarningsExceeded | undefined; - rulesMeta: { - [ruleId: string]: Rule.RuleMetaData; - }; - } - - interface DeprecatedRuleUse { - ruleId: string; - replacedBy: string[]; - } - - interface ResultsMeta { - maxWarningsExceeded?: MaxWarningsExceeded | undefined; - } - - /** The type of an object resolved by {@link ESLint.loadFormatter}. */ - interface LoadedFormatter { - - /** - * Used to call the underlying formatter. - * @param results An array of lint results to format. - * @param resultsMeta An object with an optional `maxWarningsExceeded` property that will be - * passed to the underlying formatter function along with other properties set by ESLint. - * This argument can be omitted if `maxWarningsExceeded` is not needed. - * @return The formatter output. - */ - format(results: LintResult[], resultsMeta?: ResultsMeta): string | Promise; - } - - // The documented type name is `LoadedFormatter`, but `Formatter` has been historically more used. - type Formatter = LoadedFormatter; - - /** - * The expected signature of a custom formatter. - * @param results An array of lint results to format. - * @param context Additional information for the formatter. - * @return The formatter output. - */ - type FormatterFunction = - (results: LintResult[], context: LintResultData) => string | Promise; - - // Docs reference the types by those name - type EditInfo = Rule.Fix; -} - -// #endregion - -export function loadESLint(options: { useFlatConfig: true }): Promise; -export function loadESLint(options: { useFlatConfig: false }): Promise; -export function loadESLint( - options?: { useFlatConfig?: boolean | undefined }, -): Promise; - -// #region RuleTester - -export class RuleTester { - static describe: ((...args: any) => any) | null; - static it: ((...args: any) => any) | null; - static itOnly: ((...args: any) => any) | null; - - constructor(config?: Linter.Config); - - run( - name: string, - rule: Rule.RuleModule, - tests: { - valid: Array; - invalid: RuleTester.InvalidTestCase[]; - }, - ): void; - - static only( - item: string | RuleTester.ValidTestCase | RuleTester.InvalidTestCase, - ): RuleTester.ValidTestCase | RuleTester.InvalidTestCase; -} - -export namespace RuleTester { - interface ValidTestCase { - name?: string; - code: string; - options?: any; - filename?: string | undefined; - only?: boolean; - languageOptions?: Linter.LanguageOptions | undefined; - settings?: { [name: string]: any } | undefined; - } - - interface SuggestionOutput { - messageId?: string; - desc?: string; - data?: Record | undefined; - output: string; - } - - interface InvalidTestCase extends ValidTestCase { - errors: number | Array; - output?: string | null | undefined; - } - - interface TestCaseError { - message?: string | RegExp; - messageId?: string; - /** - * @deprecated `type` is deprecated and will be removed in the next major version. - */ - type?: string | undefined; - data?: any; - line?: number | undefined; - column?: number | undefined; - endLine?: number | undefined; - endColumn?: number | undefined; - suggestions?: SuggestionOutput[] | undefined; - } -} - -// #endregion diff --git a/node_modules/eslint/lib/types/rules/best-practices.d.ts b/node_modules/eslint/lib/types/rules/best-practices.d.ts deleted file mode 100644 index eefce77..0000000 --- a/node_modules/eslint/lib/types/rules/best-practices.d.ts +++ /dev/null @@ -1,1129 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface BestPractices extends Linter.RulesRecord { - /** - * Rule to enforce getter and setter pairs in objects. - * - * @since 0.22.0 - * @see https://eslint.org/docs/rules/accessor-pairs - */ - "accessor-pairs": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - setWithoutGet: boolean; - /** - * @default false - */ - getWithoutSet: boolean; - /** - * @default true - */ - enforceForClassMembers: boolean; - }>, - ] - >; - - /** - * Rule to enforce `return` statements in callbacks of array methods. - * - * @since 2.0.0-alpha-1 - * @see https://eslint.org/docs/rules/array-callback-return - */ - "array-callback-return": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowImplicit: boolean; - /** - * @default false - */ - checkForEach: boolean; - /** - * @default false - */ - allowVoid: boolean; - }>, - ] - >; - - /** - * Rule to enforce the use of variables within the scope they are defined. - * - * @since 0.1.0 - * @see https://eslint.org/docs/rules/block-scoped-var - */ - "block-scoped-var": Linter.RuleEntry<[]>; - - /** - * Rule to enforce that class methods utilize `this`. - * - * @since 3.4.0 - * @see https://eslint.org/docs/rules/class-methods-use-this - */ - "class-methods-use-this": Linter.RuleEntry< - [ - Partial<{ - exceptMethods: string[]; - }>, - ] - >; - - /** - * Rule to enforce a maximum cyclomatic complexity allowed in a program. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/complexity - */ - complexity: Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 20 - */ - max: number; - /** - * @deprecated - * @default 20 - */ - maximum: number; - /** - * @default "classic" - * @since 9.12.0 - */ - variant: "classic" | "modified"; - }> - | number, - ] - >; - - /** - * Rule to require `return` statements to either always or never specify values. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/consistent-return - */ - "consistent-return": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - treatUndefinedAsUnspecified: boolean; - }>, - ] - >; - - /** - * Rule to enforce consistent brace style for all control statements. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/curly - */ - curly: Linter.RuleEntry<["all" | "multi" | "multi-line" | "multi-or-nest" | "consistent"]>; - - /** - * Rule to require `default` cases in `switch` statements. - * - * @since 0.6.0 - * @see https://eslint.org/docs/rules/default-case - */ - "default-case": Linter.RuleEntry< - [ - Partial<{ - /** - * @default '^no default$' - */ - commentPattern: string; - }>, - ] - >; - - /** - * Rule to enforce default clauses in switch statements to be last - * - * @since 7.0.0 - * @see https://eslint.org/docs/latest/rules/default-case-last - */ - "default-case-last": Linter.RuleEntry<[]>; - - /** - * Enforce default parameters to be last - * - * @since 6.4.0 - * @see https://eslint.org/docs/latest/rules/default-param-last - */ - "default-param-last": Linter.RuleEntry<[]>; - - /** - * Rule to enforce consistent newlines before and after dots. - * - * @since 0.21.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/dot-location) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/dot-location - */ - "dot-location": Linter.RuleEntry<["object" | "property"]>; - - /** - * Rule to enforce dot notation whenever possible. - * - * @since 0.0.7 - * @see https://eslint.org/docs/rules/dot-notation - */ - "dot-notation": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - allowKeywords: boolean; - allowPattern: string; - }>, - ] - >; - - /** - * Rule to require the use of `===` and `!==`. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/eqeqeq - */ - eqeqeq: - | Linter.RuleEntry< - [ - "always", - Partial<{ - /** - * @default 'always' - */ - null: "always" | "never" | "ignore"; - }>, - ] - > - | Linter.RuleEntry<["smart" | "allow-null"]>; - - /** - * Require grouped accessor pairs in object literals and classes. - * - * @since 6.7.0 - * @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs - */ - "grouped-accessor-pairs": Linter.RuleEntry<["anyOrder" | "getBeforeSet" | "setBeforeGet"]>; - - /** - * Rule to require `for-in` loops to include an `if` statement. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/guard-for-in - */ - "guard-for-in": Linter.RuleEntry<[]>; - - /** - * Rule to enforce a maximum number of classes per file. - * - * @since 5.0.0-alpha.3 - * @see https://eslint.org/docs/rules/max-classes-per-file - */ - "max-classes-per-file": Linter.RuleEntry<[number]>; - - /** - * Rule to disallow the use of `alert`, `confirm`, and `prompt`. - * - * @since 0.0.5 - * @see https://eslint.org/docs/rules/no-alert - */ - "no-alert": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `arguments.caller` or `arguments.callee`. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/no-caller - */ - "no-caller": Linter.RuleEntry<[]>; - - /** - * Rule to disallow lexical declarations in case clauses. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 1.9.0 - * @see https://eslint.org/docs/rules/no-case-declarations - */ - "no-case-declarations": Linter.RuleEntry<[]>; - - /** - * Rule to disallow division operators explicitly at the beginning of regular expressions. - * - * @since 0.1.0 - * @see https://eslint.org/docs/rules/no-div-regex - */ - "no-div-regex": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `else` blocks after `return` statements in `if` statements. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-else-return - */ - "no-else-return": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - allowElseIf: boolean; - }>, - ] - >; - - /** - * Rule to disallow empty functions. - * - * @since 2.0.0 - * @see https://eslint.org/docs/rules/no-empty-function - */ - "no-empty-function": Linter.RuleEntry< - [ - Partial<{ - /** - * @default [] - */ - allow: Array< - | "functions" - | "arrowFunctions" - | "generatorFunctions" - | "methods" - | "generatorMethods" - | "getters" - | "setters" - | "constructors" - | "asyncFunctions" - | "asyncMethods" - >; - }>, - ] - >; - - /** - * Rule to disallow empty destructuring patterns. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 1.7.0 - * @see https://eslint.org/docs/rules/no-empty-pattern - */ - "no-empty-pattern": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `null` comparisons without type-checking operators. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-eq-null - */ - "no-eq-null": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `eval()`. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/no-eval - */ - "no-eval": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowIndirect: boolean; - }>, - ] - >; - - /** - * Rule to disallow extending native types. - * - * @since 0.1.4 - * @see https://eslint.org/docs/rules/no-extend-native - */ - "no-extend-native": Linter.RuleEntry< - [ - Partial<{ - exceptions: string[]; - }>, - ] - >; - - /** - * Rule to disallow unnecessary calls to `.bind()`. - * - * @since 0.8.0 - * @see https://eslint.org/docs/rules/no-extra-bind - */ - "no-extra-bind": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary labels. - * - * @since 2.0.0-rc.0 - * @see https://eslint.org/docs/rules/no-extra-label - */ - "no-extra-label": Linter.RuleEntry<[]>; - - /** - * Rule to disallow fallthrough of `case` statements. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.7 - * @see https://eslint.org/docs/rules/no-fallthrough - */ - "no-fallthrough": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 'falls?\s?through' - */ - commentPattern: string; - /** - * @default false - */ - allowEmptyCase: boolean; - /** - * @default false - */ - reportUnusedFallthroughComment: boolean; - }>, - ] - >; - - /** - * Rule to disallow leading or trailing decimal points in numeric literals. - * - * @since 0.0.6 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-floating-decimal) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-floating-decimal - */ - "no-floating-decimal": Linter.RuleEntry<[]>; - - /** - * Rule to disallow assignments to native objects or read-only global variables. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 3.3.0 - * @see https://eslint.org/docs/rules/no-global-assign - */ - "no-global-assign": Linter.RuleEntry< - [ - Partial<{ - exceptions: string[]; - }>, - ] - >; - - /** - * Rule to disallow shorthand type conversions. - * - * @since 1.0.0-rc-2 - * @see https://eslint.org/docs/rules/no-implicit-coercion - */ - "no-implicit-coercion": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - boolean: boolean; - /** - * @default true - */ - number: boolean; - /** - * @default true - */ - string: boolean; - /** - * @default false - */ - disallowTemplateShorthand: boolean; - /** - * @default [] - */ - allow: Array<"~" | "!!" | "+" | "- -" | "-" | "*">; - }>, - ] - >; - - /** - * Rule to disallow variable and `function` declarations in the global scope. - * - * @since 2.0.0-alpha-1 - * @see https://eslint.org/docs/rules/no-implicit-globals - */ - "no-implicit-globals": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `eval()`-like methods. - * - * @since 0.0.7 - * @see https://eslint.org/docs/rules/no-implied-eval - */ - "no-implied-eval": Linter.RuleEntry<[]>; - - /** - * Disallow assigning to imported bindings. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 6.4.0 - * @see https://eslint.org/docs/latest/rules/no-import-assign - */ - "no-import-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `this` keywords outside of classes or class-like objects. - * - * @since 1.0.0-rc-2 - * @see https://eslint.org/docs/rules/no-invalid-this - */ - "no-invalid-this": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - capIsConstructor: boolean; - }>, - ] - >; - - /** - * Rule to disallow the use of the `__iterator__` property. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-iterator - */ - "no-iterator": Linter.RuleEntry<[]>; - - /** - * Rule to disallow labeled statements. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-labels - */ - "no-labels": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowLoop: boolean; - /** - * @default false - */ - allowSwitch: boolean; - }>, - ] - >; - - /** - * Rule to disallow unnecessary nested blocks. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-lone-blocks - */ - "no-lone-blocks": Linter.RuleEntry<[]>; - - /** - * Rule to disallow function declarations that contain unsafe references inside loop statements. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-loop-func - */ - "no-loop-func": Linter.RuleEntry<[]>; - - /** - * Rule to disallow magic numbers. - * - * @since 1.7.0 - * @see https://eslint.org/docs/rules/no-magic-numbers - */ - "no-magic-numbers": Linter.RuleEntry< - [ - Partial<{ - /** - * @default [] - */ - ignore: number[]; - /** - * @default false - */ - ignoreArrayIndexes: boolean; - /** - * @default false - */ - enforceConst: boolean; - /** - * @default false - */ - detectObjects: boolean; - }>, - ] - >; - - /** - * Rule to disallow multiple spaces. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-multi-spaces) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-multi-spaces - */ - "no-multi-spaces": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - ignoreEOLComments: boolean; - /** - * @default { Property: true } - */ - exceptions: Record; - }>, - ] - >; - - /** - * Rule to disallow multiline strings. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-multi-str - */ - "no-multi-str": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `new` operators outside of assignments or comparisons. - * - * @since 0.0.7 - * @see https://eslint.org/docs/rules/no-new - */ - "no-new": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `new` operators with the `Function` object. - * - * @since 0.0.7 - * @see https://eslint.org/docs/rules/no-new-func - */ - "no-new-func": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `new` operators with the `String`, `Number`, and `Boolean` objects. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/no-new-wrappers - */ - "no-new-wrappers": Linter.RuleEntry<[]>; - - /** - * Disallow `\\8` and `\\9` escape sequences in string literals. - * - * @since 7.14.0 - * @see https://eslint.org/docs/rules/no-nonoctal-decimal-escape - */ - "no-nonoctal-decimal-escape": Linter.RuleEntry<[]>; - - /** - * Rule to disallow octal literals. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/no-octal - */ - "no-octal": Linter.RuleEntry<[]>; - - /** - * Rule to disallow octal escape sequences in string literals. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-octal-escape - */ - "no-octal-escape": Linter.RuleEntry<[]>; - - /** - * Rule to disallow reassigning `function` parameters. - * - * @since 0.18.0 - * @see https://eslint.org/docs/rules/no-param-reassign - */ - "no-param-reassign": Linter.RuleEntry< - [ - | { - props?: false; - } - | ({ - props: true; - } & Partial<{ - /** - * @default [] - */ - ignorePropertyModificationsFor: string[]; - /** - * @since 6.6.0 - * @default [] - */ - ignorePropertyModificationsForRegex: string[]; - }>), - ] - >; - - /** - * Rule to disallow the use of the `__proto__` property. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-proto - */ - "no-proto": Linter.RuleEntry<[]>; - - /** - * Rule to disallow variable redeclaration. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-redeclare - */ - "no-redeclare": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - builtinGlobals: boolean; - }>, - ] - >; - - /** - * Rule to disallow certain properties on certain objects. - * - * @since 3.5.0 - * @see https://eslint.org/docs/rules/no-restricted-properties - */ - "no-restricted-properties": Linter.RuleEntry< - [ - ...Array< - | { - object: string; - property?: string | undefined; - message?: string | undefined; - } - | { - property: string; - message?: string | undefined; - } - >, - ] - >; - - /** - * Rule to disallow assignment operators in `return` statements. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-return-assign - */ - "no-return-assign": Linter.RuleEntry<["except-parens" | "always"]>; - - /** - * Rule to disallow unnecessary `return await`. - * - * @since 3.10.0 - * @see https://eslint.org/docs/rules/no-return-await - */ - "no-return-await": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `javascript:` urls. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-script-url - */ - "no-script-url": Linter.RuleEntry<[]>; - - /** - * Rule to disallow assignments where both sides are exactly the same. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 2.0.0-rc.0 - * @see https://eslint.org/docs/rules/no-self-assign - */ - "no-self-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow comparisons where both sides are exactly the same. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-self-compare - */ - "no-self-compare": Linter.RuleEntry<[]>; - - /** - * Rule to disallow comma operators. - * - * @since 0.5.1 - * @see https://eslint.org/docs/rules/no-sequences - */ - "no-sequences": Linter.RuleEntry< - [ - Partial<{ - /** - * @since 7.23.0 - * @default true - */ - allowInParentheses: boolean; - }>, - ] - >; - - /** - * Rule to disallow throwing literals as exceptions. - * - * @since 0.15.0 - * @see https://eslint.org/docs/rules/no-throw-literal - */ - "no-throw-literal": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unmodified loop conditions. - * - * @since 2.0.0-alpha-2 - * @see https://eslint.org/docs/rules/no-unmodified-loop-condition - */ - "no-unmodified-loop-condition": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unused expressions. - * - * @since 0.1.0 - * @see https://eslint.org/docs/rules/no-unused-expressions - */ - "no-unused-expressions": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowShortCircuit: boolean; - /** - * @default false - */ - allowTernary: boolean; - /** - * @default false - */ - allowTaggedTemplates: boolean; - /** - * @since 7.20.0 - * @default false - */ - enforceForJSX: boolean; - }>, - ] - >; - - /** - * Rule to disallow unused labels. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 2.0.0-rc.0 - * @see https://eslint.org/docs/rules/no-unused-labels - */ - "no-unused-labels": Linter.RuleEntry<[]>; - - /** - * Disallow variable assignments when the value is not used - * - * - * @since 9.0.0-alpha.1 - * @see https://eslint.org/docs/latest/rules/no-useless-assignment - */ - "no-useless-assignment": Linter.RuleEntry<[]>; - - /** - * Disallow useless backreferences in regular expressions - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 7.0.0-alpha.0 - * @see https://eslint.org/docs/latest/rules/no-useless-backreference - */ - "no-useless-backreference": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary calls to `.call()` and `.apply()`. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/no-useless-call - */ - "no-useless-call": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary `catch` clauses. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 5.11.0 - * @see https://eslint.org/docs/rules/no-useless-catch - */ - "no-useless-catch": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary concatenation of literals or template literals. - * - * @since 1.3.0 - * @see https://eslint.org/docs/rules/no-useless-concat - */ - "no-useless-concat": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary escape characters. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 2.5.0 - * @see https://eslint.org/docs/rules/no-useless-escape - */ - "no-useless-escape": Linter.RuleEntry<[]>; - - /** - * Rule to disallow redundant return statements. - * - * @since 3.9.0 - * @see https://eslint.org/docs/rules/no-useless-return - */ - "no-useless-return": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `void` operators. - * - * @since 0.8.0 - * @see https://eslint.org/docs/rules/no-void - */ - "no-void": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowAsStatement: boolean; - }>, - ] - >; - - /** - * Rule to disallow specified warning terms in comments. - * - * @since 0.4.4 - * @see https://eslint.org/docs/rules/no-warning-comments - */ - "no-warning-comments": Linter.RuleEntry< - [ - { - /** - * @default ["todo", "fixme", "xxx"] - */ - terms: string[]; - /** - * @default 'start' - */ - location: "start" | "anywhere"; - }, - ] - >; - - /** - * Rule to disallow `with` statements. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/no-with - */ - "no-with": Linter.RuleEntry<[]>; - - /** - * Rule to enforce using named capture group in regular expression. - * - * @since 5.15.0 - * @see https://eslint.org/docs/rules/prefer-named-capture-group - */ - "prefer-named-capture-group": Linter.RuleEntry<[]>; - - /** - * Disallow use of `Object.prototype.hasOwnProperty.call()` and prefer use of `Object.hasOwn()`. - * - * @since 8.5.0 - * @see https://eslint.org/docs/rules/prefer-object-has-own - */ - "prefer-object-has-own": Linter.RuleEntry<[]>; - - /** - * Rule to require using Error objects as Promise rejection reasons. - * - * @since 3.14.0 - * @see https://eslint.org/docs/rules/prefer-promise-reject-errors - */ - "prefer-promise-reject-errors": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowEmptyReject: boolean; - }>, - ] - >; - - /** - * Disallow use of the `RegExp` constructor in favor of regular expression literals. - * - * @since 6.4.0 - * @see https://eslint.org/docs/latest/rules/prefer-regex-literals - */ - "prefer-regex-literals": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - disallowRedundantWrapping: boolean; - }>, - ] - >; - - /** - * Rule to enforce the consistent use of the radix argument when using `parseInt()`. - * - * @since 0.0.7 - * @see https://eslint.org/docs/rules/radix - */ - radix: Linter.RuleEntry<["always" | "as-needed"]>; - - /** - * Rule to disallow async functions which have no `await` expression. - * - * @since 3.11.0 - * @see https://eslint.org/docs/rules/require-await - */ - "require-await": Linter.RuleEntry<[]>; - - /** - * Enforce the use of `u` or `v` flag on RegExp - * - * @since 5.3.0 - * @see https://eslint.org/docs/rules/require-unicode-regexp - */ - "require-unicode-regexp": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - requireFlag: "u" | "v"; - }>, - ] - >; - - /** - * Rule to require `var` declarations be placed at the top of their containing scope. - * - * @since 0.8.0 - * @see https://eslint.org/docs/rules/vars-on-top - */ - "vars-on-top": Linter.RuleEntry<[]>; - - /** - * Rule to require parentheses around immediate `function` invocations. - * - * @since 0.0.9 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/wrap-iife) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/wrap-iife - */ - "wrap-iife": Linter.RuleEntry< - [ - "outside" | "inside" | "any", - Partial<{ - /** - * @default false - */ - functionPrototypeMethods: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow “Yoda” conditions. - * - * @since 0.7.1 - * @see https://eslint.org/docs/rules/yoda - */ - yoda: - | Linter.RuleEntry< - [ - "never", - Partial<{ - exceptRange: boolean; - onlyEquality: boolean; - }>, - ] - > - | Linter.RuleEntry<["always"]>; -} diff --git a/node_modules/eslint/lib/types/rules/deprecated.d.ts b/node_modules/eslint/lib/types/rules/deprecated.d.ts deleted file mode 100644 index 337a63b..0000000 --- a/node_modules/eslint/lib/types/rules/deprecated.d.ts +++ /dev/null @@ -1,235 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface Deprecated extends Linter.RulesRecord { - /** - * Rule to enforce consistent indentation. - * - * @since 4.0.0-alpha.0 - * @deprecated since 4.0.0, use [`indent`](https://eslint.org/docs/rules/indent) instead. - * @see https://eslint.org/docs/rules/indent-legacy - */ - "indent-legacy": Linter.RuleEntry< - [ - number | "tab", - Partial<{ - /** - * @default 0 - */ - SwitchCase: number; - /** - * @default 1 - */ - VariableDeclarator: - | Partial<{ - /** - * @default 1 - */ - var: number | "first"; - /** - * @default 1 - */ - let: number | "first"; - /** - * @default 1 - */ - const: number | "first"; - }> - | number - | "first"; - /** - * @default 1 - */ - outerIIFEBody: number; - /** - * @default 1 - */ - MemberExpression: number | "off"; - /** - * @default { parameters: 1, body: 1 } - */ - FunctionDeclaration: Partial<{ - /** - * @default 1 - */ - parameters: number | "first" | "off"; - /** - * @default 1 - */ - body: number; - }>; - /** - * @default { parameters: 1, body: 1 } - */ - FunctionExpression: Partial<{ - /** - * @default 1 - */ - parameters: number | "first" | "off"; - /** - * @default 1 - */ - body: number; - }>; - /** - * @default { arguments: 1 } - */ - CallExpression: Partial<{ - /** - * @default 1 - */ - arguments: number | "first" | "off"; - }>; - /** - * @default 1 - */ - ArrayExpression: number | "first" | "off"; - /** - * @default 1 - */ - ObjectExpression: number | "first" | "off"; - /** - * @default 1 - */ - ImportDeclaration: number | "first" | "off"; - /** - * @default false - */ - flatTernaryExpressions: boolean; - ignoredNodes: string[]; - /** - * @default false - */ - ignoreComments: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow newlines around directives. - * - * @since 3.5.0 - * @deprecated since 4.0.0, use [`padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) instead. - * @see https://eslint.org/docs/rules/lines-around-directive - */ - "lines-around-directive": Linter.RuleEntry<["always" | "never"]>; - - /** - * Rule to require or disallow an empty line after variable declarations. - * - * @since 0.18.0 - * @deprecated since 4.0.0, use [`padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) instead. - * @see https://eslint.org/docs/rules/newline-after-var - */ - "newline-after-var": Linter.RuleEntry<["always" | "never"]>; - - /** - * Rule to require an empty line before `return` statements. - * - * @since 2.3.0 - * @deprecated since 4.0.0, use [`padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) instead. - * @see https://eslint.org/docs/rules/newline-before-return - */ - "newline-before-return": Linter.RuleEntry<[]>; - - /** - * Rule to disallow shadowing of variables inside of `catch`. - * - * @since 0.0.9 - * @deprecated since 5.1.0, use [`no-shadow`](https://eslint.org/docs/rules/no-shadow) instead. - * @see https://eslint.org/docs/rules/no-catch-shadow - */ - "no-catch-shadow": Linter.RuleEntry<[]>; - - /** - * Rule to disallow reassignment of native objects. - * - * @since 0.0.9 - * @deprecated since 3.3.0, use [`no-global-assign`](https://eslint.org/docs/rules/no-global-assign) instead. - * @see https://eslint.org/docs/rules/no-native-reassign - */ - "no-native-reassign": Linter.RuleEntry< - [ - Partial<{ - exceptions: string[]; - }>, - ] - >; - - /** - * Rule to disallow negating the left operand in `in` expressions. - * - * @since 0.1.2 - * @deprecated since 3.3.0, use [`no-unsafe-negation`](https://eslint.org/docs/rules/no-unsafe-negation) instead. - * @see https://eslint.org/docs/rules/no-negated-in-lhs - */ - "no-negated-in-lhs": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `Object` constructors. - * - * @since 0.0.9 - * @deprecated since 8.50.0, use [`no-object-constructor`](https://eslint.org/docs/rules/no-object-constructor) instead. - * @see https://eslint.org/docs/rules/no-object-constructor - */ - "no-new-object": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `new` operators with the `Symbol` object. - * - * @since 2.0.0-beta.1 - * @deprecated since 8.27.0, use [`no-new-native-nonconstructor`](https://eslint.org/docs/rules/no-new-native-nonconstructor) instead. - * @see https://eslint.org/docs/rules/no-new-symbol - */ - "no-new-symbol": Linter.RuleEntry<[]>; - - /** - * Rule to disallow spacing between function identifiers and their applications. - * - * @since 0.1.2 - * @deprecated since 3.3.0, use [`func-call-spacing`](https://eslint.org/docs/rules/func-call-spacing) instead. - * @see https://eslint.org/docs/rules/no-spaced-func - */ - "no-spaced-func": Linter.RuleEntry<[]>; - - /** - * Rule to suggest using `Reflect` methods where applicable. - * - * @since 1.0.0-rc-2 - * @deprecated since 3.9.0 - * @see https://eslint.org/docs/rules/prefer-reflect - */ - "prefer-reflect": Linter.RuleEntry< - [ - Partial<{ - exceptions: string[]; - }>, - ] - >; -} diff --git a/node_modules/eslint/lib/types/rules/ecmascript-6.d.ts b/node_modules/eslint/lib/types/rules/ecmascript-6.d.ts deleted file mode 100644 index 972a221..0000000 --- a/node_modules/eslint/lib/types/rules/ecmascript-6.d.ts +++ /dev/null @@ -1,647 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface NoRestrictedImportPathCommonOptions { - name: string; - message?: string; -} - -export type EitherImportNamesOrAllowImportName = - | { importNames?: string[]; allowImportNames?: never } - | { allowImportNames?: string[]; importNames?: never } - -export type ValidNoRestrictedImportPathOptions = NoRestrictedImportPathCommonOptions & EitherImportNamesOrAllowImportName; - -export interface NoRestrictedImportPatternCommonOptions { - message?: string; - caseSensitive?: boolean; -} - -// Base type for group or regex constraint, ensuring mutual exclusivity -export type EitherGroupOrRegEx = - | { group: string[]; regex?: never } - | { regex: string; group?: never }; - -// Base type for import name specifiers, ensuring mutual exclusivity -export type EitherNameSpecifiers = - | { importNames: string[]; allowImportNames?: never; importNamePattern?: never; allowImportNamePattern?: never } - | { importNamePattern: string; allowImportNames?: never; importNames?: never; allowImportNamePattern?: never } - | { allowImportNames: string[]; importNames?: never; importNamePattern?: never; allowImportNamePattern?: never } - | { allowImportNamePattern: string; importNames?: never; allowImportNames?: never; importNamePattern?: never } - -// Adds oneOf and not constraints, ensuring group or regex are present and mutually exclusive sets for importNames, allowImportNames, etc., as per the schema. -export type ValidNoRestrictedImportPatternOptions = NoRestrictedImportPatternCommonOptions & EitherGroupOrRegEx & EitherNameSpecifiers; - -export interface ECMAScript6 extends Linter.RulesRecord { - /** - * Rule to require braces around arrow function bodies. - * - * @since 1.8.0 - * @see https://eslint.org/docs/rules/arrow-body-style - */ - "arrow-body-style": - | Linter.RuleEntry< - [ - "as-needed", - Partial<{ - /** - * @default false - */ - requireReturnForObjectLiteral: boolean; - }>, - ] - > - | Linter.RuleEntry<["always" | "never"]>; - - /** - * Rule to require parentheses around arrow function arguments. - * - * @since 1.0.0-rc-1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/arrow-parens) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/arrow-parens - */ - "arrow-parens": - | Linter.RuleEntry<["always"]> - | Linter.RuleEntry< - [ - "as-needed", - Partial<{ - /** - * @default false - */ - requireForBlockBody: boolean; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing before and after the arrow in arrow functions. - * - * @since 1.0.0-rc-1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/arrow-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/arrow-spacing - */ - "arrow-spacing": Linter.RuleEntry<[]>; - - /** - * Rule to require `super()` calls in constructors. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.24.0 - * @see https://eslint.org/docs/rules/constructor-super - */ - "constructor-super": Linter.RuleEntry<[]>; - - /** - * Rule to enforce consistent spacing around `*` operators in generator functions. - * - * @since 0.17.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/generator-star-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/generator-star-spacing - */ - "generator-star-spacing": Linter.RuleEntry< - [ - | Partial<{ - before: boolean; - after: boolean; - named: - | Partial<{ - before: boolean; - after: boolean; - }> - | "before" - | "after" - | "both" - | "neither"; - anonymous: - | Partial<{ - before: boolean; - after: boolean; - }> - | "before" - | "after" - | "both" - | "neither"; - method: - | Partial<{ - before: boolean; - after: boolean; - }> - | "before" - | "after" - | "both" - | "neither"; - }> - | "before" - | "after" - | "both" - | "neither", - ] - >; - - /** - * Require or disallow logical assignment operator shorthand. - * - * @since 8.24.0 - * @see https://eslint.org/docs/rules/logical-assignment-operators - */ - "logical-assignment-operators": - | Linter.RuleEntry< - [ - "always", - Partial<{ - /** - * @default false - */ - enforceForIfStatements: boolean; - }>, - ] - > - | Linter.RuleEntry<["never"]>; - - /** - * Rule to disallow reassigning class members. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/no-class-assign - */ - "no-class-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow arrow functions where they could be confused with comparisons. - * - * @since 2.0.0-alpha-2 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-confusing-arrow) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-confusing-arrow - */ - "no-confusing-arrow": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - allowParens: boolean; - }>, - ] - >; - - /** - * Rule to disallow reassigning `const` variables. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/no-const-assign - */ - "no-const-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow duplicate class members. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 1.2.0 - * @see https://eslint.org/docs/rules/no-dupe-class-members - */ - "no-dupe-class-members": Linter.RuleEntry<[]>; - - /** - * Rule to disallow duplicate module imports. - * - * @since 2.5.0 - * @see https://eslint.org/docs/rules/no-duplicate-imports - */ - "no-duplicate-imports": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - includeExports: boolean; - }>, - ] - >; - - /** - * Rule to disallow `new` operator with global non-constructor functions - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 8.27.0 - * @see https://eslint.org/docs/rules/no-new-native-nonconstructor - */ - "no-new-native-nonconstructor": Linter.RuleEntry<[]>; - - /** - * Rule to disallow specified names in exports. - * - * @since 7.0.0-alpha.0 - * @see https://eslint.org/docs/rules/no-restricted-exports - */ - "no-restricted-exports": Linter.RuleEntry< - [ - Partial<{ - /** - * @default [] - */ - restrictedNamedExports: string[]; - /** - * @since 9.3.0 - */ - restrictedNamedExportsPattern: string; - /** - * @since 8.33.0 - */ - restrictDefaultExports: Partial<{ - /** - * @default false - */ - direct: boolean; - /** - * @default false - */ - named: boolean; - /** - * @default false - */ - defaultFrom: boolean; - /** - * @default false - */ - namedFrom: boolean; - /** - * @default false - */ - namespaceFrom: boolean; - }>; - }>, - ] - >; - - /** - * Rule to disallow specified modules when loaded by `import`. - * - * @since 2.0.0-alpha-1 - * @see https://eslint.org/docs/rules/no-restricted-imports - */ - "no-restricted-imports": Linter.RuleEntry< - [ - ...Array< - | string - | ValidNoRestrictedImportPathOptions - | Partial<{ - paths: Array; - patterns: Array; - }> - > - ] - >; - - /** - * Rule to disallow `this`/`super` before calling `super()` in constructors. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.24.0 - * @see https://eslint.org/docs/rules/no-this-before-super - */ - "no-this-before-super": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary computed property keys in object literals. - * - * @since 2.9.0 - * @see https://eslint.org/docs/rules/no-useless-computed-key - */ - "no-useless-computed-key": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - enforceForClassMembers: boolean; - }>, - ] - >; - - /** - * Rule to disallow unnecessary constructors. - * - * @since 2.0.0-beta.1 - * @see https://eslint.org/docs/rules/no-useless-constructor - */ - "no-useless-constructor": Linter.RuleEntry<[]>; - - /** - * Rule to disallow renaming import, export, and destructured assignments to the same name. - * - * @since 2.11.0 - * @see https://eslint.org/docs/rules/no-useless-rename - */ - "no-useless-rename": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - ignoreImport: boolean; - /** - * @default false - */ - ignoreExport: boolean; - /** - * @default false - */ - ignoreDestructuring: boolean; - }>, - ] - >; - - /** - * Rule to require `let` or `const` instead of `var`. - * - * @since 0.12.0 - * @see https://eslint.org/docs/rules/no-var - */ - "no-var": Linter.RuleEntry<[]>; - - /** - * Rule to require or disallow method and property shorthand syntax for object literals. - * - * @since 0.20.0 - * @see https://eslint.org/docs/rules/object-shorthand - */ - "object-shorthand": - | Linter.RuleEntry< - [ - "always" | "methods", - Partial<{ - /** - * @default false - */ - avoidQuotes: boolean; - /** - * @default false - */ - ignoreConstructors: boolean; - /** - * @since 8.22.0 - */ - methodsIgnorePattern: string; - /** - * @default false - */ - avoidExplicitReturnArrows: boolean; - }>, - ] - > - | Linter.RuleEntry< - [ - "properties", - Partial<{ - /** - * @default false - */ - avoidQuotes: boolean; - }>, - ] - > - | Linter.RuleEntry<["never" | "consistent" | "consistent-as-needed"]>; - - /** - * Rule to require using arrow functions for callbacks. - * - * @since 1.2.0 - * @see https://eslint.org/docs/rules/prefer-arrow-callback - */ - "prefer-arrow-callback": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowNamedFunctions: boolean; - /** - * @default true - */ - allowUnboundThis: boolean; - }>, - ] - >; - - /** - * Rule to require `const` declarations for variables that are never reassigned after declared. - * - * @since 0.23.0 - * @see https://eslint.org/docs/rules/prefer-const - */ - "prefer-const": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 'any' - */ - destructuring: "any" | "all"; - /** - * @default false - */ - ignoreReadBeforeAssign: boolean; - }>, - ] - >; - - /** - * Rule to require destructuring from arrays and/or objects. - * - * @since 3.13.0 - * @see https://eslint.org/docs/rules/prefer-destructuring - */ - "prefer-destructuring": Linter.RuleEntry< - [ - Partial< - | { - VariableDeclarator: Partial<{ - array: boolean; - object: boolean; - }>; - AssignmentExpression: Partial<{ - array: boolean; - object: boolean; - }>; - } - | { - array: boolean; - object: boolean; - } - >, - Partial<{ - enforceForRenamedProperties: boolean; - }>, - ] - >; - - /** - * Disallow the use of `Math.pow` in favor of the `**` operator. - * - * @since 6.7.0 - * @see https://eslint.org/docs/latest/rules/prefer-exponentiation-operator - */ - "prefer-exponentiation-operator": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals. - * - * @since 3.5.0 - * @see https://eslint.org/docs/rules/prefer-numeric-literals - */ - "prefer-numeric-literals": Linter.RuleEntry<[]>; - - /** - * Rule to require rest parameters instead of `arguments`. - * - * @since 2.0.0-alpha-1 - * @see https://eslint.org/docs/rules/prefer-rest-params - */ - "prefer-rest-params": Linter.RuleEntry<[]>; - - /** - * Rule to require spread operators instead of `.apply()`. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/prefer-spread - */ - "prefer-spread": Linter.RuleEntry<[]>; - - /** - * Rule to require template literals instead of string concatenation. - * - * @since 1.2.0 - * @see https://eslint.org/docs/rules/prefer-template - */ - "prefer-template": Linter.RuleEntry<[]>; - - /** - * Rule to require generator functions to contain `yield`. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/require-yield - */ - "require-yield": Linter.RuleEntry<[]>; - - /** - * Rule to enforce spacing between rest and spread operators and their expressions. - * - * @since 2.12.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/rest-spread-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/rest-spread-spacing - */ - "rest-spread-spacing": Linter.RuleEntry<["never" | "always"]>; - - /** - * Rule to enforce sorted import declarations within modules. - * - * @since 2.0.0-beta.1 - * @see https://eslint.org/docs/rules/sort-imports - */ - "sort-imports": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - ignoreCase: boolean; - /** - * @default false - */ - ignoreDeclarationSort: boolean; - /** - * @default false - */ - ignoreMemberSort: boolean; - /** - * @default ['none', 'all', 'multiple', 'single'] - */ - memberSyntaxSortOrder: Array<"none" | "all" | "multiple" | "single">; - /** - * @default false - */ - allowSeparatedGroups: boolean; - }>, - ] - >; - - /** - * Rule to require symbol descriptions. - * - * @since 3.4.0 - * @see https://eslint.org/docs/rules/symbol-description - */ - "symbol-description": Linter.RuleEntry<[]>; - - /** - * Rule to require or disallow spacing around embedded expressions of template strings. - * - * @since 2.0.0-rc.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/template-curly-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/template-curly-spacing - */ - "template-curly-spacing": Linter.RuleEntry<["never" | "always"]>; - - /** - * Rule to require or disallow spacing around the `*` in `yield*` expressions. - * - * @since 2.0.0-alpha-1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/yield-star-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/yield-star-spacing - */ - "yield-star-spacing": Linter.RuleEntry< - [ - | Partial<{ - before: boolean; - after: boolean; - }> - | "before" - | "after" - | "both" - | "neither", - ] - >; -} diff --git a/node_modules/eslint/lib/types/rules/index.d.ts b/node_modules/eslint/lib/types/rules/index.d.ts deleted file mode 100644 index f29844f..0000000 --- a/node_modules/eslint/lib/types/rules/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - - -import { Linter } from "../index"; - -import { BestPractices } from "./best-practices"; -import { Deprecated } from "./deprecated"; -import { ECMAScript6 } from "./ecmascript-6"; -import { NodeJSAndCommonJS } from "./node-commonjs"; -import { PossibleErrors } from "./possible-errors"; -import { StrictMode } from "./strict-mode"; -import { StylisticIssues } from "./stylistic-issues"; -import { Variables } from "./variables"; - -export interface ESLintRules - extends - Linter.RulesRecord, - PossibleErrors, - BestPractices, - StrictMode, - Variables, - NodeJSAndCommonJS, - StylisticIssues, - ECMAScript6, - Deprecated { } diff --git a/node_modules/eslint/lib/types/rules/node-commonjs.d.ts b/node_modules/eslint/lib/types/rules/node-commonjs.d.ts deleted file mode 100644 index 7418b5f..0000000 --- a/node_modules/eslint/lib/types/rules/node-commonjs.d.ts +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface NodeJSAndCommonJS extends Linter.RulesRecord { - /** - * Rule to require `return` statements after callbacks. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/callback-return - */ - "callback-return": Linter.RuleEntry<[string[]]>; - - /** - * Rule to require `require()` calls to be placed at top-level module scope. - * - * @since 1.4.0 - * @see https://eslint.org/docs/rules/global-require - */ - "global-require": Linter.RuleEntry<[]>; - - /** - * Rule to require error handling in callbacks. - * - * @since 0.4.5 - * @see https://eslint.org/docs/rules/handle-callback-err - */ - "handle-callback-err": Linter.RuleEntry<[string]>; - - /** - * Rule to disallow use of the `Buffer()` constructor. - * - * @since 4.0.0-alpha.0 - * @see https://eslint.org/docs/rules/no-buffer-constructor - */ - "no-buffer-constructor": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `require` calls to be mixed with regular variable declarations. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-mixed-requires - */ - "no-mixed-requires": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - grouping: boolean; - /** - * @default false - */ - allowCall: boolean; - }>, - ] - >; - - /** - * Rule to disallow `new` operators with calls to `require`. - * - * @since 0.6.0 - * @see https://eslint.org/docs/rules/no-new-require - */ - "no-new-require": Linter.RuleEntry<[]>; - - /** - * Rule to disallow string concatenation when using `__dirname` and `__filename`. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-path-concat - */ - "no-path-concat": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `process.env`. - * - * @since 0.9.0 - * @see https://eslint.org/docs/rules/no-process-env - */ - "no-process-env": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `process.exit()`. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-process-exit - */ - "no-process-exit": Linter.RuleEntry<[]>; - - /** - * Rule to disallow specified modules when loaded by `require`. - * - * @since 0.6.0 - * @see https://eslint.org/docs/rules/no-restricted-modules - */ - "no-restricted-modules": Linter.RuleEntry< - [ - ...Array< - | string - | { - name: string; - message?: string | undefined; - } - | Partial<{ - paths: Array< - | string - | { - name: string; - message?: string | undefined; - } - >; - patterns: string[]; - }> - >, - ] - >; - - /** - * Rule to disallow synchronous methods. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-sync - */ - "no-sync": Linter.RuleEntry< - [ - { - /** - * @default false - */ - allowAtRootLevel: boolean; - }, - ] - >; -} diff --git a/node_modules/eslint/lib/types/rules/possible-errors.d.ts b/node_modules/eslint/lib/types/rules/possible-errors.d.ts deleted file mode 100644 index fac05e2..0000000 --- a/node_modules/eslint/lib/types/rules/possible-errors.d.ts +++ /dev/null @@ -1,653 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface PossibleErrors extends Linter.RulesRecord { - /** - * Rule to enforce `for` loop update clause moving the counter in the right direction. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 4.0.0-beta.0 - * @see https://eslint.org/docs/rules/for-direction - */ - "for-direction": Linter.RuleEntry<[]>; - - /** - * Rule to enforce `return` statements in getters. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 4.2.0 - * @see https://eslint.org/docs/rules/getter-return - */ - "getter-return": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowImplicit: boolean; - }>, - ] - >; - - /** - * Rule to disallow using an async function as a `Promise` executor. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 5.3.0 - * @see https://eslint.org/docs/rules/no-async-promise-executor - */ - "no-async-promise-executor": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `await` inside of loops. - * - * @since 3.12.0 - * @see https://eslint.org/docs/rules/no-await-in-loop - */ - "no-await-in-loop": Linter.RuleEntry<[]>; - - /** - * Rule to disallow comparing against `-0`. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 3.17.0 - * @see https://eslint.org/docs/rules/no-compare-neg-zero - */ - "no-compare-neg-zero": Linter.RuleEntry<[]>; - - /** - * Rule to disallow assignment operators in conditional statements. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-cond-assign - */ - "no-cond-assign": Linter.RuleEntry<["except-parens" | "always"]>; - - /** - * Rule to disallow the use of `console`. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/no-console - */ - "no-console": Linter.RuleEntry< - [ - Partial<{ - allow: Array; - }>, - ] - >; - - /** - * Rule to disallow constant expressions in conditions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.4.1 - * @see https://eslint.org/docs/rules/no-constant-condition - */ - "no-constant-condition": Linter.RuleEntry< - [ - { - /** - * @default true - */ - checkLoops: boolean; - }, - ] - >; - - /** - * Rule to disallow control characters in regular expressions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.1.0 - * @see https://eslint.org/docs/rules/no-control-regex - */ - "no-control-regex": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `debugger`. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/no-debugger - */ - "no-debugger": Linter.RuleEntry<[]>; - - /** - * Rule to disallow duplicate arguments in `function` definitions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.16.0 - * @see https://eslint.org/docs/rules/no-dupe-args - */ - "no-dupe-args": Linter.RuleEntry<[]>; - - /** - * Disallow duplicate conditions in if-else-if chains. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 6.7.0 - * @see https://eslint.org/docs/rules/no-dupe-else-if - */ - "no-dupe-else-if": Linter.RuleEntry<[]>; - - /** - * Rule to disallow duplicate keys in object literals. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-dupe-keys - */ - "no-dupe-keys": Linter.RuleEntry<[]>; - - /** - * Rule to disallow a duplicate case label. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.17.0 - * @see https://eslint.org/docs/rules/no-duplicate-case - */ - "no-duplicate-case": Linter.RuleEntry<[]>; - - /** - * Rule to disallow empty block statements. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/no-empty - */ - "no-empty": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowEmptyCatch: boolean; - }>, - ] - >; - - /** - * Rule to disallow empty character classes in regular expressions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.22.0 - * @see https://eslint.org/docs/rules/no-empty-character-class - */ - "no-empty-character-class": Linter.RuleEntry<[]>; - - /** - * Rule to disallow reassigning exceptions in `catch` clauses. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-ex-assign - */ - "no-ex-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unnecessary boolean casts. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-extra-boolean-cast - */ - "no-extra-boolean-cast": Linter.RuleEntry< - [ - | Partial<{ - /** - * @since 9.3.0 - * @default false - */ - enforceForInnerExpressions: boolean; - /** - * @deprecated - */ - enforceForLogicalOperands: never; - }> - | Partial<{ - /** - * @deprecated - * @since 7.0.0-alpha.2 - * @default false - */ - enforceForLogicalOperands: boolean; - enforceForInnerExpressions: never; - }>, - ] - >; - - /** - * Rule to disallow unnecessary parentheses. - * - * @since 0.1.4 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-extra-parens) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-extra-parens - */ - "no-extra-parens": - | Linter.RuleEntry< - [ - "all", - Partial<{ - /** - * @default true, - */ - conditionalAssign: boolean; - /** - * @default true - */ - returnAssign: boolean; - /** - * @default true - */ - nestedBinaryExpressions: boolean; - /** - * @default 'none' - */ - ignoreJSX: "none" | "all" | "multi-line" | "single-line"; - /** - * @default true - */ - enforceForArrowConditionals: boolean; - }>, - ] - > - | Linter.RuleEntry<["functions"]>; - - /** - * Rule to disallow unnecessary semicolons. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-extra-semi) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-extra-semi - */ - "no-extra-semi": Linter.RuleEntry<[]>; - - /** - * Rule to disallow reassigning `function` declarations. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-func-assign - */ - "no-func-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow variable or `function` declarations in nested blocks. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.6.0 - * @see https://eslint.org/docs/rules/no-inner-declarations - */ - "no-inner-declarations": Linter.RuleEntry<["functions" | "both"]>; - - /** - * Rule to disallow invalid regular expression strings in `RegExp` constructors. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.1.4 - * @see https://eslint.org/docs/rules/no-invalid-regexp - */ - "no-invalid-regexp": Linter.RuleEntry< - [ - Partial<{ - allowConstructorFlags: string[]; - }>, - ] - >; - - /** - * Rule to disallow irregular whitespace. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.9.0 - * @see https://eslint.org/docs/rules/no-irregular-whitespace - */ - "no-irregular-whitespace": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - skipStrings: boolean; - /** - * @default false - */ - skipComments: boolean; - /** - * @default false - */ - skipRegExps: boolean; - /** - * @default false - */ - skipTemplates: boolean; - }>, - ] - >; - - /** - * Disallow literal numbers that lose precision. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 7.1.0 - * @see https://eslint.org/docs/latest/rules/no-loss-of-precision - */ - "no-loss-of-precision": Linter.RuleEntry<[]>; - - /** - * Rule to disallow characters which are made with multiple code points in character class syntax. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 5.3.0 - * @see https://eslint.org/docs/rules/no-misleading-character-class - */ - "no-misleading-character-class": Linter.RuleEntry< - [ - Partial<{ - /** - * @since 9.3.0 - * @default false - */ - allowEscape: boolean; - }>, - ] - >; - - /** - * Rule to disallow calling global object properties as functions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-obj-calls - */ - "no-obj-calls": Linter.RuleEntry<[]>; - - /** - * Rule to disallow returning values from Promise executor functions. - * - * @since 7.3.0 - * @see https://eslint.org/docs/rules/no-promise-executor-return - */ - "no-promise-executor-return": Linter.RuleEntry<[ - { - /** - * @default false - */ - allowVoid?: boolean; - }, - ]>; - - /** - * Rule to disallow use of `Object.prototypes` builtins directly. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 2.11.0 - * @see https://eslint.org/docs/rules/no-prototype-builtins - */ - "no-prototype-builtins": Linter.RuleEntry<[]>; - - /** - * Rule to disallow multiple spaces in regular expressions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-regex-spaces - */ - "no-regex-spaces": Linter.RuleEntry<[]>; - - /** - * Rule to disallow sparse arrays. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-sparse-arrays - */ - "no-sparse-arrays": Linter.RuleEntry<[]>; - - /** - * Rule to disallow template literal placeholder syntax in regular strings. - * - * @since 3.3.0 - * @see https://eslint.org/docs/rules/no-template-curly-in-string - */ - "no-template-curly-in-string": Linter.RuleEntry<[]>; - - /** - * Rule to disallow confusing multiline expressions. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.24.0 - * @see https://eslint.org/docs/rules/no-unexpected-multiline - */ - "no-unexpected-multiline": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unreachable code after `return`, `throw`, `continue`, and `break` statements. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/no-unreachable - */ - "no-unreachable": Linter.RuleEntry<[]>; - - /** - * Disallow loops with a body that allows only one iteration. - * - * @since 7.3.0 - * @see https://eslint.org/docs/latest/rules/no-unreachable-loop - */ - "no-unreachable-loop": Linter.RuleEntry< - [ - Partial<{ - /** - * @default [] - */ - ignore: "WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement"; - }>, - ] - >; - - /** - * Rule to disallow control flow statements in `finally` blocks. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 2.9.0 - * @see https://eslint.org/docs/rules/no-unsafe-finally - */ - "no-unsafe-finally": Linter.RuleEntry<[]>; - - /** - * Rule to disallow negating the left operand of relational operators. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 3.3.0 - * @see https://eslint.org/docs/rules/no-unsafe-negation - */ - "no-unsafe-negation": Linter.RuleEntry< - [ - Partial<{ - /** - * @since 6.6.0 - * @default false - */ - enforceForOrderingRelations: boolean; - }>, - ] - >; - - /** - * Disallow use of optional chaining in contexts where the `undefined` value is not allowed. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 7.15.0 - * @see https://eslint.org/docs/rules/no-unsafe-optional-chaining - */ - "no-unsafe-optional-chaining": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - disallowArithmeticOperators: boolean; - }>, - ] - >; - - /** - * Rule to disallow assignments that can lead to race conditions due to usage of `await` or `yield`. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 5.3.0 - * @see https://eslint.org/docs/rules/require-atomic-updates - */ - "require-atomic-updates": Linter.RuleEntry< - [ - Partial<{ - /** - * @since 8.3.0 - * @default false - */ - allowProperties: boolean; - }>, - ] - >; - - /** - * Rule to require calls to `isNaN()` when checking for `NaN`. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/use-isnan - */ - "use-isnan": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - enforceForSwitchCase: boolean; - /** - * @default true - */ - enforceForIndexOf: boolean; - }>, - ] - >; - - /** - * Rule to enforce comparing `typeof` expressions against valid strings. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.5.0 - * @see https://eslint.org/docs/rules/valid-typeof - */ - "valid-typeof": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - requireStringLiterals: boolean; - }>, - ] - >; -} diff --git a/node_modules/eslint/lib/types/rules/strict-mode.d.ts b/node_modules/eslint/lib/types/rules/strict-mode.d.ts deleted file mode 100644 index 23bd9a9..0000000 --- a/node_modules/eslint/lib/types/rules/strict-mode.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface StrictMode extends Linter.RulesRecord { - /** - * Rule to require or disallow strict mode directives. - * - * @since 0.1.0 - * @see https://eslint.org/docs/rules/strict - */ - strict: Linter.RuleEntry<["safe" | "global" | "function" | "never"]>; -} diff --git a/node_modules/eslint/lib/types/rules/stylistic-issues.d.ts b/node_modules/eslint/lib/types/rules/stylistic-issues.d.ts deleted file mode 100644 index da0f082..0000000 --- a/node_modules/eslint/lib/types/rules/stylistic-issues.d.ts +++ /dev/null @@ -1,2037 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface StylisticIssues extends Linter.RulesRecord { - /** - * Rule to enforce linebreaks after opening and before closing array brackets. - * - * @since 4.0.0-alpha.1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/array-bracket-newline) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/array-bracket-newline - */ - "array-bracket-newline": Linter.RuleEntry< - [ - | "always" - | "never" - | "consistent" - | Partial<{ - /** - * @default true - */ - multiline: boolean; - /** - * @default null - */ - minItems: number | null; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing inside array brackets. - * - * @since 0.24.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/array-bracket-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/array-bracket-spacing - */ - "array-bracket-spacing": - | Linter.RuleEntry< - [ - "never", - Partial<{ - /** - * @default false - */ - singleValue: boolean; - /** - * @default false - */ - objectsInArrays: boolean; - /** - * @default false - */ - arraysInArrays: boolean; - }>, - ] - > - | Linter.RuleEntry< - [ - "always", - Partial<{ - /** - * @default true - */ - singleValue: boolean; - /** - * @default true - */ - objectsInArrays: boolean; - /** - * @default true - */ - arraysInArrays: boolean; - }>, - ] - >; - - /** - * Rule to enforce line breaks after each array element. - * - * @since 4.0.0-rc.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/array-element-newline) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/array-element-newline - */ - "array-element-newline": Linter.RuleEntry< - [ - | "always" - | "never" - | "consistent" - | Partial<{ - /** - * @default true - */ - multiline: boolean; - /** - * @default null - */ - minItems: number | null; - }>, - ] - >; - - /** - * Rule to disallow or enforce spaces inside of blocks after opening block and before closing block. - * - * @since 1.2.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/block-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/block-spacing - */ - "block-spacing": Linter.RuleEntry<["always" | "never"]>; - - /** - * Rule to enforce consistent brace style for blocks. - * - * @since 0.0.7 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/brace-style) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/brace-style - */ - "brace-style": Linter.RuleEntry< - [ - "1tbs" | "stroustrup" | "allman", - Partial<{ - /** - * @default false - */ - allowSingleLine: boolean; - }>, - ] - >; - - /** - * Rule to enforce camelcase naming convention. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/camelcase - */ - camelcase: Linter.RuleEntry< - [ - Partial<{ - /** - * @default 'always' - */ - properties: "always" | "never"; - /** - * @default false - */ - ignoreDestructuring: boolean; - /** - * @since 6.7.0 - * @default false - */ - ignoreImports: boolean; - /** - * @since 7.4.0 - * @default false - */ - ignoreGlobals: boolean; - /** - * @remarks - * Also accept for regular expression patterns - */ - allow: string[]; - }>, - ] - >; - - /** - * Rule to enforce or disallow capitalization of the first letter of a comment. - * - * @since 3.11.0 - * @see https://eslint.org/docs/rules/capitalized-comments - */ - "capitalized-comments": Linter.RuleEntry< - [ - "always" | "never", - Partial<{ - ignorePattern: string; - /** - * @default false - */ - ignoreInlineComments: boolean; - /** - * @default false - */ - ignoreConsecutiveComments: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow trailing commas. - * - * @since 0.16.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/comma-dangle) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/comma-dangle - */ - "comma-dangle": Linter.RuleEntry< - [ - | "never" - | "always" - | "always-multiline" - | "only-multiline" - | Partial<{ - /** - * @default 'never' - */ - arrays: "never" | "always" | "always-multiline" | "only-multiline"; - /** - * @default 'never' - */ - objects: "never" | "always" | "always-multiline" | "only-multiline"; - /** - * @default 'never' - */ - imports: "never" | "always" | "always-multiline" | "only-multiline"; - /** - * @default 'never' - */ - exports: "never" | "always" | "always-multiline" | "only-multiline"; - /** - * @default 'never' - */ - functions: "never" | "always" | "always-multiline" | "only-multiline"; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing before and after commas. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/comma-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/comma-spacing - */ - "comma-spacing": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - before: boolean; - /** - * @default true - */ - after: boolean; - }>, - ] - >; - - /** - * Rule to enforce consistent comma style. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/comma-style) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/comma-style - */ - "comma-style": Linter.RuleEntry< - [ - "last" | "first", - Partial<{ - exceptions: Record; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing inside computed property brackets. - * - * @since 0.23.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/computed-property-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/computed-property-spacing - */ - "computed-property-spacing": Linter.RuleEntry<["never" | "always"]>; - - /** - * Rule to enforce consistent naming when capturing the current execution context. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/consistent-this - */ - "consistent-this": Linter.RuleEntry<[...string[]]>; - - /** - * Rule to require or disallow newline at the end of files. - * - * @since 0.7.1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/eol-last) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/eol-last - */ - "eol-last": Linter.RuleEntry< - [ - "always" | "never", // | 'unix' | 'windows' - ] - >; - - /** - * Rule to require or disallow spacing between function identifiers and their invocations. - * - * @since 3.3.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/function-call-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/func-call-spacing - */ - "func-call-spacing": Linter.RuleEntry<["never" | "always"]>; - - /** - * Rule to require function names to match the name of the variable or property to which they are assigned. - * - * @since 3.8.0 - * @see https://eslint.org/docs/rules/func-name-matching - */ - "func-name-matching": - | Linter.RuleEntry< - [ - "always" | "never", - Partial<{ - /** - * @default false - */ - considerPropertyDescriptor: boolean; - /** - * @default false - */ - includeCommonJSModuleExports: boolean; - }>, - ] - > - | Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - considerPropertyDescriptor: boolean; - /** - * @default false - */ - includeCommonJSModuleExports: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow named `function` expressions. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/func-names - */ - "func-names": Linter.RuleEntry< - [ - "always" | "as-needed" | "never", - Partial<{ - generators: "always" | "as-needed" | "never"; - }>, - ] - >; - - /** - * Rule to enforce the consistent use of either `function` declarations or expressions. - * - * @since 0.2.0 - * @see https://eslint.org/docs/rules/func-style - */ - "func-style": Linter.RuleEntry< - [ - "expression" | "declaration", - Partial<{ - /** - * @default false - */ - allowArrowFunctions: boolean; - overrides: { - namedExports: "declaration" | "expression" | "ignore"; - } - }>, - ] - >; - - /** - * Rule to enforce consistent line breaks inside function parentheses. - * - * @since 4.6.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/function-paren-newline) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/function-paren-newline - */ - "function-paren-newline": Linter.RuleEntry< - [ - | "always" - | "never" - | "multiline" - | "multiline-arguments" - | "consistent" - | Partial<{ - minItems: number; - }>, - ] - >; - - /** - * Rule to disallow specified identifiers. - * - * @since 2.0.0-beta.2 - * @see https://eslint.org/docs/rules/id-blacklist - */ - "id-blacklist": Linter.RuleEntry<[...string[]]>; - - /** - * Rule to enforce minimum and maximum identifier lengths. - * - * @since 1.0.0 - * @see https://eslint.org/docs/rules/id-length - */ - "id-length": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 2 - */ - min: number; - /** - * @default Infinity - */ - max: number; - /** - * @default 'always' - */ - properties: "always" | "never"; - exceptions: string[]; - }>, - ] - >; - - /** - * Rule to require identifiers to match a specified regular expression. - * - * @since 1.0.0 - * @see https://eslint.org/docs/rules/id-match - */ - "id-match": Linter.RuleEntry< - [ - string, - Partial<{ - /** - * @default false - */ - properties: boolean; - /** - * @default false - */ - onlyDeclarations: boolean; - /** - * @default false - */ - ignoreDestructuring: boolean; - }>, - ] - >; - - /** - * Rule to enforce the location of arrow function bodies. - * - * @since 4.12.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/implicit-arrow-linebreak) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/implicit-arrow-linebreak - */ - "implicit-arrow-linebreak": Linter.RuleEntry<["beside" | "below"]>; - - /** - * Rule to enforce consistent indentation. - * - * @since 0.14.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/indent) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/indent - */ - indent: Linter.RuleEntry< - [ - number | "tab", - Partial<{ - /** - * @default 0 - */ - SwitchCase: number; - /** - * @default 1 - */ - VariableDeclarator: - | Partial<{ - /** - * @default 1 - */ - var: number | "first"; - /** - * @default 1 - */ - let: number | "first"; - /** - * @default 1 - */ - const: number | "first"; - }> - | number - | "first"; - /** - * @default 1 - */ - outerIIFEBody: number; - /** - * @default 1 - */ - MemberExpression: number | "off"; - /** - * @default { parameters: 1, body: 1 } - */ - FunctionDeclaration: Partial<{ - /** - * @default 1 - */ - parameters: number | "first" | "off"; - /** - * @default 1 - */ - body: number; - }>; - /** - * @default { parameters: 1, body: 1 } - */ - FunctionExpression: Partial<{ - /** - * @default 1 - */ - parameters: number | "first" | "off"; - /** - * @default 1 - */ - body: number; - }>; - /** - * @default { arguments: 1 } - */ - CallExpression: Partial<{ - /** - * @default 1 - */ - arguments: number | "first" | "off"; - }>; - /** - * @default 1 - */ - ArrayExpression: number | "first" | "off"; - /** - * @default 1 - */ - ObjectExpression: number | "first" | "off"; - /** - * @default 1 - */ - ImportDeclaration: number | "first" | "off"; - /** - * @default false - */ - flatTernaryExpressions: boolean; - ignoredNodes: string[]; - /** - * @default false - */ - ignoreComments: boolean; - }>, - ] - >; - - /** - * Rule to enforce the consistent use of either double or single quotes in JSX attributes. - * - * @since 1.4.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/jsx-quotes) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/jsx-quotes - */ - "jsx-quotes": Linter.RuleEntry<["prefer-double" | "prefer-single"]>; - - /** - * Rule to enforce consistent spacing between keys and values in object literal properties. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/key-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/key-spacing - */ - "key-spacing": Linter.RuleEntry< - [ - | Partial< - | { - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - align: - | Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'colon' - */ - on: "value" | "colon"; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - }> - | "value" - | "colon"; - } - | { - singleLine?: - | Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - }> - | undefined; - multiLine?: - | Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - align: - | Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'colon' - */ - on: "value" | "colon"; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - }> - | "value" - | "colon"; - }> - | undefined; - } - > - | { - align: Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'colon' - */ - on: "value" | "colon"; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - }>; - singleLine?: - | Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - }> - | undefined; - multiLine?: - | Partial<{ - /** - * @default false - */ - beforeColon: boolean; - /** - * @default true - */ - afterColon: boolean; - /** - * @default 'strict' - */ - mode: "strict" | "minimum"; - }> - | undefined; - }, - ] - >; - - /** - * Rule to enforce consistent spacing before and after keywords. - * - * @since 2.0.0-beta.1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/keyword-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/keyword-spacing - */ - "keyword-spacing": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - before: boolean; - /** - * @default true - */ - after: boolean; - overrides: Record< - string, - Partial<{ - before: boolean; - after: boolean; - }> - >; - }>, - ] - >; - - /** - * Rule to enforce position of line comments. - * - * @since 3.5.0 - * @deprecated since 9.3.0, please use the [corresponding rule](https://eslint.style/rules/js/line-comment-position) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/line-comment-position - */ - "line-comment-position": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 'above' - */ - position: "above" | "beside"; - ignorePattern: string; - /** - * @default true - */ - applyDefaultIgnorePatterns: boolean; - }>, - ] - >; - - /** - * Rule to enforce consistent linebreak style. - * - * @since 0.21.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/linebreak-style) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/linebreak-style - */ - "linebreak-style": Linter.RuleEntry<["unix" | "windows"]>; - - /** - * Rule to require empty lines around comments. - * - * @since 0.22.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/lines-around-comment) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/lines-around-comment - */ - "lines-around-comment": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - beforeBlockComment: boolean; - /** - * @default false - */ - afterBlockComment: boolean; - /** - * @default false - */ - beforeLineComment: boolean; - /** - * @default false - */ - afterLineComment: boolean; - /** - * @default false - */ - allowBlockStart: boolean; - /** - * @default false - */ - allowBlockEnd: boolean; - /** - * @default false - */ - allowObjectStart: boolean; - /** - * @default false - */ - allowObjectEnd: boolean; - /** - * @default false - */ - allowArrayStart: boolean; - /** - * @default false - */ - allowArrayEnd: boolean; - /** - * @default false - */ - allowClassStart: boolean; - /** - * @default false - */ - allowClassEnd: boolean; - ignorePattern: string; - /** - * @default true - */ - applyDefaultIgnorePatterns: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow an empty line between class members. - * - * @since 4.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/lines-between-class-members) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/lines-between-class-members - */ - "lines-between-class-members": Linter.RuleEntry< - [ - "always" | "never" | { - enforce: Array< - { - blankLine: "always" | "never"; - prev: "method" | "field" | "*"; - next: "method" | "field" | "*"; - } - > - }, - Partial<{ - /** - * @default false - */ - exceptAfterSingleLine: boolean; - }>, - ] - >; - - /** - * Rule to enforce a maximum depth that blocks can be nested. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/max-depth - */ - "max-depth": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 4 - */ - max: number; - }>, - ] - >; - - /** - * Rule to enforce a maximum line length. - * - * @since 0.0.9 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/max-len) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/max-len - */ - "max-len": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 80 - */ - code: number; - /** - * @default 4 - */ - tabWidth: number; - comments: number; - ignorePattern: string; - /** - * @default false - */ - ignoreComments: boolean; - /** - * @default false - */ - ignoreTrailingComments: boolean; - /** - * @default false - */ - ignoreUrls: boolean; - /** - * @default false - */ - ignoreStrings: boolean; - /** - * @default false - */ - ignoreTemplateLiterals: boolean; - /** - * @default false - */ - ignoreRegExpLiterals: boolean; - }>, - ] - >; - - /** - * Rule to enforce a maximum number of lines per file. - * - * @since 2.12.0 - * @see https://eslint.org/docs/rules/max-lines - */ - "max-lines": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 300 - */ - max: number; - /** - * @default false - */ - skipBlankLines: boolean; - /** - * @default false - */ - skipComments: boolean; - }> - | number, - ] - >; - - /** - * Rule to enforce a maximum number of line of code in a function. - * - * @since 5.0.0 - * @see https://eslint.org/docs/rules/max-lines-per-function - */ - "max-lines-per-function": Linter.RuleEntry< - [ - Partial<{ - /** - * @default 50 - */ - max: number; - /** - * @default false - */ - skipBlankLines: boolean; - /** - * @default false - */ - skipComments: boolean; - /** - * @default false - */ - IIFEs: boolean; - }>, - ] - >; - - /** - * Rule to enforce a maximum depth that callbacks can be nested. - * - * @since 0.2.0 - * @see https://eslint.org/docs/rules/max-nested-callbacks - */ - "max-nested-callbacks": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 10 - */ - max: number; - }> - | number, - ] - >; - - /** - * Rule to enforce a maximum number of parameters in function definitions. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/max-params - */ - "max-params": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 3 - */ - max: number; - }> - | number, - ] - >; - - /** - * Rule to enforce a maximum number of statements allowed in function blocks. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/max-statements - */ - "max-statements": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 10 - */ - max: number; - /** - * @default false - */ - ignoreTopLevelFunctions: boolean; - }> - | number, - ] - >; - - /** - * Rule to enforce a maximum number of statements allowed per line. - * - * @since 2.5.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/max-statements-per-line) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/max-statements-per-line - */ - "max-statements-per-line": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 1 - */ - max: number; - }> - | number, - ] - >; - - /** - * Rule to enforce a particular style for multiline comments. - * - * @since 4.10.0 - * @deprecated since 9.3.0, please use the [corresponding rule](https://eslint.style/rules/js/multiline-comment-style) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/multiline-comment-style - */ - "multiline-comment-style": Linter.RuleEntry<["starred-block" | "bare-block" | "separate-lines"]>; - - /** - * Rule to enforce newlines between operands of ternary expressions. - * - * @since 3.1.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/multiline-ternary) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/multiline-ternary - */ - "multiline-ternary": Linter.RuleEntry<["always" | "always-multiline" | "never"]>; - - /** - * Rule to require constructor names to begin with a capital letter. - * - * @since 0.0.3-0 - * @see https://eslint.org/docs/rules/new-cap - */ - "new-cap": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - newIsCap: boolean; - /** - * @default true - */ - capIsNew: boolean; - newIsCapExceptions: string[]; - newIsCapExceptionPattern: string; - capIsNewExceptions: string[]; - capIsNewExceptionPattern: string; - /** - * @default true - */ - properties: boolean; - }>, - ] - >; - - /** - * Rule to enforce or disallow parentheses when invoking a constructor with no arguments. - * - * @since 0.0.6 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/new-parens) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/new-parens - */ - "new-parens": Linter.RuleEntry<["always" | "never"]>; - - /** - * Rule to require a newline after each call in a method chain. - * - * @since 2.0.0-rc.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/newline-per-chained-call) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/newline-per-chained-call - */ - "newline-per-chained-call": Linter.RuleEntry< - [ - { - /** - * @default 2 - */ - ignoreChainWithDepth: number; - }, - ] - >; - - /** - * Rule to disallow `Array` constructors. - * - * @since 0.4.0 - * @see https://eslint.org/docs/rules/no-array-constructor - */ - "no-array-constructor": Linter.RuleEntry<[]>; - - /** - * Rule to disallow bitwise operators. - * - * @since 0.0.2 - * @see https://eslint.org/docs/rules/no-bitwise - */ - "no-bitwise": Linter.RuleEntry< - [ - Partial<{ - allow: string[]; - /** - * @default false - */ - int32Hint: boolean; - }>, - ] - >; - - /** - * Rule to disallow `continue` statements. - * - * @since 0.19.0 - * @see https://eslint.org/docs/rules/no-continue - */ - "no-continue": Linter.RuleEntry<[]>; - - /** - * Rule to disallow inline comments after code. - * - * @since 0.10.0 - * @see https://eslint.org/docs/rules/no-inline-comments - */ - "no-inline-comments": Linter.RuleEntry<[]>; - - /** - * Rule to disallow `if` statements as the only statement in `else` blocks. - * - * @since 0.6.0 - * @see https://eslint.org/docs/rules/no-lonely-if - */ - "no-lonely-if": Linter.RuleEntry<[]>; - - /** - * Rule to disallow mixed binary operators. - * - * @since 2.12.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-mixed-operators) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-mixed-operators - */ - "no-mixed-operators": Linter.RuleEntry< - [ - Partial<{ - /** - * @default - * [ - * ["+", "-", "*", "/", "%", "**"], - * ["&", "|", "^", "~", "<<", ">>", ">>>"], - * ["==", "!=", "===", "!==", ">", ">=", "<", "<="], - * ["&&", "||"], - * ["in", "instanceof"] - * ] - */ - groups: string[][]; - /** - * @default true - */ - allowSamePrecedence: boolean; - }>, - ] - >; - - /** - * Rule to disallow mixed spaces and tabs for indentation. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.7.1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-mixed-spaces-and-tabs) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-mixed-spaces-and-tabs - */ - "no-mixed-spaces-and-tabs": Linter.RuleEntry<["smart-tabs"]>; - - /** - * Rule to disallow use of chained assignment expressions. - * - * @since 3.14.0 - * @see https://eslint.org/docs/rules/no-multi-assign - */ - "no-multi-assign": Linter.RuleEntry<[]>; - - /** - * Rule to disallow multiple empty lines. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-multiple-empty-lines) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-multiple-empty-lines - */ - "no-multiple-empty-lines": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default 2 - */ - max: number; - maxEOF: number; - maxBOF: number; - }> - | number, - ] - >; - - /** - * Rule to disallow negated conditions. - * - * @since 1.6.0 - * @see https://eslint.org/docs/rules/no-negated-condition - */ - "no-negated-condition": Linter.RuleEntry<[]>; - - /** - * Rule to disallow nested ternary expressions. - * - * @since 0.2.0 - * @see https://eslint.org/docs/rules/no-nested-ternary - */ - "no-nested-ternary": Linter.RuleEntry<[]>; - - /** - * Rule to disallow calls to the `Object` constructor without an argument - * - * @since 8.50.0 - * @see https://eslint.org/docs/rules/no-object-constructor - */ - "no-object-constructor": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the unary operators `++` and `--`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-plusplus - */ - "no-plusplus": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowForLoopAfterthoughts: boolean; - }>, - ] - >; - - /** - * Rule to disallow specified syntax. - * - * @since 1.4.0 - * @see https://eslint.org/docs/rules/no-restricted-syntax - */ - "no-restricted-syntax": Linter.RuleEntry< - [ - ...Array< - | string - | { - selector: string; - message?: string | undefined; - } - >, - ] - >; - - /** - * Rule to disallow all tabs. - * - * @since 3.2.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-tabs) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-tabs - */ - "no-tabs": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowIndentationTabs: boolean; - }>, - ] - >; - - /** - * Rule to disallow ternary operators. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-ternary - */ - "no-ternary": Linter.RuleEntry<[]>; - - /** - * Rule to disallow trailing whitespace at the end of lines. - * - * @since 0.7.1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-trailing-spaces) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-trailing-spaces - */ - "no-trailing-spaces": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - skipBlankLines: boolean; - /** - * @default false - */ - ignoreComments: boolean; - }>, - ] - >; - - /** - * Rule to disallow dangling underscores in identifiers. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-underscore-dangle - */ - "no-underscore-dangle": Linter.RuleEntry< - [ - Partial<{ - allow: string[]; - /** - * @default false - */ - allowAfterThis: boolean; - /** - * @default false - */ - allowAfterSuper: boolean; - /** - * @since 6.7.0 - * @default false - */ - allowAfterThisConstructor: boolean; - /** - * @default false - */ - enforceInMethodNames: boolean; - /** - * @since 8.15.0 - * @default false - */ - enforceInClassFields: boolean; - /** - * @since 8.31.0 - * @default true - */ - allowInArrayDestructuring: boolean; - /** - * @since 8.31.0 - * @default true - */ - allowInObjectDestructuring: boolean; - /** - * @since 7.7.0 - * @default true - */ - allowFunctionParams: boolean; - }>, - ] - >; - - /** - * Rule to disallow ternary operators when simpler alternatives exist. - * - * @since 0.21.0 - * @see https://eslint.org/docs/rules/no-unneeded-ternary - */ - "no-unneeded-ternary": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - defaultAssignment: boolean; - }>, - ] - >; - - /** - * Rule to disallow whitespace before properties. - * - * @since 2.0.0-beta.1 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/no-whitespace-before-property) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/no-whitespace-before-property - */ - "no-whitespace-before-property": Linter.RuleEntry<[]>; - - /** - * Rule to enforce the location of single-line statements. - * - * @since 3.17.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/nonblock-statement-body-position) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/nonblock-statement-body-position - */ - "nonblock-statement-body-position": Linter.RuleEntry< - [ - "beside" | "below" | "any", - Partial<{ - overrides: Record; - }>, - ] - >; - - /** - * Rule to enforce consistent line breaks inside braces. - * - * @since 2.12.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/object-curly-newline) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/object-curly-newline - */ - "object-curly-newline": Linter.RuleEntry< - [ - | "always" - | "never" - | Partial<{ - /** - * @default false - */ - multiline: boolean; - minProperties: number; - /** - * @default true - */ - consistent: boolean; - }> - | Partial< - Record< - "ObjectExpression" | "ObjectPattern" | "ImportDeclaration" | "ExportDeclaration", - | "always" - | "never" - | Partial<{ - /** - * @default false - */ - multiline: boolean; - minProperties: number; - /** - * @default true - */ - consistent: boolean; - }> - > - >, - ] - >; - - /** - * Rule to enforce consistent spacing inside braces. - * - * @since 0.22.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/object-curly-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/object-curly-spacing - */ - "object-curly-spacing": - | Linter.RuleEntry< - [ - "never", - { - /** - * @default false - */ - arraysInObjects: boolean; - /** - * @default false - */ - objectsInObjects: boolean; - }, - ] - > - | Linter.RuleEntry< - [ - "always", - { - /** - * @default true - */ - arraysInObjects: boolean; - /** - * @default true - */ - objectsInObjects: boolean; - }, - ] - >; - - /** - * Rule to enforce placing object properties on separate lines. - * - * @since 2.10.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/object-property-newline) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/object-property-newline - */ - "object-property-newline": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - allowAllPropertiesOnSameLine: boolean; - }>, - ] - >; - - /** - * Rule to enforce variables to be declared either together or separately in functions. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/one-var - */ - "one-var": Linter.RuleEntry< - [ - | "always" - | "never" - | "consecutive" - | Partial< - { - /** - * @default false - */ - separateRequires: boolean; - } & Record<"var" | "let" | "const", "always" | "never" | "consecutive"> - > - | Partial>, - ] - >; - - /** - * Rule to require or disallow newlines around variable declarations. - * - * @since 2.0.0-beta.3 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/one-var-declaration-per-line) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/one-var-declaration-per-line - */ - "one-var-declaration-per-line": Linter.RuleEntry<["initializations" | "always"]>; - - /** - * Rule to require or disallow assignment operator shorthand where possible. - * - * @since 0.10.0 - * @see https://eslint.org/docs/rules/operator-assignment - */ - "operator-assignment": Linter.RuleEntry<["always" | "never"]>; - - /** - * Rule to enforce consistent linebreak style for operators. - * - * @since 0.19.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/operator-linebreak) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/operator-linebreak - */ - "operator-linebreak": Linter.RuleEntry< - [ - "after" | "before" | "none", - Partial<{ - overrides: Record; - }>, - ] - >; - - /** - * Rule to require or disallow padding within blocks. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/padded-blocks) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/padded-blocks - */ - "padded-blocks": Linter.RuleEntry< - [ - "always" | "never" | Partial>, - { - /** - * @default false - */ - allowSingleLineBlocks: boolean; - }, - ] - >; - - /** - * Rule to require or disallow padding lines between statements. - * - * @since 4.0.0-beta.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/padding-line-between-statements) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/padding-line-between-statements - */ - "padding-line-between-statements": Linter.RuleEntry< - [ - ...Array< - { - blankLine: "any" | "never" | "always"; - } & Record<"prev" | "next", string | string[]> - >, - ] - >; - - /** - * Rule to disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead. - * - * @since 5.0.0-alpha.3 - * @see https://eslint.org/docs/rules/prefer-object-spread - */ - "prefer-object-spread": Linter.RuleEntry<[]>; - - /** - * Rule to require quotes around object literal property names. - * - * @since 0.0.6 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/quote-props) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/quote-props - */ - "quote-props": - | Linter.RuleEntry<["always" | "consistent"]> - | Linter.RuleEntry< - [ - "as-needed", - Partial<{ - /** - * @default false - */ - keywords: boolean; - /** - * @default true - */ - unnecessary: boolean; - /** - * @default false - */ - numbers: boolean; - }>, - ] - > - | Linter.RuleEntry< - [ - "consistent-as-needed", - Partial<{ - /** - * @default false - */ - keywords: boolean; - }>, - ] - >; - - /** - * Rule to enforce the consistent use of either backticks, double, or single quotes. - * - * @since 0.0.7 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/quotes) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/quotes - */ - quotes: Linter.RuleEntry< - [ - "double" | "single" | "backtick", - Partial<{ - /** - * @default false - */ - avoidEscape: boolean; - /** - * @default false - */ - allowTemplateLiterals: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow semicolons instead of ASI. - * - * @since 0.0.6 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/semi) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/semi - */ - semi: - | Linter.RuleEntry< - [ - "always", - Partial<{ - /** - * @default false - */ - omitLastInOneLineBlock: boolean; - }>, - ] - > - | Linter.RuleEntry< - [ - "never", - Partial<{ - /** - * @default 'any' - */ - beforeStatementContinuationChars: "any" | "always" | "never"; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing before and after semicolons. - * - * @since 0.16.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/semi-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/semi-spacing - */ - "semi-spacing": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - before: boolean; - /** - * @default true - */ - after: boolean; - }>, - ] - >; - - /** - * Rule to enforce location of semicolons. - * - * @since 4.0.0-beta.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/semi-style) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/semi-style - */ - "semi-style": Linter.RuleEntry<["last" | "first"]>; - - /** - * Rule to require object keys to be sorted. - * - * @since 3.3.0 - * @see https://eslint.org/docs/rules/sort-keys - */ - "sort-keys": Linter.RuleEntry< - [ - "asc" | "desc", - Partial<{ - /** - * @default true - */ - caseSensitive: boolean; - /** - * @default 2 - */ - minKeys: number; - /** - * @default false - */ - natural: boolean; - /** - * @default false - */ - allowLineSeparatedGroups: boolean; - /** - * @default false - */ - ignoreComputedKeys: boolean; - }>, - ] - >; - - /** - * Rule to require variables within the same declaration block to be sorted. - * - * @since 0.2.0 - * @see https://eslint.org/docs/rules/sort-vars - */ - "sort-vars": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - ignoreCase: boolean; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing before blocks. - * - * @since 0.9.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/space-before-blocks) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/space-before-blocks - */ - "space-before-blocks": Linter.RuleEntry< - ["always" | "never" | Partial>] - >; - - /** - * Rule to enforce consistent spacing before `function` definition opening parenthesis. - * - * @since 0.18.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/space-before-function-paren) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/space-before-function-paren - */ - "space-before-function-paren": Linter.RuleEntry< - ["always" | "never" | Partial>] - >; - - /** - * Rule to enforce consistent spacing inside parentheses. - * - * @since 0.8.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/space-in-parens) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/space-in-parens - */ - "space-in-parens": Linter.RuleEntry< - [ - "never" | "always", - Partial<{ - exceptions: string[]; - }>, - ] - >; - - /** - * Rule to require spacing around infix operators. - * - * @since 0.2.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/space-infix-ops) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/space-infix-ops - */ - "space-infix-ops": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - int32Hint: boolean; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing before or after unary operators. - * - * @since 0.10.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/space-unary-ops) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/space-unary-ops - */ - "space-unary-ops": Linter.RuleEntry< - [ - Partial<{ - /** - * @default true - */ - words: boolean; - /** - * @default false - */ - nonwords: boolean; - overrides: Record; - }>, - ] - >; - - /** - * Rule to enforce consistent spacing after the `//` or `/*` in a comment. - * - * @since 0.23.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/spaced-comment) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/spaced-comment - */ - "spaced-comment": Linter.RuleEntry< - [ - "always" | "never", - { - exceptions: string[]; - markers: string[]; - line: { - exceptions: string[]; - markers: string[]; - }; - block: { - exceptions: string[]; - markers: string[]; - /** - * @default false - */ - balanced: boolean; - }; - }, - ] - >; - - /** - * Rule to enforce spacing around colons of switch statements. - * - * @since 4.0.0-beta.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/switch-colon-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/switch-colon-spacing - */ - "switch-colon-spacing": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - before: boolean; - /** - * @default true - */ - after: boolean; - }>, - ] - >; - - /** - * Rule to require or disallow spacing between template tags and their literals. - * - * @since 3.15.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/template-tag-spacing) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/template-tag-spacing - */ - "template-tag-spacing": Linter.RuleEntry<["never" | "always"]>; - - /** - * Rule to require or disallow Unicode byte order mark (BOM). - * - * @since 2.11.0 - * @see https://eslint.org/docs/rules/unicode-bom - */ - "unicode-bom": Linter.RuleEntry<["never" | "always"]>; - - /** - * Rule to require parenthesis around regex literals. - * - * @since 0.1.0 - * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/wrap-regex) in `@stylistic/eslint-plugin-js`. - * @see https://eslint.org/docs/rules/wrap-regex - */ - "wrap-regex": Linter.RuleEntry<[]>; -} diff --git a/node_modules/eslint/lib/types/rules/variables.d.ts b/node_modules/eslint/lib/types/rules/variables.d.ts deleted file mode 100644 index 0c1328a..0000000 --- a/node_modules/eslint/lib/types/rules/variables.d.ts +++ /dev/null @@ -1,234 +0,0 @@ -/** - * @fileoverview This file contains the rule types for ESLint. It was initially extracted - * from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - -import { Linter } from "../index"; - -export interface Variables extends Linter.RulesRecord { - /** - * Rule to require or disallow initialization in variable declarations. - * - * @since 1.0.0-rc-1 - * @see https://eslint.org/docs/rules/init-declarations - */ - "init-declarations": - | Linter.RuleEntry<["always"]> - | Linter.RuleEntry< - [ - "never", - Partial<{ - ignoreForLoopInit: boolean; - }>, - ] - >; - - /** - * Rule to disallow deleting variables. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-delete-var - */ - "no-delete-var": Linter.RuleEntry<[]>; - - /** - * Rule to disallow labels that share a name with a variable. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-label-var - */ - "no-label-var": Linter.RuleEntry<[]>; - - /** - * Rule to disallow specified global variables. - * - * @since 2.3.0 - * @see https://eslint.org/docs/rules/no-restricted-globals - */ - "no-restricted-globals": Linter.RuleEntry< - [ - ...Array< - | string - | { - name: string; - message?: string | undefined; - } - >, - ] - >; - - /** - * Rule to disallow variable declarations from shadowing variables declared in the outer scope. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-shadow - */ - "no-shadow": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - builtinGlobals: boolean; - /** - * @default 'functions' - */ - hoist: "functions" | "all" | "never"; - allow: string[]; - /** - * @since 8.10.0 - * @default false - */ - ignoreOnInitialization: boolean; - }>, - ] - >; - - /** - * Rule to disallow identifiers from shadowing restricted names. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.1.4 - * @see https://eslint.org/docs/rules/no-shadow-restricted-names - */ - "no-shadow-restricted-names": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of undeclared variables unless mentioned in `global` comments. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-undef - */ - "no-undef": Linter.RuleEntry< - [ - Partial<{ - /** - * @default false - */ - typeof: boolean; - }>, - ] - >; - - /** - * Rule to disallow initializing variables to `undefined`. - * - * @since 0.0.6 - * @see https://eslint.org/docs/rules/no-undef-init - */ - "no-undef-init": Linter.RuleEntry<[]>; - - /** - * Rule to disallow the use of `undefined` as an identifier. - * - * @since 0.7.1 - * @see https://eslint.org/docs/rules/no-undefined - */ - "no-undefined": Linter.RuleEntry<[]>; - - /** - * Rule to disallow unused variables. - * - * @remarks - * Recommended by ESLint, the rule was enabled in `eslint:recommended`. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-unused-vars - */ - "no-unused-vars": Linter.RuleEntry< - [ - | "all" - | "local" - | Partial<{ - /** - * @default 'all' - */ - vars: "all" | "local"; - varsIgnorePattern: string; - /** - * @default 'after-used' - */ - args: "after-used" | "all" | "none"; - /** - * @default false - */ - ignoreRestSiblings: boolean; - argsIgnorePattern: string; - /** - * @default 'all' - */ - caughtErrors: "none" | "all"; - caughtErrorsIgnorePattern: string; - destructuredArrayIgnorePattern: string; - /** - * @default false - */ - ignoreClassWithStaticInitBlock: boolean; - /** - * @default false - */ - reportUsedIgnorePattern: boolean; - }>, - ] - >; - - /** - * Rule to disallow the use of variables before they are defined. - * - * @since 0.0.9 - * @see https://eslint.org/docs/rules/no-use-before-define - */ - "no-use-before-define": Linter.RuleEntry< - [ - | Partial<{ - /** - * @default true - */ - functions: boolean; - /** - * @default true - */ - classes: boolean; - /** - * @default true - */ - variables: boolean; - /** - * @default false - */ - allowNamedExports: boolean; - }> - | "nofunc", - ] - >; -} diff --git a/node_modules/eslint/lib/types/universal.d.ts b/node_modules/eslint/lib/types/universal.d.ts deleted file mode 100644 index df4fdec..0000000 --- a/node_modules/eslint/lib/types/universal.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @fileoverview typings for "eslint/universal" module - * @author 唯然 - */ - -export { Linter } from "./index"; diff --git a/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts b/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts deleted file mode 100644 index 2600b72..0000000 --- a/node_modules/eslint/lib/types/use-at-your-own-risk.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @fileoverview This file contains the types for the use-at-your-own-risk - * entrypoint. It was initially extracted from the `@types/eslint` package. - */ - -/* - * MIT License - * Copyright (c) Microsoft Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE - */ - - -import { ESLint, Rule } from "./index.js"; - -/** @deprecated */ -export const builtinRules: Map; - -/** @deprecated */ -export class FileEnumerator { - constructor( - params?: { - cwd?: string; - configArrayFactory?: any; - extensions?: any; - globInputPaths?: boolean; - errorOnUnmatchedPattern?: boolean; - ignore?: boolean; - }, - ); - isTargetPath(filePath: string, providedConfig?: any): boolean; - iterateFiles( - patternOrPatterns: string | string[], - ): IterableIterator<{ config: any; filePath: string; ignored: boolean }>; -} - -export { /** @deprecated */ ESLint as FlatESLint }; - -/** @deprecated */ -export class LegacyESLint { - static configType: "eslintrc"; - - static readonly version: string; - - static outputFixes(results: ESLint.LintResult[]): Promise; - - static getErrorResults(results: ESLint.LintResult[]): ESLint.LintResult[]; - - constructor(options?: ESLint.LegacyOptions); - - lintFiles(patterns: string | string[]): Promise; - - lintText( - code: string, - options?: { filePath?: string | undefined; warnIgnored?: boolean | undefined }, - ): Promise; - - getRulesMetaForResults(results: ESLint.LintResult[]): ESLint.LintResultData["rulesMeta"]; - - hasFlag(flag: string): false; - - calculateConfigForFile(filePath: string): Promise; - - isPathIgnored(filePath: string): Promise; - - loadFormatter(nameOrPath?: string): Promise; -} - -/** @deprecated */ -export function shouldUseFlatConfig(): Promise; diff --git a/node_modules/eslint/lib/universal.js b/node_modules/eslint/lib/universal.js deleted file mode 100644 index 51bac58..0000000 --- a/node_modules/eslint/lib/universal.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @fileoverview exports for browsers - * @author 唯然 - */ - -"use strict"; - -const { Linter } = require("./linter/linter"); - -module.exports = { Linter }; diff --git a/node_modules/eslint/lib/unsupported-api.js b/node_modules/eslint/lib/unsupported-api.js deleted file mode 100644 index 1feb18f..0000000 --- a/node_modules/eslint/lib/unsupported-api.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @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"); -const { ESLint: FlatESLint, shouldUseFlatConfig } = require("./eslint/eslint"); -const { LegacyESLint } = require("./eslint/legacy-eslint"); -const builtinRules = require("./rules"); - -//----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = { - builtinRules, - FlatESLint, - shouldUseFlatConfig, - FileEnumerator, - LegacyESLint -}; diff --git a/node_modules/eslint/messages/all-files-ignored.js b/node_modules/eslint/messages/all-files-ignored.js deleted file mode 100644 index 70877a4..0000000 --- a/node_modules/eslint/messages/all-files-ignored.js +++ /dev/null @@ -1,16 +0,0 @@ -"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/all-matched-files-ignored.js b/node_modules/eslint/messages/all-matched-files-ignored.js deleted file mode 100644 index b568bec..0000000 --- a/node_modules/eslint/messages/all-matched-files-ignored.js +++ /dev/null @@ -1,21 +0,0 @@ -"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, explicitly list one or more of the files from this glob that you'd like to lint to see more details about why they are ignored. - - * If the file is ignored because of a matching ignore pattern, check global ignores in your config file. - https://eslint.org/docs/latest/use/configure/ignore - - * If the file is ignored because no matching configuration was supplied, check file patterns in your config file. - https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-arbitrary-extensions - - * If the file is ignored because it is located outside of the base path, change the location of your config file to be in a parent directory. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/config-file-missing.js b/node_modules/eslint/messages/config-file-missing.js deleted file mode 100644 index a416a87..0000000 --- a/node_modules/eslint/messages/config-file-missing.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; - -module.exports = function() { - return ` -ESLint couldn't find an eslint.config.(js|mjs|cjs) file. - -From ESLint v9.0.0, the default configuration file is now eslint.config.js. -If you are using a .eslintrc.* file, please follow the migration guide -to update your configuration file to the new format: - -https://eslint.org/docs/latest/use/configure/migration-guide - -If you still have problems after following the migration guide, please stop by -https://eslint.org/chat/help to chat with the team. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/eslintrc-incompat.js b/node_modules/eslint/messages/eslintrc-incompat.js deleted file mode 100644 index b89c39b..0000000 --- a/node_modules/eslint/messages/eslintrc-incompat.js +++ /dev/null @@ -1,119 +0,0 @@ -"use strict"; - -/* eslint consistent-return: 0 -- no default case */ - -const messages = { - - env: ` -A config object is using the "env" key, which is not supported in flat config system. - -Flat config uses "languageOptions.globals" to define global variables for your files. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options - -If you're not using "env" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - extends: ` -A config object is using the "extends" key, which is not supported in flat config system. - -Instead of "extends", you can include config objects that you'd like to extend from directly in the flat config array. - -If you're using "extends" in your config file, please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#predefined-and-shareable-configs - -If you're not using "extends" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - globals: ` -A config object is using the "globals" key, which is not supported in flat config system. - -Flat config uses "languageOptions.globals" to define global variables for your files. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options - -If you're not using "globals" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - ignorePatterns: ` -A config object is using the "ignorePatterns" key, which is not supported in flat config system. - -Flat config uses "ignores" to specify files to ignore. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files - -If you're not using "ignorePatterns" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - noInlineConfig: ` -A config object is using the "noInlineConfig" key, which is not supported in flat config system. - -Flat config uses "linterOptions.noInlineConfig" to specify files to ignore. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#linter-options -`, - - overrides: ` -A config object is using the "overrides" key, which is not supported in flat config system. - -Flat config is an array that acts like the eslintrc "overrides" array. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#glob-based-configs - -If you're not using "overrides" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - parser: ` -A config object is using the "parser" key, which is not supported in flat config system. - -Flat config uses "languageOptions.parser" to override the default parser. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#custom-parsers - -If you're not using "parser" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - parserOptions: ` -A config object is using the "parserOptions" key, which is not supported in flat config system. - -Flat config uses "languageOptions.parserOptions" to specify parser options. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#configuring-language-options - -If you're not using "parserOptions" directly (it may be coming from a plugin), please see the following: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`, - - reportUnusedDisableDirectives: ` -A config object is using the "reportUnusedDisableDirectives" key, which is not supported in flat config system. - -Flat config uses "linterOptions.reportUnusedDisableDirectives" to specify files to ignore. - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#linter-options -`, - - root: ` -A config object is using the "root" key, which is not supported in flat config system. - -Flat configs always act as if they are the root config file, so this key can be safely removed. -` -}; - -module.exports = function({ key }) { - - return messages[key].trim(); -}; diff --git a/node_modules/eslint/messages/eslintrc-plugins.js b/node_modules/eslint/messages/eslintrc-plugins.js deleted file mode 100644 index bb708c9..0000000 --- a/node_modules/eslint/messages/eslintrc-plugins.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -module.exports = function({ plugins }) { - - const isArrayOfStrings = typeof plugins[0] === "string"; - - return ` -A config object has a "plugins" key defined as an array${isArrayOfStrings ? " of strings" : ""}. - -Flat config requires "plugins" to be an object in this form: - - { - plugins: { - ${isArrayOfStrings && plugins[0] ? plugins[0] : "namespace"}: pluginObject - } - } - -Please see the following page for information on how to convert your config object into the correct format: -https://eslint.org/docs/latest/use/configure/migration-guide#importing-plugins-and-custom-parsers - -If you're using a shareable config that you cannot rewrite in flat config format, then use the compatibility utility: -https://eslint.org/docs/latest/use/configure/migration-guide#using-eslintrc-configs-in-flat-config -`; -}; diff --git a/node_modules/eslint/messages/extend-config-missing.js b/node_modules/eslint/messages/extend-config-missing.js deleted file mode 100644 index 5b3498f..0000000 --- a/node_modules/eslint/messages/extend-config-missing.js +++ /dev/null @@ -1,13 +0,0 @@ -"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 deleted file mode 100644 index e7c6cb5..0000000 --- a/node_modules/eslint/messages/failed-to-read-json.js +++ /dev/null @@ -1,11 +0,0 @@ -"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 deleted file mode 100644 index 1a62fcf..0000000 --- a/node_modules/eslint/messages/file-not-found.js +++ /dev/null @@ -1,10 +0,0 @@ -"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/invalid-rule-options.js b/node_modules/eslint/messages/invalid-rule-options.js deleted file mode 100644 index 9a8acc9..0000000 --- a/node_modules/eslint/messages/invalid-rule-options.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -const { stringifyValueForError } = require("./shared"); - -module.exports = function({ ruleId, value }) { - return ` -Configuration for rule "${ruleId}" is invalid. Each rule must have a severity ("off", 0, "warn", 1, "error", or 2) and may be followed by additional options for the rule. - -You passed '${stringifyValueForError(value, 4)}', which doesn't contain a valid severity. - -If you're attempting to configure rule options, perhaps you meant: - - "${ruleId}": ["error", ${stringifyValueForError(value, 8)}] - -See https://eslint.org/docs/latest/use/configure/rules#using-configuration-files for configuring rules. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/invalid-rule-severity.js b/node_modules/eslint/messages/invalid-rule-severity.js deleted file mode 100644 index 3f13183..0000000 --- a/node_modules/eslint/messages/invalid-rule-severity.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -const { stringifyValueForError } = require("./shared"); - -module.exports = function({ ruleId, value }) { - return ` -Configuration for rule "${ruleId}" is invalid. Expected severity of "off", 0, "warn", 1, "error", or 2. - -You passed '${stringifyValueForError(value, 4)}'. - -See https://eslint.org/docs/latest/use/configure/rules#using-configuration-files for configuring rules. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/no-config-found.js b/node_modules/eslint/messages/no-config-found.js deleted file mode 100644 index 64b93ed..0000000 --- a/node_modules/eslint/messages/no-config-found.js +++ /dev/null @@ -1,15 +0,0 @@ -"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@latest - -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 Discord server: https://eslint.org/chat -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/plugin-conflict.js b/node_modules/eslint/messages/plugin-conflict.js deleted file mode 100644 index 4113a53..0000000 --- a/node_modules/eslint/messages/plugin-conflict.js +++ /dev/null @@ -1,22 +0,0 @@ -"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 see https://eslint.org/docs/latest/use/troubleshooting. -`; - - return result; -}; diff --git a/node_modules/eslint/messages/plugin-invalid.js b/node_modules/eslint/messages/plugin-invalid.js deleted file mode 100644 index 4c60e41..0000000 --- a/node_modules/eslint/messages/plugin-invalid.js +++ /dev/null @@ -1,16 +0,0 @@ -"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 see https://eslint.org/docs/latest/use/troubleshooting. -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/plugin-missing.js b/node_modules/eslint/messages/plugin-missing.js deleted file mode 100644 index 366ec45..0000000 --- a/node_modules/eslint/messages/plugin-missing.js +++ /dev/null @@ -1,19 +0,0 @@ -"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 see https://eslint.org/docs/latest/use/troubleshooting. -`.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 deleted file mode 100644 index 4559c8d..0000000 --- a/node_modules/eslint/messages/print-config-with-directory-path.js +++ /dev/null @@ -1,8 +0,0 @@ -"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/latest/use/command-line-interface#--print-config -`.trimStart(); -}; diff --git a/node_modules/eslint/messages/shared.js b/node_modules/eslint/messages/shared.js deleted file mode 100644 index 8c6e9b9..0000000 --- a/node_modules/eslint/messages/shared.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @fileoverview Shared utilities for error messages. - * @author Josh Goldberg - */ - -"use strict"; - -/** - * Converts a value to a string that may be printed in errors. - * @param {any} value The invalid value. - * @param {number} indentation How many spaces to indent - * @returns {string} The value, stringified. - */ -function stringifyValueForError(value, indentation) { - return value ? JSON.stringify(value, null, 4).replace(/\n/gu, `\n${" ".repeat(indentation)}`) : `${value}`; -} - -module.exports = { stringifyValueForError }; diff --git a/node_modules/eslint/messages/whitespace-found.js b/node_modules/eslint/messages/whitespace-found.js deleted file mode 100644 index 8a801bc..0000000 --- a/node_modules/eslint/messages/whitespace-found.js +++ /dev/null @@ -1,11 +0,0 @@ -"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/chalk/index.d.ts b/node_modules/eslint/node_modules/chalk/index.d.ts deleted file mode 100644 index 9cd88f3..0000000 --- a/node_modules/eslint/node_modules/chalk/index.d.ts +++ /dev/null @@ -1,415 +0,0 @@ -/** -Basic foreground colors. - -[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) -*/ -declare type ForegroundColor = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray' - | 'grey' - | 'blackBright' - | 'redBright' - | 'greenBright' - | 'yellowBright' - | 'blueBright' - | 'magentaBright' - | 'cyanBright' - | 'whiteBright'; - -/** -Basic background colors. - -[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) -*/ -declare type BackgroundColor = - | 'bgBlack' - | 'bgRed' - | 'bgGreen' - | 'bgYellow' - | 'bgBlue' - | 'bgMagenta' - | 'bgCyan' - | 'bgWhite' - | 'bgGray' - | 'bgGrey' - | 'bgBlackBright' - | 'bgRedBright' - | 'bgGreenBright' - | 'bgYellowBright' - | 'bgBlueBright' - | 'bgMagentaBright' - | 'bgCyanBright' - | 'bgWhiteBright'; - -/** -Basic colors. - -[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) -*/ -declare type Color = ForegroundColor | BackgroundColor; - -declare type Modifiers = - | 'reset' - | 'bold' - | 'dim' - | 'italic' - | 'underline' - | 'inverse' - | 'hidden' - | 'strikethrough' - | 'visible'; - -declare namespace chalk { - /** - Levels: - - `0` - All colors disabled. - - `1` - Basic 16 colors support. - - `2` - ANSI 256 colors support. - - `3` - Truecolor 16 million colors support. - */ - type Level = 0 | 1 | 2 | 3; - - interface Options { - /** - Specify the color support for Chalk. - - By default, color support is automatically detected based on the environment. - - Levels: - - `0` - All colors disabled. - - `1` - Basic 16 colors support. - - `2` - ANSI 256 colors support. - - `3` - Truecolor 16 million colors support. - */ - level?: Level; - } - - /** - Return a new Chalk instance. - */ - type Instance = new (options?: Options) => Chalk; - - /** - Detect whether the terminal supports color. - */ - interface ColorSupport { - /** - The color level used by Chalk. - */ - level: Level; - - /** - Return whether Chalk supports basic 16 colors. - */ - hasBasic: boolean; - - /** - Return whether Chalk supports ANSI 256 colors. - */ - has256: boolean; - - /** - Return whether Chalk supports Truecolor 16 million colors. - */ - has16m: boolean; - } - - interface ChalkFunction { - /** - Use a template string. - - @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) - - @example - ``` - import chalk = require('chalk'); - - log(chalk` - CPU: {red ${cpu.totalPercent}%} - RAM: {green ${ram.used / ram.total * 100}%} - DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} - `); - ``` - - @example - ``` - import chalk = require('chalk'); - - log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`) - ``` - */ - (text: TemplateStringsArray, ...placeholders: unknown[]): string; - - (...text: unknown[]): string; - } - - interface Chalk extends ChalkFunction { - /** - Return a new Chalk instance. - */ - Instance: Instance; - - /** - The color support for Chalk. - - By default, color support is automatically detected based on the environment. - - Levels: - - `0` - All colors disabled. - - `1` - Basic 16 colors support. - - `2` - ANSI 256 colors support. - - `3` - Truecolor 16 million colors support. - */ - level: Level; - - /** - Use HEX value to set text color. - - @param color - Hexadecimal value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.hex('#DEADED'); - ``` - */ - hex(color: string): Chalk; - - /** - Use keyword color value to set text color. - - @param color - Keyword value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.keyword('orange'); - ``` - */ - keyword(color: string): Chalk; - - /** - Use RGB values to set text color. - */ - rgb(red: number, green: number, blue: number): Chalk; - - /** - Use HSL values to set text color. - */ - hsl(hue: number, saturation: number, lightness: number): Chalk; - - /** - Use HSV values to set text color. - */ - hsv(hue: number, saturation: number, value: number): Chalk; - - /** - Use HWB values to set text color. - */ - hwb(hue: number, whiteness: number, blackness: number): Chalk; - - /** - Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. - - 30 <= code && code < 38 || 90 <= code && code < 98 - For example, 31 for red, 91 for redBright. - */ - ansi(code: number): Chalk; - - /** - Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. - */ - ansi256(index: number): Chalk; - - /** - Use HEX value to set background color. - - @param color - Hexadecimal value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.bgHex('#DEADED'); - ``` - */ - bgHex(color: string): Chalk; - - /** - Use keyword color value to set background color. - - @param color - Keyword value representing the desired color. - - @example - ``` - import chalk = require('chalk'); - - chalk.bgKeyword('orange'); - ``` - */ - bgKeyword(color: string): Chalk; - - /** - Use RGB values to set background color. - */ - bgRgb(red: number, green: number, blue: number): Chalk; - - /** - Use HSL values to set background color. - */ - bgHsl(hue: number, saturation: number, lightness: number): Chalk; - - /** - Use HSV values to set background color. - */ - bgHsv(hue: number, saturation: number, value: number): Chalk; - - /** - Use HWB values to set background color. - */ - bgHwb(hue: number, whiteness: number, blackness: number): Chalk; - - /** - Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. - - 30 <= code && code < 38 || 90 <= code && code < 98 - For example, 31 for red, 91 for redBright. - Use the foreground code, not the background code (for example, not 41, nor 101). - */ - bgAnsi(code: number): Chalk; - - /** - Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. - */ - bgAnsi256(index: number): Chalk; - - /** - Modifier: Resets the current color chain. - */ - readonly reset: Chalk; - - /** - Modifier: Make text bold. - */ - readonly bold: Chalk; - - /** - Modifier: Emitting only a small amount of light. - */ - readonly dim: Chalk; - - /** - Modifier: Make text italic. (Not widely supported) - */ - readonly italic: Chalk; - - /** - Modifier: Make text underline. (Not widely supported) - */ - readonly underline: Chalk; - - /** - Modifier: Inverse background and foreground colors. - */ - readonly inverse: Chalk; - - /** - Modifier: Prints the text, but makes it invisible. - */ - readonly hidden: Chalk; - - /** - Modifier: Puts a horizontal line through the center of the text. (Not widely supported) - */ - readonly strikethrough: Chalk; - - /** - Modifier: Prints the text only when Chalk has a color support level > 0. - Can be useful for things that are purely cosmetic. - */ - readonly visible: Chalk; - - readonly black: Chalk; - readonly red: Chalk; - readonly green: Chalk; - readonly yellow: Chalk; - readonly blue: Chalk; - readonly magenta: Chalk; - readonly cyan: Chalk; - readonly white: Chalk; - - /* - Alias for `blackBright`. - */ - readonly gray: Chalk; - - /* - Alias for `blackBright`. - */ - readonly grey: Chalk; - - readonly blackBright: Chalk; - readonly redBright: Chalk; - readonly greenBright: Chalk; - readonly yellowBright: Chalk; - readonly blueBright: Chalk; - readonly magentaBright: Chalk; - readonly cyanBright: Chalk; - readonly whiteBright: Chalk; - - readonly bgBlack: Chalk; - readonly bgRed: Chalk; - readonly bgGreen: Chalk; - readonly bgYellow: Chalk; - readonly bgBlue: Chalk; - readonly bgMagenta: Chalk; - readonly bgCyan: Chalk; - readonly bgWhite: Chalk; - - /* - Alias for `bgBlackBright`. - */ - readonly bgGray: Chalk; - - /* - Alias for `bgBlackBright`. - */ - readonly bgGrey: Chalk; - - readonly bgBlackBright: Chalk; - readonly bgRedBright: Chalk; - readonly bgGreenBright: Chalk; - readonly bgYellowBright: Chalk; - readonly bgBlueBright: Chalk; - readonly bgMagentaBright: Chalk; - readonly bgCyanBright: Chalk; - readonly bgWhiteBright: Chalk; - } -} - -/** -Main Chalk object that allows to chain styles together. -Call the last one as a method with a string argument. -Order doesn't matter, and later styles take precedent in case of a conflict. -This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. -*/ -declare const chalk: chalk.Chalk & chalk.ChalkFunction & { - supportsColor: chalk.ColorSupport | false; - Level: chalk.Level; - Color: Color; - ForegroundColor: ForegroundColor; - BackgroundColor: BackgroundColor; - Modifiers: Modifiers; - stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false}; -}; - -export = chalk; diff --git a/node_modules/eslint/node_modules/chalk/license b/node_modules/eslint/node_modules/chalk/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/eslint/node_modules/chalk/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/eslint/node_modules/chalk/package.json b/node_modules/eslint/node_modules/chalk/package.json deleted file mode 100644 index 47c23f2..0000000 --- a/node_modules/eslint/node_modules/chalk/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "chalk", - "version": "4.1.2", - "description": "Terminal string styling done right", - "license": "MIT", - "repository": "chalk/chalk", - "funding": "https://github.com/chalk/chalk?sponsor=1", - "main": "source", - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && nyc ava && tsd", - "bench": "matcha benchmark.js" - }, - "files": [ - "source", - "index.d.ts" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "str", - "ansi", - "style", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "devDependencies": { - "ava": "^2.4.0", - "coveralls": "^3.0.7", - "execa": "^4.0.0", - "import-fresh": "^3.1.0", - "matcha": "^0.7.0", - "nyc": "^15.0.0", - "resolve-from": "^5.0.0", - "tsd": "^0.7.4", - "xo": "^0.28.2" - }, - "xo": { - "rules": { - "unicorn/prefer-string-slice": "off", - "unicorn/prefer-includes": "off", - "@typescript-eslint/member-ordering": "off", - "no-redeclare": "off", - "unicorn/string-content": "off", - "unicorn/better-regex": "off" - } - } -} diff --git a/node_modules/eslint/node_modules/chalk/readme.md b/node_modules/eslint/node_modules/chalk/readme.md deleted file mode 100644 index a055d21..0000000 --- a/node_modules/eslint/node_modules/chalk/readme.md +++ /dev/null @@ -1,341 +0,0 @@ -

-
-
- Chalk -
-
-
-

- -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk) - - - -
- ---- - - - ---- - -
- -## Highlights - -- Expressive API -- Highly performant -- Ability to nest styles -- [256/Truecolor color support](#256-and-truecolor-color-support) -- Auto-detects color support -- Doesn't extend `String.prototype` -- Clean and focused -- Actively maintained -- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020 - -## Install - -```console -$ npm install chalk -``` - -## Usage - -```js -const chalk = require('chalk'); - -console.log(chalk.blue('Hello world!')); -``` - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -const chalk = require('chalk'); -const log = console.log; - -// Combine styled and normal strings -log(chalk.blue('Hello') + ' World' + chalk.red('!')); - -// Compose multiple styles using the chainable API -log(chalk.blue.bgRed.bold('Hello world!')); - -// Pass in multiple arguments -log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz')); - -// Nest styles -log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!')); - -// Nest styles of the same type even (color, underline, background) -log(chalk.green( - 'I am a green line ' + - chalk.blue.underline.bold('with a blue substring') + - ' that becomes green again!' -)); - -// ES2015 template literal -log(` -CPU: ${chalk.red('90%')} -RAM: ${chalk.green('40%')} -DISK: ${chalk.yellow('70%')} -`); - -// ES2015 tagged template literal -log(chalk` -CPU: {red ${cpu.totalPercent}%} -RAM: {green ${ram.used / ram.total * 100}%} -DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} -`); - -// Use RGB colors in terminal emulators that support it. -log(chalk.keyword('orange')('Yay for orange colored text!')); -log(chalk.rgb(123, 45, 67).underline('Underlined reddish color')); -log(chalk.hex('#DEADED').bold('Bold gray!')); -``` - -Easily define your own themes: - -```js -const chalk = require('chalk'); - -const error = chalk.bold.red; -const warning = chalk.keyword('orange'); - -console.log(error('Error!')); -console.log(warning('Warning!')); -``` - -Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args): - -```js -const name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> 'Hello Sindre' -``` - -## API - -### chalk.` - -
-
<
-
-
 
-
 
-
 
-
-
 
-
- ?
-
>
-
- - - - - - - - - - - - -
-
-
Link to ARC home page.
- - -
-
- -
- - - - -
- -
- - -

County Economic Status in Appalachia, FY 2004

- - - (Effective October 1, 2003 through September 30, 2004) -

Each fiscal year the Appalachian Regional Commission classifies -the Regions counties into one of four economic levels based on a -comparison of county and national rates for three economic indicators: -three-year average unemployment rates, per-capita market income rates, -and poverty rates. See the methodology for a description of each -economic level.

- - - -
- -
- This maps shows ARCs economic classification of the 410 counties in the Appalachian Region for FY 2004 (October 1, 2003 through September 30, 2004). Ninety-one counties are classified as distressed, 289 are classified as transitional, 22 are classified as competitive, and 8 are classified as attainment. For a list of county classifications, see the downloadable Excel file. -
- - - -
-
- - - -
-
-
-
- - -
- - - - - - - - - - -
 
- - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/needle/test/files/tomcat_charset.html b/node_modules/needle/test/files/tomcat_charset.html deleted file mode 100644 index f849f7c..0000000 --- a/node_modules/needle/test/files/tomcat_charset.html +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - - - - - - - - - -TomcatUTF-8/EUCȤ - - - - - - -
The Wayback Machine - https://web.archive.org/web/20181003202907/http://www.nina.jp:80/server/slackware/webapp/tomcat_charset.html
- - -

TomcatUTF-8/EUC-JPȤ

-

-[Фμ¸ Slackware] -

-

- : 2004/12/31 -

-
-

-"Фμ¸"θ - - - -

-
-
- -

-Tomcat֤륭饯åȤξϡhttpd.confΥ롼ȤǻꤷAddDefaultCharsetͤƱˤʤ餷 -Directoryǥ쥯ƥ֤ǻꤷAddDefaultCharset̵뤵äݤ -ĤǤˡmeta̵뤵ߤ -<---Τؤ󡢸ҤSetCharacterEncodingFilterưʤȤ⤢ꡢʤ... -

- -

-WEBФϥ롼ȤAddDefaultCharsetEUC-JP򤷤ƤꡢƥȥѥʲUTF-8ˤΤǡʤ餫к򤷤ʤʸƤޤ -

- -

֥åȤξ

-

-response.setContentTypeǥ饯åȤꤹ롣 -EUC-JPѤʤ顢response.setContentType("text/html; charset=EUC-JP") -UTF-8Ѥʤ顢response.setContentType("text/html; charset=UTF-8") -

-
-# HelloWorld.java
-
-import java.io.*;
-import java.text.*;
-import java.util.*;
-import javax.servlet.*;
-import javax.servlet.http.*;
-
-public class HelloWorld extends HttpServlet {
-
-    public void doGet(HttpServletRequest request,
-                      HttpServletResponse response)
-        throws IOException, ServletException
-    {
-        response.setContentType("text/html; charset=EUC-JP");
-        PrintWriter out = response.getWriter();
-
-        out.println("<html>");
-        out.println("<head>");
-        out.println("<title>HelloWorld</title>");
-        out.println("</head>");
-        out.println("<body>");
-        out.println("<p>");
-        out.println("ˤ");
-        out.println("</p>");
-        out.println("</body>");
-        out.println("</html>");
-    }
-}
-
-

-JAVAUTF-8ǽԤΤǡʳEUC-JPʤɤѤϡѥ뤹Ȥ-encodingĤ뤳ȡ -

-
-# javac -encoding EUC-JP -classpath .:$CATALINA_HOME/common/lib/servlet-api.jar HelloWorld.java
-
- -

JSPξ

-

-ǥ쥯ƥ֤ǥ饯åȤꤹ롣 -EUC-JPѤʤ顢<%@ page contentType="text/html; charset=EUC-JP" %> -UTF-8Ѥʤ顢<%@ page contentType="text/html; charset=UTF-8" %> -

-
-# hello.jsp
-
-<%@ page contentType="text/html; charset=EUC-JP" %>
-<html>
-<head>
-<title>HelloWorld</title>
-</head>
-<body>
-<p>
-<%
-    out.println("ˤ");
-%>
-</p>
-</body>
-</html>
-
- -

ŪƥġHTMLˤξ

-

-workers2.propetiesեǡƥȥѥʲΤ٤ƤΥեTomcatϤ褦ꤷƤ硢ŪƥĤˤĤƤ⤳ΥڡƬ˽񤤤褦ʥ饯åȾ֤롣 -HTMLmetacharsetꤷƤ̵뤵Τǡɥȥ롼Ȥȥƥȥѥǰۤʤ륭饯åȤѤȤդɬס -

-
-# workers2.properties
-
-[uri:/hoge/*]    <---٤ƤΥեTomcat˽
-
-

SetCharacterEncodingFilterѤΤʤΤ褦ɤäƤcharset֤Ƥʤ -ʤΤǡweb.xml<mime-mapping>charsetȳĥҤδϢդꤷ -

-
-<!--ʥƥȥѥ/WEB-INF/web.xml-->
-
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE web-app
-     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-    "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
-  <mime-mapping>
-    <extension>html</extension>
-    <mime-type>text/html; charset=UTF-8</mime-type>
-  </mime-mapping>
-</web-app>
-
-

-SetCharacterEncodingFilterѤˡ񤤤Ƥȡ$CATALINA_HOME/webapps/jsp-examples/WEB-INF/classes/filtersǥ쥯ȥˤSetCharacterEncodingFilter.java򥳥ѥ뤷ơ -

-
-# cd $CATALINA_HOME/webapps/jsp-examples/WEB-INF/classes
-# javac -classpath .:$CATALINA_HOME/common/lib/servlet-api.jar filters.SetCharacterEncodingFilter.java
-
-

-줿饹եʥƥȥѥ/WEB-INF/classes/filtersǥ쥯ȥ˥ԡơʥƥȥѥ/WEB-INF/web.xml˥ե륿򵭽Ҥ餷 -

-
-<!--ʥƥȥѥ/WEB-INF/web.xml-->
-
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE web-app
-     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-    "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
-  <filter>
-      <filter-name>Set Character Encoding</filter-name>
-      <filter-class>filters.SetCharacterEncodingFilter</filter-class>
-      <init-param>
-          <param-name>encoding</param-name>
-          <param-value>UTF-8</param-value>
-      </init-param>
-  </filter>
-  <filter-mapping>
-      <filter-name>Set Character Encoding</filter-name>
-      <url-pattern>/*</url-pattern>
-  </filter-mapping>
-</web-app>
-
-

-... -

- -
-

-[Фμ¸ Slackware] -

- - - - - \ No newline at end of file diff --git a/node_modules/needle/test/headers_spec.js b/node_modules/needle/test/headers_spec.js deleted file mode 100644 index 5ae6259..0000000 --- a/node_modules/needle/test/headers_spec.js +++ /dev/null @@ -1,320 +0,0 @@ -var http = require('http'), - helpers = require('./helpers'), - should = require('should'); - -var port = 54321; - - -describe('request headers', function() { - - var needle, - server, - existing_sockets, - original_defaultMaxSockets; - - before(function(done) { - setTimeout(function() { - existing_sockets = get_active_sockets().length; - server = helpers.server({ port: port }, done); - }, 100); - }) - - after(function(done) { - server.close(done); - }) - - function send_request(opts, cb) { - needle.get('http://localhost:' + port, opts, cb); - } - - function get_active_sockets() { - var handles = process._getActiveHandles(); - - return handles.filter(function(el) { - if (el.constructor.name.toString() == 'Socket') { - return el.destroyed !== true; - } - }) - } - - describe('old node versions (<0.11.4) with persistent keep-alive connections', function() { - - // emulate old node behaviour - before(function() { - delete require.cache[require.resolve('..')] // in case it was already loaded - original_defaultMaxSockets = http.Agent.defaultMaxSockets; - http.Agent.defaultMaxSockets = 5; - needle = require('..'); - }) - - after(function() { - http.Agent.defaultMaxSockets = original_defaultMaxSockets; - delete require.cache[require.resolve('..')] - }) - - describe('default options', function() { - - it('sends a Connection: close header', function(done) { - send_request({}, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({}, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10) - }); - }) - - }) - - describe('passing connection: close', function() { - - it('sends a Connection: close header', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10) - }); - }) - - }) - - describe('passing connection: keep-alive', function() { - - it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { - send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('sends a Connection: keep-alive header (using options.connection)', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('one open socket remain after request', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }); - }) - - }) - - }) - - describe('new node versions with smarter connection disposing', function() { - - before(function() { - delete require.cache[require.resolve('..')] - original_defaultMaxSockets = http.Agent.defaultMaxSockets; - http.Agent.defaultMaxSockets = Infinity; - needle = require('..'); - }) - - after(function() { - http.Agent.defaultMaxSockets = original_defaultMaxSockets; - delete require.cache[require.resolve('..')] - }) - - describe('default options', function() { - - var node_major_ver = process.version.split('.')[0].replace('v', ''); - - if (parseInt(node_major_ver) >= 4) { - - it('sets Connection header to close (> v4)', function(done) { - send_request({}, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done() - }) - }) - - } else { - - it('sets Connection header to keep-alive (< v4)', function(done) { - send_request({}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - } - - if (parseInt(node_major_ver) >= 14) { - - // TODO: figure out why this happens - it('two open sockets remains after request (>= v14)', function(done) { - send_request({}, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets + 2); - done(); - }); - }) - - } else if (parseInt(node_major_ver) >= 8 || parseInt(node_major_ver) == 0) { - - it('one open socket remains after request (> v8 && v0.10)', function(done) { - send_request({}, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }); - }) - - } else { - - it('no open sockets remain after request (> v0.10 && < v8)', function(done) { - send_request({}, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }); - }) - - } - - }) - - describe('passing connection: close', function() { - - it('sends a Connection: close header', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10); - }); - }) - - }) - - describe('passing connection: keep-alive', function() { - - it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { - send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('sends a Connection: keep-alive header (using options.connection)', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('one open socket remain after request', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }); - }) - - }) - - }) - - describe('using shared keep-alive agent', function() { - - before(function() { - needle.defaults({ agent: http.Agent({ keepAlive: true }) }) - }) - - after(function() { - needle.defaults().agent.destroy(); // close existing connections - needle.defaults({ agent: null }); // and reset default value - }) - - describe('default options', function() { - - it('sends a Connection: keep-alive header', function(done) { - send_request({}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('one open socket remain after request', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }, 10); - }); - }) - - }) - - describe('passing connection: close', function() { - - it('sends a Connection: close header', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - resp.body.headers['connection'].should.eql('close'); - done(); - }) - }) - - it('no open sockets remain after request', function(done) { - send_request({ connection: 'close' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets); - done(); - }, 10) - }); - }) - - }) - - describe('passing connection: keep-alive', function() { - - it('sends a Connection: keep-alive header (using options.headers.connection)', function(done) { - send_request({ headers: { connection: 'keep-alive' }}, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('sends a Connection: keep-alive header (using options.connection)', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - resp.body.headers['connection'].should.eql('keep-alive'); - done(); - }) - }) - - it('one open socket remain after request', function(done) { - send_request({ connection: 'keep-alive' }, function(err, resp) { - setTimeout(function() { - get_active_sockets().length.should.eql(existing_sockets + 1); - done(); - }, 10); - }) - }) - - }) - - - }) - -}) diff --git a/node_modules/needle/test/helpers.js b/node_modules/needle/test/helpers.js deleted file mode 100644 index 613ff57..0000000 --- a/node_modules/needle/test/helpers.js +++ /dev/null @@ -1,74 +0,0 @@ -var fs = require('fs'); - -var protocols = { - http : require('http'), - https : require('https') -} - -var keys = { - cert : fs.readFileSync(__dirname + '/keys/ssl.cert'), - key : fs.readFileSync(__dirname + '/keys/ssl.key') -} - -var helpers = {}; - -helpers.server = function(opts, cb) { - - var defaults = { - code : 200, - headers : {'Content-Type': 'application/json'} - } - - var mirror_response = function(req) { - return JSON.stringify({ - headers: req.headers, - body: req.body - }) - } - - var get = function(what) { - if (!opts[what]) - return defaults[what]; - - if (typeof opts[what] == 'function') - return opts[what](); // set them at runtime - else - return opts[what]; - } - - var finish = function(req, res) { - if (opts.handler) return opts.handler(req, res); - - res.writeHead(get('code'), get('headers')); - res.end(opts.response || mirror_response(req)); - } - - var handler = function(req, res) { - - req.setEncoding('utf8'); // get as string - req.body = ''; - req.on('data', function(str) { req.body += str }) - req.socket.on('error', function(e) { - // res.writeHead(500, {'Content-Type': 'text/plain'}); - // res.end('Error: ' + e.message); - }) - - setTimeout(function(){ - finish(req, res); - }, opts.wait || 0); - - }; - - var protocol = opts.protocol || 'http'; - var server; - - if (protocol == 'https') - server = protocols[protocol].createServer(keys, handler); - else - server = protocols[protocol].createServer(handler); - - server.listen(opts.port, cb); - return server; -} - -module.exports = helpers; \ No newline at end of file diff --git a/node_modules/needle/test/long_string_spec.js b/node_modules/needle/test/long_string_spec.js deleted file mode 100644 index 4f2fa73..0000000 --- a/node_modules/needle/test/long_string_spec.js +++ /dev/null @@ -1,43 +0,0 @@ -var needle = require('../'), - should = require('should'); - -describe('when posting a very long string', function() { - - this.timeout(20000); - - function get_string(length) { - var str = ''; - for (var i = 0; i < length; i++) { - str += 'x'; - } - return str; - } - - var major_version = process.version.split('.')[0]; - - it("shouldn't throw an EPIPE error out of nowhere", function(done) { - - // for some reason this test fails in Github Actions with Node v8.x - // although in my Linux box passes without issues - if (process.env.CI && (major_version == 'v8' || major_version == 'v6')) { - return done(); - } - - var error; - - function finished() { - setTimeout(function() { - should.not.exist(error); - done(); - }, 300); - } - - try { - needle.post('https://google.com', { data: get_string(Math.pow(2, 20)) }, finished) - } catch(e) { - error = e; - } - - }) - -}) diff --git a/node_modules/needle/test/mimetype.js b/node_modules/needle/test/mimetype.js deleted file mode 100644 index dbeaf29..0000000 --- a/node_modules/needle/test/mimetype.js +++ /dev/null @@ -1,81 +0,0 @@ -var should = require('should'), - needle = require('./../'), - helpers = require('./helpers'); - -describe('receiving json and xml content as string', function() { - - this.timeout(5000); - - ["text/plain", "application/json", "application/ld+json", "application/xml", "image/svg+xml"].forEach(function(mimetype, offset){ - - describe('Given content-type: "'+mimetype+'"', function () { - - var server, port = 54330+offset; - - before(function(done) { - server = helpers.server({ - port: port, - response: 'content', - headers: { 'Content-Type': mimetype } - }, done); - }) - - after(function(done) { - server.close(done) - }) - - describe('with parse = false', function () { - it('delivers by default as string', function (done) { - - needle.get('http://localhost:' + port, { parse: false }, function (err, resp) { - - resp.body.should.be.a.String; - (typeof resp.body).should.eql('string') - done(); - }) - - }) - - }) - - }) - - }); - - ["application/octet-stream", "image/png"].forEach(function(mimetype, offset){ - - describe('Given content-type: "'+mimetype+'"', function () { - - var server, port = 54340+offset; - - before(function(done) { - server = helpers.server({ - port: port, - response: 'content', - headers: { 'Content-Type': mimetype } - }, done); - }) - - after(function(done) { - server.close(done) - }) - - describe('with parse = false', function () { - it('delivers by default as Buffer', function (done) { - - needle.get('http://localhost:' + port, { parse: false }, function (err, resp) { - - resp.body.should.be.a.Buffer; - (resp.body instanceof Buffer).should.eql(true) - done(); - }) - - }) - - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/output_spec.js b/node_modules/needle/test/output_spec.js deleted file mode 100644 index ecda05c..0000000 --- a/node_modules/needle/test/output_spec.js +++ /dev/null @@ -1,263 +0,0 @@ -// this lets us run tests in ancient node versions (v0.10.x) -if (process.version.split('.')[0] == 'v0' && !Buffer.from) { - Buffer.from = function(args) { - return new Buffer(args); - } -} - -var should = require('should'), - needle = require('./../'), - http = require('http'), - sinon = require('sinon'), - stream = require('stream'), - fs = require('fs'), - port = 11111, - server; - -describe('with output option', function() { - - var server, handler, file = '/tmp/foobar.out'; - - function send_request_cb(where, cb) { - var url = 'http://localhost:' + port + '/whatever.file'; - return needle.get(url, { output: where }, cb); - } - - function send_request_stream(where, cb) { - var url = 'http://localhost:' + port + '/whatever.file'; - var stream = needle.get(url, { output: where }); - stream.on('end', cb); - } - - // this will only work in UNICES - function get_open_file_descriptors() { - var list = fs.readdirSync('/proc/self/fd'); - return list.length; - } - - var send_request = send_request_cb; - - before(function(){ - server = http.createServer(function(req, res) { - handler(req, res); - }).listen(port); - }); - - after(function() { - server.close(); - }) - - beforeEach(function() { - try { fs.unlinkSync(file) } catch(e) { }; - }) - - describe('and a 404 response', function() { - - before(function() { - handler = function(req, res) { - res.writeHead(404, {'Content-Type': 'text/plain' }); - res.end(); - } - }) - - it('doesnt attempt to write a file', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(404); - spy.called.should.eql(false); - spy.restore(); - done(); - }) - }) - - it('doesnt actually write a file', function(done) { - send_request(file, function(err, resp) { - resp.statusCode.should.eql(404); - fs.existsSync(file).should.eql(false); - done(); - }) - }) - - }) - - describe('and a 200 response', function() { - - describe('for an empty response', function() { - - before(function() { - handler = function(req, res) { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end(); - } - }) - - it('uses a writableStream', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(200); - spy.called.should.eql(true); - spy.restore(); - done(); - }) - }) - - it('writes a file', function(done) { - fs.existsSync(file).should.eql(false); - send_request(file, function(err, resp) { - fs.existsSync(file).should.eql(true); - done(); - }) - }) - - it('file is zero bytes in length', function(done) { - send_request(file, function(err, resp) { - fs.statSync(file).size.should.equal(0); - done(); - }) - }) - - if (process.platform == 'linux') { - it('closes the file descriptor', function(done) { - var open_descriptors = get_open_file_descriptors(); - send_request(file + Math.random(), function(err, resp) { - var current_descriptors = get_open_file_descriptors(); - open_descriptors.should.eql(current_descriptors); - done() - }) - }) - } - - }) - - describe('for a JSON response', function() { - - before(function() { - handler = function(req, res) { - res.writeHead(200, { 'Content-Type': 'application/javascript' }); - res.end(JSON.stringify({foo: 'bar'})); - } - }) - - it('uses a writableStream', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(200); - spy.called.should.eql(true); - spy.restore(); - done(); - }) - }) - - it('writes a file', function(done) { - fs.existsSync(file).should.eql(false); - send_request(file, function(err, resp) { - fs.existsSync(file).should.eql(true); - done(); - }) - }) - - it('file size equals response length', function(done) { - send_request(file, function(err, resp) { - fs.statSync(file).size.should.equal(resp.bytes); - done(); - }) - }) - - it('response pipeline is honoured (JSON is decoded by default)', function(done) { - send_request_stream(file, function(err, resp) { - // we need to wait a bit since writing to config.output - // happens independently of needle's callback logic. - setTimeout(function() { - fs.readFileSync(file).toString().should.eql('{\"foo\":\"bar\"}'); - done(); - }, 20); - }) - }) - - if (process.platform == 'linux') { - it('closes the file descriptor', function(done) { - var open_descriptors = get_open_file_descriptors(); - send_request(file + Math.random(), function(err, resp) { - var current_descriptors = get_open_file_descriptors(); - open_descriptors.should.eql(current_descriptors); - done() - }) - }) - } - - }) - - describe('for a binary file', function() { - - var pixel = Buffer.from("base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs", "base64"); - - before(function() { - handler = function(req, res) { - res.writeHead(200, { 'Content-Type': 'application/octet-stream', 'Transfer-Encoding': 'chunked' }); - res.write(pixel.slice(0, 10)); - res.write(pixel.slice(10, 20)); - res.write(pixel.slice(20, 30)); - res.write(pixel.slice(30)); - res.end(); - } - }) - - it('uses a writableStream', function(done) { - var spy = sinon.spy(fs, 'createWriteStream'); - send_request(file, function(err, resp) { - resp.statusCode.should.eql(200); - spy.called.should.eql(true); - spy.restore(); - done(); - }) - }) - - it('writes a file', function(done) { - fs.existsSync(file).should.eql(false); - send_request(file, function(err, resp) { - fs.existsSync(file).should.eql(true); - done(); - }) - }) - - it('file size equals response length', function(done) { - send_request(file, function(err, resp) { - fs.statSync(file).size.should.equal(resp.bytes); - done(); - }) - }) - - it('file is equal to original buffer', function(done) { - send_request(file, function(err, resp) { - // we need to wait a bit since writing to config.output - // happens independently of needle's callback logic. - setTimeout(function() { - fs.readFileSync(file).should.eql(pixel); - done(); - }, 20); - }) - }) - - it('returns the data in resp.body too', function(done) { - send_request(file, function(err, resp) { - resp.body.should.eql(pixel); - done(); - }) - }) - - if (process.platform == 'linux') { - it('closes the file descriptor', function(done) { - var open_descriptors = get_open_file_descriptors(); - send_request(file + Math.random(), function(err, resp) { - var current_descriptors = get_open_file_descriptors(); - open_descriptors.should.eql(current_descriptors); - done() - }) - }) - } - - }) - - }) - -}) diff --git a/node_modules/needle/test/parsing_spec.js b/node_modules/needle/test/parsing_spec.js deleted file mode 100644 index bb8000b..0000000 --- a/node_modules/needle/test/parsing_spec.js +++ /dev/null @@ -1,588 +0,0 @@ -var should = require('should'), - needle = require('./../'), - http = require('http'), - port = 11111, - server; - -describe('parsing', function(){ - - describe('when response is an JSON string', function(){ - - var json_string = '{"foo":"bar"}'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json'); - res.end(json_string); - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }) - - describe('and parse option is not passed', function() { - - describe('with default parse_response', function() { - - before(function() { - needle.defaults().parse_response.should.eql('all') - }) - - it('should return object', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.have.property('foo', 'bar'); - done(); - }) - }) - - }) - - describe('and default parse_response is set to false', function() { - - it('does NOT return object when disabled using .defaults', function(done){ - needle.defaults({ parse_response: false }) - - needle.get('localhost:' + port, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(String) - body.toString().should.eql('{"foo":"bar"}'); - - needle.defaults({ parse_response: 'all' }); - done(); - }) - }) - - - }) - - }) - - describe('and parse option is true', function() { - - describe('and JSON is valid', function() { - - it('should return object', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, response, body){ - should.not.exist(err); - body.should.have.property('foo', 'bar') - done(); - }) - }) - - it('should have a .parser = json property', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - should.not.exist(err); - resp.parser.should.eql('json'); - done(); - }) - }) - - }); - - describe('and response is empty', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = ""; - }); - - after(function() { - json_string = old_json_string; - }); - - it('should return an empty string', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - should.not.exist(err); - resp.body.should.equal(''); - done(); - }) - }) - - }) - - describe('and JSON is invalid', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = "this is not going to work"; - }); - - after(function() { - json_string = old_json_string; - }); - - it('does not throw', function(done) { - (function(){ - needle.get('localhost:' + port, { parse: true }, done); - }).should.not.throw(); - }); - - it('does NOT return object', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, response, body) { - should.not.exist(err); - body.should.be.a.String; - body.toString().should.eql('this is not going to work'); - done(); - }) - }) - - }); - - }) - - describe('and parse option is false', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: false }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(String) - body.toString().should.eql('{"foo":"bar"}'); - done(); - }) - }) - - it('should NOT have a .parser = json property', function(done) { - needle.get('localhost:' + port, { parse: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser); - done(); - }) - }) - - }) - - describe('and parse option is "xml"', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(String) - body.toString().should.eql('{"foo":"bar"}'); - done(); - }) - }) - - it('should NOT have a .parser = json property', function(done) { - needle.get('localhost:' + port, { parse: 'xml' }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser); - done(); - }) - }) - - }) - - }); - - describe('when response is JSON \'false\'', function(){ - - var json_string = 'false'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json'); - res.end(json_string); - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }) - - describe('and parse option is not passed', function() { - - it('should return object', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.equal(false); - done(); - }) - }) - - }) - - describe('and parse option is true', function() { - - describe('and JSON is valid', function() { - - it('should return object', function(done){ - needle.get('localhost:' + port, { parse: true }, function(err, response, body){ - should.not.exist(err); - body.should.equal(false) - done(); - }) - }) - - }); - - describe('and response is empty', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = ""; - }); - - after(function() { - json_string = old_json_string; - }); - - it('should return an empty string', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, resp) { - should.not.exist(err); - resp.body.should.equal(''); - done(); - }) - }) - - }) - - describe('and JSON is invalid', function() { - - var old_json_string; - - before(function() { - old_json_string = json_string; - json_string = "this is not going to work"; - }); - - after(function() { - json_string = old_json_string; - }); - - it('does not throw', function(done) { - (function(){ - needle.get('localhost:' + port, { parse: true }, done); - }).should.not.throw(); - }); - - it('does NOT return object', function(done) { - needle.get('localhost:' + port, { parse: true }, function(err, response, body) { - should.not.exist(err); - body.should.be.a.String; - body.toString().should.eql('this is not going to work'); - done(); - }) - }) - - }); - - }) - - describe('and parse option is false', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: false }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(String) - body.toString().should.eql('false'); - done(); - }) - }) - - }) - - describe('and parse option is "xml"', function() { - - it('does NOT return object', function(done){ - needle.get('localhost:' + port, { parse: 'xml' }, function(err, response, body) { - should.not.exist(err); - body.should.be.an.instanceof(String) - body.toString().should.eql('false'); - done(); - }) - }) - - }) - - - }); - - describe('when response is an invalid XML string', function(){ - - before(function(done){ - server = http.createServer(function(req, res) { - res.writeHeader(200, {'Content-Type': 'application/xml'}) - res.end("") - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }) - - describe('and parse_response is true', function(){ - - it('should return original string', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { - should.not.exist(err); - body.should.eql('') - should.not.exist(body.name); - done(); - }) - }) - - it('should not have a .parser = xml property', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser); - done(); - }) - }) - - }) - - describe('and parse response is false', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ - should.not.exist(err); - body.toString().should.eql('') - done(); - }) - }) - - it('should not have a .parser property', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser) - done(); - }) - }) - - }) - - }) - - describe('when response is a valid XML string', function(){ - - before(function(done) { - server = http.createServer(function(req, res) { - res.writeHeader(200, {'Content-Type': 'application/xml'}) - res.end("

hello

") - }).listen(port, done); - }); - - after(function(done) { - server.close(done); - }) - - describe('and parse_response is true', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { - should.not.exist(err); - body.name.should.eql('post') - body.children[0].name.should.eql('p') - body.children[0].value.should.eql('hello') - - body.children[1].name.should.eql('p') - body.children[1].value.should.eql('world') - done(); - }) - }) - - it('should have a .parser = xml property', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { - should.not.exist(err); - resp.parser.should.eql('xml'); - done(); - }) - }) - - }) - - describe('and parse response is false', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ - should.not.exist(err); - body.toString().should.eql('

hello

') - done(); - }) - }) - - it('should not have a .parser property', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser) - done(); - }) - }) - - }) - - }) - - describe('valid XML, using xml2js', function() { - - var parsers, origParser; - - before(function(done) { - var xml2js = require('xml2js') - parsers = require('../lib/parsers'); - origParser = parsers['application/xml']; - - var customParser = require('xml2js').parseString; - parsers.use('xml2js', ['application/xml'], function(buff, cb) { - var opts = { explicitRoot: true, explicitArray: false }; - customParser(buff, opts, cb); - }) - - server = http.createServer(function(req, res) { - res.writeHeader(200, {'Content-Type': 'application/xml'}) - res.end("

hello

world

") - }).listen(port, done); - }); - - after(function(done) { - parsers['application/xml'] = origParser; - server.close(done); - }) - - describe('and parse_response is true', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, response, body) { - should.not.exist(err); - body.should.eql({ post: { p: ['hello', 'world' ]}}) - done(); - }) - }) - - it('should have a .parser = xml property', function(done) { - needle.get('localhost:' + port, { parse_response: true }, function(err, resp) { - should.not.exist(err); - resp.parser.should.eql('xml2js'); - done(); - }) - }) - - }) - - describe('and parse response is false', function(){ - - it('should return valid object', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, response, body){ - should.not.exist(err); - body.toString().should.eql('

hello

world

') - done(); - }) - }) - - it('should not have a .parser property', function(done) { - needle.get('localhost:' + port, { parse_response: false }, function(err, resp) { - should.not.exist(err); - should.not.exist(resp.parser) - done(); - }) - }) - - }) - - }) - - describe('when response is a JSON API flavored JSON string', function () { - - var json_string = '{"data":[{"type":"articles","id":"1","attributes":{"title":"Needle","body":"The leanest and most handsome HTTP client in the Nodelands."}}],"included":[{"type":"people","id":"42","attributes":{"name":"Tomás"}}]}'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/vnd.api+json'); - res.end(json_string); - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }); - - describe('and parse option is not passed', function() { - - describe('with default parse_response', function() { - - before(function() { - needle.defaults().parse_response.should.eql('all') - }) - - it('should return object', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.deepEqual({ - "data": [{ - "type": "articles", - "id": "1", - "attributes": { - "title": "Needle", - "body": "The leanest and most handsome HTTP client in the Nodelands." - } - }], - "included": [ - { - "type": "people", - "id": "42", - "attributes": { - "name": "Tomás" - } - } - ] - }); - done(); - }); - }); - - }); - - }) - - }); - - describe('when response is a HAL JSON content-type', function () { - - var json_string = '{"name": "Tomás", "_links": {"href": "https://github.com/tomas/needle.git"}}'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/hal+json'); - res.end(json_string); - }).listen(port, done); - }); - - after(function(done){ - server.close(done); - }); - - describe('and parse option is not passed', function() { - - describe('with default parse_response', function() { - - before(function() { - needle.defaults().parse_response.should.eql('all') - }) - - it('should return object', function(done){ - needle.get('localhost:' + port, function(err, response, body){ - should.ifError(err); - body.should.deepEqual({ - 'name': 'Tomás', - '_links': { - 'href': 'https://github.com/tomas/needle.git' - }}); - done(); - }); - }); - - }); - - }) - - }); - -}) diff --git a/node_modules/needle/test/post_data_spec.js b/node_modules/needle/test/post_data_spec.js deleted file mode 100644 index 5c826d6..0000000 --- a/node_modules/needle/test/post_data_spec.js +++ /dev/null @@ -1,1021 +0,0 @@ -var needle = require('..'), - http = require('http'), - should = require('should'), - sinon = require('sinon'), - stream = require('stream'), - helpers = require('./helpers'); - -var multiparts = ['----------------------NODENEEDLEHTTPCLIENT']; -multiparts.push(['Content-Disposition: form-data; name=\"foo\"']) -multiparts.push(['\r\nbar\r\n----------------------NODENEEDLEHTTPCLIENT--']) -// multiparts.push(['Content-Disposition: form-data; name=\"test\"']) -// multiparts.push(['\r\næµè¯\r\n----------------------NODENEEDLEHTTPCLIENT--']) -// multiparts.push(['\r\n' + Buffer.from('测试').toString() + '\r\n----------------------NODENEEDLEHTTPCLIENT--']) - - -describe('post data (e.g. request body)', function() { - - var stub, spy, server; - - before(function(done) { - server = helpers.server({ port: 4321 }, done); - }) - - after(function(done) { - server.close(done); - }) - - afterEach(function() { - if (stub) stub.restore(); - if (spy) spy.restore(); - }) - - function get(data, opts, cb) { - return needle.request('get', 'http://localhost:' + 4321, data, opts, cb) - } - - function post(data, opts, cb) { - return needle.request('post', 'http://localhost:' + 4321, data, opts, cb) - } - - function spystub_request() { - var http_req = http.request; - stub = sinon.stub(http, 'request').callsFake(function(opts, cb) { - var req = http_req(opts, cb); - spy = sinon.spy(req, 'write'); - return req; - }) - } - - function check_request(method) { - stub.calledOnce.should.be.true; - stub.args[0][0]['headers']['host'].should.equal('localhost:4321'); - stub.args[0][0]['method'].should.equal(method); - } - - describe('with multipart: true', function() { - - describe('when null', function() { - - it('sends request (non multipart)', function(done) { - spystub_request(); - - post(null, { multipart: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('doesnt set Content-Type header', function(done) { - post(null, { multipart: true }, function(err, resp) { - should.not.exist(resp.body.headers['content-type']); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post(null, { multipart: true }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - spystub_request(); - - post(null, { multipart: true }, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('when string', function() { - - it('explodes', function() { - (function() { - post('foobar', { multipart: true }) - }).should.throw() - }) - - }) - - describe('when object', function() { - - describe('get request', function() { - - it('sends request', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('multipart/form-data; boundary=--------------------NODENEEDLEHTTPCLIENT'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes string as buffer', function(done) { - spystub_request(); - - get({ foo: 'bar' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - - spy.args[0][0].should.be.an.instanceof(String); - spy.args[0][0].toString().should.equal(multiparts.join('\r\n')); - resp.body.body.should.eql(multiparts.join('\r\n')); - done(); - }) - }) - - it('writes japanese chars correctly as binary', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - - spy.args[0][0].should.be.an.instanceof(String); - Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d') - done(); - }) - }) - - - }) - - describe('post request', function() { - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('writes string as buffer', function(done) { - spystub_request(); - - post({ foo: 'bar' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(String); - spy.args[0][0].toString().should.equal(multiparts.join('\r\n')); - resp.body.body.should.eql(multiparts.join('\r\n')); - done(); - }) - }) - - it('writes japanese chars correctly as binary', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { multipart: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(String); - Buffer.from(spy.args[0][0]).toString('hex').should.eql('2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d22666f6f220d0a0d0a6261720d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e540d0a436f6e74656e742d446973706f736974696f6e3a20666f726d2d646174613b206e616d653d2274657374220d0a0d0ac3a6c2b5c28bc3a8c2afc2950d0a2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d4e4f44454e4545444c4548545450434c49454e542d2d') - done(); - }) - }) - - }) - - }) - - describe('when stream', function() { - - var stream_for_multipart; - - before(function() { - stream_for_multipart = new stream.Readable(); - stream_for_multipart._read = function() { - this.push('foobar'); - this.push(null); - } - }) - - it('explodes', function() { - (function() { - post(stream_for_multipart, { multipart: true }) - }).should.throw() - }) - - }) - - }) - - describe('non multipart', function() { - - describe('when null', function() { - - describe('get request', function() { - - it('sends request', function(done) { - spystub_request(); - - get(null, {}, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - spystub_request(); - - get(null, {}, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('post request', function() { - - it('sends request', function(done) { - spystub_request(); - - post(null, {}, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - spystub_request(); - - post(null, {}, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - }) - - describe('when string with no equal sign', function() { - - describe('get request', function() { - - it('explodes', function() { - (function() { - get('foobar', {}) - }).should.throw() - }) - - }) - - describe('post request', function() { - - it('sends request', function(done) { - spystub_request(); - - post('foobar', {}, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('writes string as buffer', function(done) { - spystub_request(); - - post('foobar', {}, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - describe('when string WITH equal sign', function() { - - describe('get request', function() { - - describe('with json: false (default)', function() { - - it('sends request, adding data as querystring', function(done) { - spystub_request(); - - get('foo=bar', { json: false }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/?foo=bar') - done(); - }) - }) - - it('doesnt set Content-Type header', function(done) { - get('foo=bar', { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - should.not.exist(resp.body.headers['content-type']); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - get('foo=bar', { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - get('foo=bar', { json: false }, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request, without setting a querystring', function(done) { - spystub_request(); - - get('foo=bar', { json: true }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/') - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - get('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) { - get('foo=bar', { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foo=bar') - resp.body.body.should.eql('foo=bar'); - done(); - }) - }) - - }) - - }) - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post('foo=bar', { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post('foo=bar', { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post('foo=bar', { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post('foo=bar', { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foo=bar'); - resp.body.body.should.eql('foo=bar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post('foo=bar', { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post('foo=bar', { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes raw string (assuming it already is JSON, so no JSON.stringify)', function(done) { - post('foo=bar', { json: true }, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify('foo=bar'); - spy.args[0][0].toString().should.eql('foo=bar') - resp.body.body.should.eql('foo=bar'); - done(); - }) - }) - - }) - - }) - - }) - - describe('when object', function() { - - describe('get request', function() { - - describe('with json: false (default)', function() { - - it('sends request, adding data as querystring', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/?foo=bar&test=%E6%B5%8B%E8%AF%95') - done(); - }) - }) - - it('doesnt set Content-Type header', function(done) { - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - should.not.exist(resp.body.headers['content-type']); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('doesnt write anything', function(done) { - get({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - spy.called.should.be.false; - resp.body.body.should.eql(''); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request, without setting a querystring', function(done) { - spystub_request(); - - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - check_request('get'); - stub.args[0][0]['path'].should.equal('/') - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringify version of object', function(done) { - get({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - - }) - - }) - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post({ foo: 'bar', test: '测试' }, { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95'); - resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95'); - done(); - }) - }) - - }) - - describe('with json: false and content_type = "application/json"', function() { - - var opts = { json: false, content_type: 'application/json' }; - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to application/json', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].constructor.name.should.eql('Buffer'); - spy.args[0][0].toString().should.equal('foo=bar&test=%E6%B5%8B%E8%AF%95'); - resp.body.body.should.eql('foo=bar&test=%E6%B5%8B%E8%AF%95'); - done(); - }) - }) - - }) - - describe('with json: undefined but content-type = application/json', function() { - - var opts = { headers: { 'content-type': 'application/json' } }; - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('doesnt change Content-Type header', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json'); - done(); - }) - }) - - it('leaves default Accept header', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post({ foo: 'bar', test: '测试' }, { json: true }, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - - }) - - - describe('with json: true and content_type: */* (passed, not default)', function() { - - var opts = { json: true, accept: '*/*' }; - - it('sends request', function(done) { - spystub_request(); - - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to application/json', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('respects Accept header set by user', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post({ foo: 'bar', test: '测试' }, opts, function(err, resp) { - spy.called.should.be.true; - var json = JSON.stringify({ foo: 'bar', test: '测试' }) - spy.args[0][0].toString().should.eql(json) - resp.body.body.should.eql(json); - done(); - }) - }) - - }) - - }) - - }) - - describe('when buffer', function() { - - describe('get request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - // should.not.exist(resp.body.headers['content-type']); - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - get(Buffer.from('foobar'), { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request, without setting a querystring', function(done) { - spystub_request(); - - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - check_request('get'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringify version of object', function(done) { - get(Buffer.from('foobar'), { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foobar') - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post(Buffer.from('foobar'), { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('passes raw buffer (assuming its a JSON string beneath)', function(done) { - post(Buffer.from('foobar'), { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foobar') - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - }) - - describe('when stream', function() { - - var input_stream; - - beforeEach(function() { - input_stream = new stream.Readable(); - input_stream._read = function() { - this.push('foobar'); - this.push(null); - } - }) - - describe('get request', function() { - - it('explodes', function() { - (function() { - get(input_stream, {}) - }).should.throw() - }) - - }); - - describe('post request', function() { - - describe('with json: false (default)', function() { - - it('sends request', function(done) { - spystub_request(); - - post(input_stream, { json: false }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header to www-form-urlencoded', function(done) { - post(input_stream, { json: false }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/x-www-form-urlencoded'); - done(); - }) - }) - - it('doesnt change default Accept header', function(done) { - post(input_stream, { json: false }, function(err, resp) { - // resp.body contains 'header' and 'body', mirroring what we sent - resp.body.headers['accept'].should.equal('*/*'); - done(); - }) - }) - - it('writes as buffer', function(done) { - post(input_stream, { json: false }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].should.be.an.instanceof(Buffer); - spy.args[0][0].toString().should.equal('foobar'); - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - describe('with json: true', function() { - - it('sends request', function(done) { - spystub_request(); - - post(input_stream, { json: true }, function(err, resp) { - check_request('post'); - done(); - }) - }) - - it('sets Content-Type header', function(done) { - post(input_stream, { json: true }, function(err, resp) { - resp.body.headers['content-type'].should.equal('application/json; charset=utf-8'); - done(); - }) - }) - - it('set Accept header to application/json', function(done) { - post(input_stream, { json: true }, function(err, resp) { - resp.body.headers['accept'].should.equal('application/json'); - done(); - }) - }) - - it('writes JSON.stringified object', function(done) { - post(input_stream, { json: true }, function(err, resp) { - spy.called.should.be.true; - spy.args[0][0].toString().should.eql('foobar') - resp.body.body.should.eql('foobar'); - done(); - }) - }) - - }) - - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/proxy_spec.js b/node_modules/needle/test/proxy_spec.js deleted file mode 100644 index 46b0b5e..0000000 --- a/node_modules/needle/test/proxy_spec.js +++ /dev/null @@ -1,268 +0,0 @@ -var helpers = require('./helpers'), - should = require('should'), - sinon = require('sinon'), - http = require('http'), - needle = require('./../'); - -var port = 7707; -var url = 'localhost:' + port; -var nonexisting_host = 'awepfokawepofawe.com'; - -describe('proxy option', function() { - - var spy, opts; - - function send_request(opts, done) { - if (spy) spy.restore(); - spy = sinon.spy(http, 'request'); - needle.get(url, opts, done); - } - - ////////////////////// - // proxy opts helpers - - function not_proxied(done) { - return function(err, resp) { - var path = spy.args[0][0].path; - path.should.eql('/'); // not the full original URI - spy.restore(); - done(); - } - } - - function proxied(host, port, done) { - return function(err, resp) { - var path = spy.args[0][0].path; - path.should.eql('http://' + url); // the full original URI - - var http_host = spy.args[0][0].host; - if (http_host) http_host.should.eql(host); - - var http_port = spy.args[0][0].port; - if (http_port) http_port.should.eql(port); - - spy.restore(); - done(); - } - } - - ////////////////////// - // auth helpers - - function get_auth(header) { - var token = header.split(/\s+/).pop(); - return token && Buffer.from(token, 'base64').toString().split(':'); - } - - function no_proxy_auth(done) { - return function(err, resp) { - var headers = spy.args[0][0].headers; - Object.keys(headers).should.not.containEql('proxy-authorization'); - done(); - } - } - - function header_set(name, user, pass, done) { - return function(err, resp) { - var headers = spy.args[0][0].headers; - var auth = get_auth(headers[name]); - auth[0].should.eql(user); - auth[1].should.eql(pass); - done(); - } - } - - function proxy_auth_set(user, pass, done) { - return header_set('proxy-authorization', user, pass, done); - } - - function basic_auth_set(user, pass, done) { - return header_set('authorization', user, pass, done); - } - - after(function() { - spy.restore(); - }) - - describe('when null proxy is passed', function() { - - it('does not proxy', function(done) { - send_request({ proxy: null }, not_proxied(done)) - }) - - describe('but defaults has been set', function() { - - before(function() { - needle.defaults({ proxy: 'foobar' }); - }) - - after(function() { - needle.defaults({ proxy: null }); - }) - - it('tries to proxy anyway', function(done) { - send_request({}, proxied('foobar', 80, done)) - }) - - }) - - }) - - describe('when weird string is passed', function() { - - it('tries to proxy anyway', function(done) { - send_request({ proxy: 'alfalfa' }, proxied('alfalfa', 80, done)) - }) - }) - - describe('when valid url is passed', function() { - - describe('without NO_PROXY env var set', function() { - it('proxies request', function(done) { - send_request({ proxy: nonexisting_host + ':123/done' }, proxied(nonexisting_host, '123', done)) - }) - - it('does not set a Proxy-Authorization header', function(done) { - send_request({ proxy: nonexisting_host + ':123/done' }, no_proxy_auth(done)); - }) - }) - - describe('with NO_PROXY env var set', function() { - - it('proxies request if matching host not found in list', function(done) { - process.env.NO_PROXY = 'foo'; - send_request({ proxy: nonexisting_host + ':123/done' }, proxied(nonexisting_host, '123', function() { - delete process.env.NO_PROXY; - done(); - })) - }) - - it('does not proxy request if matching host in list and just has a different port', function(done) { - process.env.NO_PROXY = 'localhost'; - send_request({ proxy: nonexisting_host + ':123/done' }, not_proxied(function() { - delete process.env.NO_PROXY; - done(); - })) - }) - - it('does not proxy if matching host found in list', function(done) { - process.env.NO_PROXY = 'foo,' + url; - send_request({ proxy: nonexisting_host + ':123/done' }, not_proxied(function() { - delete process.env.NO_PROXY; - done(); - })) - }) - }) - - describe('and proxy url contains user:pass', function() { - - before(function() { - opts = { - proxy: 'http://mj:x@' + nonexisting_host + ':123/done' - } - }) - - it('proxies request', function(done) { - send_request(opts, proxied(nonexisting_host, '123', done)) - }) - - it('sets Proxy-Authorization header', function(done) { - send_request(opts, proxy_auth_set('mj', 'x', done)); - }) - - }) - - describe('and a proxy_user is passed', function() { - - before(function() { - opts = { - proxy: nonexisting_host + ':123', - proxy_user: 'someone', - proxy_pass: 'else' - } - }) - - it('proxies request', function(done) { - send_request(opts, proxied(nonexisting_host, '123', done)) - }) - - it('sets Proxy-Authorization header', function(done) { - send_request(opts, proxy_auth_set('someone', 'else', done)); - }) - - describe('and url also contains user:pass', function() { - - it('url user:pass wins', function(done) { - var opts = { - proxy: 'http://xxx:yyy@' + nonexisting_host + ':123', - proxy_user: 'someone', - proxy_pass: 'else' - } - - send_request(opts, proxy_auth_set('xxx', 'yyy', done)); - }) - - }) - - describe('and options.username is also present', function() { - - before(function() { - opts = { proxy_user: 'foobar', username: 'someone' }; - }) - - it('a separate Authorization header is set', function(done) { - var opts = { - proxy: nonexisting_host + ':123', - proxy_user: 'someone', - proxy_pass: 'else', - username: 'test', - password: 'X' - } - - send_request(opts, basic_auth_set('test', 'X', done)); - }) - - }) - - }) - - }) - - describe('when environment variable is set', function() { - - describe('and default is unchanged', function() { - - before(function() { - process.env.HTTP_PROXY = 'foobar'; - }) - - after(function() { - delete process.env.HTTP_PROXY; - }) - - it('tries to proxy', function(done) { - send_request({}, proxied('foobar', 80, done)) - }) - - }) - - describe('and functionality is disabled', function() { - - before(function() { - process.env.HTTP_PROXY = 'foobar'; - }) - - after(function() { - delete process.env.HTTP_PROXY; - }) - - it('ignores proxy', function(done) { - send_request({ - use_proxy_from_env_var: false - }, not_proxied(done)) - }) - - }) - }) - -}) diff --git a/node_modules/needle/test/querystring_spec.js b/node_modules/needle/test/querystring_spec.js deleted file mode 100644 index 34c1748..0000000 --- a/node_modules/needle/test/querystring_spec.js +++ /dev/null @@ -1,128 +0,0 @@ -var should = require('should'), - stringify = require('../lib/querystring').build; - -describe('stringify', function() { - - describe('with null', function() { - - it('throws', function() { - (function() { - var res = stringify(null); - }).should.throw(); - }) - - }) - - describe('with a number', function() { - - it('throws', function() { - (function() { - var res = stringify(100); - }).should.throw(); - }) - - }) - - describe('with a string', function() { - - describe('that is empty', function() { - - it('throws', function() { - (function() { - var res = stringify(''); - }).should.throw(); - }) - - }) - - describe('that doesnt contain an equal sign', function() { - - it('throws', function() { - (function() { - var res = stringify('boomshagalaga'); - }).should.throw(); - }) - - }) - - describe('that contains an equal sign', function() { - - it('works', function() { - var res = stringify('hello=123'); - res.should.eql('hello=123'); - }) - - }) - - }) - - describe('with an array', function() { - - describe('with key val objects', function() { - - it('works', function() { - var res = stringify([ {foo: 'bar'} ]); - res.should.eql('foo=bar'); - }) - - }) - - describe('where all elements are strings with an equal sign', function() { - - it('works', function() { - var res = stringify([ 'bar=123', 'quux=' ]); - res.should.eql('bar=123&quux='); - }) - - }) - - describe('with random words', function() { - - it('throws', function() { - (function() { - var res = stringify(['hello', 'there']); - }).should.throw(); - }) - - }) - - describe('with integers', function() { - - it('throws', function() { - (function() { - var res = stringify([123, 432]); - }).should.throw(); - }) - - }) - - }) - - describe('with an object', function() { - - it('works', function() { - var res = stringify({ test: 100 }); - res.should.eql('test=100'); - }) - - describe('with object where val is an array', function() { - - it('works', function() { - var res = stringify({ foo: ['bar', 'baz'] }); - res.should.eql('foo[]=bar&foo[]=baz'); - }) - - }) - - describe('with object where val is an array of key val objects', function() { - - it('works', function() { - var res = stringify({ foo: [{'1': 'bar'}, {'2': 'baz'}] }); - res.should.eql('foo[][1]=bar&foo[][2]=baz'); - }) - - }) - - }) - -}) diff --git a/node_modules/needle/test/redirect_spec.js b/node_modules/needle/test/redirect_spec.js deleted file mode 100644 index 5b97c5a..0000000 --- a/node_modules/needle/test/redirect_spec.js +++ /dev/null @@ -1,465 +0,0 @@ -var helpers = require('./helpers'), - should = require('should'), - sinon = require('sinon'), - needle = require('./../'); - -var ports = { - http : 8888, - https : 9999 -} - -var protocols = { - http : require('http'), - https : require('https') -} - -var code = 301; -var location; // var to set the response location - -function response_code() { - return code; -} - -function response_headers() { - return { 'Content-Type': 'text/plain', 'Location': location } -} - -describe('redirects', function() { - - var spies = {}, - servers = {}; - - var current_protocol; - var hostname = require('os').hostname(); - - // open two servers, one that responds to a redirect - before(function(done) { - - var conf = { - port : ports.http, - code : response_code, - headers : response_headers - } - - servers.http = helpers.server(conf, function() { - conf.port = ports.https; - conf.protocol = 'https'; - servers.https = helpers.server(conf, done); - }); - }) - - after(function(done) { - servers.http.close(function() { - servers.https.close(done); - }); - }) - - var prots = {'http': 'https'}; - Object.keys(prots).forEach(function(protocol) { - - current_protocol = protocol; - var other_protocol = protocol == 'http' ? 'https' : 'http'; - - var opts, // each test will modify this - host = '127.0.0.1', - url = protocol + '://' + host + ':' + ports[protocol] + '/hello'; - - function send_request(opts, cb) { - if (protocol == 'https') opts.rejectUnauthorized = false; - // console.log(' -- sending request ' + url + ' -- redirect to ' + location); - needle.post(url, { foo: 'bar' }, opts, cb); - } - - function not_followed(done) { - send_request(opts, function(err, resp) { - resp.statusCode.should.eql(301); - if (current_protocol == 'http') { - spies.http.callCount.should.eql(1); // only original request - spies.https.callCount.should.eql(0); - } else { - spies.http.callCount.should.eql(0); - spies.https.callCount.should.eql(1); // only original request - } - done(); - }) - } - - function followed_same_protocol(done) { - send_request(opts, function(err, resp) { - // the original request plus the redirect one - spies[current_protocol].callCount.should.eql(2); - done(); - }) - } - - function followed_other_protocol(done) { - send_request(opts, function(err, resp) { - // on new-ish node versions, https.request calls http.request internally, - // so we need to amount for that additional call. - // update: this doesn't happen on node > 10.x - - var node_major_ver = process.version.split('.')[0].replace('v', ''); - var http_calls = protocols.http.Agent.defaultMaxSockets == Infinity && parseInt(node_major_ver) < 10 ? 2 : 1; - - spies.http.callCount.should.eql(http_calls); // the one(s) from http.request - spies.https.callCount.should.eql(1); // the one from https.request (redirect) - done(); - }) - } - - // set a spy on [protocol].request - // so we can see how many times a request was made - before(function() { - spies.http = sinon.spy(protocols.http, 'request'); - spies.https = sinon.spy(protocols.https, 'request'); - }) - - // and make sure it is restored after each test - afterEach(function() { - spies.http.reset(); - spies.https.reset(); - }) - - after(function() { - spies.http.restore(); - spies.https.restore(); - }) - - describe('when overriding defaults', function() { - - before(function() { - needle.defaults({ follow_max: 10 }); - opts = {}; - }) - - after(function() { - // reset values to previous - needle.defaults({ follow_max: 0 }); - }) - - describe('and redirected to the same path on same host and protocol', function() { - before(function() { - location = url; - }) - it('does not follow redirect', not_followed); - }) - - describe('and redirected to the same path on same host and different protocol', function() { - before(function() { - location = url.replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - - it('follows redirect', followed_other_protocol); - }) - - describe('and redirected to a different path on same host, same protocol', function() { - before(function() { - location = url.replace('/hello', '/goodbye'); - }) - it('follows redirect', followed_same_protocol); - }) - - describe('and redirected to a different path on same host, different protocol', function() { - before(function() { - location = url.replace('/hello', '/goodbye').replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('follows redirect', followed_other_protocol); - }) - - describe('and redirected to same path on another host, same protocol', function() { - before(function() { - location = url.replace(host, hostname); - }) - it('follows redirect', followed_same_protocol); - }) - - describe('and redirected to same path on another host, different protocol', function() { - before(function() { - location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('follows redirect', followed_other_protocol); - }) - - }) - - // false and null have the same result - var values = [false, null]; - values.forEach(function(value) { - - describe('when follow is ' + value, function() { - - before(function() { - opts = { follow: value }; - }) - - describe('and redirected to the same path on same host and protocol', function() { - before(function() { - location = url; - }) - - it('throws an error', function() { - (function() { - send_request(opts, function() { }); - }).should.throw; - }) - - }) - - }) - - }) - - describe('when follow is true', function() { - - before(function() { - opts = { follow: true }; - }) - - describe('and redirected to the same path on same host and protocol', function() { - before(function() { location = url }) - - it('throws an error', function() { - (function() { - send_request(opts, function() { }); - }).should.throw; - }) - - }) - - }) - - describe('when follow is > 0', function() { - - before(function() { - needle.defaults({ follow: 10 }); - }) - - after(function() { - needle.defaults({ follow: 0 }); - }) - - describe('when keep_method is false', function() { - - before(function() { - opts = { follow_keep_method: false }; - }) - - // defaults to follow host and protocol - describe('and redirected to the same path on same host and different protocol', function() { - - before(function() { - location = url.replace(protocol, other_protocol); - }) - - it('follows redirect', followed_other_protocol); - - it('sends a GET request with no data', function(done) { - send_request(opts, function(err, resp) { - // spy.args[0][3].should.eql(null); - spies.http.args[0][0].method.should.eql('GET'); - done(); - }) - }) - - it('does not resend cookies if follow_set_cookies is false', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = false; - send_request(opts, function(err, resp) { - should.not.exist(spies.http.args[0][0].headers['cookie']); - done(); - }) - }) - - it('resends cookies if follow_set_cookies is true', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = true; - send_request(opts, function(err, resp) { - spies.http.args[0][0].headers['cookie'].should.eql('foo=bar') - done(); - }) - }) - - }) - - }) - - describe('and set_referer is true', function() { - - before(function() { - opts = { follow_set_referer: true }; - }) - - // defaults to follow host and protocol - describe('and redirected to the same path on same host and different protocol', function() { - - before(function() { - location = url.replace(protocol, other_protocol); - }) - - it('follows redirect', followed_other_protocol); - - it('sets Referer header when following redirect', function(done) { - send_request(opts, function(err, resp) { - // spies.http.args[0][3].should.eql({ foo: 'bar'}); - spies.http.args[0][0].headers['referer'].should.eql("http://" + host + ":8888/hello"); - done(); - }) - }) - - it('does not resend cookies if follow_set_cookies is false', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = false; - send_request(opts, function(err, resp) { - should.not.exist(spies.http.args[0][0].headers['cookie']); - done(); - }) - }) - - it('resends cookies if follow_set_cookies is true', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = true; - send_request(opts, function(err, resp) { - spies.http.args[0][0].headers['cookie'].should.eql('foo=bar') - done(); - }) - }) - - }) - - }) - - describe('and keep_method is true', function() { - - before(function() { - opts = { follow_keep_method: true }; - }) - - // defaults to follow host and protocol - describe('and redirected to the same path on same host and different protocol', function() { - - before(function() { - location = url.replace(protocol, other_protocol); - }) - - it('follows redirect', followed_other_protocol); - - it('sends a POST request with the original data', function(done) { - send_request(opts, function(err, resp) { - spies.http.args[0][0].method.should.eql('post'); - // spies.http.args[0][3].should.eql({ foo: 'bar'}); - done(); - }) - }) - - it('does not resend cookies if follow_set_cookies is false', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = false; - send_request(opts, function(err, resp) { - should.not.exist(spies.http.args[0][0].headers['cookie']); - done(); - }) - }) - - it('resends cookies if follow_set_cookies is true', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = true; - send_request(opts, function(err, resp) { - spies.http.args[0][0].headers['cookie'].should.eql('foo=bar') - done(); - }) - }) - - }) - - }) - - describe('and if_same_host is false', function() { - - before(function() { - opts = { follow_if_same_host: false }; - }) - - // by default it will follow other protocols - describe('and redirected to same path on another domain, same protocol', function() { - before(function() { - location = url.replace(host, hostname); - }) - - it('follows redirect', followed_same_protocol); - - it('does not resend cookies even if follow_set_cookies is true', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = true; - send_request(opts, function(err, resp) { - should.not.exist(spies.http.args[0][0].headers['cookie']); - done(); - }) - }) - }) - - }) - - describe('and if_same_host is true', function() { - - before(function() { - opts = { follow_if_same_host: true }; - }) - - // by default it will follow other protocols - describe('and redirected to same path on another domain, same protocol', function() { - before(function() { - location = url.replace(host, hostname); - }) - - it('does not follow redirect', not_followed); - }) - - }) - - describe('and if_same_protocol is false', function() { - - before(function() { - opts = { follow_if_same_protocol: false }; - }) - - // by default it will follow other hosts - describe('and redirected to same path on another domain, different protocol', function() { - before(function() { - location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - - it('follows redirect', followed_other_protocol); - - it('does not resend cookies even if follow_set_cookies is true', function(done) { - opts.cookies = {foo: 'bar'}; - opts.follow_set_cookies = true; - send_request(opts, function(err, resp) { - should.not.exist(spies.http.args[0][0].headers['cookie']); - done(); - }) - }) - }) - - }) - - describe('and if_same_protocol is true', function() { - - before(function() { - opts = { follow_if_same_protocol: true }; - }) - - // by default it will follow other hosts - describe('and redirected to same path on another domain, different protocol', function() { - before(function() { - location = url.replace(host, hostname).replace(protocol, other_protocol).replace(ports[protocol], ports[other_protocol]); - }) - it('does not follow redirect', not_followed); - }) - - }) - - }) - - }) - -}); diff --git a/node_modules/needle/test/redirect_with_timeout.js b/node_modules/needle/test/redirect_with_timeout.js deleted file mode 100644 index 7e8e02e..0000000 --- a/node_modules/needle/test/redirect_with_timeout.js +++ /dev/null @@ -1,45 +0,0 @@ -var should = require('should') -var needle = require('./../') - -describe('follow redirects when read_timeout is set', function () { - - it('clear timeout before following redirect', function (done) { - var opts = { - open_timeout: 1000, - read_timeout: 3000, - follow: 5, - user_agent: 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36' - } - - var timedOut = 0 - var redirects = 0 - - var timer = setTimeout(function () { - var hasRedirects = redirects > 0 - hasRedirects.should.equal(true) - done() - }, opts.read_timeout || 3000) - - var resp = needle.get('http://google.com/', opts, function (err, resp, body) { - var noErr = err === null - var hasBody = body.length > 0 - noErr.should.equal(true); - hasBody.should.equal(true); - }); - - resp.on('redirect', function (location) { - redirects++ - // console.info(' Redirected to ', location) - }) - - resp.on('timeout', function (type) { - timedOut++ - timedOut.should.equal(0) - // console.error(' ', type, 'timeout') - clearTimeout(timer) - done() - }) - - }).timeout(30000) - -}) \ No newline at end of file diff --git a/node_modules/needle/test/request_stream_spec.js b/node_modules/needle/test/request_stream_spec.js deleted file mode 100644 index 8f37533..0000000 --- a/node_modules/needle/test/request_stream_spec.js +++ /dev/null @@ -1,164 +0,0 @@ -var fs = require('fs'), - needle = require('..'), - stream = require('stream'), - http = require('http'), - should = require('should'), - sinon = require('sinon'); - -var port = 2233; - -var node_major_ver = parseInt(process.version.split('.')[0].replace('v', '')); -var node_minor_ver = parseInt(process.version.split('.')[1]); - -describe('request stream length', function() { - - var server, writable; - - function createServer() { - return http.createServer(function(req, res) { - - req.on('data', function(chunk) { - // console.log(chunk.length); - }) - - req.on('end', function() { - res.writeHeader(200, { 'Content-Type': 'application/json'}) - res.end(JSON.stringify({ headers: req.headers })) - }) - - }) - } - - before(function(done) { - server = createServer(); - server.listen(port, done) - }) - - beforeEach(function() { - writable = new stream.Readable(); - writable._read = function() { - this.push('hello world'); - this.push(null); - } - }) - - after(function(done) { - server.close(done) - }) - - function send_request(opts, cb) { - needle.post('http://localhost:' + port, writable, opts, cb) - } - - describe('no stream_length set', function() { - - it('doesnt set Content-Length header', function(done) { - send_request({}, function(err, resp) { - should.not.exist(resp.body.headers['content-length']); - done() - }) - }) - - it('works if Transfer-Encoding is not set', function(done) { - send_request({}, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - }) - - describe('stream_length is set to valid value', function() { - - it('sets Content-Length header to that value', function(done) { - send_request({ stream_length: 11 }, function(err, resp) { - resp.body.headers['content-length'].should.eql('11'); - done() - }) - }) - - it('works if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 11, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - var code = node_major_ver == 10 && node_minor_ver > 15 ? 400 : 200; - resp.statusCode.should.eql(code); - done() - }) - }) - - it('works if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 11 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - }) - - - describe('stream_length set to 0', function() { - - describe('stream with path', function() { - - var stub; - - beforeEach(function() { - writable.path = '/foo/bar'; - stub = sinon.stub(fs, 'stat').callsFake(function(path, cb) { - cb(null, { size: 11 }) - }) - }) - - afterEach(function() { - stub.restore(); - }) - - it('sets Content-Length header to streams length', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - resp.body.headers['content-length'].should.eql('11'); - done() - }) - }) - - it('works if Transfer-Encoding is set to a blank string', function(done) { - send_request({ stream_length: 0, headers: { 'Transfer-Encoding': '' }}, function(err, resp) { - should.not.exist(err); - var code = node_major_ver == 10 && node_minor_ver > 15 ? 400 : 200; - resp.statusCode.should.eql(code); - done() - }) - }) - - it('works if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - }) - - describe('stream without path', function() { - - it('does not set Content-Length header', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - should.not.exist(resp.body.headers['content-length']); - done() - }) - }) - - it('works if Transfer-Encoding is not set', function(done) { - send_request({ stream_length: 0 }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - }) - - }) - -}) diff --git a/node_modules/needle/test/response_stream_spec.js b/node_modules/needle/test/response_stream_spec.js deleted file mode 100644 index a0ccef8..0000000 --- a/node_modules/needle/test/response_stream_spec.js +++ /dev/null @@ -1,138 +0,0 @@ -var should = require('should'), - needle = require('./../'), - http = require('http'), - stream = require('stream'), - fs = require('fs'), - port = 11111, - server; - -describe('response streams', function() { - - describe('when the server sends back json', function(){ - - before(function(done) { - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json') - res.end('{"foo":"bar"}') - }).listen(port, done); - }); - - after(function(done) { - server.close(done); - }) - - describe('and the client uses streams', function(){ - - it('creates a proper streams2 stream', function(done) { - var stream = needle.get('localhost:' + port) - - // newer node versions set this to null instead of false - var bool = !!stream._readableState.flowing; - should.equal(false, bool); - - var readableCalled = false; - stream.on('readable', function() { - readableCalled = true; - }) - - stream.on('finish', function() { - readableCalled.should.be.true; - done(); - }); - - stream.resume(); - }) - - it('emits a single data item which is our JSON object', function(done) { - var stream = needle.get('localhost:' + port) - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - chunk.should.be.an.Object; - chunks.push(chunk); - } - }) - - stream.on('done', function () { - chunks.should.have.length(1) - chunks[0].should.have.property('foo', 'bar'); - done(); - }); - }) - - it('emits a raw buffer if we do not want to parse JSON', function(done) { - var stream = needle.get('localhost:' + port, { parse: false }) - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - Buffer.isBuffer(chunk).should.be.true; - chunks.push(chunk); - } - }) - - stream.on('done', function() { - var body = Buffer.concat(chunks).toString(); - body.should.equal('{"foo":"bar"}') - done(); - }); - }) - - }) - }) - - describe('when the server sends back what was posted to it', function () { - var file = 'asdf.txt'; - - before(function(done){ - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/octet') - req.pipe(res); - }).listen(port); - - fs.writeFile(file, 'contents of stream', done); - }); - - after(function(done){ - server.close(); - fs.unlink(file, done); - }) - - it('can PUT a stream', function (done) { - var stream = needle.put('localhost:' + port, fs.createReadStream(file), { stream: true }); - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - Buffer.isBuffer(chunk).should.be.true; - chunks.push(chunk); - } - }) - - stream.on('end', function () { - var body = Buffer.concat(chunks).toString(); - body.should.equal('contents of stream') - done(); - }); - }); - - it('can PATCH a stream', function (done) { - var stream = needle.patch('localhost:' + port, fs.createReadStream(file), { stream: true }); - - var chunks = []; - stream.on('readable', function () { - while (chunk = this.read()) { - Buffer.isBuffer(chunk).should.be.true; - chunks.push(chunk); - } - }) - - stream.on('end', function () { - var body = Buffer.concat(chunks).toString(); - body.should.equal('contents of stream') - done(); - }); - }); - }) -}) diff --git a/node_modules/needle/test/socket_cleanup_spec.js b/node_modules/needle/test/socket_cleanup_spec.js deleted file mode 100644 index fdfc0cb..0000000 --- a/node_modules/needle/test/socket_cleanup_spec.js +++ /dev/null @@ -1,79 +0,0 @@ -var should = require('should'), - needle = require('./../'), - fs = require('fs'), - https = require('https'), - stream = require('stream'); - -describe('socket cleanup', function(){ - - var outFile = 'test/tmp'; - var httpAgent, readStream, writeStream - - var file = 'ubuntu-21.04-desktop-amd64.iso', - url = 'https://releases.ubuntu.com/21.04/' + file; - - function getActiveSockets() { - return Object.keys(httpAgent.sockets).length - } - - before(function() { - httpAgent = new https.Agent({ - keepAlive : true, - maxSockets : 1 - }); - }) - - after(function() { - httpAgent.destroy() - fs.unlinkSync(outFile); - }) - - it('should cleanup sockets on ERR_STREAM_PREMATURE_CLOSE (using .pipe)', function(done) { - getActiveSockets().should.eql(0); - - var resp = needle.get(url, { agent: httpAgent }); - var writable = fs.createWriteStream(outFile); - resp.pipe(writable); - - writable.on('close', function(e) { - if (!resp.done) resp.abort(); - }) - - setTimeout(function() { - getActiveSockets().should.eql(1); - writable.destroy(); - }, 50); - - setTimeout(function() { - getActiveSockets().should.eql(0); - done(); - }, 500); // takes a bit - }) - - it('should cleanup sockets on ERR_STREAM_PREMATURE_CLOSE (using stream.pipeline)', function(done) { - if (!stream.pipeline) - return done() - - getActiveSockets().should.eql(0); - - var resp = needle.get(url, { agent: httpAgent }); - var writable = fs.createWriteStream(outFile); - - stream.pipeline(resp, writable, function(err) { - err.code.should.eql('ERR_STREAM_PREMATURE_CLOSE') - if (err) resp.request.destroy(); - }); - - setTimeout(function() { - getActiveSockets().should.eql(1); - writable.destroy(); - }, 50); - - setTimeout(function() { - getActiveSockets().should.eql(0); - done(); - }, 1000); // takes a bit - - }) - -}) diff --git a/node_modules/needle/test/socket_pool_spec.js b/node_modules/needle/test/socket_pool_spec.js deleted file mode 100644 index 75080bd..0000000 --- a/node_modules/needle/test/socket_pool_spec.js +++ /dev/null @@ -1,67 +0,0 @@ -var needle = require('../'), - should = require('should'), - http = require('http'); - -var server, port = 11112; - -describe('socket reuse', function() { - - var httpAgent = new http.Agent({ - keepAlive : true, - maxSockets : 1 - }); - - before(function(done) { - server = http.createServer(function(req, res) { - res.setHeader('Content-Type', 'application/json'); - setTimeout(function() { - res.end('{"foo":"bar"}'); - }, 50); - }).listen(port, done); - }); - - after(function(done) { - httpAgent.destroy(); - server.close(done); - }); - - describe('when sockets are reused', function() { - - it('does not duplicate listeners on .end', function(done) { - - var last_error; - var count = 10; - - function completed(err) { - --count || done(last_error); - } - - function send() { - needle.get('localhost:' + port, { agent: httpAgent }, function(err, resp) { - if (err) - throw new Error("Unexpected error: " + err); - - // lets go through all sockets and inspect all socket objects - for (hostTarget in httpAgent.sockets) { - httpAgent.sockets[hostTarget].forEach(function(socket) { - // normally, there are 2 internal listeners and 1 needle sets up, - // but to be sure the test does not fail even if newer node versions - // introduce additional listeners, we use a higher limit. - try { - socket.listeners('end').length.should.be.below(5, "too many listeners on the socket object's end event"); - } catch (e) { - last_error = e; - } - }); - } - - completed(); - }); - } - - for (var i = 0; i < count; i++) { - send(); - } - }); - }); -}); diff --git a/node_modules/needle/test/stream_events_spec.js b/node_modules/needle/test/stream_events_spec.js deleted file mode 100644 index 57ef994..0000000 --- a/node_modules/needle/test/stream_events_spec.js +++ /dev/null @@ -1,144 +0,0 @@ -var needle = require('../'), - fs = require('fs'), - should = require('should'), - helpers = require('./helpers'); - -describe('stream events', function() { - - var server, - port = 3456, - responseData, - serverOpts = {}, - requestHandler = function(req, res) { res.end('OK') } - - before(function() { - var opts = { - port: port, - handler: function(req, res) { requestHandler(req, res) } - } - server = helpers.server(opts); - }) - - after(function() { - server.close(); - }) - - beforeEach(function() { - responseData = ''; - }) - - describe('when consuming data directly', function() { - - function send_request(opts, cb) { - return needle - .get('http://localhost:' + port, opts) - .on('data', function(data) { responseData += data }) - } - - describe('and request stream fails', function() { - - it('emits done event with error', function(done) { - requestHandler = function(req, res) { req.socket.destroy() } - - send_request({}).on('done', function(err) { - err.code.should.eql('ECONNRESET'); - responseData.should.eql(''); - done() - }) - }) - - }) - - describe('and request succeeds but decoding fails', function() { - - it('emits done event without error', function(done) { - requestHandler = function(req, res) { - res.setHeader('Content-Type', 'application/json') - res.end('invalid:json') - } - - send_request({ json: true }).on('done', function(err) { - should.not.exist(err); - responseData.should.eql('invalid:json'); - done() - }) - }) - - }) - - describe('and request succeeds and pipeline works ok', function() { - - it('emits done event without error', function(done) { - requestHandler = function(req, res) { res.end('{"ok":1}') } - - send_request({ json: true }).on('done', function(err) { - should.not.exist(err); - responseData.should.eql('{"ok":1}'); - done() - }) - }) - - }) - - }) - - describe('when piping to a fs writableStream', function() { - - var outFile = 'test/tmp.dat'; - - function send_request(opts, cb) { - return needle - .get('http://localhost:' + port, opts) - .pipe(fs.createWriteStream(outFile)) - .on('data', function(data) { responseData += data }) - } - - after(function(done) { - fs.unlink(outFile, done) - }) - - describe('and request stream fails', function() { - - it('final stream emits done event with error', function(done) { - requestHandler = function(req, res) { req.socket.destroy() } - - send_request({}).on('done', function(err) { - err.code.should.eql('ECONNRESET'); - done() - }) - }) - - }) - - describe('and request succeeds but decoding fails', function() { - - it('final stream emits done event without error', function(done) { - requestHandler = function(req, res) { - res.setHeader('Content-Type', 'application/json') - res.end('invalid:json') - } - - send_request({ json: true }).on('done', function(err) { - should.not.exist(err); - done() - }) - }) - - }) - - describe('and request succeeds and pipeline works ok', function() { - - it('final stream emits done event without error', function(done) { - requestHandler = function(req, res) { res.end('{"ok":1}') } - - send_request({ json: true }).on('done', function(err) { - should.not.exist(err); - done() - }) - }) - - }) - - }) - -}) \ No newline at end of file diff --git a/node_modules/needle/test/tls_options_spec.js b/node_modules/needle/test/tls_options_spec.js deleted file mode 100644 index 208f829..0000000 --- a/node_modules/needle/test/tls_options_spec.js +++ /dev/null @@ -1,57 +0,0 @@ -var needle = require('..'), - https = require('https'), - helpers = require('./helpers'), - should = require('should'); - -describe('tls options', function() { - - describe('rejectUnauthorized: false', function() { - - var url = 'https://expired-rsa-dv.ssl.com/'; - - it('is an expired cert', function(done) { - needle.get(url, function(err, resp) { - err.code.should.eql('CERT_HAS_EXPIRED') - should.not.exist(resp) - done() - }) - }) - - it('allows fetching pages under expired certificates', function(done) { - needle.get(url, { rejectUnauthorized: false }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - }) - - it('also works when using custom agent', function(done) { - var agent = new https.Agent({ rejectUnauthorized: true }) - - // should overwrite value from custom agent - needle.get(url, { rejectUnauthorized: false }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - done() - }) - - }) - - it('also works with shared/default agent', function(done) { - var agent = new https.Agent({ rejectUnauthorized: true }) - needle.defaults({ agent: agent }) - - // should overwrite value from custom agent - needle.get(url, { rejectUnauthorized: false }, function(err, resp) { - should.not.exist(err); - resp.statusCode.should.eql(200); - - needle.defaults({ agent: null }) - done() - }) - - }) - - }) - -}) \ No newline at end of file diff --git a/node_modules/needle/test/uri_modifier_spec.js b/node_modules/needle/test/uri_modifier_spec.js deleted file mode 100644 index 1a12a36..0000000 --- a/node_modules/needle/test/uri_modifier_spec.js +++ /dev/null @@ -1,46 +0,0 @@ -var needle = require('../'), - sinon = require('sinon'), - should = require('should'), - http = require('http'), - helpers = require('./helpers'); - -var port = 3456; - -describe('uri_modifier config parameter function', function() { - - var server, uri; - - function send_request(mw, cb) { - needle.get(uri, { uri_modifier: mw }, cb); - } - - before(function(done){ - server = helpers.server({ port: port }, done); - }) - - after(function(done) { - server.close(done); - }) - - describe('modifies uri', function() { - - var path = '/foo/replace'; - - before(function() { - uri = 'localhost:' + port + path - }); - - it('should modify path', function(done) { - send_request(function(uri) { - return uri.replace('/replace', ''); - }, function(err, res) { - should.not.exist(err); - should(res.req.path).be.exactly('/foo'); - done(); - }); - - }); - - }) - -}) diff --git a/node_modules/needle/test/url_spec.js b/node_modules/needle/test/url_spec.js deleted file mode 100644 index 5154d58..0000000 --- a/node_modules/needle/test/url_spec.js +++ /dev/null @@ -1,155 +0,0 @@ -var needle = require('../'), - sinon = require('sinon'), - should = require('should'), - http = require('http'), - helpers = require('./helpers'); - -var port = 3456; - -describe('urls', function() { - - var server, url; - - function send_request(cb) { - return needle.get(url, cb); - } - - before(function(done){ - server = helpers.server({ port: port }, done); - }) - - after(function(done) { - server.close(done); - }) - - describe('null URL', function(){ - - it('throws', function(){ - (function() { - send_request() - }).should.throw(); - }) - - }) - - describe('invalid protocol', function(){ - - before(function() { - url = 'foo://google.com/what' - }) - - it('does not throw', function(done) { - (function() { - send_request(function(err) { - done(); - }) - }).should.not.throw() - }) - - it('returns an error', function(done) { - send_request(function(err) { - err.should.be.an.Error; - err.code.should.match(/ENOTFOUND|EADDRINFO|EAI_AGAIN/) - done(); - }) - }) - - }) - - describe('invalid host', function(){ - - before(function() { - url = 'http://s1\\\u0002.com/' - }) - - it('fails', function(done) { - (function() { - send_request(function(){ }) - }.should.throw(TypeError)) - done() - }) - - }) - -/* - describe('invalid path', function(){ - - before(function() { - url = 'http://www.google.com\\\/x\\\ %^&*() /x2.com/' - }) - - it('fails', function(done) { - send_request(function(err) { - err.should.be.an.Error; - done(); - }) - }) - - }) -*/ - - describe('valid protocol and path', function() { - - before(function() { - url = 'http://localhost:' + port + '/foo'; - }) - - it('works', function(done) { - send_request(function(err){ - should.not.exist(err); - done(); - }) - }) - - }) - - describe('no protocol but with slashes and valid path', function() { - - before(function() { - url = '//localhost:' + port + '/foo'; - }) - - it('works', function(done) { - send_request(function(err){ - should.not.exist(err); - done(); - }) - }) - - }) - - describe('no protocol nor slashes and valid path', function() { - - before(function() { - url = 'localhost:' + port + '/foo'; - }) - - it('works', function(done) { - send_request(function(err){ - should.not.exist(err); - done(); - }) - }) - - }) - - describe('double encoding', function() { - - var path = '/foo?email=' + encodeURIComponent('what-ever@Example.Com'); - - before(function() { - url = 'localhost:' + port + path - }); - - it('should not occur', function(done) { - send_request(function(err, res) { - should.not.exist(err); - should(res.req.path).be.exactly(path); - done(); - }); - - }); - - }) - -}) diff --git a/node_modules/needle/test/utils/formidable.js b/node_modules/needle/test/utils/formidable.js deleted file mode 100644 index ba1d983..0000000 --- a/node_modules/needle/test/utils/formidable.js +++ /dev/null @@ -1,17 +0,0 @@ -var formidable = require('formidable'), - http = require('http'), - util = require('util'); - -var port = process.argv[2] || 8888; - -http.createServer(function(req, res) { - var form = new formidable.IncomingForm(); - form.parse(req, function(err, fields, files) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.write('received upload:\n\n'); - console.log(util.inspect({fields: fields, files: files})) - res.end(util.inspect({fields: fields, files: files})); - }); -}).listen(port); - -console.log('HTTP server listening on port ' + port); \ No newline at end of file diff --git a/node_modules/needle/test/utils/proxy.js b/node_modules/needle/test/utils/proxy.js deleted file mode 100644 index 531bf49..0000000 --- a/node_modules/needle/test/utils/proxy.js +++ /dev/null @@ -1,62 +0,0 @@ -var http = require('http'), - https = require('https'), - url = require('url'); - -var port = 1234, - log = true, - request_auth = false; - -http.createServer(function(request, response) { - - console.log(request.headers); - console.log("Got request: " + request.url); - console.log("Forwarding request to " + request.headers['host']); - - if (request_auth) { - if (!request.headers['proxy-authorization']) { - response.writeHead(407, {'Proxy-Authenticate': 'Basic realm="proxy.com"'}) - return response.end('Hello.'); - } - } - - var remote = url.parse(request.url); - var protocol = remote.protocol == 'https:' ? https : http; - - var opts = { - host: request.headers['host'], - port: remote.port || (remote.protocol == 'https:' ? 443 : 80), - method: request.method, - path: remote.pathname, - headers: request.headers - } - - var proxy_request = protocol.request(opts, function(proxy_response){ - - proxy_response.on('data', function(chunk) { - if (log) console.log(chunk.toString()); - response.write(chunk, 'binary'); - }); - proxy_response.on('end', function() { - response.end(); - }); - - response.writeHead(proxy_response.statusCode, proxy_response.headers); - }); - - request.on('data', function(chunk) { - if (log) console.log(chunk.toString()); - proxy_request.write(chunk, 'binary'); - }); - - request.on('end', function() { - proxy_request.end(); - }); - -}).listen(port); - -process.on('uncaughtException', function(err){ - console.log('Uncaught exception!'); - console.log(err); -}); - -console.log("Proxy server listening on port " + port); diff --git a/node_modules/needle/test/utils/test.js b/node_modules/needle/test/utils/test.js deleted file mode 100644 index 8d58d70..0000000 --- a/node_modules/needle/test/utils/test.js +++ /dev/null @@ -1,104 +0,0 @@ -// TODO: write specs. :) - -var fs = require('fs'), - client = require('./../../'); - -process.env.DEBUG = true; - -var response_callback = function(err, resp, body){ - console.log(err); - if(resp) console.log("Got status code " + resp.statusCode) - console.log(body); -} - -function simple_head(){ - client.head('http://www.amazon.com', response_callback); -} - -function simple_get(){ - client.get('http://www.nodejs.org', response_callback); -} - -function proxy_get(){ - client.get('https://www.google.com/search?q=nodejs', {proxy: 'http://localhost:1234'}, response_callback); -} - -function auth_get(){ - client.get('https://www.twitter.com', {username: 'asd', password: '123'}, response_callback); -} - -function simple_post(url){ - - var data = { - foo: 'bar', - baz: { - nested: 'attribute' - } - } - - client.post(url, data, response_callback); - -} - -function multipart_post(url){ - - var filename = 'test_file.txt'; - var data = 'Plain text data.\nLorem ipsum dolor sit amet.\nBla bla bla.\n'; - fs.writeFileSync(filename, data); - - var black_pixel = Buffer.from("data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=".replace(/^data:image\/\w+;base64,/, ""), "base64"); - - var data = { - foo: 'bar', - bar: 'baz', - nested: { - my_document: { file: filename, content_type: 'text/plain' }, - even: { - more: 'nesting' - } - }, - pixel: { filename: 'black_pixel.gif', buffer: black_pixel, content_type: 'image/gif' }, - field2: {value: JSON.stringify({"json":[ {"one":1}, {"two":2} ]}), content_type: 'application/json' } - } - - client.post(url, data, {multipart: true}, function(err, resp, body){ - - console.log(err); - console.log("Got status code " + resp.statusCode) - console.log(body); - fs.unlink(filename); - - }); - -} - -switch(process.argv[2]){ - case 'head': - simple_head(); - break; - case 'get': - simple_get(); - break; - case 'auth': - auth_get(); - break; - case 'proxy': - proxy_get(); - break; - case 'post': - simple_post(process.argv[3] || 'http://posttestserver.com/post.php'); - break; - case 'multipart': - multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example'); - break; - case 'all': - simple_head(); - simple_get(); - auth_get(); - proxy_get(); - simple_post(process.argv[3] || 'http://posttestserver.com/post.php'); - multipart_post(process.argv[3] || 'http://posttestserver.com/post.php?dir=example'); - break; - default: - console.log("Usage: ./test.js [head|get|auth|proxy|multipart]") -} diff --git a/node_modules/needle/test/utils_spec.js b/node_modules/needle/test/utils_spec.js deleted file mode 100644 index ce9685c..0000000 --- a/node_modules/needle/test/utils_spec.js +++ /dev/null @@ -1,105 +0,0 @@ -var helpers = require('./helpers'), - should = require('should'), - sinon = require('sinon'), - utils = require('./../lib/utils'); - -describe('utils.should_proxy_to()', function() { - - var should_proxy_to = utils.should_proxy_to; - - var noProxy = ".ic1.mycorp,localhost,127.0.0.1,*.mycorp.org"; - var noProxyWithPorts = " ,.mycorp.org:1234,.ic1.mycorp,localhost,127.0.0.1"; - - var uris = { - hostname: "http://registry.random.opr.mycorp.org", - with_port: "http://registry.random.opr.mycorp.org:9874", - with_another_port: "http://registry.random.opr.mycorp.org:1234", - localhost: "http://localhost", - ip: "http://127.0.0.1" - } - - it("returns true if NO_PROXY is undefined", function(done) { - process.env.NO_PROXY = undefined; - should_proxy_to(uris.hostname).should.true() - delete process.env.NO_PROXY; - done(); - }); - - it("returns true if NO_PROXY is empty", function(done) { - process.env.NO_PROXY = ""; - should_proxy_to(uris.hostname).should.true() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if NO_PROXY is a wildcard", function(done) { - process.env.NO_PROXY = "*"; - should_proxy_to(uris.hostname).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns true if the host matches and the ports don't (URI doesn't have port specified)", function(done) { - process.env.NO_PROXY = noProxyWithPorts; - should_proxy_to(uris.hostname).should.true() - delete process.env.NO_PROXY; - done(); - }); - - it("returns true if the host matches and the ports don't (both have a port specified but just different values)", function(done) { - process.env.NO_PROXY = noProxyWithPorts; - should_proxy_to(uris.with_port).should.true() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if the host matches and the ports don't (no_proxy pattern doesn't have a port)", function(done) { - process.env.NO_PROXY = noProxy; - should_proxy_to(uris.with_port).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if host matches", function(done) { - process.env.NO_PROXY = noProxy; - should_proxy_to(uris.hostname).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if the host and port matches", function(done) { - process.env.NO_PROXY = noProxyWithPorts; - should_proxy_to(uris.with_another_port).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if the host matches (localhost)", function(done) { - process.env.NO_PROXY = noProxy; - should_proxy_to(uris.localhost).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if the host matches (ip)", function(done) { - process.env.NO_PROXY = noProxy; - should_proxy_to(uris.ip).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if the host matches (ip)", function(done) { - process.env.NO_PROXY = noProxy.replace(/,g/, " "); - should_proxy_to(uris.ip).should.false() - delete process.env.NO_PROXY; - done(); - }); - - it("returns false if the host matches (ip)", function(done) { - process.env.NO_PROXY = noProxy.replace(/,g/, " "); - should_proxy_to(uris.ip).should.false() - delete process.env.NO_PROXY; - done(); - }); - -}) diff --git a/node_modules/node-gyp-build/LICENSE b/node_modules/node-gyp-build/LICENSE deleted file mode 100644 index 56fce08..0000000 --- a/node_modules/node-gyp-build/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Mathias Buus - -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/node-gyp-build/README.md b/node_modules/node-gyp-build/README.md deleted file mode 100644 index f712ca6..0000000 --- a/node_modules/node-gyp-build/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# node-gyp-build - -> Build tool and bindings loader for [`node-gyp`][node-gyp] that supports prebuilds. - -``` -npm install node-gyp-build -``` - -[![Test](https://github.com/prebuild/node-gyp-build/actions/workflows/test.yml/badge.svg)](https://github.com/prebuild/node-gyp-build/actions/workflows/test.yml) - -Use together with [`prebuildify`][prebuildify] to easily support prebuilds for your native modules. - -## Usage - -> **Note.** Prebuild names have changed in [`prebuildify@3`][prebuildify] and `node-gyp-build@4`. Please see the documentation below. - -`node-gyp-build` works similar to [`node-gyp build`][node-gyp] except that it will check if a build or prebuild is present before rebuilding your project. - -It's main intended use is as an npm install script and bindings loader for native modules that bundle prebuilds using [`prebuildify`][prebuildify]. - -First add `node-gyp-build` as an install script to your native project - -``` js -{ - ... - "scripts": { - "install": "node-gyp-build" - } -} -``` - -Then in your `index.js`, instead of using the [`bindings`](https://www.npmjs.com/package/bindings) module use `node-gyp-build` to load your binding. - -``` js -var binding = require('node-gyp-build')(__dirname) -``` - -If you do these two things and bundle prebuilds with [`prebuildify`][prebuildify] your native module will work for most platforms -without having to compile on install time AND will work in both node and electron without the need to recompile between usage. - -Users can override `node-gyp-build` and force compiling by doing `npm install --build-from-source`. - -Prebuilds will be attempted loaded from `MODULE_PATH/prebuilds/...` and then next `EXEC_PATH/prebuilds/...` (the latter allowing use with `zeit/pkg`) - -## Supported prebuild names - -If so desired you can bundle more specific flavors, for example `musl` builds to support Alpine, or targeting a numbered ARM architecture version. - -These prebuilds can be bundled in addition to generic prebuilds; `node-gyp-build` will try to find the most specific flavor first. Prebuild filenames are composed of _tags_. The runtime tag takes precedence, as does an `abi` tag over `napi`. For more details on tags, please see [`prebuildify`][prebuildify]. - -Values for the `libc` and `armv` tags are auto-detected but can be overridden through the `LIBC` and `ARM_VERSION` environment variables, respectively. - -## License - -MIT - -[prebuildify]: https://github.com/prebuild/prebuildify -[node-gyp]: https://www.npmjs.com/package/node-gyp diff --git a/node_modules/node-gyp-build/SECURITY.md b/node_modules/node-gyp-build/SECURITY.md deleted file mode 100644 index da9c516..0000000 --- a/node_modules/node-gyp-build/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -## Security contact information - -To report a security vulnerability, please use the -[Tidelift security contact](https://tidelift.com/security). -Tidelift will coordinate the fix and disclosure. diff --git a/node_modules/node-gyp-build/bin.js b/node_modules/node-gyp-build/bin.js deleted file mode 100755 index c778e0a..0000000 --- a/node_modules/node-gyp-build/bin.js +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env node - -var proc = require('child_process') -var os = require('os') -var path = require('path') - -if (!buildFromSource()) { - proc.exec('node-gyp-build-test', function (err, stdout, stderr) { - if (err) { - if (verbose()) console.error(stderr) - preinstall() - } - }) -} else { - preinstall() -} - -function build () { - var win32 = os.platform() === 'win32' - var shell = win32 - var args = [win32 ? 'node-gyp.cmd' : 'node-gyp', 'rebuild'] - - try { - var pkg = require('node-gyp/package.json') - args = [ - process.execPath, - path.join(require.resolve('node-gyp/package.json'), '..', typeof pkg.bin === 'string' ? pkg.bin : pkg.bin['node-gyp']), - 'rebuild' - ] - shell = false - } catch (_) {} - - proc.spawn(args[0], args.slice(1), { stdio: 'inherit', shell, windowsHide: true }).on('exit', function (code) { - if (code || !process.argv[3]) process.exit(code) - exec(process.argv[3]).on('exit', function (code) { - process.exit(code) - }) - }) -} - -function preinstall () { - if (!process.argv[2]) return build() - exec(process.argv[2]).on('exit', function (code) { - if (code) process.exit(code) - build() - }) -} - -function exec (cmd) { - if (process.platform !== 'win32') { - var shell = os.platform() === 'android' ? 'sh' : true - return proc.spawn(cmd, [], { - shell, - stdio: 'inherit' - }) - } - - return proc.spawn(cmd, [], { - windowsVerbatimArguments: true, - stdio: 'inherit', - shell: true, - windowsHide: true - }) -} - -function buildFromSource () { - return hasFlag('--build-from-source') || process.env.npm_config_build_from_source === 'true' -} - -function verbose () { - return hasFlag('--verbose') || process.env.npm_config_loglevel === 'verbose' -} - -// TODO (next major): remove in favor of env.npm_config_* which works since npm -// 0.1.8 while npm_config_argv will stop working in npm 7. See npm/rfcs#90 -function hasFlag (flag) { - if (!process.env.npm_config_argv) return false - - try { - return JSON.parse(process.env.npm_config_argv).original.indexOf(flag) !== -1 - } catch (_) { - return false - } -} diff --git a/node_modules/node-gyp-build/build-test.js b/node_modules/node-gyp-build/build-test.js deleted file mode 100755 index b6622a5..0000000 --- a/node_modules/node-gyp-build/build-test.js +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env node - -process.env.NODE_ENV = 'test' - -var path = require('path') -var test = null - -try { - var pkg = require(path.join(process.cwd(), 'package.json')) - if (pkg.name && process.env[pkg.name.toUpperCase().replace(/-/g, '_')]) { - process.exit(0) - } - test = pkg.prebuild.test -} catch (err) { - // do nothing -} - -if (test) require(path.join(process.cwd(), test)) -else require('./')() diff --git a/node_modules/node-gyp-build/index.js b/node_modules/node-gyp-build/index.js deleted file mode 100644 index 07eb14f..0000000 --- a/node_modules/node-gyp-build/index.js +++ /dev/null @@ -1,6 +0,0 @@ -const runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line -if (typeof runtimeRequire.addon === 'function') { // if the platform supports native resolving prefer that - module.exports = runtimeRequire.addon.bind(runtimeRequire) -} else { // else use the runtime version here - module.exports = require('./node-gyp-build.js') -} diff --git a/node_modules/node-gyp-build/node-gyp-build.js b/node_modules/node-gyp-build/node-gyp-build.js deleted file mode 100644 index 76b96e1..0000000 --- a/node_modules/node-gyp-build/node-gyp-build.js +++ /dev/null @@ -1,207 +0,0 @@ -var fs = require('fs') -var path = require('path') -var os = require('os') - -// Workaround to fix webpack's build warnings: 'the request of a dependency is an expression' -var runtimeRequire = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require // eslint-disable-line - -var vars = (process.config && process.config.variables) || {} -var prebuildsOnly = !!process.env.PREBUILDS_ONLY -var abi = process.versions.modules // TODO: support old node where this is undef -var runtime = isElectron() ? 'electron' : (isNwjs() ? 'node-webkit' : 'node') - -var arch = process.env.npm_config_arch || os.arch() -var platform = process.env.npm_config_platform || os.platform() -var libc = process.env.LIBC || (isAlpine(platform) ? 'musl' : 'glibc') -var armv = process.env.ARM_VERSION || (arch === 'arm64' ? '8' : vars.arm_version) || '' -var uv = (process.versions.uv || '').split('.')[0] - -module.exports = load - -function load (dir) { - return runtimeRequire(load.resolve(dir)) -} - -load.resolve = load.path = function (dir) { - dir = path.resolve(dir || '.') - - try { - var name = runtimeRequire(path.join(dir, 'package.json')).name.toUpperCase().replace(/-/g, '_') - if (process.env[name + '_PREBUILD']) dir = process.env[name + '_PREBUILD'] - } catch (err) {} - - if (!prebuildsOnly) { - var release = getFirst(path.join(dir, 'build/Release'), matchBuild) - if (release) return release - - var debug = getFirst(path.join(dir, 'build/Debug'), matchBuild) - if (debug) return debug - } - - var prebuild = resolve(dir) - if (prebuild) return prebuild - - var nearby = resolve(path.dirname(process.execPath)) - if (nearby) return nearby - - var target = [ - 'platform=' + platform, - 'arch=' + arch, - 'runtime=' + runtime, - 'abi=' + abi, - 'uv=' + uv, - armv ? 'armv=' + armv : '', - 'libc=' + libc, - 'node=' + process.versions.node, - process.versions.electron ? 'electron=' + process.versions.electron : '', - typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line - ].filter(Boolean).join(' ') - - throw new Error('No native build was found for ' + target + '\n loaded from: ' + dir + '\n') - - function resolve (dir) { - // Find matching "prebuilds/-" directory - var tuples = readdirSync(path.join(dir, 'prebuilds')).map(parseTuple) - var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0] - if (!tuple) return - - // Find most specific flavor first - var prebuilds = path.join(dir, 'prebuilds', tuple.name) - var parsed = readdirSync(prebuilds).map(parseTags) - var candidates = parsed.filter(matchTags(runtime, abi)) - var winner = candidates.sort(compareTags(runtime))[0] - if (winner) return path.join(prebuilds, winner.file) - } -} - -function readdirSync (dir) { - try { - return fs.readdirSync(dir) - } catch (err) { - return [] - } -} - -function getFirst (dir, filter) { - var files = readdirSync(dir).filter(filter) - return files[0] && path.join(dir, files[0]) -} - -function matchBuild (name) { - return /\.node$/.test(name) -} - -function parseTuple (name) { - // Example: darwin-x64+arm64 - var arr = name.split('-') - if (arr.length !== 2) return - - var platform = arr[0] - var architectures = arr[1].split('+') - - if (!platform) return - if (!architectures.length) return - if (!architectures.every(Boolean)) return - - return { name, platform, architectures } -} - -function matchTuple (platform, arch) { - return function (tuple) { - if (tuple == null) return false - if (tuple.platform !== platform) return false - return tuple.architectures.includes(arch) - } -} - -function compareTuples (a, b) { - // Prefer single-arch prebuilds over multi-arch - return a.architectures.length - b.architectures.length -} - -function parseTags (file) { - var arr = file.split('.') - var extension = arr.pop() - var tags = { file: file, specificity: 0 } - - if (extension !== 'node') return - - for (var i = 0; i < arr.length; i++) { - var tag = arr[i] - - if (tag === 'node' || tag === 'electron' || tag === 'node-webkit') { - tags.runtime = tag - } else if (tag === 'napi') { - tags.napi = true - } else if (tag.slice(0, 3) === 'abi') { - tags.abi = tag.slice(3) - } else if (tag.slice(0, 2) === 'uv') { - tags.uv = tag.slice(2) - } else if (tag.slice(0, 4) === 'armv') { - tags.armv = tag.slice(4) - } else if (tag === 'glibc' || tag === 'musl') { - tags.libc = tag - } else { - continue - } - - tags.specificity++ - } - - return tags -} - -function matchTags (runtime, abi) { - return function (tags) { - if (tags == null) return false - if (tags.runtime && tags.runtime !== runtime && !runtimeAgnostic(tags)) return false - if (tags.abi && tags.abi !== abi && !tags.napi) return false - if (tags.uv && tags.uv !== uv) return false - if (tags.armv && tags.armv !== armv) return false - if (tags.libc && tags.libc !== libc) return false - - return true - } -} - -function runtimeAgnostic (tags) { - return tags.runtime === 'node' && tags.napi -} - -function compareTags (runtime) { - // Precedence: non-agnostic runtime, abi over napi, then by specificity. - return function (a, b) { - if (a.runtime !== b.runtime) { - return a.runtime === runtime ? -1 : 1 - } else if (a.abi !== b.abi) { - return a.abi ? -1 : 1 - } else if (a.specificity !== b.specificity) { - return a.specificity > b.specificity ? -1 : 1 - } else { - return 0 - } - } -} - -function isNwjs () { - return !!(process.versions && process.versions.nw) -} - -function isElectron () { - if (process.versions && process.versions.electron) return true - if (process.env.ELECTRON_RUN_AS_NODE) return true - return typeof window !== 'undefined' && window.process && window.process.type === 'renderer' -} - -function isAlpine (platform) { - return platform === 'linux' && fs.existsSync('/etc/alpine-release') -} - -// Exposed for unit tests -// TODO: move to lib -load.parseTags = parseTags -load.matchTags = matchTags -load.compareTags = compareTags -load.parseTuple = parseTuple -load.matchTuple = matchTuple -load.compareTuples = compareTuples diff --git a/node_modules/node-gyp-build/optional.js b/node_modules/node-gyp-build/optional.js deleted file mode 100755 index 8daa04a..0000000 --- a/node_modules/node-gyp-build/optional.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node - -/* -I am only useful as an install script to make node-gyp not compile for purely optional native deps -*/ - -process.exit(0) diff --git a/node_modules/node-gyp-build/package.json b/node_modules/node-gyp-build/package.json deleted file mode 100644 index 6f6f28b..0000000 --- a/node_modules/node-gyp-build/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "node-gyp-build", - "version": "4.8.4", - "description": "Build tool and bindings loader for node-gyp that supports prebuilds", - "main": "index.js", - "imports": { - "fs": { - "bare": "builtin:fs", - "default": "fs" - }, - "path": { - "bare": "builtin:path", - "default": "path" - }, - "os": { - "bare": "builtin:os", - "default": "os" - } - }, - "devDependencies": { - "array-shuffle": "^1.0.1", - "standard": "^14.0.0", - "tape": "^5.0.0" - }, - "scripts": { - "test": "standard && node test" - }, - "bin": { - "node-gyp-build": "./bin.js", - "node-gyp-build-optional": "./optional.js", - "node-gyp-build-test": "./build-test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/prebuild/node-gyp-build.git" - }, - "author": "Mathias Buus (@mafintosh)", - "license": "MIT", - "bugs": { - "url": "https://github.com/prebuild/node-gyp-build/issues" - }, - "homepage": "https://github.com/prebuild/node-gyp-build" -} diff --git a/node_modules/normalize-path/LICENSE b/node_modules/normalize-path/LICENSE deleted file mode 100644 index d32ab44..0000000 --- a/node_modules/normalize-path/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018, 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/normalize-path/README.md b/node_modules/normalize-path/README.md deleted file mode 100644 index 726d4d6..0000000 --- a/node_modules/normalize-path/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# normalize-path [![NPM version](https://img.shields.io/npm/v/normalize-path.svg?style=flat)](https://www.npmjs.com/package/normalize-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/normalize-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/normalize-path) - -> Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled. - -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 normalize-path -``` - -## Usage - -```js -const normalize = require('normalize-path'); - -console.log(normalize('\\foo\\bar\\baz\\')); -//=> '/foo/bar/baz' -``` - -**win32 namespaces** - -```js -console.log(normalize('\\\\?\\UNC\\Server01\\user\\docs\\Letter.txt')); -//=> '//?/UNC/Server01/user/docs/Letter.txt' - -console.log(normalize('\\\\.\\CdRomX')); -//=> '//./CdRomX' -``` - -**Consecutive slashes** - -Condenses multiple consecutive forward slashes (except for leading slashes in win32 namespaces) to a single slash. - -```js -console.log(normalize('.//foo//bar///////baz/')); -//=> './foo/bar/baz' -``` - -### Trailing slashes - -By default trailing slashes are removed. Pass `false` as the last argument to disable this behavior and _**keep** trailing slashes_: - -```js -console.log(normalize('foo\\bar\\baz\\', false)); //=> 'foo/bar/baz/' -console.log(normalize('./foo/bar/baz/', false)); //=> './foo/bar/baz/' -``` - -## Release history - -### v3.0 - -No breaking changes in this release. - -* a check was added to ensure that [win32 namespaces](https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces) are handled properly by win32 `path.parse()` after a path has been normalized by this library. -* a minor optimization was made to simplify how the trailing separator was handled - -## 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 - -Other useful path-related libraries: - -* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.") -* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.") -* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.") -* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.") -* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with "Return `true` if a file path ends with the given string/suffix.") -* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 35 | [jonschlinkert](https://github.com/jonschlinkert) | -| 1 | [phated](https://github.com/phated) | - -### Author - -**Jon Schlinkert** - -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) - -### License - -Copyright © 2018, [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 April 19, 2018._ \ No newline at end of file diff --git a/node_modules/normalize-path/index.js b/node_modules/normalize-path/index.js deleted file mode 100644 index 6fac553..0000000 --- a/node_modules/normalize-path/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * normalize-path - * - * Copyright (c) 2014-2018, Jon Schlinkert. - * Released under the MIT License. - */ - -module.exports = function(path, stripTrailing) { - if (typeof path !== 'string') { - throw new TypeError('expected path to be a string'); - } - - if (path === '\\' || path === '/') return '/'; - - var len = path.length; - if (len <= 1) return path; - - // ensure that win32 namespaces has two leading slashes, so that the path is - // handled properly by the win32 version of path.parse() after being normalized - // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces - var prefix = ''; - if (len > 4 && path[3] === '\\') { - var ch = path[2]; - if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { - path = path.slice(2); - prefix = '//'; - } - } - - var segs = path.split(/[/\\]+/); - if (stripTrailing !== false && segs[segs.length - 1] === '') { - segs.pop(); - } - return prefix + segs.join('/'); -}; diff --git a/node_modules/normalize-path/package.json b/node_modules/normalize-path/package.json deleted file mode 100644 index ad61098..0000000 --- a/node_modules/normalize-path/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "normalize-path", - "description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.", - "version": "3.0.0", - "homepage": "https://github.com/jonschlinkert/normalize-path", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Blaine Bublitz (https://twitter.com/BlaineBublitz)", - "Jon Schlinkert (http://twitter.com/jonschlinkert)" - ], - "repository": "jonschlinkert/normalize-path", - "bugs": { - "url": "https://github.com/jonschlinkert/normalize-path/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^1.0.0", - "minimist": "^1.2.0", - "mocha": "^3.5.3" - }, - "keywords": [ - "absolute", - "backslash", - "delimiter", - "file", - "file-path", - "filepath", - "fix", - "forward", - "fp", - "fs", - "normalize", - "path", - "relative", - "separator", - "slash", - "slashes", - "trailing", - "unix", - "urix" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "description": "Other useful path-related libraries:", - "list": [ - "contains-path", - "is-absolute", - "is-relative", - "parse-filepath", - "path-ends-with", - "path-ends-with", - "unixify" - ] - }, - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/now-and-later/LICENSE b/node_modules/now-and-later/LICENSE deleted file mode 100644 index 160890d..0000000 --- a/node_modules/now-and-later/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014, 2021-2022 Blaine Bublitz and Eric Schoffstall - -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/now-and-later/README.md b/node_modules/now-and-later/README.md deleted file mode 100644 index ab452e2..0000000 --- a/node_modules/now-and-later/README.md +++ /dev/null @@ -1,215 +0,0 @@ -

- - - -

- -# now-and-later - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Map over an array or object of values in parallel or series, passing each through the async iterator, with optional lifecycle hooks. - -## Usage - -```js -var nal = require('now-and-later'); - -function iterator(value, key, cb) { - // called with each value in sequence - // also passes the key - cb(null, value * 2); -} - -function create(value, key) { - // called at the beginning of every iteration - // return a storage object to be passed to each lifecycle method - return { key: key, value: value }; -} - -function before(storage) { - // called before the iterator function of every iteration - // receives the storage returned from `create` -} - -function after(result, storage) { - // called after a success occurs in the iterator function of any iteration - // receives the `result` of the iterator and the storage returned from `create` -} - -function error(error, storage) { - // called after an error occurs in the iterator function of any iteration - // receives the `error` of the iterator and the storage returned from `create` -} - -function done(error, results) { - // called after all iterations complete or an error occurs in an iterator - // receives an `error` if one occurred and all results (or partial results upon error) of the iterators -} - -/* - Calling mapSeries with an object can't guarantee order - It uses Object.keys to get an order - It is better to use an array if order must be guaranteed - */ -nal.mapSeries( - [1, 2, 3], - iterator, - { - create: create, - before: before, - after: after, - error: error, - }, - done -); - -nal.map( - { - iter1: 1, - iter2: 2, - }, - iterator, - { - create: create, - before: before, - after: after, - error: error, - }, - done -); -``` - -## API - -### `map(values, iterator[, options][, callback])` - -Takes an object or array of `values` and an `iterator` function to execute with each value. -Optionally, takes an `options` object and a `callback` function that is called upon completion of the iterations. - -All iterations run in parallel. - -#### `values` - -An array or object of values to iterate over. - -If `values` is an array, iterations are started in order by index. If `values` is an object, iterations are started in order by the order returned by `Object.keys` (order is not guaranteed). - -If `values` is an array, the results of each iteration will be mapped to an array. If `values` is an object, the results of each iteration will be mapped to an object with corresponding keys. - -#### `iterator(value, key, done)` - -An async function called per iteration. All iterations are run in parallel. - -The `iterator` function is called once with each `value`, `key` and a function (`done(error, result)`) to call when the async work is complete. - -If `done` is passed an error as the first argument, the iteration will fail and the sequence will be ended; however, any iterations in progress will still complete. If `done` is passed a `result` value as the second argument, it will be added to the final results array or object. - -#### `options` - -The `options` object is primarily used for specifying functions that give insight into the lifecycle of each iteration. The possible extension points are `create`, `before`, `after` and `error`. If an extension point is not specified, it defaults to a no-op function. - -The `options` object for `map` also allows specifying `concurrency` in which to run your iterations. By default, your iterations will run at maximum concurrency. - -##### `options.concurrency` - -Limits the amount of iterations allowed to run at a given time. - -##### `options.create(value, key)` - -Called at the very beginning of each iteration with the `value` being iterated and the `key` from the array or object. If `create` returns a value (`storage`), it is passed to the `before`, `after` and `error` extension points. - -If a value is not returned, an empty object is used as `storage` for each other extension point. - -This is useful for tracking information across an iteration. - -##### `options.before(storage)` - -Called immediately before each iteration with the `storage` value returned from the `create` extension point. - -##### `options.after(result, storage)` - -Called immediately after each iteration with the `result` of the iteration and the `storage` value returned from the `create` extension point. - -##### `options.error(error, storage)` - -Called immediately after a failed iteration with the `error` of the iteration and the `storage` value returned from the `create` extension point. - -#### `callback(error, results)` - -A function that is called after all iterations have completed or one iteration has errored. - -If all iterations completed successfully, the `error` argument will be empty and the `results` will be a mapping of the `iterator` results. - -If an iteration errored, the `error` argument will be passed from that iteration and the `results` will be whatever partial results had completed successfully before the error occurred. - -### `mapSeries(values, iterator[, options][, callback])` - -Takes an object or array of `values` and an `iterator` function to execute with each value. -Optionally, takes an `options` object and a `callback` function that is called upon completion of the iterations. - -All iterations run in serial. - -#### `values` - -An array or object of values to iterate over. - -If `values` is an array, iterations are started in order by index. If `values` is an object, iterations are started in order by the order returned by `Object.keys` (order is not guaranteed). - -If `values` is an array, the results of each iteration will be mapped to an array. If `values` is an object, the results of each iteration will be mapped to an object with corresponding keys. - -#### `iterator(value, key, done)` - -An async function called per iteration. All iterations are run in serial. - -The `iterator` function is called once with each `value`, `key` and a function (`done(error, result)`) to call when the async work is complete. - -If `done` is passed an error as the first argument, the iteration will fail and the sequence will be ended without executing any more iterations. If `done` is passed a `result` value as the second argument, it will be added to the final results array or object. - -#### `options` - -The `options` object is primarily used for specifying functions that give insight into the lifecycle of each iteration. The possible extension points are `create`, `before`, `after` and `error`. If an extension point is not specified, it defaults to a no-op function. - -##### `options.create(value, key)` - -Called at the very beginning of each iteration with the `value` being iterated and the `key` from the array or object. If `create` returns a value (`storage`), it is passed to the `before`, `after` and `error` extension points. - -If a value is not returned, an empty object is used as `storage` for each other extension point. - -This is useful for tracking information across an iteration. - -##### `options.before(storage)` - -Called immediately before each iteration with the `storage` value returned from the `create` extension point. - -##### `options.after(result, storage)` - -Called immediately after each iteration with the `result` of the iteration and the `storage` value returned from the `create` extension point. - -##### `options.error(error, storage)` - -Called immediately after a failed iteration with the `error` of the iteration and the `storage` value returned from the `create` extension point. - -#### `callback(error, results)` - -A function that is called after all iterations have completed or one iteration has errored. - -If all iterations completed successfully, the `error` argument will be empty and the `results` will be a mapping of the `iterator` results. - -If an iteration errored, the `error` argument will be passed from that iteration and the `results` will be whatever partial results had completed successfully before the error occurred. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/now-and-later.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/now-and-later -[npm-image]: https://img.shields.io/npm/v/now-and-later.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/now-and-later/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/now-and-later/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/now-and-later -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/now-and-later/master.svg?style=flat-square - diff --git a/node_modules/now-and-later/index.js b/node_modules/now-and-later/index.js deleted file mode 100644 index 692f0b7..0000000 --- a/node_modules/now-and-later/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -module.exports = { - map: require('./lib/map'), - mapSeries: require('./lib/mapSeries'), -}; diff --git a/node_modules/now-and-later/lib/helpers.js b/node_modules/now-and-later/lib/helpers.js deleted file mode 100644 index cce96af..0000000 --- a/node_modules/now-and-later/lib/helpers.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -function noop() {} - -var defaultExts = { - create: noop, - before: noop, - after: noop, - error: noop, -}; - -function defaultExtensions(options) { - options = options || {}; - return { - create: options.create || defaultExts.create, - before: options.before || defaultExts.before, - after: options.after || defaultExts.after, - error: options.error || defaultExts.error, - }; -} - -function initializeResults(values) { - var keys = Object.keys(values); - var results = Array.isArray(values) ? [] : {}; - - var idx = 0; - var length = keys.length; - - for (idx = 0; idx < length; idx++) { - var key = keys[idx]; - results[key] = undefined; - } - - return results; -} - -module.exports = { - defaultExtensions: defaultExtensions, - noop: noop, - initializeResults: initializeResults, -}; diff --git a/node_modules/now-and-later/lib/map.js b/node_modules/now-and-later/lib/map.js deleted file mode 100644 index 0587f8b..0000000 --- a/node_modules/now-and-later/lib/map.js +++ /dev/null @@ -1,83 +0,0 @@ -'use strict'; - -var once = require('once'); - -var helpers = require('./helpers'); - -function map(values, iterator, options, done) { - // Allow for options to not be specified - if (typeof options === 'function') { - done = options; - options = {}; - } - - // Handle no callback case - if (typeof done !== 'function') { - done = helpers.noop; - } - - done = once(done); - - // Will throw if non-object - var keys = Object.keys(values); - var length = keys.length; - var count = length; - var idx = 0; - // Return the same type as passed in - var results = helpers.initializeResults(values); - - var extensions = helpers.defaultExtensions(options); - - if (length === 0) { - return done(null, results); - } - - var maxConcurrent = length; - if (options && options.concurrency) { - maxConcurrent = options.concurrency; - } - var running = 0; - var sync = false; - kickoff(); - - function kickoff() { - if (sync) { - return; - } - sync = true; - while (running < maxConcurrent && idx < length) { - var key = keys[idx]; - next(key); - idx++; - } - sync = false; - } - - function next(key) { - running++; - var value = values[key]; - - var storage = extensions.create(value, key) || {}; - - extensions.before(storage); - iterator(value, key, once(handler)); - - function handler(err, result) { - running--; - if (err) { - extensions.error(err, storage); - return done(err, results); - } - - extensions.after(result, storage); - results[key] = result; - if (--count === 0) { - done(err, results); - } else { - kickoff(); - } - } - } -} - -module.exports = map; diff --git a/node_modules/now-and-later/lib/mapSeries.js b/node_modules/now-and-later/lib/mapSeries.js deleted file mode 100644 index 3a2c4c3..0000000 --- a/node_modules/now-and-later/lib/mapSeries.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -var once = require('once'); - -var helpers = require('./helpers'); - -function mapSeries(values, iterator, options, done) { - // Allow for options to not be specified - if (typeof options === 'function') { - done = options; - options = {}; - } - - // Handle no callback case - if (typeof done !== 'function') { - done = helpers.noop; - } - - done = once(done); - - // Will throw if non-object - var keys = Object.keys(values); - var length = keys.length; - var idx = 0; - // Return the same type as passed in - var results = helpers.initializeResults(values); - - var extensions = helpers.defaultExtensions(options); - - if (length === 0) { - return done(null, results); - } - - var key = keys[idx]; - next(key); - - function next(key) { - var value = values[key]; - - var storage = extensions.create(value, key) || {}; - - extensions.before(storage); - iterator(value, key, once(handler)); - - function handler(err, result) { - if (err) { - extensions.error(err, storage); - return done(err, results); - } - - extensions.after(result, storage); - results[key] = result; - - if (++idx >= length) { - done(err, results); - } else { - next(keys[idx]); - } - } - } -} - -module.exports = mapSeries; diff --git a/node_modules/now-and-later/package.json b/node_modules/now-and-later/package.json deleted file mode 100644 index 6944d33..0000000 --- a/node_modules/now-and-later/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "now-and-later", - "version": "3.0.0", - "description": "Map over an array or object of values in parallel or series, passing each through the async iterator, with optional lifecycle hooks.", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/now-and-later", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "files": [ - "index.js", - "lib", - "LICENSE" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "once": "^1.4.0" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.4.2", - "mocha": "^8.4.0", - "nyc": "^15.1.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "async", - "parallel", - "series", - "each", - "async.js", - "map", - "control", - "flow", - "extension", - "tracing", - "debug", - "aop", - "aspect", - "timing", - "tracing" - ] -} diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js deleted file mode 100644 index 0930cf8..0000000 --- a/node_modules/object-assign/index.js +++ /dev/null @@ -1,90 +0,0 @@ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; diff --git a/node_modules/object-assign/license b/node_modules/object-assign/license deleted file mode 100644 index 654d0bf..0000000 --- a/node_modules/object-assign/license +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json deleted file mode 100644 index 503eb1e..0000000 --- a/node_modules/object-assign/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "object-assign", - "version": "4.1.1", - "description": "ES2015 `Object.assign()` ponyfill", - "license": "MIT", - "repository": "sindresorhus/object-assign", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "xo && ava", - "bench": "matcha bench.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "object", - "assign", - "extend", - "properties", - "es2015", - "ecmascript", - "harmony", - "ponyfill", - "prollyfill", - "polyfill", - "shim", - "browser" - ], - "devDependencies": { - "ava": "^0.16.0", - "lodash": "^4.16.4", - "matcha": "^0.7.0", - "xo": "^0.16.0" - } -} diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md deleted file mode 100644 index 1be09d3..0000000 --- a/node_modules/object-assign/readme.md +++ /dev/null @@ -1,61 +0,0 @@ -# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign) - -> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com) - - -## Use the built-in - -Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), -support `Object.assign()` :tada:. If you target only those environments, then by all -means, use `Object.assign()` instead of this package. - - -## Install - -``` -$ npm install --save object-assign -``` - - -## Usage - -```js -const objectAssign = require('object-assign'); - -objectAssign({foo: 0}, {bar: 1}); -//=> {foo: 0, bar: 1} - -// multiple sources -objectAssign({foo: 0}, {bar: 1}, {baz: 2}); -//=> {foo: 0, bar: 1, baz: 2} - -// overwrites equal keys -objectAssign({foo: 0}, {foo: 1}, {foo: 2}); -//=> {foo: 2} - -// ignores null and undefined sources -objectAssign({foo: 0}, null, {bar: 1}, undefined); -//=> {foo: 0, bar: 1} -``` - - -## API - -### objectAssign(target, [source, ...]) - -Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones. - - -## Resources - -- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign) - - -## Related - -- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()` - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/object.defaults/LICENSE b/node_modules/object.defaults/LICENSE deleted file mode 100644 index d290fe0..0000000 --- a/node_modules/object.defaults/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2015, 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/object.defaults/README.md b/node_modules/object.defaults/README.md deleted file mode 100644 index 435c897..0000000 --- a/node_modules/object.defaults/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# object.defaults [![NPM version](https://img.shields.io/npm/v/object.defaults.svg?style=flat)](https://www.npmjs.com/package/object.defaults) [![NPM monthly downloads](https://img.shields.io/npm/dm/object.defaults.svg?style=flat)](https://npmjs.org/package/object.defaults) [![NPM total downloads](https://img.shields.io/npm/dt/object.defaults.svg?style=flat)](https://npmjs.org/package/object.defaults) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/object.defaults.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/object.defaults) - -> Like `extend` but only copies missing properties/values to the target object. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save object.defaults -``` - -Install with [bower](https://bower.io/) - -```sh -$ bower install object.defaults --save -``` - -## Usage - -```js -var defaults = require('object.defaults'); - -var obj = {a: 'c'}; -defaults(obj, {a: 'bbb', d: 'c'}); -console.log(obj); -//=> {a: 'c', d: 'c'} -``` - -Or immutable defaulting: -```js -var defaults = require('object.defaults/immutable'); -var obj = {a: 'c'}; -var defaulted = defaults(obj, {a: 'bbb', d: 'c'}); -console.log(obj !== defaulted); -//=> true -``` - -## About - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 16 | [jonschlinkert](https://github.com/jonschlinkert) | -| 1 | [phated](https://github.com/phated) | -| 1 | [sobolevn](https://github.com/sobolevn) | - -### 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.5.0, on April 26, 2017._ \ No newline at end of file diff --git a/node_modules/object.defaults/immutable.js b/node_modules/object.defaults/immutable.js deleted file mode 100644 index 16d847e..0000000 --- a/node_modules/object.defaults/immutable.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var slice = require('array-slice'); - -var defaults = require('./mutable'); - -/** - * Extends an empty object with properties of one or - * more additional `objects` - * - * @name .defaults.immutable - * @param {Object} `objects` - * @return {Object} - * @api public - */ - -module.exports = function immutableDefaults() { - var args = slice(arguments); - return defaults.apply(null, [{}].concat(args)); -}; diff --git a/node_modules/object.defaults/index.js b/node_modules/object.defaults/index.js deleted file mode 100644 index b9e6437..0000000 --- a/node_modules/object.defaults/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * object.defaults - * - * Copyright (c) 2014-2015, 2017, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -module.exports = require('./mutable'); -module.exports.immutable = require('./immutable'); diff --git a/node_modules/object.defaults/mutable.js b/node_modules/object.defaults/mutable.js deleted file mode 100644 index fac447f..0000000 --- a/node_modules/object.defaults/mutable.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var each = require('array-each'); -var slice = require('array-slice'); -var forOwn = require('for-own'); -var isObject = require('isobject'); - -/** - * Extends the `target` object with properties of one or - * more additional `objects` - * - * @name .defaults - * @param {Object} `target` The target object. Pass an empty object to shallow clone. - * @param {Object} `objects` - * @return {Object} - * @api public - */ - -module.exports = function defaults(target, objects) { - if (target == null) { - return {}; - } - - each(slice(arguments, 1), function(obj) { - if (isObject(obj)) { - forOwn(obj, function(val, key) { - if (target[key] == null) { - target[key] = val; - } - }); - } - }); - - return target; -}; diff --git a/node_modules/object.defaults/package.json b/node_modules/object.defaults/package.json deleted file mode 100644 index 56cf82c..0000000 --- a/node_modules/object.defaults/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "object.defaults", - "description": "Like `extend` but only copies missing properties/values to the target object.", - "version": "1.1.0", - "homepage": "https://github.com/jonschlinkert/object.defaults", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Sobolev Nikita (https://github.com/sobolevn)" - ], - "repository": "jonschlinkert/object.defaults", - "bugs": { - "url": "https://github.com/jonschlinkert/object.defaults/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "immutable.js", - "mutable.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - }, - "devDependencies": { - "gulp-format-md": "^0.1.11", - "mocha": "^3.2.0" - }, - "keywords": [ - "copy", - "default", - "defaults", - "extend", - "javascript", - "js", - "merge", - "object", - "properties", - "property", - "util", - "utils", - "value", - "values" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/object.pick/LICENSE b/node_modules/object.pick/LICENSE deleted file mode 100644 index 39245ac..0000000 --- a/node_modules/object.pick/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/object.pick/README.md b/node_modules/object.pick/README.md deleted file mode 100644 index 48f7453..0000000 --- a/node_modules/object.pick/README.md +++ /dev/null @@ -1,76 +0,0 @@ -# object.pick [![NPM version](https://img.shields.io/npm/v/object.pick.svg?style=flat)](https://www.npmjs.com/package/object.pick) [![NPM monthly downloads](https://img.shields.io/npm/dm/object.pick.svg?style=flat)](https://npmjs.org/package/object.pick) [![NPM total downloads](https://img.shields.io/npm/dt/object.pick.svg?style=flat)](https://npmjs.org/package/object.pick) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/object.pick.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/object.pick) - -> Returns a filtered copy of an object with only the specified keys, similar to `_.pick` from lodash / underscore. - -You might also be interested in [object.omit](https://github.com/jonschlinkert/object.omit). - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save object.pick -``` - -## benchmarks - -This is the [fastest implementation](http://jsperf.com/pick-props) I tested. Pull requests welcome! - -## Usage - -```js -var pick = require('object.pick'); - -pick({a: 'a', b: 'b'}, 'a') -//=> {a: 'a'} - -pick({a: 'a', b: 'b', c: 'c'}, ['a', 'b']) -//=> {a: 'a', b: 'b'} -``` - -## About - -### Related projects - -* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") -* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value "Use property paths (`a.b.c`) to get a nested value from an object.") -* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.") -* [set-value](https://www.npmjs.com/package/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | [homepage](https://github.com/jonschlinkert/set-value "Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths.") - -### 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/object.pick/blob/master/LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 27, 2016._ \ No newline at end of file diff --git a/node_modules/object.pick/index.js b/node_modules/object.pick/index.js deleted file mode 100644 index 0ce0178..0000000 --- a/node_modules/object.pick/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/*! - * object.pick - * - * Copyright (c) 2014-2015 Jon Schlinkert, contributors. - * Licensed under the MIT License - */ - -'use strict'; - -var isObject = require('isobject'); - -module.exports = function pick(obj, keys) { - if (!isObject(obj) && typeof obj !== 'function') { - return {}; - } - - var res = {}; - if (typeof keys === 'string') { - if (keys in obj) { - res[keys] = obj[keys]; - } - return res; - } - - var len = keys.length; - var idx = -1; - - while (++idx < len) { - var key = keys[idx]; - if (key in obj) { - res[key] = obj[key]; - } - } - return res; -}; diff --git a/node_modules/object.pick/package.json b/node_modules/object.pick/package.json deleted file mode 100644 index b655dbe..0000000 --- a/node_modules/object.pick/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "object.pick", - "description": "Returns a filtered copy of an object with only the specified keys, similar to `_.pick` from lodash / underscore.", - "version": "1.3.0", - "homepage": "https://github.com/jonschlinkert/object.pick", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/object.pick", - "bugs": { - "url": "https://github.com/jonschlinkert/object.pick/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "isobject": "^3.0.1" - }, - "devDependencies": { - "gulp-format-md": "^1.0.0", - "mocha": "^3.1.2", - "vinyl": "^2.0.0" - }, - "keywords": [ - "object", - "pick" - ], - "verb": { - "run": true, - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "list": [ - "extend-shallow", - "get-value", - "mixin-deep", - "set-value" - ], - "highlight": "object.omit" - }, - "reflinks": [ - "verb" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/once/LICENSE b/node_modules/once/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/once/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 1f1ffca..0000000 --- a/node_modules/once/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# 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 deleted file mode 100644 index 2354067..0000000 --- a/node_modules/once/once.js +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 16815b2..0000000 --- a/node_modules/once/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "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 deleted file mode 100644 index 2928cc2..0000000 --- a/node_modules/optionator/CHANGELOG.md +++ /dev/null @@ -1,59 +0,0 @@ -# 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 deleted file mode 100644 index 525b118..0000000 --- a/node_modules/optionator/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index 9cd0bb4..0000000 --- a/node_modules/optionator/README.md +++ /dev/null @@ -1,238 +0,0 @@ -# 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.4 - - 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 deleted file mode 100644 index 59e6f96..0000000 --- a/node_modules/optionator/lib/help.js +++ /dev/null @@ -1,260 +0,0 @@ -// 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 deleted file mode 100644 index 436b7cc..0000000 --- a/node_modules/optionator/lib/index.js +++ /dev/null @@ -1,465 +0,0 @@ -// 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.4'; - 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 deleted file mode 100644 index 5bc0cbb..0000000 --- a/node_modules/optionator/lib/util.js +++ /dev/null @@ -1,54 +0,0 @@ -// 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 deleted file mode 100644 index 72b21ba..0000000 --- a/node_modules/optionator/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "optionator", - "version": "0.9.4", - "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.5", - "type-check": "^0.4.0", - "levn": "^0.4.1", - "fast-levenshtein": "^2.0.6" - }, - "devDependencies": { - "livescript": "^1.6.0", - "mocha": "^10.4.0" - } -} diff --git a/node_modules/p-limit/index.d.ts b/node_modules/p-limit/index.d.ts deleted file mode 100644 index f348d7f..0000000 --- a/node_modules/p-limit/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -declare namespace pLimit { - interface Limit { - /** - The number of promises that are currently running. - */ - readonly activeCount: number; - - /** - The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ - readonly pendingCount: number; - - /** - Discard pending promises that are waiting to run. - - This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. - - Note: This does not cancel promises that are already running. - */ - clearQueue: () => void; - - /** - @param fn - Promise-returning/async function. - @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions. - @returns The promise returned by calling `fn(...arguments)`. - */ - ( - fn: (...arguments: Arguments) => PromiseLike | ReturnType, - ...arguments: Arguments - ): Promise; - } -} - -/** -Run multiple promise-returning & async functions with limited concurrency. - -@param concurrency - Concurrency limit. Minimum: `1`. -@returns A `limit` function. -*/ -declare function pLimit(concurrency: number): pLimit.Limit; - -export = pLimit; diff --git a/node_modules/p-limit/index.js b/node_modules/p-limit/index.js deleted file mode 100644 index c2ae52d..0000000 --- a/node_modules/p-limit/index.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; -const Queue = require('yocto-queue'); - -const pLimit = concurrency => { - if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) { - throw new TypeError('Expected `concurrency` to be a number from 1 and up'); - } - - const queue = new Queue(); - let activeCount = 0; - - const next = () => { - activeCount--; - - if (queue.size > 0) { - queue.dequeue()(); - } - }; - - const run = async (fn, resolve, ...args) => { - activeCount++; - - const result = (async () => fn(...args))(); - - resolve(result); - - try { - await result; - } catch {} - - next(); - }; - - const enqueue = (fn, resolve, ...args) => { - queue.enqueue(run.bind(null, fn, resolve, ...args)); - - (async () => { - // This function needs to wait until the next microtask before comparing - // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously - // when the run function is dequeued and called. The comparison in the if-statement - // needs to happen asynchronously as well to get an up-to-date value for `activeCount`. - await Promise.resolve(); - - if (activeCount < concurrency && queue.size > 0) { - queue.dequeue()(); - } - })(); - }; - - const generator = (fn, ...args) => new Promise(resolve => { - enqueue(fn, resolve, ...args); - }); - - Object.defineProperties(generator, { - activeCount: { - get: () => activeCount - }, - pendingCount: { - get: () => queue.size - }, - clearQueue: { - value: () => { - queue.clear(); - } - } - }); - - return generator; -}; - -module.exports = pLimit; diff --git a/node_modules/p-limit/license b/node_modules/p-limit/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/p-limit/license +++ /dev/null @@ -1,9 +0,0 @@ -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/p-limit/package.json b/node_modules/p-limit/package.json deleted file mode 100644 index 7651473..0000000 --- a/node_modules/p-limit/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "p-limit", - "version": "3.1.0", - "description": "Run multiple promise-returning & async functions with limited concurrency", - "license": "MIT", - "repository": "sindresorhus/p-limit", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "promise", - "limit", - "limited", - "concurrency", - "throttle", - "throat", - "rate", - "batch", - "ratelimit", - "task", - "queue", - "async", - "await", - "promises", - "bluebird" - ], - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "devDependencies": { - "ava": "^2.4.0", - "delay": "^4.4.0", - "in-range": "^2.0.0", - "random-int": "^2.0.1", - "time-span": "^4.0.0", - "tsd": "^0.13.1", - "xo": "^0.35.0" - } -} diff --git a/node_modules/p-limit/readme.md b/node_modules/p-limit/readme.md deleted file mode 100644 index b283c1e..0000000 --- a/node_modules/p-limit/readme.md +++ /dev/null @@ -1,101 +0,0 @@ -# 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`\ -Default: `Infinity` - -Concurrency limit. - -### limit(fn, ...args) - -Returns the promise returned by calling `fn(...args)`. - -#### fn - -Type: `Function` - -Promise-returning/async function. - -#### args - -Any arguments to pass through to `fn`. - -Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions. - -### limit.activeCount - -The number of promises that are currently running. - -### limit.pendingCount - -The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - -### limit.clearQueue() - -Discard pending promises that are waiting to run. - -This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app. - -Note: This does not cancel promises that are already running. - -## FAQ - -### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package? - -This package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue. - -## 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) - ---- - -
- - 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/p-locate/index.d.ts b/node_modules/p-locate/index.d.ts deleted file mode 100644 index 38c7e57..0000000 --- a/node_modules/p-locate/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -declare namespace pLocate { - interface Options { - /** - Number of concurrently pending promises returned by `tester`. Minimum: `1`. - - @default Infinity - */ - readonly concurrency?: number; - - /** - Preserve `input` order when searching. - - Disable this to improve performance if you don't care about the order. - - @default true - */ - readonly preserveOrder?: boolean; - } -} - -/** -Get the first fulfilled promise that satisfies the provided testing function. - -@param input - An iterable of promises/values to test. -@param tester - This function will receive resolved values from `input` and is expected to return a `Promise` or `boolean`. -@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`. - -@example -``` -import pathExists = require('path-exists'); -import pLocate = require('p-locate'); - -const files = [ - 'unicorn.png', - 'rainbow.png', // Only this one actually exists on disk - 'pony.png' -]; - -(async () => { - const foundPath = await pLocate(files, file => pathExists(file)); - - console.log(foundPath); - //=> 'rainbow' -})(); -``` -*/ -declare function pLocate( - input: Iterable | ValueType>, - tester: (element: ValueType) => PromiseLike | boolean, - options?: pLocate.Options -): Promise; - -export = pLocate; diff --git a/node_modules/p-locate/index.js b/node_modules/p-locate/index.js deleted file mode 100644 index 641c3dd..0000000 --- a/node_modules/p-locate/index.js +++ /dev/null @@ -1,50 +0,0 @@ -'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 await it -const testElement = async (element, tester) => tester(await element); - -// The input can also be a promise, so we `Promise.all()` them both -const finder = async element => { - const values = await Promise.all(element); - if (values[1] === true) { - throw new EndError(values[0]); - } - - return false; -}; - -const pLocate = async (iterable, tester, options) => { - options = { - concurrency: Infinity, - preserveOrder: true, - ...options - }; - - const limit = pLimit(options.concurrency); - - // Start all the promises concurrently with optional limit - const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); - - // Check the promises either serially or concurrently - const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); - - try { - await Promise.all(items.map(element => checkLimit(finder, element))); - } catch (error) { - if (error instanceof EndError) { - return error.value; - } - - throw error; - } -}; - -module.exports = pLocate; diff --git a/node_modules/p-locate/license b/node_modules/p-locate/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/p-locate/license +++ /dev/null @@ -1,9 +0,0 @@ -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/p-locate/package.json b/node_modules/p-locate/package.json deleted file mode 100644 index 2d5e447..0000000 --- a/node_modules/p-locate/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "p-locate", - "version": "5.0.0", - "description": "Get the first fulfilled promise that satisfies the provided testing function", - "license": "MIT", - "repository": "sindresorhus/p-locate", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "promise", - "locate", - "find", - "finder", - "search", - "searcher", - "test", - "array", - "collection", - "iterable", - "iterator", - "race", - "fulfilled", - "fastest", - "async", - "await", - "promises", - "bluebird" - ], - "dependencies": { - "p-limit": "^3.0.2" - }, - "devDependencies": { - "ava": "^2.4.0", - "delay": "^4.1.0", - "in-range": "^2.0.0", - "time-span": "^4.0.0", - "tsd": "^0.13.1", - "xo": "^0.32.1" - } -} diff --git a/node_modules/p-locate/readme.md b/node_modules/p-locate/readme.md deleted file mode 100644 index be85ec1..0000000 --- a/node_modules/p-locate/readme.md +++ /dev/null @@ -1,93 +0,0 @@ -# p-locate [![Build Status](https://travis-ci.com/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.com/github/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 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' -]; - -(async () => { - const foundPath = await pLocate(files, file => pathExists(file)); - - 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` - -An iterable of promises/values to test. - -#### tester(element) - -Type: `Function` - -This function will receive resolved values from `input` and is 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) - ---- - -
- - 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/parent-module/index.js b/node_modules/parent-module/index.js deleted file mode 100644 index a26f953..0000000 --- a/node_modules/parent-module/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'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 deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/parent-module/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/parent-module/package.json b/node_modules/parent-module/package.json deleted file mode 100644 index 790333d..0000000 --- a/node_modules/parent-module/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "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 deleted file mode 100644 index dffb4ce..0000000 --- a/node_modules/parent-module/readme.md +++ /dev/null @@ -1,67 +0,0 @@ -# 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/parse-filepath/LICENSE b/node_modules/parse-filepath/LICENSE deleted file mode 100644 index fa30c4c..0000000 --- a/node_modules/parse-filepath/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2015, 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/parse-filepath/README.md b/node_modules/parse-filepath/README.md deleted file mode 100644 index 3eb7ce5..0000000 --- a/node_modules/parse-filepath/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# parse-filepath [![NPM version](https://img.shields.io/npm/v/parse-filepath.svg?style=flat)](https://www.npmjs.com/package/parse-filepath) [![NPM downloads](https://img.shields.io/npm/dm/parse-filepath.svg?style=flat)](https://npmjs.org/package/parse-filepath) [![Build Status](https://img.shields.io/travis/jonschlinkert/parse-filepath.svg?style=flat)](https://travis-ci.org/jonschlinkert/parse-filepath) - -> Pollyfill for node.js `path.parse`, parses a filepath into an object. - -You might also be interested in [global-prefix](https://github.com/jonschlinkert/global-prefix). - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install parse-filepath --save -``` - -## Usage - -```js -var parsePath = require('parse-filepath'); -parsePath(filepath); -``` - -This can be used as a polyfill for the native node.js `path.parse()` method, and it also adds a few properties: - -* `path`: the original filepath -* `isAbsolute`: (getter) true if the given path is absolute -* `absolute`: (getter) fully resolved, absolute filepath -* `dirname`: alias for `dir` -* `basename`: alias for `base` -* `extname`: alias for `ext` -* `stem`: alias for `name` - -**Example** - -```js -var parsePath = require('parse-filepath'); -console.log(parsePath('foo/bar/baz/index.js')); -``` - -Returns: - -```js -{ root: '', - dir: 'foo/bar/baz', - base: 'index.js', - ext: '.js', - name: 'index', - - // aliases - extname: '.js', - basename: 'index.js', - dirname: 'foo/bar/baz', - stem: 'index', - - // original path - path: 'foo/bar/baz/index.js', - - // getters - absolute: [Getter/Setter], - isAbsolute: [Getter/Setter] } -``` - -## Related projects - -You might also be interested in these projects: - -* [global-prefix](https://www.npmjs.com/package/global-prefix): Get the npm global path prefix. | [homepage](https://github.com/jonschlinkert/global-prefix) -* [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute) -* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative) -* [relative](https://www.npmjs.com/package/relative): Get the relative filepath from path A to path B. Calculates from file-to-directory, file-to-file, directory-to-file,… [more](https://www.npmjs.com/package/relative) | [homepage](https://github.com/jonschlinkert/relative) - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-filepath/issues/new). - -## Building docs - -Generate readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install verb && npm run docs -``` - -Or, if [verb](https://github.com/verbose/verb) is installed globally: - -```sh -$ 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/parse-filepath/blob/master/LICENSE). - -*** - -_This file was generated by [verb](https://github.com/verbose/verb), v, on March 29, 2016._ \ No newline at end of file diff --git a/node_modules/parse-filepath/index.js b/node_modules/parse-filepath/index.js deleted file mode 100644 index 0df0170..0000000 --- a/node_modules/parse-filepath/index.js +++ /dev/null @@ -1,95 +0,0 @@ -'use strict'; - -var path = require('path'); -var isAbsolute = require('is-absolute'); -var pathRoot = require('path-root'); -var MapCache = require('map-cache'); -var cache = new MapCache(); - -module.exports = function(filepath) { - if (typeof filepath !== 'string') { - throw new TypeError('parse-filepath expects a string'); - } - - if (cache.has(filepath)) { - return cache.get(filepath); - } - - var obj = {}; - if (typeof path.parse === 'function') { - obj = path.parse(filepath); - obj.extname = obj.ext; - obj.basename = obj.base; - obj.dirname = obj.dir; - obj.stem = obj.name; - - } else { - define(obj, 'root', function() { - return pathRoot(this.path); - }); - - define(obj, 'extname', function() { - return path.extname(filepath); - }); - - define(obj, 'ext', function() { - return this.extname; - }); - - define(obj, 'name', function() { - return path.basename(filepath, this.ext); - }); - - define(obj, 'stem', function() { - return this.name; - }); - - define(obj, 'base', function() { - return this.name + this.ext; - }); - - define(obj, 'basename', function() { - return this.base; - }); - - define(obj, 'dir', function() { - var dir = path.dirname(filepath); - if (dir === '.') { - return (filepath[0] === '.') ? dir : ''; - } else { - return dir; - } - }); - - define(obj, 'dirname', function() { - return this.dir; - }); - } - - obj.path = filepath; - - define(obj, 'absolute', function() { - return path.resolve(this.path); - }); - - define(obj, 'isAbsolute', function() { - return isAbsolute(this.path); - }); - - cache.set(filepath, obj); - return obj; -}; - -function define(obj, prop, fn) { - var cached; - Object.defineProperty(obj, prop, { - configurable: true, - enumerable: true, - set: function(val) { - cached = val; - }, - get: function() { - return cached || (cached = fn.call(obj)); - } - }); -} diff --git a/node_modules/parse-filepath/package.json b/node_modules/parse-filepath/package.json deleted file mode 100644 index 1f0ab47..0000000 --- a/node_modules/parse-filepath/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "parse-filepath", - "description": "Pollyfill for node.js `path.parse`, parses a filepath into an object.", - "version": "1.0.2", - "homepage": "https://github.com/jonschlinkert/parse-filepath", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/parse-filepath", - "bugs": { - "url": "https://github.com/jonschlinkert/parse-filepath/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.8" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - }, - "devDependencies": { - "gulp-format-md": "^0.1.7", - "mocha": "^2.2.5", - "should": "^7.0.2" - }, - "keywords": [ - "absolute", - "basename", - "dir", - "directory", - "dirname", - "ext", - "extension", - "extname", - "file", - "filename", - "filepath", - "is-absolute", - "name", - "object", - "parse", - "parser", - "parts", - "path", - "segment" - ], - "verb": { - "run": true, - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "highlight": "global-prefix", - "list": [ - "global-prefix", - "is-absolute", - "is-relative", - "relative" - ] - }, - "reflinks": [ - "verb" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/parse-imports/dist/index.cjs b/node_modules/parse-imports/dist/index.cjs deleted file mode 100644 index ac54aec..0000000 --- a/node_modules/parse-imports/dist/index.cjs +++ /dev/null @@ -1,242 +0,0 @@ -var esModuleLexer = require('es-module-lexer'); -var assert = require('node:assert'); -var slashes = require('slashes'); -var module$1 = require('node:module'); -var node_path = require('node:path'); - -var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; -const separatorRegex = /^(?:\s+|,)$/u; -const skipSeparators = (imported, i) => { - while (i < imported.length && separatorRegex.test(imported[i])) { - i++; - } - return i; -}; -const skipNonSeparators = (imported, i) => { - while (i < imported.length && !separatorRegex.test(imported[i])) { - i++; - } - return i; -}; - -const parseDefaultImport = (importClauseString, i) => { - const startIndex = i; - i = skipNonSeparators(importClauseString, i); - return { - defaultImport: importClauseString.slice(startIndex, i), - i - }; -}; - -const parseNamedImports = (importClauseString, i) => { - const startIndex = ++i; - while (i < importClauseString.length && importClauseString[i] !== `}`) { - i++; - } - const namedImports = importClauseString.slice(startIndex, i++).split(`,`).map(namedImport => { - namedImport = namedImport.trim(); - if (namedImport.includes(` `)) { - const components = namedImport.split(` `); - return { - specifier: components[0], - binding: components.at(-1) - }; - } - return { - specifier: namedImport, - binding: namedImport - }; - }).filter(({ - specifier - }) => specifier.length > 0); - return { - namedImports, - i - }; -}; - -const parseNamespaceImport = (importClauseString, i) => { - i++; - i = skipSeparators(importClauseString, i); - i += `as`.length; - i = skipSeparators(importClauseString, i); - const startIndex = i; - i = skipNonSeparators(importClauseString, i); - return { - namespaceImport: importClauseString.slice(startIndex, i), - i - }; -}; - -// Assumes import clause is syntactically valid -const parseImportClause = importClauseString => { - let defaultImport; - let namespaceImport; - const namedImports = []; - for (let i = 0; i < importClauseString.length; i++) { - if (separatorRegex.test(importClauseString[i])) { - continue; - } - if (importClauseString[i] === `{`) { - let newNamedImports; - ({ - namedImports: newNamedImports, - i - } = parseNamedImports(importClauseString, i)); - namedImports.push(...newNamedImports); - } else if (importClauseString[i] === `*`) { - ({ - namespaceImport, - i - } = parseNamespaceImport(importClauseString, i)); - } else { - ({ - defaultImport, - i - } = parseDefaultImport(importClauseString, i)); - } - } - return { - default: defaultImport, - namespace: namespaceImport, - named: namedImports - }; -}; - -// Assumes the string is syntactically valid -const isConstantStringLiteral = stringLiteral => { - const quote = [`'`, `"`, `\``].find(quoteCandidate => stringLiteral.startsWith(quoteCandidate) && stringLiteral.endsWith(quoteCandidate)); - if (quote == null) { - return false; - } - for (let i = 1; i < stringLiteral.length - 1; i++) { - // Check for end of string literal before end of stringLiteral - if (stringLiteral[i] === quote && stringLiteral[i - 1] !== `\\`) { - return false; - } - - // Check for interpolated value in template literal - if (quote === `\`` && stringLiteral.slice(i, i + 2) === `\${` && stringLiteral[i - 1] !== `\\`) { - return false; - } - } - return true; -}; - -const builtinModules = new Set(module$1.builtinModules); -const parseType = moduleSpecifier => { - if (moduleSpecifier.length === 0) { - return `invalid`; - } - if (moduleSpecifier.startsWith(`/`)) { - return `absolute`; - } - if (moduleSpecifier.startsWith(`.`)) { - return `relative`; - } - if (builtinModules.has(moduleSpecifier)) { - return `builtin`; - } - return `package`; -}; - -const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))); -const resolve = (from, to) => { - try { - return require$1.resolve(to, { - paths: [node_path.dirname(from)] - }); - } catch { - return undefined; - } -}; - -const parseModuleSpecifier = (moduleSpecifierString, { - isDynamicImport, - resolveFrom -}) => { - assert(isDynamicImport || isConstantStringLiteral(moduleSpecifierString)); - const { - isConstant, - value - } = !isDynamicImport || isConstantStringLiteral(moduleSpecifierString) ? { - isConstant: true, - value: slashes.removeSlashes(moduleSpecifierString.slice(1, -1)) - } : { - isConstant: false, - value: undefined - }; - return { - type: isConstant ? parseType(value) : `unknown`, - isConstant, - code: moduleSpecifierString, - value, - resolved: typeof resolveFrom === `string` && isConstant ? resolve(resolveFrom, value) : undefined - }; -}; - -const wasmLoadPromise = esModuleLexer.init; -const parseImports = async (code, options) => { - await wasmLoadPromise; - return parseImportsSync(code, options); -}; -const parseImportsSync = (code, { - resolveFrom -} = {}) => { - const result = esModuleLexer.parse(code, resolveFrom == null ? undefined : resolveFrom); - if (!Array.isArray(result)) { - throw new TypeError(`Expected WASM to be loaded before calling parseImportsSync`); - } - const [imports] = result; - return { - *[Symbol.iterator]() { - for (let { - d: dynamicImportStartIndex, - ss: statementStartIndex, - s: moduleSpecifierStartIndex, - e: moduleSpecifierEndIndexExclusive - } of imports) { - const isImportMeta = dynamicImportStartIndex === -2; - if (isImportMeta) { - continue; - } - const isDynamicImport = dynamicImportStartIndex > -1; - - // Include string literal quotes in character range - if (!isDynamicImport) { - moduleSpecifierStartIndex--; - moduleSpecifierEndIndexExclusive++; - } - const moduleSpecifierString = code.slice(moduleSpecifierStartIndex, moduleSpecifierEndIndexExclusive); - const moduleSpecifier = { - startIndex: moduleSpecifierStartIndex, - endIndex: moduleSpecifierEndIndexExclusive, - ...parseModuleSpecifier(moduleSpecifierString, { - isDynamicImport, - resolveFrom - }) - }; - let importClause; - if (!isDynamicImport) { - let importClauseString = code.slice(statementStartIndex + `import`.length, moduleSpecifierStartIndex).trim(); - if (importClauseString.endsWith(`from`)) { - importClauseString = importClauseString.slice(0, Math.max(0, importClauseString.length - `from`.length)); - } - importClause = parseImportClause(importClauseString); - } - yield { - startIndex: statementStartIndex, - // Include the closing parenthesis for dynamic import - endIndex: isDynamicImport ? moduleSpecifierEndIndexExclusive + 1 : moduleSpecifierEndIndexExclusive, - isDynamicImport, - moduleSpecifier, - importClause - }; - } - } - }; -}; - -exports.parseImports = parseImports; -exports.parseImportsSync = parseImportsSync; -exports.wasmLoadPromise = wasmLoadPromise; diff --git a/node_modules/parse-imports/dist/index.d.ts b/node_modules/parse-imports/dist/index.d.ts deleted file mode 100644 index 8411f6d..0000000 --- a/node_modules/parse-imports/dist/index.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** Options for parsing imports. */ -type Options = { - /** - * If set to a file path, then {@link Import.moduleSpecifier.resolved} of - * returned instances will be set to the result of calling - * `require.resolve(moduleSpecifier.value)` from the given file path. - * Otherwise, will be undefined. - */ - readonly resolveFrom?: string -} - -/** - * A type representing what kind of module a specifier refers to. - * - * - 'unknown' if the module specifier is not a simple constant string literal - * - 'invalid' if the module specifier is the empty string - * - 'absolute' if the module specifier is an absolute file path - * - 'relative' if the module specifier is a relative file path - * - 'builtin' if the module specifier is the name of a builtin Node.js package - * - 'package' otherwise - */ -type ModuleSpecifierType = - | 'invalid' - | 'absolute' - | 'relative' - | 'builtin' - | 'package' - | 'unknown' - -/** - * A type representing an import in JavaScript code. - * - * `code.substring(startIndex, endIndex)` returns the full import statement or - * expression. - */ -type Import = { - /** The start index of the import in the JavaScript (inclusive). */ - startIndex: number - - /** The end index of the import in the JavaScript (exclusive). */ - endIndex: number - - /** Whether the import is a dynamic import (e.g. `import('module')`). */ - isDynamicImport: boolean - - /** - * A type representing the code specifiying the module being imported. - * - * `code.substring(moduleSpecifier.startIndex, moduleSpecifier.endIndex)` - * returns the module specifier including quotes. - */ - moduleSpecifier: { - /** - * What kind of module the specifier refers to. - * - * 'unknown' when `moduleSpecifier.isConstant` is false. - */ - type: ModuleSpecifierType - - /** The start index of the specifier in the JavaScript (inclusive). */ - startIndex: number - - /** The end index of the specifier in the JavaScript (exclusive). */ - endIndex: number - - /** - * True when the import is not a dynamic import (`isDynamicImport` is - * false), or when the import is a dynamic import where the specifier is a - * simple string literal (e.g. import('fs'), import("fs"), import(`fs`)). - */ - isConstant: boolean - - /** - * The module specifier as it was written in the code. For non-constant - * dynamic imports it could be a complex expression. - */ - code: string - - /** - * `code` without string literal quotes and unescaped if `isConstant` is - * true. Otherwise, it is undefined. - */ - value?: string - - /** Set if the `resolveFrom` option is set and `value` is not undefined. */ - resolved?: string - } - - /** - * A type representing what is being imported from the module. - * - * Undefined if `isDynamicImport` is true. - */ - importClause?: { - /** - * The default import identifier or undefined if the import statement does - * not have a default import. - */ - default?: string - - /** - * An array of objects representing the named imports of the import - * statement. It is empty if the import statement does not have any named - * imports. Each object in the array has a specifier field set to the - * imported identifier and a binding field set to the identifier for - * accessing the imported value. - * For example, `import { a, x as y } from 'something'` would have the - * following array: - * ``` - * [{ specifier: 'a', binding: 'a' }, { specifier: 'x', binding: 'y' }] - * ``` - */ - named: { specifier: string; binding: string }[] - - /** - * The namespace import identifier or undefined if the import statement does - * not have a namespace import. - */ - namespace?: string - } -} - -/** - * A promise that resolves once WASM has finished loading. - * - * Await this promise to be certain calling `parseImportsSync` is safe. - */ -declare const wasmLoadPromise: Promise - -/** - * Returns a promise resolving to a lazy iterable/iterator that iterates over - * the imports in `code`. - */ -declare const parseImports: ( - code: string, - options?: Options, -) => Promise> - -/** - * Returns a lazy iterable/iterator that iterates over the imports in `code`. - * - * @throws if called before WASM has finished loading. Await `wasmLoadPromise` - * to be sure it has finished. - */ -declare const parseImportsSync: ( - code: string, - options?: Options, -) => Iterable - -export { type Import, type ModuleSpecifierType, type Options, parseImports, parseImportsSync, wasmLoadPromise }; diff --git a/node_modules/parse-imports/dist/index.js b/node_modules/parse-imports/dist/index.js deleted file mode 100644 index fa92dd3..0000000 --- a/node_modules/parse-imports/dist/index.js +++ /dev/null @@ -1,239 +0,0 @@ -import { init, parse } from 'es-module-lexer'; -import assert from 'node:assert'; -import { removeSlashes } from 'slashes'; -import module, { createRequire } from 'node:module'; -import { dirname } from 'node:path'; - -const separatorRegex = /^(?:\s+|,)$/u; -const skipSeparators = (imported, i) => { - while (i < imported.length && separatorRegex.test(imported[i])) { - i++; - } - return i; -}; -const skipNonSeparators = (imported, i) => { - while (i < imported.length && !separatorRegex.test(imported[i])) { - i++; - } - return i; -}; - -const parseDefaultImport = (importClauseString, i) => { - const startIndex = i; - i = skipNonSeparators(importClauseString, i); - return { - defaultImport: importClauseString.slice(startIndex, i), - i - }; -}; - -const parseNamedImports = (importClauseString, i) => { - const startIndex = ++i; - while (i < importClauseString.length && importClauseString[i] !== `}`) { - i++; - } - const namedImports = importClauseString.slice(startIndex, i++).split(`,`).map(namedImport => { - namedImport = namedImport.trim(); - if (namedImport.includes(` `)) { - const components = namedImport.split(` `); - return { - specifier: components[0], - binding: components.at(-1) - }; - } - return { - specifier: namedImport, - binding: namedImport - }; - }).filter(({ - specifier - }) => specifier.length > 0); - return { - namedImports, - i - }; -}; - -const parseNamespaceImport = (importClauseString, i) => { - i++; - i = skipSeparators(importClauseString, i); - i += `as`.length; - i = skipSeparators(importClauseString, i); - const startIndex = i; - i = skipNonSeparators(importClauseString, i); - return { - namespaceImport: importClauseString.slice(startIndex, i), - i - }; -}; - -// Assumes import clause is syntactically valid -const parseImportClause = importClauseString => { - let defaultImport; - let namespaceImport; - const namedImports = []; - for (let i = 0; i < importClauseString.length; i++) { - if (separatorRegex.test(importClauseString[i])) { - continue; - } - if (importClauseString[i] === `{`) { - let newNamedImports; - ({ - namedImports: newNamedImports, - i - } = parseNamedImports(importClauseString, i)); - namedImports.push(...newNamedImports); - } else if (importClauseString[i] === `*`) { - ({ - namespaceImport, - i - } = parseNamespaceImport(importClauseString, i)); - } else { - ({ - defaultImport, - i - } = parseDefaultImport(importClauseString, i)); - } - } - return { - default: defaultImport, - namespace: namespaceImport, - named: namedImports - }; -}; - -// Assumes the string is syntactically valid -const isConstantStringLiteral = stringLiteral => { - const quote = [`'`, `"`, `\``].find(quoteCandidate => stringLiteral.startsWith(quoteCandidate) && stringLiteral.endsWith(quoteCandidate)); - if (quote == null) { - return false; - } - for (let i = 1; i < stringLiteral.length - 1; i++) { - // Check for end of string literal before end of stringLiteral - if (stringLiteral[i] === quote && stringLiteral[i - 1] !== `\\`) { - return false; - } - - // Check for interpolated value in template literal - if (quote === `\`` && stringLiteral.slice(i, i + 2) === `\${` && stringLiteral[i - 1] !== `\\`) { - return false; - } - } - return true; -}; - -const builtinModules = new Set(module.builtinModules); -const parseType = moduleSpecifier => { - if (moduleSpecifier.length === 0) { - return `invalid`; - } - if (moduleSpecifier.startsWith(`/`)) { - return `absolute`; - } - if (moduleSpecifier.startsWith(`.`)) { - return `relative`; - } - if (builtinModules.has(moduleSpecifier)) { - return `builtin`; - } - return `package`; -}; - -const require = createRequire(import.meta.url); -const resolve = (from, to) => { - try { - return require.resolve(to, { - paths: [dirname(from)] - }); - } catch { - return undefined; - } -}; - -const parseModuleSpecifier = (moduleSpecifierString, { - isDynamicImport, - resolveFrom -}) => { - assert(isDynamicImport || isConstantStringLiteral(moduleSpecifierString)); - const { - isConstant, - value - } = !isDynamicImport || isConstantStringLiteral(moduleSpecifierString) ? { - isConstant: true, - value: removeSlashes(moduleSpecifierString.slice(1, -1)) - } : { - isConstant: false, - value: undefined - }; - return { - type: isConstant ? parseType(value) : `unknown`, - isConstant, - code: moduleSpecifierString, - value, - resolved: typeof resolveFrom === `string` && isConstant ? resolve(resolveFrom, value) : undefined - }; -}; - -const wasmLoadPromise = init; -const parseImports = async (code, options) => { - await wasmLoadPromise; - return parseImportsSync(code, options); -}; -const parseImportsSync = (code, { - resolveFrom -} = {}) => { - const result = parse(code, resolveFrom == null ? undefined : resolveFrom); - if (!Array.isArray(result)) { - throw new TypeError(`Expected WASM to be loaded before calling parseImportsSync`); - } - const [imports] = result; - return { - *[Symbol.iterator]() { - for (let { - d: dynamicImportStartIndex, - ss: statementStartIndex, - s: moduleSpecifierStartIndex, - e: moduleSpecifierEndIndexExclusive - } of imports) { - const isImportMeta = dynamicImportStartIndex === -2; - if (isImportMeta) { - continue; - } - const isDynamicImport = dynamicImportStartIndex > -1; - - // Include string literal quotes in character range - if (!isDynamicImport) { - moduleSpecifierStartIndex--; - moduleSpecifierEndIndexExclusive++; - } - const moduleSpecifierString = code.slice(moduleSpecifierStartIndex, moduleSpecifierEndIndexExclusive); - const moduleSpecifier = { - startIndex: moduleSpecifierStartIndex, - endIndex: moduleSpecifierEndIndexExclusive, - ...parseModuleSpecifier(moduleSpecifierString, { - isDynamicImport, - resolveFrom - }) - }; - let importClause; - if (!isDynamicImport) { - let importClauseString = code.slice(statementStartIndex + `import`.length, moduleSpecifierStartIndex).trim(); - if (importClauseString.endsWith(`from`)) { - importClauseString = importClauseString.slice(0, Math.max(0, importClauseString.length - `from`.length)); - } - importClause = parseImportClause(importClauseString); - } - yield { - startIndex: statementStartIndex, - // Include the closing parenthesis for dynamic import - endIndex: isDynamicImport ? moduleSpecifierEndIndexExclusive + 1 : moduleSpecifierEndIndexExclusive, - isDynamicImport, - moduleSpecifier, - importClause - }; - } - } - }; -}; - -export { parseImports, parseImportsSync, wasmLoadPromise }; diff --git a/node_modules/parse-imports/license-apache b/node_modules/parse-imports/license-apache deleted file mode 100644 index 137069b..0000000 --- a/node_modules/parse-imports/license-apache +++ /dev/null @@ -1,73 +0,0 @@ -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/parse-imports/license-mit b/node_modules/parse-imports/license-mit deleted file mode 100644 index 4f65155..0000000 --- a/node_modules/parse-imports/license-mit +++ /dev/null @@ -1,20 +0,0 @@ -MIT License - -Copyright (c) 2024 Tomer Aberbach - -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/parse-imports/notice-apache b/node_modules/parse-imports/notice-apache deleted file mode 100644 index d261b6e..0000000 --- a/node_modules/parse-imports/notice-apache +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2020-2024 Google LLC - -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/parse-imports/package.json b/node_modules/parse-imports/package.json deleted file mode 100644 index b40330f..0000000 --- a/node_modules/parse-imports/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "parse-imports", - "version": "2.2.1", - "author": { - "name": "Tomer Aberbach", - "email": "tomeraberbach@gmail.com", - "url": "https://tomeraberba.ch" - }, - "description": "A blazing fast ES module imports parser.", - "keywords": [ - "esm", - "imports", - "module", - "parser", - "imports" - ], - "homepage": "https://github.com/TomerAberbach/parse-imports", - "repository": "TomerAberbach/parse-imports", - "bugs": { - "url": "https://github.com/TomerAberbach/parse-imports/issues" - }, - "license": "Apache-2.0 AND MIT", - "files": [ - "dist", - "license-apache", - "license-mit", - "notice-apache" - ], - "type": "module", - "engines": { - "node": ">= 18" - }, - "exports": { - "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist/index.js" - }, - "types": "./dist/index.d.ts", - "main": "./dist/index.cjs", - "module": "./dist/index.js", - "prettier": "tomer/prettier-config", - "dependencies": { - "es-module-lexer": "^1.5.3", - "slashes": "^3.0.12" - }, - "devDependencies": { - "@types/jest": "^29.5.12", - "@types/node": "^20.14.8", - "eslint": "^8.57.0", - "jest": "^29.7.0", - "prettier": "^3.3.2", - "tomer": "^3.2.4", - "typescript": "^5.5.2" - }, - "scripts": { - "format": "tomer format", - "lint": "tomer lint", - "typecheck": "tomer typecheck", - "test": "tomer test", - "build": "tomer build", - "clean": "tomer clean dist" - } -} \ No newline at end of file diff --git a/node_modules/parse-imports/readme.md b/node_modules/parse-imports/readme.md deleted file mode 100644 index 6b9f4c3..0000000 --- a/node_modules/parse-imports/readme.md +++ /dev/null @@ -1,278 +0,0 @@ -

- parse-imports -

- - - -
- A blazing fast ES module imports parser. -
- -## Features - -- Uses the superb WASM-based - [`es-module-lexer`](https://github.com/guybedford/es-module-lexer) under the - hood -- Identifies module specifier types (e.g. relative file import, package import, - builtin import, etc.) -- Unescapes module specifier escape sequences -- Collects default, named, and namespace imports -- Works with dynamic imports -- Resolves module specifier paths via `require.resolve` - -## Install - -```sh -$ npm i parse-imports -``` - -## Usage - -```js -import { parseImports } from 'parse-imports' - -const code = ` - import a from 'b' - import * as c from './d' - import { e as f, g as h, i } from '/j' - import k, { l as m } from 'n' - import o, * as p from "./q" - import r, { s as t, u } from "/v" - import fs from 'fs' - - ;(async () => { - await import("w") - await import("x" + "y") - })() -` - -// Lazily iterate over iterable of imports -for (const $import of await parseImports(code)) { - console.log($import) -} - -// Or get as an array of imports -const imports = [...(await parseImports(code))] - -console.log(imports[0]) -//=> -// { -// startIndex: 3, -// endIndex: 20, -// isDynamicImport: false, -// moduleSpecifier: { -// type: 'package', -// startIndex: 17, -// endIndex: 20, -// isConstant: true, -// code: `'b'`, -// value: 'b', -// resolved: undefined -// }, -// importClause: { -// default: 'a', -// named: [], -// namespace: undefined -// } -// } - -console.log(imports[1]) -//=> -// { -// startIndex: 23, -// endIndex: 47, -// isDynamicImport: false, -// moduleSpecifier: { -// type: 'relative', -// startIndex: 42, -// endIndex: 47, -// isConstant: true, -// code: `'./d'`, -// value: './d', -// resolved: undefined -// }, -// importClause: { -// default: undefined, -// named: [], -// namespace: 'c' -// } -// } - -console.log(imports[5]) -//=> -// { -// startIndex: 153, -// endIndex: 186, -// isDynamicImport: false, -// moduleSpecifier: { -// type: 'absolute', -// startIndex: 182, -// endIndex: 186, -// isConstant: true, -// code: '"/v"', -// value: '/v', -// resolved: undefined -// }, -// importClause: { -// default: 'r', -// named: [ -// { specifier: 's', binding: 't' }, -// { specifier: 'u', binding: 'u' } -// ], -// namespace: undefined -// } -// } - -console.log(imports[7]) -//=> -// { -// startIndex: 238, -// endIndex: 249, -// isDynamicImport: true, -// moduleSpecifier: { -// type: 'package', -// startIndex: 245, -// endIndex: 248, -// isConstant: true, -// code: '"w"', -// value: 'w', -// resolved: undefined -// }, -// importClause: undefined -// } - -console.log(imports[8]) -//=> -// { -// startIndex: 260, -// endIndex: 277, -// isDynamicImport: true, -// moduleSpecifier: { -// type: 'unknown', -// startIndex: 267, -// endIndex: 276, -// isConstant: false, -// code: '"x" + "y"', -// value: undefined, -// resolved: undefined -// }, -// importClause: undefined -// } -``` - -## API - -Use `parseImports` when you're able to await a `Promise` result and -`parseImportsSync` otherwise. - -> [!IMPORTANT] -> -> You can only call `parseImportsSync` once the WASM has loaded. You can be sure -> this has happened by awaiting the exported `wasmLoadPromise`. - -See the [type definitions](./src/index.d.ts) for details. - -### Types - - - -```ts -type ModuleSpecifierType = - | 'invalid' - | 'absolute' - | 'relative' - | 'builtin' - | 'package' - | 'unknown' - -type Import = { - startIndex: number - endIndex: number - isDynamicImport: boolean - moduleSpecifier: { - type: ModuleSpecifierType - startIndex: number - endIndex: number - isConstant: boolean - code: string - value?: string - resolved?: string - } - importClause?: { - default?: string - named: string[] - namespace?: string - } -} -``` - -#### `Import` - -`code.substring(startIndex, endIndex)` returns the full import statement or -expression. -`code.substring(moduleSpecifier.startIndex, moduleSpecifier.endIndex)` returns -the module specifier including quotes. - -`moduleSpecifier.isConstant` is `true` when the import is not a dynamic import -(`isDynamicImport` is `false`), or when the import is a dynamic import where the -specifier is a simple string literal (e.g. `import('fs')`, `import("fs")`, -``import(`fs`)``). - -If `moduleSpecifier.isConstant` is `false`, then `moduleSpecifier.type` is -`'unknown'`. Otherwise, it is set according to the following rules: - -- `'invalid'` if the module specifier is the empty string -- `'absolute'` if the module specifier is an absolute file path -- `'relative'` if the module specifier is a relative file path -- `'builtin'` if the module specifier is the name of a builtin Node.js package -- `'package'` otherwise - -`moduleSpecifier.code` is the module specifier as it was written in the code. -For non-constant dynamic imports it could be a complex expression. - -`moduleSpecifier.value` is `moduleSpecifier.code` without string literal quotes -and unescaped if `moduleSpecifier.isConstant` is `true`. Otherwise, it is -`undefined`. - -`moduleSpecifier.resolved` is set if the `resolveFrom` option is set and -`moduleSpecifier.value` is not `undefined`. - -`importClause` is only `undefined` if `isDynamicImport` is `true`. - -`importClause.default` is the default import identifier or `undefined` if the -import statement does not have a default import. - -`importClause.named` is the array of objects representing the named imports of -the import statement. It is empty if the import statement does not have any -named imports. Each object in the array has a `specifier` field set to the -imported identifier and a `binding` field set to the identifier for accessing -the imported value. For example, `import { a, x as y } from 'something'` would -have the following array for `importClause.named`: -`[{ specifier: 'a', binding: 'a' }, { specifier: 'x', binding: 'y' }]`. - -`importClause.namespace` is the namespace import identifier or `undefined` if -the import statement does not have a namespace import. - -## Contributing - -Stars are always welcome! - -For bugs and feature requests, -[please create an issue](https://github.com/TomerAberbach/parse-imports/issues/new). - -## License - -[MIT](https://github.com/TomerAberbach/parse-imports/blob/main/license) © -[Tomer Aberbach](https://github.com/TomerAberbach) \ -[Apache 2.0](https://github.com/TomerAberbach/parse-imports/blob/main/license-apache) © -[Google](https://github.com/TomerAberbach/parse-imports/blob/main/notice-apache) diff --git a/node_modules/parse-node-version/LICENSE b/node_modules/parse-node-version/LICENSE deleted file mode 100644 index bde9654..0000000 --- a/node_modules/parse-node-version/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Blaine Bublitz and Eric Schoffstall - -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/parse-node-version/README.md b/node_modules/parse-node-version/README.md deleted file mode 100644 index 2bb35bf..0000000 --- a/node_modules/parse-node-version/README.md +++ /dev/null @@ -1,51 +0,0 @@ -

- - - -

- -# parse-node-version - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] - -Turn node's process.version into something useful. - -## Usage - -```js -var nodeVersion = require('parse-node-version')(process.version); - -console.log( - nodeVersion.major, - nodeVersion.minor, - nodeVersion.patch, - nodeVersion.pre, - nodeVersion.build -); -``` - -## API - -### parseVersion(nodeVersionString) - -Takes a node version string (usually `process.version`) and returns an object with the `major`/`minor`/`patch` (which will all be numbers) and `pre`/`build` keys (which will always be a string). If the version doesn't contain any pre-release or build information, the properties will be returned as empty string. - -## License - -MIT - -[downloads-image]: http://img.shields.io/npm/dm/parse-node-version.svg -[npm-url]: https://www.npmjs.com/package/parse-node-version -[npm-image]: http://img.shields.io/npm/v/parse-node-version.svg - -[travis-url]: https://travis-ci.org/gulpjs/parse-node-version -[travis-image]: http://img.shields.io/travis/gulpjs/parse-node-version.svg?label=travis-ci - -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/parse-node-version -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/parse-node-version.svg?label=appveyor - -[coveralls-url]: https://coveralls.io/r/gulpjs/parse-node-version -[coveralls-image]: http://img.shields.io/coveralls/gulpjs/parse-node-version/master.svg - -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/node_modules/parse-node-version/index.js b/node_modules/parse-node-version/index.js deleted file mode 100644 index 87fc764..0000000 --- a/node_modules/parse-node-version/index.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -function parseNodeVersion(version) { - var match = version.match(/^v(\d{1,2})\.(\d{1,2})\.(\d{1,2})(?:-([0-9A-Za-z-.]+))?(?:\+([0-9A-Za-z-.]+))?$/); // eslint-disable-line max-len - if (!match) { - throw new Error('Unable to parse: ' + version); - } - - var res = { - major: parseInt(match[1], 10), - minor: parseInt(match[2], 10), - patch: parseInt(match[3], 10), - pre: match[4] || '', - build: match[5] || '', - }; - - return res; -} - -module.exports = parseNodeVersion; diff --git a/node_modules/parse-node-version/package.json b/node_modules/parse-node-version/package.json deleted file mode 100644 index f4124e2..0000000 --- a/node_modules/parse-node-version/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "parse-node-version", - "version": "1.0.1", - "description": "Turn node's process.version into something useful.", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/parse-node-version", - "license": "MIT", - "engines": { - "node": ">= 0.10" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "mocha --async-only", - "cover": "istanbul cover _mocha --report lcovonly", - "coveralls": "npm run cover && istanbul-coveralls" - }, - "dependencies": {}, - "devDependencies": { - "eslint": "^2.13.0", - "eslint-config-gulp": "^3.0.1", - "expect": "^1.20.2", - "istanbul": "^0.4.3", - "istanbul-coveralls": "^1.0.3", - "mocha": "^3.5.3" - }, - "keywords": [ - "process.version", - "node version", - "version parse" - ] -} diff --git a/node_modules/parse-passwd/LICENSE b/node_modules/parse-passwd/LICENSE deleted file mode 100644 index f92fdcf..0000000 --- a/node_modules/parse-passwd/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Brian Woodward - -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/parse-passwd/README.md b/node_modules/parse-passwd/README.md deleted file mode 100644 index 31b1e79..0000000 --- a/node_modules/parse-passwd/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# parse-passwd [![NPM version](https://img.shields.io/npm/v/parse-passwd.svg?style=flat)](https://www.npmjs.com/package/parse-passwd) [![NPM downloads](https://img.shields.io/npm/dm/parse-passwd.svg?style=flat)](https://npmjs.org/package/parse-passwd) [![Linux Build Status](https://img.shields.io/travis/doowb/parse-passwd.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/parse-passwd) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/parse-passwd.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/doowb/parse-passwd) - -> Parse a passwd file into a list of users. - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install --save parse-passwd -``` - -## Usage - -```js -var parse = require('parse-passwd'); -``` - -## API - -**Example** - -```js -// assuming '/etc/passwd' contains: -// doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash -console.log(parse(fs.readFileSync('/etc/passwd', 'utf8'))); - -//=> [ -//=> { -//=> username: 'doowb', -//=> password: '*', -//=> uid: '123', -//=> gid: '123', -//=> gecos: 'Brian Woodward', -//=> homedir: '/Users/doowb', -//=> shell: '/bin/bash' -//=> } -//=> ] -``` - -**Params** - -* `content` **{String}**: Content of a passwd file to parse. -* `returns` **{Array}**: Array of user objects parsed from the content. - -## About - -### Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards. - -### 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 - -**Brian Woodward** - -* [github/doowb](https://github.com/doowb) -* [twitter/doowb](http://twitter.com/doowb) - -### License - -Copyright © 2016, [Brian Woodward](https://github.com/doowb). -Released under the [MIT license](LICENSE). - -*** - -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 19, 2016._ \ No newline at end of file diff --git a/node_modules/parse-passwd/index.js b/node_modules/parse-passwd/index.js deleted file mode 100644 index 7524520..0000000 --- a/node_modules/parse-passwd/index.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; - -/** - * Parse the content of a passwd file into a list of user objects. - * This function ignores blank lines and comments. - * - * ```js - * // assuming '/etc/passwd' contains: - * // doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash - * console.log(parse(fs.readFileSync('/etc/passwd', 'utf8'))); - * - * //=> [ - * //=> { - * //=> username: 'doowb', - * //=> password: '*', - * //=> uid: '123', - * //=> gid: '123', - * //=> gecos: 'Brian Woodward', - * //=> homedir: '/Users/doowb', - * //=> shell: '/bin/bash' - * //=> } - * //=> ] - * ``` - * @param {String} `content` Content of a passwd file to parse. - * @return {Array} Array of user objects parsed from the content. - * @api public - */ - -module.exports = function(content) { - if (typeof content !== 'string') { - throw new Error('expected a string'); - } - return content - .split('\n') - .map(user) - .filter(Boolean); -}; - -function user(line, i) { - if (!line || !line.length || line.charAt(0) === '#') { - return null; - } - - // see https://en.wikipedia.org/wiki/Passwd for field descriptions - var fields = line.split(':'); - return { - username: fields[0], - password: fields[1], - uid: fields[2], - gid: fields[3], - // see https://en.wikipedia.org/wiki/Gecos_field for GECOS field descriptions - gecos: fields[4], - homedir: fields[5], - shell: fields[6] - }; -} diff --git a/node_modules/parse-passwd/package.json b/node_modules/parse-passwd/package.json deleted file mode 100644 index b09fb0f..0000000 --- a/node_modules/parse-passwd/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "parse-passwd", - "description": "Parse a passwd file into a list of users.", - "version": "1.0.0", - "homepage": "https://github.com/doowb/parse-passwd", - "author": "Brian Woodward (https://github.com/doowb)", - "repository": "doowb/parse-passwd", - "bugs": { - "url": "https://github.com/doowb/parse-passwd/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "LICENSE" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^0.1.11", - "mocha": "^3.1.2" - }, - "keywords": [ - "etc", - "etc-passwd", - "etc/passwd", - "parse", - "parse-passwd", - "passwd" - ], - "verb": { - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [] - }, - "reflinks": [ - "verb", - "verb-generate-readme" - ] - } -} diff --git a/node_modules/path-exists/index.d.ts b/node_modules/path-exists/index.d.ts deleted file mode 100644 index 54b7ab8..0000000 --- a/node_modules/path-exists/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -declare const pathExists: { - /** - Check if a path exists. - - @returns Whether the path exists. - - @example - ``` - // foo.ts - import pathExists = require('path-exists'); - - (async () => { - console.log(await pathExists('foo.ts')); - //=> true - })(); - ``` - */ - (path: string): Promise; - - /** - Synchronously check if a path exists. - - @returns Whether the path exists. - */ - sync(path: string): boolean; -}; - -export = pathExists; diff --git a/node_modules/path-exists/index.js b/node_modules/path-exists/index.js deleted file mode 100644 index 1943921..0000000 --- a/node_modules/path-exists/index.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; -const fs = require('fs'); -const {promisify} = require('util'); - -const pAccess = promisify(fs.access); - -module.exports = async path => { - try { - await pAccess(path); - return true; - } catch (_) { - return false; - } -}; - -module.exports.sync = path => { - try { - fs.accessSync(path); - return true; - } catch (_) { - return false; - } -}; diff --git a/node_modules/path-exists/license b/node_modules/path-exists/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/path-exists/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/path-exists/package.json b/node_modules/path-exists/package.json deleted file mode 100644 index 0755256..0000000 --- a/node_modules/path-exists/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "path-exists", - "version": "4.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": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "path", - "exists", - "exist", - "file", - "filepath", - "fs", - "filesystem", - "file-system", - "access", - "stat" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/path-exists/readme.md b/node_modules/path-exists/readme.md deleted file mode 100644 index 81f9845..0000000 --- a/node_modules/path-exists/readme.md +++ /dev/null @@ -1,52 +0,0 @@ -# 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 - -NOTE: `fs.existsSync` has been un-deprecated in Node.js since 6.8.0. If you only need to check synchronously, this module is not needed. - -While [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), 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 path-exists -``` - - -## Usage - -```js -// foo.js -const pathExists = require('path-exists'); - -(async () => { - console.log(await pathExists('foo.js')); - //=> true -})(); -``` - - -## API - -### pathExists(path) - -Returns a `Promise` 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-key/index.d.ts b/node_modules/path-key/index.d.ts deleted file mode 100644 index 7c575d1..0000000 --- a/node_modules/path-key/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/// - -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 deleted file mode 100644 index 0cf6415..0000000 --- a/node_modules/path-key/index.js +++ /dev/null @@ -1,16 +0,0 @@ -'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 deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/path-key/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/path-key/package.json b/node_modules/path-key/package.json deleted file mode 100644 index c8cbd38..0000000 --- a/node_modules/path-key/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "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 deleted file mode 100644 index a9052d7..0000000 --- a/node_modules/path-key/readme.md +++ /dev/null @@ -1,61 +0,0 @@ -# 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 deleted file mode 100644 index 810f3db..0000000 --- a/node_modules/path-parse/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 05097f8..0000000 --- a/node_modules/path-parse/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# 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 deleted file mode 100644 index f062d0a..0000000 --- a/node_modules/path-parse/index.js +++ /dev/null @@ -1,75 +0,0 @@ -'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 deleted file mode 100644 index 36c23f8..0000000 --- a/node_modules/path-parse/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "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/path-root-regex/LICENSE b/node_modules/path-root-regex/LICENSE deleted file mode 100644 index e28e603..0000000 --- a/node_modules/path-root-regex/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 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/path-root-regex/README.md b/node_modules/path-root-regex/README.md deleted file mode 100644 index 9cc61ec..0000000 --- a/node_modules/path-root-regex/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# path-root-regex [![NPM version](https://img.shields.io/npm/v/path-root-regex.svg?style=flat)](https://www.npmjs.com/package/path-root-regex) [![NPM downloads](https://img.shields.io/npm/dm/path-root-regex.svg?style=flat)](https://npmjs.org/package/path-root-regex) [![Build Status](https://img.shields.io/travis/regexhq/path-root-regex.svg?style=flat)](https://travis-ci.org/regexhq/path-root-regex) - -> Regular expression for getting the root of a posix or windows filepath. - -You might also be interested in [path-root](https://github.com/jonschlinkert/path-root). - -## Usage - -The module exposes a function that must be called to get the regex (modified from the split device regex in the node.js path module); - -```js -var pathRootRegex = require('path-root-regex'); - -console.log(pathRootRegex() instanceof RegExp); -//=> true -``` - -See the [path-root](https://github.com/jonschlinkert/path-root) module for examples. - -## Related projects - -You might also be interested in these projects: - -* [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute) -* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Parse a filepath into an object. Falls back on the native node.js `path.parse` method if… [more](https://www.npmjs.com/package/parse-filepath) | [homepage](https://github.com/jonschlinkert/parse-filepath) - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/path-root-regex/issues/new). - -## 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/regexhq/path-root-regex/blob/master/LICENSE). - -*** - -_This file was generated by [verb](https://github.com/verbose/verb), v, on March 29, 2016._ \ No newline at end of file diff --git a/node_modules/path-root-regex/index.js b/node_modules/path-root-regex/index.js deleted file mode 100644 index b6eeea4..0000000 --- a/node_modules/path-root-regex/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/*! - * path-root-regex - * - * Copyright (c) 2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -module.exports = function() { - // Regex is modified from the split device regex in the node.js path module. - return /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?/; -}; diff --git a/node_modules/path-root-regex/package.json b/node_modules/path-root-regex/package.json deleted file mode 100644 index 0596371..0000000 --- a/node_modules/path-root-regex/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "path-root-regex", - "description": "Regular expression for getting the root of a posix or windows filepath.", - "version": "0.1.2", - "homepage": "https://github.com/regexhq/path-root-regex", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "regexhq/path-root-regex", - "bugs": { - "url": "https://github.com/regexhq/path-root-regex/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "gulp-format-md": "^0.1.7", - "mocha": "^2.4.5" - }, - "keywords": [ - "detect", - "expression", - "file", - "filepath", - "match", - "parse", - "path", - "regex", - "regexp", - "regular", - "root", - "test" - ], - "verb": { - "run": true, - "toc": false, - "layout": false, - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "highlight": "path-root", - "list": [ - "parse-filepath", - "is-absolute" - ] - }, - "reflinks": [ - "verb", - "path-root" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/path-root/LICENSE b/node_modules/path-root/LICENSE deleted file mode 100644 index e28e603..0000000 --- a/node_modules/path-root/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 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/path-root/README.md b/node_modules/path-root/README.md deleted file mode 100644 index aa3c861..0000000 --- a/node_modules/path-root/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# path-root [![NPM version](https://img.shields.io/npm/v/path-root.svg?style=flat)](https://www.npmjs.com/package/path-root) [![NPM downloads](https://img.shields.io/npm/dm/path-root.svg?style=flat)](https://npmjs.org/package/path-root) [![Build Status](https://img.shields.io/travis/jonschlinkert/path-root.svg?style=flat)](https://travis-ci.org/jonschlinkert/path-root) - -> Get the root of a posix or windows filepath. - -You might also be interested in [parse-filepath](https://github.com/jonschlinkert/parse-filepath). - -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -$ npm install path-root --save -``` - -## Usage - -```js -var pathRoot = require('path-root'); -``` - -**Examples** - -```js -pathRoot('\\\\server\\share\\abc'); -//=> '\\\\server\\share\\' - -pathRoot('\\\\server foo\\some folder\\base-file.js'); -//=> '\\\\server foo\\some folder\\' - -pathRoot('\\\\?\\UNC\\server\\share'); -//=> '\\\\?\\UNC\\' - -pathRoot('foo/bar/baz.js'); -//=> '' - -pathRoot('c:\\foo\\bar\\baz.js'); -//=> 'c:\\' - -pathRoot('\\\\slslslsl\\admin$\\system32'); -//=> '\\\\slslslsl\\admin$\\' - -pathRoot('/foo/bar/baz.js'); -//=> '/' -``` - -## Related projects - -You might also be interested in these projects: - -* [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute) -* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Parse a filepath into an object. Falls back on the native node.js `path.parse` method if… [more](https://www.npmjs.com/package/parse-filepath) | [homepage](https://github.com/jonschlinkert/parse-filepath) -* [path-root-regex](https://www.npmjs.com/package/path-root-regex): Regular expression for getting the root of a posix or windows filepath. | [homepage](https://github.com/regexhq/path-root-regex) - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/path-root/issues/new). - -## Building docs - -Generate readme and API documentation with [verb](https://github.com/verbose/verb): - -```sh -$ npm install verb && npm run docs -``` - -Or, if [verb](https://github.com/verbose/verb) is installed globally: - -```sh -$ 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/path-root/blob/master/LICENSE). - -*** - -_This file was generated by [verb](https://github.com/verbose/verb), v, on March 29, 2016._ \ No newline at end of file diff --git a/node_modules/path-root/index.js b/node_modules/path-root/index.js deleted file mode 100644 index 8e141ba..0000000 --- a/node_modules/path-root/index.js +++ /dev/null @@ -1,21 +0,0 @@ -/*! - * path-root - * - * Copyright (c) 2016, Jon Schlinkert. - * Licensed under the MIT License. - */ - -'use strict'; - -var pathRootRegex = require('path-root-regex'); - -module.exports = function(filepath) { - if (typeof filepath !== 'string') { - throw new TypeError('expected a string'); - } - - var match = pathRootRegex().exec(filepath); - if (match) { - return match[0]; - } -}; diff --git a/node_modules/path-root/package.json b/node_modules/path-root/package.json deleted file mode 100644 index 35cf577..0000000 --- a/node_modules/path-root/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "path-root", - "description": "Get the root of a posix or windows filepath.", - "version": "0.1.1", - "homepage": "https://github.com/jonschlinkert/path-root", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": "jonschlinkert/path-root", - "bugs": { - "url": "https://github.com/jonschlinkert/path-root/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "path-root-regex": "^0.1.0" - }, - "devDependencies": { - "gulp-format-md": "^0.1.7", - "mocha": "^2.4.5" - }, - "keywords": [ - "path", - "root" - ], - "verb": { - "run": true, - "toc": false, - "layout": "default", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "related": { - "highlight": "parse-filepath", - "list": [ - "path-root-regex", - "parse-filepath", - "is-absolute" - ] - }, - "reflinks": [ - "verb" - ], - "lint": { - "reflinks": true - } - } -} diff --git a/node_modules/picomatch/CHANGELOG.md b/node_modules/picomatch/CHANGELOG.md deleted file mode 100644 index 8ccc6c1..0000000 --- a/node_modules/picomatch/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ -# Release history - -**All notable changes to this project will be documented in this file.** - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -
- Guiding Principles - -- Changelogs are for humans, not machines. -- There should be an entry for every single version. -- The same types of changes should be grouped. -- Versions and sections should be linkable. -- The latest version comes first. -- The release date of each versions is displayed. -- Mention whether you follow Semantic Versioning. - -
- -
- Types of changes - -Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): - -- `Added` for new features. -- `Changed` for changes in existing functionality. -- `Deprecated` for soon-to-be removed features. -- `Removed` for now removed features. -- `Fixed` for any bug fixes. -- `Security` in case of vulnerabilities. - -
- -## 2.3.1 (2022-01-02) - -### Fixed - -* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). - -### Changed - -* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). - -## 2.3.0 (2021-05-21) - -### Fixed - -* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) - -## 2.2.3 (2021-04-10) - -### Fixed - -* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). -* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). - -## 2.2.2 (2020-03-21) - -### Fixed - -* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). - -## 2.2.1 (2020-01-04) - -* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. - -## 2.2.0 (2020-01-04) - -* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) -* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. - -## 2.1.0 (2019-10-31) - -* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) -* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) -* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) -* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) -* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) -* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) -* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) -* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) -* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) -* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) -* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) -* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) -* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) -* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) -* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) -* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) -* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) -* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) -* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) -* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) -* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) -* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) - -## 2.0.7 (2019-05-14) - -* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) -* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) -* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) -* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) - -## 2.0.4 (2019-04-10) - -### Fixed - -- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. -- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. - -## 2.0.0 (2019-04-10) - -### Added - -- Adds support for `options.onIgnore`. See the readme for details -- Adds support for `options.onResult`. See the readme for details - -### Breaking changes - -- The unixify option was renamed to `windows` -- caching and all related options and methods have been removed - -## 1.0.0 (2018-11-05) - -- adds `.onMatch` option -- improvements to `.scan` method -- numerous improvements and optimizations for matching and parsing -- better windows path handling - -## 0.1.0 - 2017-04-13 - -First release. - - -[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/node_modules/picomatch/LICENSE b/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca..0000000 --- a/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, 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/picomatch/README.md b/node_modules/picomatch/README.md deleted file mode 100644 index b0526e2..0000000 --- a/node_modules/picomatch/README.md +++ /dev/null @@ -1,708 +0,0 @@ -

Picomatch

- -

- -version - - -test status - - -coverage status - - -downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.makeRe](#makere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L32) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -### [.test](lib/picomatch.js#L117) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L161) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L183) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L199) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L231) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L245) - -Compile a regular expression from the `state` object returned by the -[parse()](#parse) method. - -**Params** - -* `state` **{Object}** -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. -* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. -* `returns` **{RegExp}** - -### [.makeRe](lib/picomatch.js#L286) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. -* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L321) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | - -picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[] - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -``` -# .makeRe star - picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) - minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) - -# .makeRe star; dot=true - picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) - minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) - -# .makeRe globstar - picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) - minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) - -# .makeRe globstars - picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) - minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) - -# .makeRe with leading star - picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) - minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) - -# .makeRe - basic braces - picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) - minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-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 -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/node_modules/picomatch/index.js b/node_modules/picomatch/index.js deleted file mode 100644 index d2f2bc5..0000000 --- a/node_modules/picomatch/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/node_modules/picomatch/lib/constants.js b/node_modules/picomatch/lib/constants.js deleted file mode 100644 index a62ef38..0000000 --- a/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,179 +0,0 @@ -'use strict'; - -const path = require('path'); -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)` -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - SEP: path.sep, - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/node_modules/picomatch/lib/parse.js b/node_modules/picomatch/lib/parse.js deleted file mode 100644 index 58269d0..0000000 --- a/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1091 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(win32); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. - // In this case, we need to parse the string and use it in the output of the original pattern. - // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. - // - // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. - const expression = parse(rest, { ...options, fastpaths: false }).output; - - output = token.close = `)${expression})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if (next === '<' && !utils.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - const win32 = utils.isWindows(options); - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(win32); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/node_modules/picomatch/lib/picomatch.js b/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index 782d809..0000000 --- a/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,342 +0,0 @@ -'use strict'; - -const path = require('path'); -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse(input, options); - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/node_modules/picomatch/lib/scan.js b/node_modules/picomatch/lib/scan.js deleted file mode 100644 index e59cd7a..0000000 --- a/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/node_modules/picomatch/lib/utils.js b/node_modules/picomatch/lib/utils.js deleted file mode 100644 index c3ca766..0000000 --- a/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; - -const path = require('path'); -const win32 = process.platform === 'win32'; -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; -}; - -exports.isWindows = options => { - if (options && typeof options.windows === 'boolean') { - return options.windows; - } - return win32 === true || path.sep === '\\'; -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; diff --git a/node_modules/picomatch/package.json b/node_modules/picomatch/package.json deleted file mode 100644 index 3db22d4..0000000 --- a/node_modules/picomatch/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "2.3.1", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "lib" - ], - "main": "index.js", - "engines": { - "node": ">=8.6" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^6.8.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^6.2.2", - "nyc": "^15.0.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/node_modules/pify/index.js b/node_modules/pify/index.js deleted file mode 100644 index df56221..0000000 --- a/node_modules/pify/index.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -const processFn = (fn, options) => function (...args) { - const P = options.promiseModule; - - return new P((resolve, reject) => { - if (options.multiArgs) { - args.push((...result) => { - if (options.errorFirst) { - if (result[0]) { - reject(result); - } else { - result.shift(); - resolve(result); - } - } else { - resolve(result); - } - }); - } else if (options.errorFirst) { - args.push((error, result) => { - if (error) { - reject(error); - } else { - resolve(result); - } - }); - } else { - args.push(resolve); - } - - fn.apply(this, args); - }); -}; - -module.exports = (input, options) => { - options = Object.assign({ - exclude: [/.+(Sync|Stream)$/], - errorFirst: true, - promiseModule: Promise - }, options); - - const objType = typeof input; - if (!(input !== null && (objType === 'object' || objType === 'function'))) { - throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${input === null ? 'null' : objType}\``); - } - - const filter = key => { - const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); - return options.include ? options.include.some(match) : !options.exclude.some(match); - }; - - let ret; - if (objType === 'function') { - ret = function (...args) { - return options.excludeMain ? input(...args) : processFn(input, options).apply(this, args); - }; - } else { - ret = Object.create(Object.getPrototypeOf(input)); - } - - for (const key in input) { // eslint-disable-line guard-for-in - const property = input[key]; - ret[key] = typeof property === 'function' && filter(key) ? processFn(property, options) : property; - } - - return ret; -}; diff --git a/node_modules/pify/license b/node_modules/pify/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/pify/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/pify/package.json b/node_modules/pify/package.json deleted file mode 100644 index a5468cd..0000000 --- a/node_modules/pify/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "pify", - "version": "4.0.1", - "description": "Promisify a callback-style function", - "license": "MIT", - "repository": "sindresorhus/pify", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=6" - }, - "scripts": { - "test": "xo && ava", - "optimization-test": "node --allow-natives-syntax optimization-test.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "promise", - "promises", - "promisify", - "all", - "denodify", - "denodeify", - "callback", - "cb", - "node", - "then", - "thenify", - "convert", - "transform", - "wrap", - "wrapper", - "bind", - "to", - "async", - "await", - "es2015", - "bluebird" - ], - "devDependencies": { - "ava": "^0.25.0", - "pinkie-promise": "^2.0.0", - "v8-natives": "^1.1.0", - "xo": "^0.23.0" - } -} diff --git a/node_modules/pify/readme.md b/node_modules/pify/readme.md deleted file mode 100644 index 7ae3f1c..0000000 --- a/node_modules/pify/readme.md +++ /dev/null @@ -1,145 +0,0 @@ -# pify [![Build Status](https://travis-ci.org/sindresorhus/pify.svg?branch=master)](https://travis-ci.org/sindresorhus/pify) - -> Promisify a callback-style function - ---- - -
- - Get professional support for 'pify' with a Tidelift subscription - -
- - Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies. -
-
- ---- - - -## Install - -``` -$ npm install pify -``` - - -## Usage - -```js -const fs = require('fs'); -const pify = require('pify'); - -// Promisify a single function -pify(fs.readFile)('package.json', 'utf8').then(data => { - console.log(JSON.parse(data).name); - //=> 'pify' -}); - -// Promisify all methods in a module -pify(fs).readFile('package.json', 'utf8').then(data => { - console.log(JSON.parse(data).name); - //=> 'pify' -}); -``` - - -## API - -### pify(input, [options]) - -Returns a `Promise` wrapped version of the supplied function or module. - -#### input - -Type: `Function` `Object` - -Callback-style function or module whose methods you want to promisify. - -#### options - -##### multiArgs - -Type: `boolean`
-Default: `false` - -By default, the promisified function will only return the second argument from the callback, which works fine for most APIs. This option can be useful for modules like `request` that return multiple arguments. Turning this on will make it return an array of all arguments from the callback, excluding the error argument, instead of just the second argument. This also applies to rejections, where it returns an array of all the callback arguments, including the error. - -```js -const request = require('request'); -const pify = require('pify'); - -pify(request, {multiArgs: true})('https://sindresorhus.com').then(result => { - const [httpResponse, body] = result; -}); -``` - -##### include - -Type: `string[]` `RegExp[]` - -Methods in a module to promisify. Remaining methods will be left untouched. - -##### exclude - -Type: `string[]` `RegExp[]`
-Default: `[/.+(Sync|Stream)$/]` - -Methods in a module **not** to promisify. Methods with names ending with `'Sync'` are excluded by default. - -##### excludeMain - -Type: `boolean`
-Default: `false` - -If given module is a function itself, it will be promisified. Turn this option on if you want to promisify only methods of the module. - -```js -const pify = require('pify'); - -function fn() { - return true; -} - -fn.method = (data, callback) => { - setImmediate(() => { - callback(null, data); - }); -}; - -// Promisify methods but not `fn()` -const promiseFn = pify(fn, {excludeMain: true}); - -if (promiseFn()) { - promiseFn.method('hi').then(data => { - console.log(data); - }); -} -``` - -##### errorFirst - -Type: `boolean`
-Default: `true` - -Whether the callback has an error as the first argument. You'll want to set this to `false` if you're dealing with an API that doesn't have an error as the first argument, like `fs.exists()`, some browser APIs, Chrome Extension APIs, etc. - -##### promiseModule - -Type: `Function` - -Custom promise module to use instead of the native one. - -Check out [`pinkie-promise`](https://github.com/floatdrop/pinkie-promise) if you need a tiny promise polyfill. - - -## Related - -- [p-event](https://github.com/sindresorhus/p-event) - Promisify an event by waiting for it to be emitted -- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently -- [More…](https://github.com/sindresorhus/promise-fun) - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/plugin-error/LICENSE b/node_modules/plugin-error/LICENSE deleted file mode 100644 index e6755b6..0000000 --- a/node_modules/plugin-error/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Blaine Bublitz , Eric Schoffstall 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/plugin-error/README.md b/node_modules/plugin-error/README.md deleted file mode 100644 index f5199c8..0000000 --- a/node_modules/plugin-error/README.md +++ /dev/null @@ -1,69 +0,0 @@ -

- - - -

- -# plugin-error - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] - -Error handling for Vinyl plugins. - -## Usage - -```js -var PluginError = require('plugin-error'); - -var err = new PluginError('test', { - message: 'something broke' -}); - -var err = new PluginError({ - plugin: 'test', - message: 'something broke' -}); - -var err = new PluginError('test', 'something broke'); - -var err = new PluginError('test', 'something broke', { showStack: true }); - -var existingError = new Error('OMG'); -var err = new PluginError('test', existingError, { showStack: true }); -``` - -## API - -### `new PluginError(pluginName, message[, options])` - -Error constructor that takes: -* `pluginName` - a `String` that should be the module name of your plugin -* `message` - a `String` message or an existing `Error` object -* `options` - an `Object` of your options - -**Behavior:** - -* By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error. -* If you pass an error object as the message the stack will be pulled from that, otherwise one will be created. -* If you pass in a custom stack string you need to include the message along with that. -* Error properties will be included in `err.toString()`, but may be omitted by including `{ showProperties: false }` in the options. - -## License - -MIT - -[downloads-image]: http://img.shields.io/npm/dm/plugin-error.svg -[npm-url]: https://www.npmjs.com/package/plugin-error -[npm-image]: http://img.shields.io/npm/v/plugin-error.svg - -[travis-url]: https://travis-ci.org/gulpjs/plugin-error -[travis-image]: http://img.shields.io/travis/gulpjs/plugin-error.svg?label=travis-ci - -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/plugin-error -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/plugin-error.svg?label=appveyor - -[coveralls-url]: https://coveralls.io/r/gulpjs/plugin-error -[coveralls-image]: http://img.shields.io/coveralls/gulpjs/plugin-error/master.svg - -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/node_modules/plugin-error/index.d.ts b/node_modules/plugin-error/index.d.ts deleted file mode 100644 index 4ff8f54..0000000 --- a/node_modules/plugin-error/index.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -declare namespace PluginError { - interface Constructor { - /** - * @param plugin Plugin name - * @param error Base error - * @param options Error options - */ - new (plugin: string, error: E, options?: Options): PluginError; - - /** - * @param plugin Plugin name - * @param error Base error or error message - * @param options Error options - */ - new (plugin: string, error: E | string, options: Options): PluginError; - - /** - * @param plugin Plugin name - * @param error Base error, error message, or options with message - */ - new (plugin: string, error: E | string | (Options & {message: string})): PluginError; - - /** - * @param options Options with plugin name and message - */ - new(options: Options & {plugin: string, message: string}): PluginError; - } - - interface Options { - /** - * Error name - */ - name?: string; - - /** - * Error message - */ - message?: any; - - /** - * File name where the error occurred - */ - fileName?: string; - - - /** - * Line number where the error occurred - */ - lineNumber?: number; - - /** - * Error properties will be included in err.toString(). Can be omitted by - * setting this to false. - * - * Default: `true` - */ - showProperties?: boolean; - - /** - * By default the stack will not be shown. Set this to true if you think the - * stack is important for your error. - * - * Default: `false` - */ - showStack?: boolean; - - /** - * Error stack to use for `err.toString()` if `showStack` is `true`. - * By default it uses the `stack` of the original error if you used one, otherwise it captures a new stack. - */ - stack?: string; - } - - /** - * The `SimplePluginError` interface defines the properties available on all the the instances of `PluginError`. - * - * @internal - */ - interface SimplePluginError extends Error { - /** - * Plugin name - */ - plugin: string; - - /** - * Boolean controlling if the stack will be shown in `err.toString()`. - */ - showStack: boolean; - - /** - * Boolean controlling if properties will be shown in `err.toString()`. - */ - showProperties: boolean; - - /** - * File name where the error occurred - */ - fileName?: string; - - /** - * Line number where the error occurred - */ - lineNumber?: number; - } -} - -/** - * Abstraction for error handling for Vinyl plugins - */ -type PluginError = PluginError.SimplePluginError & T; - -declare const PluginError: PluginError.Constructor; - -export = PluginError; diff --git a/node_modules/plugin-error/index.js b/node_modules/plugin-error/index.js deleted file mode 100644 index a4d360d..0000000 --- a/node_modules/plugin-error/index.js +++ /dev/null @@ -1,190 +0,0 @@ -var util = require('util'); -var colors = require('ansi-colors'); -var extend = require('extend-shallow'); -var differ = require('arr-diff'); -var union = require('arr-union'); - -var nonEnum = ['message', 'name', 'stack']; -var ignored = union(nonEnum, ['__safety', '_stack', 'plugin', 'showProperties', 'showStack']); -var props = ['fileName', 'lineNumber', 'message', 'name', 'plugin', 'showProperties', 'showStack', 'stack']; - -function PluginError(plugin, message, options) { - if (!(this instanceof PluginError)) { - throw new Error('Call PluginError using new'); - } - - Error.call(this); - var opts = setDefaults(plugin, message, options); - var self = this; - - // If opts has an error, get details from it - if (typeof opts.error === 'object') { - var keys = union(Object.keys(opts.error), nonEnum); - - // These properties are not enumerable, so we have to add them explicitly. - keys.forEach(function(prop) { - self[prop] = opts.error[prop]; - }); - } - - // Opts object can override - props.forEach(function(prop) { - if (prop in opts) { - this[prop] = opts[prop]; - } - }, this); - - // Defaults - if (!this.name) { - this.name = 'Error'; - } - if (!this.stack) { - - /** - * `Error.captureStackTrace` appends a stack property which - * relies on the toString method of the object it is applied to. - * - * Since we are using our own toString method which controls when - * to display the stack trace, if we don't go through this safety - * object we'll get stack overflow problems. - */ - - var safety = {}; - safety.toString = function() { - return this._messageWithDetails() + '\nStack:'; - }.bind(this); - - Error.captureStackTrace(safety, arguments.callee || this.constructor); - this.__safety = safety; - } - if (!this.plugin) { - throw new Error('Missing plugin name'); - } - if (!this.message) { - throw new Error('Missing error message'); - } -} - -util.inherits(PluginError, Error); - -/** - * Output a formatted message with details - */ - -PluginError.prototype._messageWithDetails = function() { - var msg = 'Message:\n ' + this.message; - var details = this._messageDetails(); - if (details !== '') { - msg += '\n' + details; - } - return msg; -}; - -/** - * Output actual message details - */ - -PluginError.prototype._messageDetails = function() { - if (!this.showProperties) { - return ''; - } - - var props = differ(Object.keys(this), ignored); - var len = props.length; - - if (len === 0) { - return ''; - } - - var res = ''; - var i = 0; - while (len--) { - var prop = props[i++]; - res += ' '; - res += prop + ': ' + this[prop]; - res += '\n'; - } - return 'Details:\n' + res; -}; - -/** - * Override the `toString` method - */ - -PluginError.prototype.toString = function() { - var detailsWithStack = function(stack) { - return this._messageWithDetails() + '\nStack:\n' + stack; - }.bind(this); - - var msg = ''; - if (this.showStack) { - // If there is no wrapped error, use the stack captured in the PluginError ctor - if (this.__safety) { - msg = this.__safety.stack; - - } else if (this._stack) { - msg = detailsWithStack(this._stack); - - } else { - // Stack from wrapped error - msg = detailsWithStack(this.stack); - } - return message(msg, this); - } - - msg = this._messageWithDetails(); - return message(msg, this); -}; - -// Format the output message -function message(msg, thisArg) { - var sig = colors.red(thisArg.name); - sig += ' in plugin '; - sig += '"' + colors.cyan(thisArg.plugin) + '"'; - sig += '\n'; - sig += msg; - return sig; -} - -/** - * Set default options based on arguments. - */ - -function setDefaults(plugin, message, opts) { - if (typeof plugin === 'object') { - return defaults(plugin); - } - opts = opts || {}; - if (message instanceof Error) { - opts.error = message; - } else if (typeof message === 'object') { - opts = message; - } else { - opts.message = message; - } - opts.plugin = plugin; - return defaults(opts); -} - -/** - * Extend default options with: - * - * - `showStack`: default=false - * - `showProperties`: default=true - * - * @param {Object} `opts` Options to extend - * @return {Object} - */ - -function defaults(opts) { - return extend({ - showStack: false, - showProperties: true, - }, opts); -} - -/** - * Expose `PluginError` - */ - -module.exports = PluginError; diff --git a/node_modules/plugin-error/package.json b/node_modules/plugin-error/package.json deleted file mode 100644 index cd75f29..0000000 --- a/node_modules/plugin-error/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "plugin-error", - "version": "1.0.1", - "description": "Error handling for Vinyl plugins.", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Jon Schlinkert ", - "Blaine Bublitz " - ], - "repository": "gulpjs/plugin-error", - "license": "MIT", - "engines": { - "node": ">= 0.10" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.d.ts", - "index.js" - ], - "scripts": { - "lint": "eslint . && jscs index.js test/", - "pretest": "npm run lint", - "test": "mocha --async-only && npm run test-types", - "test-types": "tsc -p test/types", - "cover": "istanbul cover _mocha --report lcovonly", - "coveralls": "npm run cover && istanbul-coveralls" - }, - "dependencies": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" - }, - "devDependencies": { - "eslint": "^1.7.3", - "eslint-config-gulp": "^2.0.0", - "expect": "^1.20.2", - "istanbul": "^0.4.3", - "istanbul-coveralls": "^1.0.3", - "jscs": "^2.3.5", - "jscs-preset-gulp": "^1.0.0", - "mocha": "^3.0.0", - "typescript": "^2.6.2" - }, - "keywords": [ - "error", - "plugin", - "gulp-util" - ] -} diff --git a/node_modules/possible-typed-array-names/.eslintrc b/node_modules/possible-typed-array-names/.eslintrc deleted file mode 100644 index 3b5d9e9..0000000 --- a/node_modules/possible-typed-array-names/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", -} diff --git a/node_modules/possible-typed-array-names/.github/FUNDING.yml b/node_modules/possible-typed-array-names/.github/FUNDING.yml deleted file mode 100644 index 7afce20..0000000 --- a/node_modules/possible-typed-array-names/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# 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/possible-typed-array-names -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/possible-typed-array-names/CHANGELOG.md b/node_modules/possible-typed-array-names/CHANGELOG.md deleted file mode 100644 index cae3fae..0000000 --- a/node_modules/possible-typed-array-names/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -# 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 - 2024-02-19 - -### Commits - -- Initial implementation, tests, readme, types [`c279f55`](https://github.com/ljharb/possible-typed-array-names/commit/c279f550021896afa50c1169b3111618a96cf898) -- Initial commit [`0f22bf2`](https://github.com/ljharb/possible-typed-array-names/commit/0f22bf24d16fc8ea29483ed7ed378afb3758a4df) -- npm init [`25d6cff`](https://github.com/ljharb/possible-typed-array-names/commit/25d6cffe4091921e4e210704dabed37ae3d7b261) -- Only apps should have lockfiles [`a1bd592`](https://github.com/ljharb/possible-typed-array-names/commit/a1bd592fa037430d401b1d6d26cfea2c2d6789db) diff --git a/node_modules/possible-typed-array-names/LICENSE b/node_modules/possible-typed-array-names/LICENSE deleted file mode 100644 index f82f389..0000000 --- a/node_modules/possible-typed-array-names/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 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/possible-typed-array-names/README.md b/node_modules/possible-typed-array-names/README.md deleted file mode 100644 index 7ebbf81..0000000 --- a/node_modules/possible-typed-array-names/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# possible-typed-array-names [![Version Badge][npm-version-svg]][package-url] - -[![github actions][actions-image]][actions-url] -[![coverage][codecov-image]][codecov-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][npm-badge-png]][package-url] - -A simple list of possible Typed Array names. - -## Example - -```js -const assert = require('assert'); - -const names = require('possible-typed-array-names'); - -assert(Array.isArray(names)); -assert(names.every(name => ( - typeof name === 'string' - && typeof globalThis[name] === 'function' - && globalThis[name].name === name -))); -``` - -## 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/possible-typed-array-names -[npm-version-svg]: https://versionbadg.es/ljharb/possible-typed-array-names.svg -[deps-svg]: https://david-dm.org/ljharb/possible-typed-array-names.svg -[deps-url]: https://david-dm.org/ljharb/possible-typed-array-names -[dev-deps-svg]: https://david-dm.org/ljharb/possible-typed-array-names/dev-status.svg -[dev-deps-url]: https://david-dm.org/ljharb/possible-typed-array-names#info=devDependencies -[npm-badge-png]: https://nodei.co/npm/possible-typed-array-names.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/possible-typed-array-names.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/possible-typed-array-names.svg -[downloads-url]: https://npm-stat.com/charts.html?package=possible-typed-array-names -[codecov-image]: https://codecov.io/gh/ljharb/possible-typed-array-names/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/ljharb/possible-typed-array-names/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/possible-typed-array-names -[actions-url]: https://github.com/ljharb/possible-typed-array-names/actions diff --git a/node_modules/possible-typed-array-names/index.d.ts b/node_modules/possible-typed-array-names/index.d.ts deleted file mode 100644 index 342584d..0000000 --- a/node_modules/possible-typed-array-names/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare const names: [ - 'Float32Array', - 'Float64Array', - 'Int8Array', - 'Int16Array', - 'Int32Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Uint16Array', - 'Uint32Array', - 'BigInt64Array', - 'BigUint64Array' -]; - -export = names; \ No newline at end of file diff --git a/node_modules/possible-typed-array-names/index.js b/node_modules/possible-typed-array-names/index.js deleted file mode 100644 index f3c1199..0000000 --- a/node_modules/possible-typed-array-names/index.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** @type {import('.')} */ -module.exports = [ - 'Float32Array', - 'Float64Array', - 'Int8Array', - 'Int16Array', - 'Int32Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Uint16Array', - 'Uint32Array', - 'BigInt64Array', - 'BigUint64Array' -]; diff --git a/node_modules/possible-typed-array-names/package.json b/node_modules/possible-typed-array-names/package.json deleted file mode 100644 index 3b4b933..0000000 --- a/node_modules/possible-typed-array-names/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "possible-typed-array-names", - "version": "1.0.0", - "description": "A simple list of possible Typed Array names.", - "main": "index.js", - "exports": { - ".": "./index.js", - "./package.json": "./package.json" - }, - "types": "./index.d.ts", - "sideEffects": false, - "scripts": { - "prepack": "npmignore --auto --commentLines=autogenerated", - "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", - "prelint": "evalmd README.md", - "lint": "eslint --ext=js,mjs .", - "postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", - "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/possible-typed-array-names.git" - }, - "keywords": [ - "typed", - "array", - "typedarray", - "Float32Array", - "Float64Array", - "Int8Array", - "Int16Array", - "Int32Array", - "Uint8Array", - "Uint8ClampedArray", - "Uint16Array", - "Uint32Array", - "BigInt64Array", - "BigUint64Array" - ], - "author": "Jordan Harband ", - "license": "MIT", - "bugs": { - "url": "https://github.com/ljharb/possible-typed-array-names/issues" - }, - "homepage": "https://github.com/ljharb/possible-typed-array-names#readme", - "devDependencies": { - "@ljharb/eslint-config": "^21.1.0", - "@types/tape": "^5.6.4", - "aud": "^2.0.4", - "auto-changelog": "^2.4.0", - "eclint": "^2.8.1", - "eslint": "=8.8.0", - "evalmd": "^0.0.19", - "in-publish": "^2.0.1", - "npmignore": "^0.3.1", - "nyc": "^10.3.2", - "safe-publish-latest": "^2.0.0", - "tape": "^5.7.5", - "typescript": "next" - }, - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - }, - "engines": { - "node": ">= 0.4" - } -} diff --git a/node_modules/possible-typed-array-names/test/index.js b/node_modules/possible-typed-array-names/test/index.js deleted file mode 100644 index af59606..0000000 --- a/node_modules/possible-typed-array-names/test/index.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var test = require('tape'); - -var names = require('../'); - -test('typed array names', function (t) { - for (var i = 0; i < names.length; i++) { - t.equal(typeof names[i], 'string', 'is string'); - t.equal(names.indexOf(names[i]), i, 'is unique'); - - t.match(typeof global[names[i]], /^(?:function|undefined)$/, 'is a global function, or `undefined`'); - } - - t.end(); -}); diff --git a/node_modules/possible-typed-array-names/tsconfig.json b/node_modules/possible-typed-array-names/tsconfig.json deleted file mode 100644 index 99dfeb6..0000000 --- a/node_modules/possible-typed-array-names/tsconfig.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Projects */ - - /* Language and Environment */ - "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - // "rootDir": "./", /* Specify the root folder within your source files. */ - // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ - "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - - /* JavaScript Support */ - "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ - "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ - - /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - "declarationMap": true, /* Create sourcemaps for d.ts files. */ - "noEmit": true, /* Disable emitting files from a compilation. */ - - /* Interop Constraints */ - "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - - /* Completeness */ - // "skipLibCheck": true /* Skip type checking all .d.ts files. */ - }, - "exclude": [ - "coverage", - ], -} diff --git a/node_modules/prelude-ls/CHANGELOG.md b/node_modules/prelude-ls/CHANGELOG.md deleted file mode 100644 index 71b8a0f..0000000 --- a/node_modules/prelude-ls/CHANGELOG.md +++ /dev/null @@ -1,108 +0,0 @@ -# 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 deleted file mode 100644 index 525b118..0000000 --- a/node_modules/prelude-ls/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index fabc212..0000000 --- a/node_modules/prelude-ls/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# 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 deleted file mode 100644 index 09777a8..0000000 --- a/node_modules/prelude-ls/lib/Func.js +++ /dev/null @@ -1,69 +0,0 @@ -// 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 deleted file mode 100644 index d2e41ab..0000000 --- a/node_modules/prelude-ls/lib/List.js +++ /dev/null @@ -1,716 +0,0 @@ -// 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 deleted file mode 100644 index f6b5319..0000000 --- a/node_modules/prelude-ls/lib/Num.js +++ /dev/null @@ -1,130 +0,0 @@ -// 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 deleted file mode 100644 index 0b8d321..0000000 --- a/node_modules/prelude-ls/lib/Obj.js +++ /dev/null @@ -1,154 +0,0 @@ -// 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 deleted file mode 100644 index 59406d6..0000000 --- a/node_modules/prelude-ls/lib/Str.js +++ /dev/null @@ -1,92 +0,0 @@ -// 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 deleted file mode 100644 index 9dcbed4..0000000 --- a/node_modules/prelude-ls/lib/index.js +++ /dev/null @@ -1,178 +0,0 @@ -// 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 deleted file mode 100644 index c313c3d..0000000 --- a/node_modules/prelude-ls/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "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/prettier-linter-helpers/.editorconfig b/node_modules/prettier-linter-helpers/.editorconfig deleted file mode 100644 index c9fe4a7..0000000 --- a/node_modules/prettier-linter-helpers/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -# editorconfig.org -root = true - -[*] -charset = utf-8 -indent_size = 2 -indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true - -# Markdown syntax specifies that trailing whitespaces can be meaningful, -# so let’s not trim those. e.g. 2 trailing spaces = linebreak (
) -# See https://daringfireball.net/projects/markdown/syntax#p -[*.md] -trim_trailing_whitespace = false diff --git a/node_modules/prettier-linter-helpers/.eslintignore b/node_modules/prettier-linter-helpers/.eslintignore deleted file mode 100644 index 2b026ff..0000000 --- a/node_modules/prettier-linter-helpers/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -!.eslintrc.js -node_modules diff --git a/node_modules/prettier-linter-helpers/.eslintrc.js b/node_modules/prettier-linter-helpers/.eslintrc.js deleted file mode 100644 index 6dd28c3..0000000 --- a/node_modules/prettier-linter-helpers/.eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: ['node'], - extends: ['plugin:node/recommended', 'plugin:prettier/recommended'], - env: {mocha: true}, - root: true, -}; diff --git a/node_modules/prettier-linter-helpers/.github/CONTRIBUTING.md b/node_modules/prettier-linter-helpers/.github/CONTRIBUTING.md deleted file mode 100644 index c9df1f8..0000000 --- a/node_modules/prettier-linter-helpers/.github/CONTRIBUTING.md +++ /dev/null @@ -1,41 +0,0 @@ -# Contributing - -Thanks for contributing! - -## Installation - -```sh -git clone https://github.com/prettier/prettier-linter-helpers.git -cd prettier-linter-helpers -yarn install -``` - -## Running the tests - -```sh -yarn run test -``` - -Linting is ran as part of `yarn run test`. The build will fail if there are any linting errors. You can run `yarn run lint --fix` to fix some linting errors (including formatting to match prettier's expectations). To run the tests without linting run `yarn run test`. - -## Publishing - -- Ensure you are on the master branch locally. -- Update `CHANGELOG.md` and commit. -- Run the following: - - ```sh - yarn publish - git push --follow-tags - ``` - - Running `yarn publish` shall: - - - Bump the version in package.json (asking you for the new version number) - - Create a new commit containing that version bump in package.json - - Create a tag for that commit - - Publish to the npm repository - - Running `git push --follow-tags` shall: - - - Push the commit and tag to GitHub diff --git a/node_modules/prettier-linter-helpers/.prettierignore b/node_modules/prettier-linter-helpers/.prettierignore deleted file mode 100644 index ec6d3cd..0000000 --- a/node_modules/prettier-linter-helpers/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -package.json diff --git a/node_modules/prettier-linter-helpers/.prettierrc b/node_modules/prettier-linter-helpers/.prettierrc deleted file mode 100644 index 6a5acb6..0000000 --- a/node_modules/prettier-linter-helpers/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "arrowParens": "always", - "singleQuote": true, - "trailingComma": "es5", - "bracketSpacing": false -} diff --git a/node_modules/prettier-linter-helpers/.vscode/settings.json b/node_modules/prettier-linter-helpers/.vscode/settings.json deleted file mode 100644 index d6983d7..0000000 --- a/node_modules/prettier-linter-helpers/.vscode/settings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "editor.formatOnSave": true, - "files.exclude": { - "**/.DS_Store": true, - "**/.git": true, - "**/node_modules": true - }, - "prettier.eslintIntegration": true, - "search.exclude": { - "**/node_modules": true - } -} diff --git a/node_modules/prettier-linter-helpers/LICENSE.md b/node_modules/prettier-linter-helpers/LICENSE.md deleted file mode 100644 index 26864eb..0000000 --- a/node_modules/prettier-linter-helpers/LICENSE.md +++ /dev/null @@ -1,24 +0,0 @@ -# The MIT License (MIT) - -Copyright © 2017 Andres Suarez and Teddy Katz - -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/prettier-linter-helpers/README.md b/node_modules/prettier-linter-helpers/README.md deleted file mode 100644 index 5852fdf..0000000 --- a/node_modules/prettier-linter-helpers/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# prettier-linter-helpers - -Helper functions for exposing prettier changes within linting tools. - -This package contains: - -- `showInvisibles(string)` - Replace invisible characters with ones you can see for - for easier diffing. -- `generateDifferences(source, prettierSource)` - Generate an array of - differences between two strings. - -## Inspiration - -This code was extracted from [eslint-plugin-prettier v2.7.0](https://github.com/prettier/eslint-plugin-prettier/blob/v2.7.0/eslint-plugin-prettier.js#L85-L215) diff --git a/node_modules/prettier-linter-helpers/index.js b/node_modules/prettier-linter-helpers/index.js deleted file mode 100644 index 0191646..0000000 --- a/node_modules/prettier-linter-helpers/index.js +++ /dev/null @@ -1,145 +0,0 @@ -const diff = require('fast-diff'); - -const LINE_ENDING_RE = /\r\n|[\r\n\u2028\u2029]/; - -/** - * Converts invisible characters to a commonly recognizable visible form. - * @param {string} str - The string with invisibles to convert. - * @returns {string} The converted string. - */ -function showInvisibles(str) { - let ret = ''; - for (let i = 0; i < str.length; i++) { - switch (str[i]) { - case ' ': - ret += '·'; // Middle Dot, \u00B7 - break; - case '\n': - ret += '⏎'; // Return Symbol, \u23ce - break; - case '\t': - ret += '↹'; // Left Arrow To Bar Over Right Arrow To Bar, \u21b9 - break; - case '\r': - ret += '␍'; // Carriage Return Symbol, \u240D - break; - default: - ret += str[i]; - break; - } - } - return ret; -} - -/** - * Generate results for differences between source code and formatted version. - * - * @param {string} source - The original source. - * @param {string} prettierSource - The Prettier formatted source. - * @returns {Array} - An array containing { operation, offset, insertText, deleteText } - */ -function generateDifferences(source, prettierSource) { - // fast-diff returns the differences between two texts as a series of - // INSERT, DELETE or EQUAL operations. The results occur only in these - // sequences: - // /-> INSERT -> EQUAL - // EQUAL | /-> EQUAL - // \-> DELETE | - // \-> INSERT -> EQUAL - // Instead of reporting issues at each INSERT or DELETE, certain sequences - // are batched together and are reported as a friendlier "replace" operation: - // - A DELETE immediately followed by an INSERT. - // - Any number of INSERTs and DELETEs where the joining EQUAL of one's end - // and another's beginning does not have line endings (i.e. issues that occur - // on contiguous lines). - - const results = diff(source, prettierSource); - const differences = []; - - const batch = []; - let offset = 0; // NOTE: INSERT never advances the offset. - while (results.length) { - const result = results.shift(); - const op = result[0]; - const text = result[1]; - switch (op) { - case diff.INSERT: - case diff.DELETE: - batch.push(result); - break; - case diff.EQUAL: - if (results.length) { - if (batch.length) { - if (LINE_ENDING_RE.test(text)) { - flush(); - offset += text.length; - } else { - batch.push(result); - } - } else { - offset += text.length; - } - } - break; - default: - throw new Error(`Unexpected fast-diff operation "${op}"`); - } - if (batch.length && !results.length) { - flush(); - } - } - - return differences; - - function flush() { - let aheadDeleteText = ''; - let aheadInsertText = ''; - while (batch.length) { - const next = batch.shift(); - const op = next[0]; - const text = next[1]; - switch (op) { - case diff.INSERT: - aheadInsertText += text; - break; - case diff.DELETE: - aheadDeleteText += text; - break; - case diff.EQUAL: - aheadDeleteText += text; - aheadInsertText += text; - break; - } - } - if (aheadDeleteText && aheadInsertText) { - differences.push({ - offset, - operation: generateDifferences.REPLACE, - insertText: aheadInsertText, - deleteText: aheadDeleteText, - }); - } else if (!aheadDeleteText && aheadInsertText) { - differences.push({ - offset, - operation: generateDifferences.INSERT, - insertText: aheadInsertText, - }); - } else if (aheadDeleteText && !aheadInsertText) { - differences.push({ - offset, - operation: generateDifferences.DELETE, - deleteText: aheadDeleteText, - }); - } - offset += aheadDeleteText.length; - } -} - -generateDifferences.INSERT = 'insert'; -generateDifferences.DELETE = 'delete'; -generateDifferences.REPLACE = 'replace'; - -module.exports = { - showInvisibles, - generateDifferences, -}; diff --git a/node_modules/prettier-linter-helpers/package.json b/node_modules/prettier-linter-helpers/package.json deleted file mode 100644 index 38434a0..0000000 --- a/node_modules/prettier-linter-helpers/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "prettier-linter-helpers", - "version": "1.0.0", - "description": "Utilities to help expose prettier output in linting tools", - "contributors": [ - "Ben Scott", - "Teddy Katz" - ], - "main": "index.js", - "license": "MIT", - "scripts": { - "lint": "eslint .", - "test": "npm run lint && mocha", - "format": "yarn run prettier '**/*.{js,json,md,yml}' --write && yarn run lint --fix" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/prettier/prettier-linter-helpers.git" - }, - "bugs": { - "url": "https://github.com/prettier/prettier-linter-helpers/issues" - }, - "homepage": "https://github.com/prettier/prettier-linter-helpers#readme", - "dependencies": { - "fast-diff": "^1.1.2" - }, - "devDependencies": { - "eslint": "^5.6.1", - "eslint-config-prettier": "^3.1.0", - "eslint-plugin-node": "^7.0.1", - "eslint-plugin-prettier": "^2.7.0", - "mocha": "^5.2.0", - "prettier": "^1.14.3" - }, - "engines": { - "node": ">=6.0.0" - } -} diff --git a/node_modules/prettier-linter-helpers/test/index.test.js b/node_modules/prettier-linter-helpers/test/index.test.js deleted file mode 100644 index 6109161..0000000 --- a/node_modules/prettier-linter-helpers/test/index.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const {showInvisibles, generateDifferences} = require('..'); -const assert = require('assert'); - -describe('showInvisibles', () => { - it('shows invisibles', () => { - assert.strictEqual(showInvisibles('1 2\n3\t4\r5'), '1·2⏎3↹4␍5'); - }); -}); - -describe('generateDifferences', () => { - it('operation: insert', () => { - const differences = generateDifferences('abc', 'abcdef'); - assert.deepStrictEqual(differences, [ - {operation: 'insert', offset: 3, insertText: 'def'}, - ]); - }); - it('operation: delete', () => { - const differences = generateDifferences('abcdef', 'abc'); - assert.deepStrictEqual(differences, [ - {operation: 'delete', offset: 3, deleteText: 'def'}, - ]); - }); - it('operation: replace', () => { - const differences = generateDifferences('abc', 'def'); - assert.deepStrictEqual(differences, [ - {operation: 'replace', offset: 0, deleteText: 'abc', insertText: 'def'}, - ]); - }); -}); diff --git a/node_modules/prettier/LICENSE b/node_modules/prettier/LICENSE deleted file mode 100644 index a32876c..0000000 --- a/node_modules/prettier/LICENSE +++ /dev/null @@ -1,4380 +0,0 @@ -# Prettier license - -Prettier is released under the MIT license: - -Copyright © James Long and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -## Licenses of bundled dependencies - -The published Prettier artifact additionally contains code with the following licenses: -MIT, ISC, BSD-2-Clause, BSD-3-Clause, Apache-2.0 - -## Bundled dependencies - -### @angular/compiler@v19.0.0 - -> Angular - the compiler library - -License: MIT -Repository: -Author: angular - -> The MIT License -> -> Copyright (c) 2010-2024 Google LLC. https://angular.dev/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. - ----------------------------------------- - -### @babel/code-frame@v7.26.2 - -> Generate errors that contain a code frame that point to source locations. - -License: MIT -Homepage: -Repository: -Author: The Babel Team (https://babel.dev/team) - -> MIT License -> -> Copyright (c) 2014-present Sebastian McKenzie 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. - ----------------------------------------- - -### @babel/helper-validator-identifier@v7.25.9 - -> Validate identifier/keywords name - -License: MIT -Repository: -Author: The Babel Team (https://babel.dev/team) - -> MIT License -> -> Copyright (c) 2014-present Sebastian McKenzie 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. - ----------------------------------------- - -### @babel/parser@v7.26.2 - -> A JavaScript parser - -License: MIT -Homepage: -Repository: -Author: The Babel Team (https://babel.dev/team) - -> Copyright (C) 2012-2014 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. - ----------------------------------------- - -### @glimmer/env@v0.1.7 - -> Glimmer application environment variables stub - -License: MIT - -> Copyright (c) 2017 Martin Muñoz and contributors. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of -> this software and associated documentation files (the "Software"), to deal in -> the Software without restriction, including without limitation the rights to -> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -> of the Software, and to permit persons to whom the Software is furnished to do -> so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ----------------------------------------- - -### @glimmer/syntax@v0.93.0 - -License: MIT - -> Copyright (c) 2015 Tilde, 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. - ----------------------------------------- - -### @glimmer/util@v0.93.0 - -> Common utilities used in Glimmer - -License: MIT - -> Copyright (c) 2015 Tilde, 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. - ----------------------------------------- - -### @glimmer/wire-format@v0.93.0 - -License: MIT - -> Copyright (c) 2015 Tilde, 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. - ----------------------------------------- - -### @handlebars/parser@v2.0.0 - -> The parser for the Handlebars language - -License: ISC -Homepage: -Repository: - ----------------------------------------- - -### @nodelib/fs.scandir@v2.1.5 - -> List files and directories inside the specified directory - -License: MIT - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> 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. - ----------------------------------------- - -### @nodelib/fs.stat@v2.0.5 - -> Get the status of a file with some features - -License: MIT - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> 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. - ----------------------------------------- - -### @nodelib/fs.walk@v1.2.8 - -> A library for efficiently walking a directory recursively - -License: MIT - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> 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. - ----------------------------------------- - -### @prettier/is-es5-identifier-name@v0.2.0 - -> Check if provided string is an `IdentifierName` as specified in ECMA262 edition 5.1 section 7.6. - -License: MIT -Author: fisker Cheung - -> MIT License -> -> Copyright (c) fisker Cheung (https://www.fiskercheung.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. - ----------------------------------------- - -### @prettier/parse-srcset@v3.1.0 - -> A spec-conformant JavaScript parser for the HTML5 srcset attribute - -License: MIT -Homepage: -Author: Alex Bell - -> The MIT License (MIT) -> -> Copyright (c) 2014 Alex Bell -> Copyright (c) fisker Cheung -> -> 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. - ----------------------------------------- - -### @typescript-eslint/types@v8.16.0 - -> Types for the TypeScript-ESTree AST spec - -License: MIT -Homepage: -Repository: - -> MIT License -> -> Copyright (c) 2019 typescript-eslint 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. - ----------------------------------------- - -### @typescript-eslint/typescript-estree@v8.16.0 - -> A parser that converts TypeScript source code into an ESTree compatible form - -License: BSD-2-Clause -Homepage: -Repository: - -> BSD 2-Clause License -> -> TypeScript ESTree -> -> Originally extracted from: -> -> TypeScript ESLint Parser -> Copyright JS Foundation and other contributors, https://js.foundation -> -> 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. - ----------------------------------------- - -### acorn@v8.14.0 - -> ECMAScript parser - -License: MIT -Homepage: -Repository: - -> 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. - ----------------------------------------- - -### acorn-jsx@v5.3.2 - -> Modern, fast React.js JSX parser - -License: MIT -Homepage: -Repository: - -> 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. - ----------------------------------------- - -### angular-estree-parser@v10.2.0 - -> A parser that converts Angular source code into an ESTree-compatible form - -License: MIT -Homepage: -Author: Ika (https://github.com/ikatyang) - -> MIT License -> -> Copyright (c) Ika (https://github.com/ikatyang) -> -> 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. - ----------------------------------------- - -### angular-html-parser@v8.0.1 - -> A HTML parser extracted from Angular with some modifications - -License: MIT -Homepage: -Author: Ika (https://github.com/ikatyang) - -> MIT License -> -> Copyright (c) Ika (https://github.com/ikatyang) -> -> 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. - ----------------------------------------- - -### ansi-regex@v6.1.0 - -> Regular expression for matching ANSI escape codes - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### bail@v1.0.5 - -> Throw a given error - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### braces@v3.0.3 - -> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) -Contributors: - - Brian Woodward (https://twitter.com/doowb) - - Elan Shanker (https://github.com/es128) - - Eugene Sharygin (https://github.com/eush77) - - hemanth.hm (http://h3manth.com) - - Jon Schlinkert (http://twitter.com/jonschlinkert) - -> The MIT License (MIT) -> -> Copyright (c) 2014-present, 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. - ----------------------------------------- - -### camelcase@v8.0.0 - -> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar` - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### ccount@v1.1.0 - -> Count characters - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### chalk@v5.3.0 - -> Terminal string styling done right - -License: MIT - -> 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. - ----------------------------------------- - -### character-entities@v1.2.4 - -> HTML character entity information - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### character-entities-legacy@v1.1.4 - -> HTML legacy character entity information - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### character-reference-invalid@v1.1.4 - -> HTML invalid numeric character reference information - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### ci-info@v4.1.0 - -> Get details about the current Continuous Integration environment - -License: MIT -Homepage: -Author: Thomas Watson Steen (https://twitter.com/wa7son) -Contributors: - - Sibiraj (https://github.com/sibiraj-s) - -> The MIT License (MIT) -> -> Copyright (c) 2016 Thomas Watson Steen -> -> 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. - ----------------------------------------- - -### collapse-white-space@v1.0.6 - -> Replace multiple white-space characters with a single space - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### common-path-prefix@v3.0.0 - -> Computes the longest prefix string that is common to each path, excluding the base component - -License: ISC -Homepage: -Repository: -Author: Mark Wubben (https://novemberborn.net/) - -> ISC License (ISC) -> Copyright (c) 2016, Mark Wubben -> -> 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. - ----------------------------------------- - -### dashify@v2.0.0 - -> Convert a camelcase or space-separated string to a dash-separated string. ~12 sloc, fast, supports diacritics. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) -Contributors: - - Jeffrey Priebe (https://github.com/jeffreypriebe) - - Jon Schlinkert (http://twitter.com/jonschlinkert) - - Ondrej Brinkel (https://www.anzui.de) - -> The MIT License (MIT) -> -> Copyright (c) 2015-present, 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@v7.0.0 - -> A JavaScript text diff implementation. - -License: BSD-3-Clause -Repository: - -> BSD 3-Clause License -> -> Copyright (c) 2009-2015, Kevin Decker -> 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. -> -> 3. 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. - ----------------------------------------- - -### editorconfig@v0.15.3 - -> EditorConfig File Locator and Interpreter for Node.js - -License: MIT -Repository: -Author: EditorConfig Team -Contributors: - - Hong Xu (topbug.net) - - Jed Mao (https://github.com/jedmao/) - - Trey Hunner (http://treyhunner.com) - -> Copyright © 2012 EditorConfig Team -> -> 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. - ----------------------------------------- - -### emoji-regex@v10.4.0 - -> A regular expression to match all Emoji-only symbols as per the Unicode Standard. - -License: MIT -Homepage: -Repository: -Author: Mathias Bynens (https://mathiasbynens.be/) - -> 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. - ----------------------------------------- - -### escape-string-regexp@v5.0.0 - -> Escape RegExp special characters - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### espree@v10.3.0 - -> An Esprima-compatible JavaScript parser built on Acorn - -License: BSD-2-Clause -Homepage: -Author: Nicholas C. Zakas - -> 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. - ----------------------------------------- - -### extend@v3.0.2 - -> Port of jQuery.extend for node.js and the browser - -License: MIT -Repository: -Author: Stefan Thomas (http://www.justmoon.net) -Contributors: - - Jordan Harband (https://github.com/ljharb) - -> The MIT License (MIT) -> -> Copyright (c) 2014 Stefan Thomas -> -> 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. - ----------------------------------------- - -### fast-glob@v3.3.2 - -> It's a very fast and efficient glob library for Node.js - -License: MIT -Author: Denis Malinochkin (https://mrmlnc.com) - -> The MIT License (MIT) -> -> Copyright (c) Denis Malinochkin -> -> 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. - ----------------------------------------- - -### fast-json-stable-stringify@v2.1.0 - -> deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify - -License: MIT -Homepage: -Repository: -Author: James Halliday (http://substack.net) - -> 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. - ----------------------------------------- - -### fastq@v1.17.1 - -> Fast, in memory work queue - -License: ISC -Homepage: -Repository: -Author: Matteo Collina - -> Copyright (c) 2015-2020, Matteo Collina -> -> 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. - ----------------------------------------- - -### file-entry-cache@v9.1.0 - -> 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 - -License: MIT -Author: Jared Wray (https://jaredwray.com) - -> The MIT License (MIT) -> -> Copyright (c) Roy Riojas & Jared Wray -> -> 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. - ----------------------------------------- - -### fill-range@v7.1.1 - -> Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex` - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) -Contributors: - - Edo Rivai (edo.rivai.nl) - - Jon Schlinkert (http://twitter.com/jonschlinkert) - - Paul Miller (paulmillr.com) - - Rouven Weßling (www.rouvenwessling.de) - - null (https://github.com/wtgtybhertgeghgtwtg) - -> The MIT License (MIT) -> -> Copyright (c) 2014-present, 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. - ----------------------------------------- - -### find-cache-dir@v5.0.0 - -> Finds the common standard cache directory - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> MIT License -> -> Copyright (c) Sindre Sorhus (https://sindresorhus.com) -> Copyright (c) James Talmage (https://github.com/jamestalmage) -> -> 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. - ----------------------------------------- - -### find-up@v6.3.0 - -> Find a file or directory by walking up parent directories - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### flat-cache@v5.0.0 - -> A stupidly simple key/value storage using files to persist some data - -License: MIT -Author: Jared Wray (https://jaredwray.com) - -> The MIT License (MIT) -> -> Copyright (c) Roy Riojas and Jared Wray -> -> 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. - ----------------------------------------- - -### flatted@v3.3.2 - -> A super light and fast circular JSON parser. - -License: ISC -Homepage: -Repository: -Author: Andrea Giammarchi - -> 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. - ----------------------------------------- - -### flatten@v1.0.3 - -> Flatten arbitrarily nested arrays into a non-nested list of non-array items. Maintained for legacy compatibility. - -License: MIT -Homepage: -Repository: -Author: Joshua Holbrook (http://jesusabdullah.net) -Contributors: - - M.K. (https://github.com/mk-pmb) - -> The MIT License (MIT) -> -> Copyright (c) 2016 Joshua Holbrook -> -> 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. - ----------------------------------------- - -### flow-parser@v0.255.0 - -> JavaScript parser written in OCaml. Produces ESTree AST - -License: MIT -Homepage: -Repository: -Author: Flow Team - ----------------------------------------- - -### get-east-asian-width@v1.3.0 - -> Determine the East Asian Width of a Unicode character - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### get-stdin@v9.0.0 - -> Get stdin as a string or buffer - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### glob-parent@v5.1.2 - -> Extract the non-magic parent path from a glob string. - -License: ISC -Author: Gulp Team (https://gulpjs.com/) -Contributors: - - Elan Shanker (https://github.com/es128) - - Blaine Bublitz - -> The ISC License -> -> Copyright (c) 2015, 2019 Elan Shanker -> -> 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. - ----------------------------------------- - -### graphql@v16.9.0 - -> A Query Language and Runtime which can target any service. - -License: MIT -Homepage: -Repository: - -> MIT License -> -> Copyright (c) GraphQL 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. - ----------------------------------------- - -### ignore@v6.0.2 - -> Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others. - -License: MIT -Repository: -Author: kael - -> 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. - ----------------------------------------- - -### import-meta-resolve@v4.1.0 - -> Resolve things like Node.js — ponyfill for `import.meta.resolve` - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2021 Titus Wormer -> -> Permission is hereby granted, free of charge, to any person obtaining -> a copy of this software and associated documentation files (the -> 'Software'), to deal in the Software without restriction, including -> without limitation the rights to use, copy, modify, merge, publish, -> distribute, sublicense, and/or sell copies of the Software, and to -> permit persons to whom the Software is furnished to do so, subject to -> the following conditions: -> -> The above copyright notice and this permission notice shall be -> included in all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -> -> --- -> -> This is a derivative work based on: -> . -> Which is licensed: -> -> """ -> Copyright Node.js contributors. All rights reserved. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to -> deal in the Software without restriction, including without limitation the -> rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -> sell copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -> IN THE SOFTWARE. -> """ -> -> This license applies to parts of Node.js originating from the -> https://github.com/joyent/node repository: -> -> """ -> Copyright Joyent, Inc. and other Node contributors. All rights reserved. -> 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. -> """ - ----------------------------------------- - -### index-to-position@v0.1.2 - -> Convert a string index to its line and column position - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### indexes-of@v1.0.1 - -> line String/Array#indexOf but return all the indexes in an array - -License: MIT -Homepage: -Repository: -Author: Dominic Tarr (dominictarr.com) - -> Copyright (c) 2013 Dominic Tarr -> -> 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. - ----------------------------------------- - -### inherits@v2.0.4 - -> Browser-friendly inheritance fully compatible with standard node.js inherits() - -License: ISC - -> 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. - ----------------------------------------- - -### is-alphabetical@v1.0.4 - -> Check if a character is alphabetical - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### is-alphanumerical@v1.0.4 - -> Check if a character is alphanumerical - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### is-buffer@v2.0.5 - -> Determine if an object is a Buffer - -License: MIT -Repository: -Author: Feross Aboukhadijeh (https://feross.org) - -> The MIT License (MIT) -> -> Copyright (c) Feross Aboukhadijeh -> -> 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. - ----------------------------------------- - -### is-decimal@v1.0.4 - -> Check if a character is decimal - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### is-extglob@v2.1.1 - -> Returns true if a string has an extglob. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) - -> 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. - ----------------------------------------- - -### is-glob@v4.0.3 - -> 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. - -License: MIT -Homepage: -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) - -> 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. - ----------------------------------------- - -### is-hexadecimal@v1.0.4 - -> Check if a character is hexadecimal - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### is-number@v7.0.0 - -> Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) -Contributors: - - Jon Schlinkert (http://twitter.com/jonschlinkert) - - Olsten Larck (https://i.am.charlike.online) - - Rouven Weßling (www.rouvenwessling.de) - -> The MIT License (MIT) -> -> Copyright (c) 2014-present, 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. - ----------------------------------------- - -### is-plain-obj@v2.1.0 - -> Check if a value is a plain object - -License: MIT -Author: Sindre Sorhus (sindresorhus.com) - -> 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. - ----------------------------------------- - -### is-whitespace-character@v1.0.4 - -> Check if a character is a whitespace character - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### is-word-character@v1.0.4 - -> Check if a character is a word character - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### iterate-directory-up@v1.1.1 - -> Iterate directory up. - -License: MIT -Homepage: -Author: fisker Cheung (https://www.fiskercheung.com/) - -> MIT License -> -> Copyright (c) fisker Cheung (https://www.fiskercheung.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. - ----------------------------------------- - -### jest-docblock@v30.0.0-alpha.6 - -License: MIT -Repository: - -> MIT License -> -> Copyright (c) Meta Platforms, Inc. and affiliates. -> Copyright Contributors to the Jest project. -> -> 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. - ----------------------------------------- - -### js-tokens@v4.0.0 - -> A regex that tokenizes JavaScript. - -License: MIT -Author: Simon Lydell - -> The MIT License (MIT) -> -> Copyright (c) 2014, 2015, 2016, 2017, 2018 Simon Lydell -> -> 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. - ----------------------------------------- - -### js-yaml@v4.1.0 - -> YAML 1.2 parser and serializer - -License: MIT -Author: Vladimir Zapparov -Contributors: - - Aleksey V Zapparov (http://www.ixti.net/) - - Vitaly Puzrin (https://github.com/puzrin) - - Martin Grenfell (http://got-ravings.blogspot.com) - -> (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. - ----------------------------------------- - -### json-buffer@v3.0.1 - -> JSON parse & stringify that supports binary via bops & base64 - -License: MIT -Homepage: -Repository: -Author: Dominic Tarr (http://dominictarr.com) - -> Copyright (c) 2013 Dominic Tarr -> -> 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. - ----------------------------------------- - -### json5@v2.2.3 - -> JSON for Humans - -License: MIT -Homepage: -Repository: -Author: Aseem Kishore -Contributors: - - Max Nanasy - - Andrew Eisenberg - - Jordan Tucker - -> MIT License -> -> Copyright (c) 2012-2018 Aseem Kishore, and [others]. -> -> 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. -> -> [others]: https://github.com/json5/json5/contributors - ----------------------------------------- - -### keyv@v4.5.4 - -> Simple key-value storage with support for multiple backends - -License: MIT -Homepage: -Repository: -Author: Jared Wray (http://jaredwray.com) - ----------------------------------------- - -### leven@v4.0.0 - -> Measure the difference between two strings using the Levenshtein distance algorithm - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### lines-and-columns@v2.0.4 - -> Maps lines and columns to character offsets and back. - -License: MIT -Homepage: -Repository: -Author: Brian Donovan - -> The MIT License (MIT) -> -> Copyright (c) 2015 Brian Donovan -> -> 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. - ----------------------------------------- - -### locate-path@v7.2.0 - -> Get the first path that exists on disk of multiple paths - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### lru-cache@v4.1.5 - -> A cache object that deletes the least-recently-used items. - -License: ISC -Author: Isaac Z. Schlueter - -> 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. - ----------------------------------------- - -### markdown-escapes@v1.0.4 - -> List of escapable characters in markdown - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### merge2@v1.4.1 - -> Merge multiple streams into one stream in sequence or parallel. - -License: MIT -Homepage: -Repository: - -> The MIT License (MIT) -> -> Copyright (c) 2014-2020 Teambition -> -> 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. - ----------------------------------------- - -### meriyah@v6.0.3 - -> A 100% compliant, self-hosted javascript parser with high focus on both performance and stability - -License: ISC -Homepage: -Repository: -Author: Kenny F. (https://github.com/KFlash) -Contributors: - - Chunpeng Huo (https://github.com/3cp) - -> ISC License -> -> Copyright (c) 2019 and later, KFlash and others. -> -> 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. - ----------------------------------------- - -### micromatch@v4.0.8 - -> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) -Contributors: - - null (https://github.com/DianeLooney) - - Amila Welihinda (amilajack.com) - - Bogdan Chadkin (https://github.com/TrySound) - - Brian Woodward (https://twitter.com/doowb) - - Devon Govett (http://badassjs.com) - - Elan Shanker (https://github.com/es128) - - Fabrício Matté (https://ultcombo.js.org) - - Jon Schlinkert (http://twitter.com/jonschlinkert) - - Martin Kolárik (https://kolarik.sk) - - Olsten Larck (https://i.am.charlike.online) - - Paul Miller (paulmillr.com) - - Tom Byrer (https://github.com/tomByrer) - - Tyler Akins (http://rumkin.com) - - Peter Bright (https://github.com/drpizza) - - Kuba Juszczyk (https://github.com/ku8ar) - -> The MIT License (MIT) -> -> Copyright (c) 2014-present, 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. - ----------------------------------------- - -### minimist@v1.2.8 - -> parse argument options - -License: MIT -Homepage: -Repository: -Author: James Halliday (http://substack.net) - -> 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. - ----------------------------------------- - -### n-readlines@v1.0.1 - -> Read file line by line without buffering the whole file in memory. - -License: MIT -Repository: -Author: Yoan Arnaudov - -> The MIT License (MIT) -> -> Copyright (c) 2013 Liucw -> -> 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. - ----------------------------------------- - -### nanoid@v3.3.7 - -> A tiny (116 bytes), secure URL-friendly unique string ID generator - -License: MIT -Author: Andrey Sitnik - -> The MIT License (MIT) -> -> Copyright 2017 Andrey Sitnik -> -> 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. - ----------------------------------------- - -### p-limit@v4.0.0 - -> Run multiple promise-returning & async functions with limited concurrency - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### p-locate@v6.0.0 - -> Get the first fulfilled promise that satisfies the provided testing function - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### parse-entities@v2.0.0 - -> Parse HTML character references: fast, spec-compliant, positional information - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### parse-json@v8.1.0 - -> Parse JSON with more helpful errors - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### path-exists@v5.0.0 - -> Check if a path exists - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### picocolors@v1.1.1 - -> The tiniest and the fastest library for terminal output formatting with ANSI colors - -License: ISC -Author: Alexey Raspopov - -> ISC License -> -> Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov -> -> 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. - ----------------------------------------- - -### picomatch@v2.3.1 - -> Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) - -> The MIT License (MIT) -> -> Copyright (c) 2017-present, 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. - ----------------------------------------- - -### pkg-dir@v7.0.0 - -> Find the root directory of a Node.js project or npm package - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### please-upgrade-node@v3.2.0 - -> Displays a beginner-friendly message telling your user to upgrade their version of Node - -License: MIT -Homepage: -Repository: -Author: typicode - -> MIT License -> -> Copyright (c) 2017 -> -> 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. - ----------------------------------------- - -### postcss@v8.4.49 - -> Tool for transforming styles with JS plugins - -License: MIT -Homepage: -Author: Andrey Sitnik - -> The MIT License (MIT) -> -> Copyright 2013 Andrey Sitnik -> -> 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. - ----------------------------------------- - -### postcss-less@v6.0.0 - -> LESS parser for PostCSS - -License: MIT -Homepage: -Author: Denys Kniazevych - -> The MIT License (MIT) -> -> Copyright (c) 2013 Andrey Sitnik -> Copyright (c) 2016 Denys Kniazevych -> Copyright (c) 2016 Pat Sissons -> Copyright (c) 2017 Andrew Powell -> -> 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. - ----------------------------------------- - -### postcss-media-query-parser@v0.2.3 - -> A tool for parsing media query lists. - -License: MIT -Homepage: -Repository: -Author: dryoma - ----------------------------------------- - -### postcss-scss@v4.0.9 - -> SCSS parser for PostCSS - -License: MIT -Author: Andrey Sitnik - -> The MIT License (MIT) -> -> Copyright 2013 Andrey Sitnik -> -> 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. - ----------------------------------------- - -### postcss-selector-parser@v2.2.3 - -License: MIT -Homepage: -Author: Ben Briggs (http://beneb.info) - -> Copyright (c) Ben Briggs (http://beneb.info) -> -> 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. - ----------------------------------------- - -### postcss-values-parser@v2.0.1 - -> A CSS property value parser for use with PostCSS - -License: MIT -Author: Andrew Powell (shellscape) (http://shellscape.org) - -> Copyright (c) Andrew Powell -> -> 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. - ----------------------------------------- - -### pseudomap@v1.0.2 - -> A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available. - -License: ISC -Homepage: -Repository: -Author: Isaac Z. Schlueter (http://blog.izs.me/) - -> 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. - ----------------------------------------- - -### queue-microtask@v1.2.3 - -> fast, tiny `queueMicrotask` shim for modern engines - -License: MIT -Homepage: -Repository: -Author: Feross Aboukhadijeh (https://feross.org) - -> The MIT License (MIT) -> -> Copyright (c) Feross Aboukhadijeh -> -> 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. - ----------------------------------------- - -### remark-footnotes@v2.0.0 - -> remark plugin to add support for pandoc footnotes - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2020 Titus Wormer -> -> 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. - ----------------------------------------- - -### remark-math@v3.0.1 - -> remark plugin to parse and stringify math - -License: MIT -Author: Junyoung Choi (https://rokt33r.github.io) -Contributors: - - Junyoung Choi (https://rokt33r.github.io) - - Titus Wormer (https://wooorm.com) - ----------------------------------------- - -### remark-parse@v8.0.3 - -> remark plugin to parse Markdown - -License: MIT -Homepage: -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - - Eugene Sharygin - - Junyoung Choi - - Elijah Hamovitz - - Ika - ----------------------------------------- - -### repeat-string@v1.6.1 - -> Repeat the given string n times. Fastest implementation for repeating a string. - -License: MIT -Homepage: -Author: Jon Schlinkert (http://github.com/jonschlinkert) -Contributors: - - Brian Woodward (https://github.com/doowb) - - Jon Schlinkert (http://twitter.com/jonschlinkert) - - Linus Unnebäck (http://linus.unnebäck.se) - - Thijs Busser (http://tbusser.net) - - Titus (wooorm.com) - -> 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. - ----------------------------------------- - -### reusify@v1.0.4 - -> Reuse objects and functions with style - -License: MIT -Homepage: -Repository: -Author: Matteo Collina - -> The MIT License (MIT) -> -> Copyright (c) 2015 Matteo Collina -> -> 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. - ----------------------------------------- - -### run-parallel@v1.2.0 - -> Run an array of functions in parallel - -License: MIT -Homepage: -Repository: -Author: Feross Aboukhadijeh (https://feross.org) - -> The MIT License (MIT) -> -> Copyright (c) Feross Aboukhadijeh -> -> 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. - ----------------------------------------- - -### sdbm@v2.0.0 - -> SDBM non-cryptographic hash function - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### semver@v7.6.3 - -> The semantic version parser used by npm. - -License: ISC -Repository: -Author: GitHub Inc. - -> 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. - ----------------------------------------- - -### semver-compare@v1.0.0 - -> compare two semver version strings, returning -1, 0, or 1 - -License: MIT -Homepage: -Repository: -Author: James Halliday (http://substack.net) - -> 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. - ----------------------------------------- - -### sigmund@v1.0.1 - -> Quick and dirty signatures for Objects. - -License: ISC -Repository: -Author: Isaac Z. Schlueter (http://blog.izs.me/) - -> 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. - ----------------------------------------- - -### simple-html-tokenizer@v0.5.11 - -> Simple HTML Tokenizer is a lightweight JavaScript library that can be used to tokenize the kind of HTML normally found in templates. - -License: MIT -Repository: - -> Copyright (c) 2014 Yehuda Katz and contributors -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of -> this software and associated documentation files (the "Software"), to deal in -> the Software without restriction, including without limitation the rights to -> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -> of the Software, and to permit persons to whom the Software is furnished to do -> so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -> SOFTWARE. - ----------------------------------------- - -### smol-toml@v1.3.1 - -> A small, fast, and correct TOML parser/serializer - -License: BSD-3-Clause -Author: Cynthia - -> Copyright (c) Squirrel Chat et al., 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. -> 3. 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. - ----------------------------------------- - -### state-toggle@v1.0.3 - -> Enter/exit a state - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### strip-ansi@v7.1.0 - -> Strip ANSI escape codes from a string - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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. - ----------------------------------------- - -### to-fast-properties@v4.0.0 - -> Force V8 to use fast properties for an object - -License: MIT -Author: Sindre Sorhus (https:/sindresorhus.com) - -> MIT License -> -> Copyright (c) Petka Antonov -> Benjamin Gruenbaum -> John-David Dalton -> Sindre Sorhus -> -> 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. - ----------------------------------------- - -### to-regex-range@v5.0.1 - -> Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions. - -License: MIT -Homepage: -Author: Jon Schlinkert (https://github.com/jonschlinkert) -Contributors: - - Jon Schlinkert (http://twitter.com/jonschlinkert) - - Rouven Weßling (www.rouvenwessling.de) - -> The MIT License (MIT) -> -> Copyright (c) 2015-present, 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. - ----------------------------------------- - -### trim@v1.0.1 - -> Trim string whitespace - -License: MIT -Repository: -Author: TJ Holowaychuk - ----------------------------------------- - -### trim-trailing-lines@v1.1.4 - -> Remove final line feeds from a string - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### trough@v1.0.5 - -> Middleware: a channel used to convey a liquid - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### ts-api-utils@v1.4.2 - -> Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️ - -License: MIT -Repository: -Author: JoshuaKGoldberg - -> # 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. - ----------------------------------------- - -### typescript@v5.7.2 - -> TypeScript is a language for application scale JavaScript development - -License: Apache-2.0 -Homepage: -Repository: -Author: Microsoft Corp. - -> 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: -> -> You must give any other recipients of the Work or Derivative Works a copy of this License; and -> -> You must cause any modified files to carry prominent notices stating that You changed the files; and -> -> 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 -> -> 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 - ----------------------------------------- - -### unherit@v1.1.3 - -> Clone a constructor without affecting the super-class - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### unified@v9.2.2 - -> Interface for parsing, inspecting, transforming, and serializing content through syntax trees - -License: MIT -Homepage: -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - - Junyoung Choi - - Hernan Rajchert - - Christian Murphy - - Vse Mozhet Byt - - Richard Littauer - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### uniq@v1.0.1 - -> Removes duplicates from a sorted array in place - -License: MIT -Repository: -Author: Mikola Lysenko - -> 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. - ----------------------------------------- - -### unist-util-is@v4.1.0 - -> unist utility to check if a node passes a test - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - - Christian Murphy - - Lucas Brandstaetter (https://github.com/Roang-zero1) - -> (The MIT license) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### unist-util-remove-position@v2.0.1 - -> unist utility to remove positions from a tree - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### unist-util-stringify-position@v2.0.3 - -> unist utility to serialize a node, position, or point as a human readable location - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### unist-util-visit@v2.0.3 - -> unist utility to visit nodes - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - - Eugene Sharygin - - Richard Gibson - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### unist-util-visit-parents@v3.1.1 - -> unist utility to recursively walk over nodes, with ancestral information - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### url-or-path@v2.3.2 - -> Convert between file URL and path. - -License: MIT -Homepage: -Author: fisker Cheung (https://www.fiskercheung.com/) - -> MIT License -> -> Copyright (c) fisker Cheung (https://www.fiskercheung.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. - ----------------------------------------- - -### vfile@v4.2.1 - -> Virtual file format for text processing - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - - Brendan Abbott - - Denys Dovhan - - Kyle Mathews - - Shinnosuke Watanabe - - Sindre Sorhus - -> (The MIT License) -> -> Copyright (c) 2015 Titus Wormer -> -> 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. - ----------------------------------------- - -### vfile-location@v3.2.0 - -> vfile utility to convert between positional (line and column-based) and offset (range-based) locations - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - - Christian Murphy - -> (The MIT License) -> -> Copyright (c) 2016 Titus Wormer -> -> 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. - ----------------------------------------- - -### vfile-message@v2.0.4 - -> vfile utility to create a virtual message - -License: MIT -Author: Titus Wormer (https://wooorm.com) -Contributors: - - Titus Wormer (https://wooorm.com) - -> (The MIT License) -> -> Copyright (c) 2017 Titus Wormer -> -> 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. - ----------------------------------------- - -### vnopts@v2.0.0 - -> validate and normalize options - -License: MIT -Homepage: -Author: Ika (https://github.com/ikatyang) - -> MIT License -> -> Copyright (c) Ika (https://github.com/ikatyang) -> -> 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. - ----------------------------------------- - -### wcwidth.js@v2.0.0 - -> a javascript porting of C's wcwidth() - -License: MIT -Homepage: -Repository: -Author: Woong Jun (http://code.woong.org/) -Contributors: - - Tim Oxley (http://campjs.com/) - -> wcwidth.js: a javascript portng of C's wcwidth() -> ================================================ -> -> Copyright (C) 2012-2014 by Woong Jun and Tim Oxley. -> -> This package is a javascript porting of `wcwidth()` implementation -> [by Markus Kuhn](http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c). -> -> 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. -> -> -> THIS SOFTWARE IS PROVIDED ``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 AUTHOR -> 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. - ----------------------------------------- - -### xtend@v4.0.2 - -> extend like a boss - -License: MIT -Homepage: -Author: Raynos -Contributors: - - Jake Verbaten - - Matt Esch - -> The MIT License (MIT) -> Copyright (c) 2012-2014 Raynos. -> -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> 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. - ----------------------------------------- - -### yallist@v2.1.2 - -> Yet Another Linked List - -License: ISC -Repository: -Author: Isaac Z. Schlueter (http://blog.izs.me/) - -> 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. - ----------------------------------------- - -### yaml@v1.10.2 - -> JavaScript parser and stringifier for YAML - -License: ISC -Homepage: -Author: Eemeli Aro - -> Copyright 2018 Eemeli Aro -> -> 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. - ----------------------------------------- - -### yaml-unist-parser@v2.0.1 - -> A YAML parser that produces output compatible with unist - -License: MIT -Homepage: -Author: Ika (https://github.com/ikatyang) - -> MIT License -> -> Copyright (c) Ika (https://github.com/ikatyang) -> -> 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. - ----------------------------------------- - -### yocto-queue@v1.1.1 - -> Tiny queue data structure - -License: MIT -Author: Sindre Sorhus (https://sindresorhus.com) - -> 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/prettier/README.md b/node_modules/prettier/README.md deleted file mode 100644 index d852667..0000000 --- a/node_modules/prettier/README.md +++ /dev/null @@ -1,109 +0,0 @@ -[![Prettier Banner](https://unpkg.com/prettier-logo@1.0.3/images/prettier-banner-light.svg)](https://prettier.io) - -

Opinionated Code Formatter

- -

- - JavaScript - · TypeScript - · Flow - · JSX - · JSON - -
- - CSS - · SCSS - · Less - -
- - HTML - · Vue - · Angular - -
- - GraphQL - · Markdown - · YAML - -
- - - Your favorite language? - - -

- -

- - Github Actions Build Status - - Github Actions Build Status - - Github Actions Build Status - - Codecov Coverage Status - - Blazing Fast -
- - npm version - - weekly downloads from npm - - code style: prettier - - Follow Prettier on Twitter -

- -## Intro - -Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. - -### Input - - -```js -foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne()); -``` - -### Output - -```js -foo( - reallyLongArg(), - omgSoManyParameters(), - IShouldRefactorThis(), - isThereSeriouslyAnotherOne(), -); -``` - -Prettier can be run [in your editor](https://prettier.io/docs/en/editors.html) on-save, in a [pre-commit hook](https://prettier.io/docs/en/precommit.html), or in [CI environments](https://prettier.io/docs/en/cli.html#list-different) to ensure your codebase has a consistent style without devs ever having to post a nit-picky comment on a code review ever again! - ---- - -**[Documentation](https://prettier.io/docs/en/)** - - -[Install](https://prettier.io/docs/en/install.html) · -[Options](https://prettier.io/docs/en/options.html) · -[CLI](https://prettier.io/docs/en/cli.html) · -[API](https://prettier.io/docs/en/api.html) - -**[Playground](https://prettier.io/playground/)** - ---- - -## Badge - -Show the world you're using _Prettier_ → [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) - -```md -[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) -``` - -## Contributing - -See [CONTRIBUTING.md](CONTRIBUTING.md). diff --git a/node_modules/prettier/bin/prettier.cjs b/node_modules/prettier/bin/prettier.cjs deleted file mode 100755 index 08f8e3b..0000000 --- a/node_modules/prettier/bin/prettier.cjs +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __commonJS = function(cb, mod) { - return function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; -}; - -// node_modules/semver-compare/index.js -var require_semver_compare = __commonJS({ - "node_modules/semver-compare/index.js": function(exports2, module2) { - module2.exports = function cmp(a, b) { - var pa = a.split("."); - var pb = b.split("."); - for (var i = 0; i < 3; i++) { - var na = Number(pa[i]); - var nb = Number(pb[i]); - if (na > nb) return 1; - if (nb > na) return -1; - if (!isNaN(na) && isNaN(nb)) return 1; - if (isNaN(na) && !isNaN(nb)) return -1; - } - return 0; - }; - } -}); - -// node_modules/please-upgrade-node/index.js -var require_please_upgrade_node = __commonJS({ - "node_modules/please-upgrade-node/index.js": function(exports2, module2) { - var semverCompare = require_semver_compare(); - module2.exports = function pleaseUpgradeNode2(pkg, opts) { - var opts = opts || {}; - var requiredVersion = pkg.engines.node.replace(">=", ""); - var currentVersion = process.version.replace("v", ""); - if (semverCompare(currentVersion, requiredVersion) === -1) { - if (opts.message) { - console.error(opts.message(requiredVersion)); - } else { - console.error( - pkg.name + " requires at least version " + requiredVersion + " of Node, please upgrade" - ); - } - if (opts.hasOwnProperty("exitCode")) { - process.exit(opts.exitCode); - } else { - process.exit(1); - } - } - }; - } -}); - -// bin/prettier.cjs -var nodeModule = require("module"); -if (typeof nodeModule.enableCompileCache === "function") { - nodeModule.enableCompileCache(); -} -var pleaseUpgradeNode = require_please_upgrade_node(); -var packageJson = require("../package.json"); -pleaseUpgradeNode(packageJson); -function runCli(cli) { - return cli.run(); -} -var dynamicImport = new Function("module", "return import(module)"); -var promise = dynamicImport("../internal/cli.mjs").then(runCli); -module.exports.__promise = promise; diff --git a/node_modules/prettier/doc.d.ts b/node_modules/prettier/doc.d.ts deleted file mode 100644 index 5011775..0000000 --- a/node_modules/prettier/doc.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -// https://github.com/prettier/prettier/blob/next/src/document/public.js -export namespace builders { - type DocCommand = - | Align - | BreakParent - | Cursor - | Fill - | Group - | IfBreak - | Indent - | IndentIfBreak - | Label - | Line - | LineSuffix - | LineSuffixBoundary - | Trim; - type Doc = string | Doc[] | DocCommand; - - interface Align { - type: "align"; - contents: Doc; - n: number | string | { type: "root" }; - } - - interface BreakParent { - type: "break-parent"; - } - - interface Cursor { - type: "cursor"; - placeholder: symbol; - } - - interface Fill { - type: "fill"; - parts: Doc[]; - } - - interface Group { - type: "group"; - id?: symbol; - contents: Doc; - break: boolean; - expandedStates: Doc[]; - } - - interface HardlineWithoutBreakParent extends Line { - hard: true; - } - - interface IfBreak { - type: "if-break"; - breakContents: Doc; - flatContents: Doc; - } - - interface Indent { - type: "indent"; - contents: Doc; - } - - interface IndentIfBreak { - type: "indent-if-break"; - } - - interface Label { - type: "label"; - label: any; - contents: Doc; - } - - interface Line { - type: "line"; - soft?: boolean | undefined; - hard?: boolean | undefined; - literal?: boolean | undefined; - } - - interface LineSuffix { - type: "line-suffix"; - contents: Doc; - } - - interface LineSuffixBoundary { - type: "line-suffix-boundary"; - } - - interface LiterallineWithoutBreakParent extends Line { - hard: true; - literal: true; - } - - type LiteralLine = [LiterallineWithoutBreakParent, BreakParent]; - - interface Softline extends Line { - soft: true; - } - - type Hardline = [HardlineWithoutBreakParent, BreakParent]; - - interface Trim { - type: "trim"; - } - - interface GroupOptions { - shouldBreak?: boolean | undefined; - id?: symbol | undefined; - } - - function addAlignmentToDoc(doc: Doc, size: number, tabWidth: number): Doc; - - /** @see [align](https://github.com/prettier/prettier/blob/main/commands.md#align) */ - function align(widthOrString: Align["n"], doc: Doc): Align; - - /** @see [breakParent](https://github.com/prettier/prettier/blob/main/commands.md#breakparent) */ - const breakParent: BreakParent; - - /** @see [conditionalGroup](https://github.com/prettier/prettier/blob/main/commands.md#conditionalgroup) */ - function conditionalGroup(alternatives: Doc[], options?: GroupOptions): Group; - - /** @see [dedent](https://github.com/prettier/prettier/blob/main/commands.md#dedent) */ - function dedent(doc: Doc): Align; - - /** @see [dedentToRoot](https://github.com/prettier/prettier/blob/main/commands.md#dedenttoroot) */ - function dedentToRoot(doc: Doc): Align; - - /** @see [fill](https://github.com/prettier/prettier/blob/main/commands.md#fill) */ - function fill(docs: Doc[]): Fill; - - /** @see [group](https://github.com/prettier/prettier/blob/main/commands.md#group) */ - function group(doc: Doc, opts?: GroupOptions): Group; - - /** @see [hardline](https://github.com/prettier/prettier/blob/main/commands.md#hardline) */ - const hardline: Hardline; - - /** @see [hardlineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */ - const hardlineWithoutBreakParent: HardlineWithoutBreakParent; - - /** @see [ifBreak](https://github.com/prettier/prettier/blob/main/commands.md#ifbreak) */ - function ifBreak( - ifBreak: Doc, - noBreak?: Doc, - options?: { groupId?: symbol | undefined }, - ): IfBreak; - - /** @see [indent](https://github.com/prettier/prettier/blob/main/commands.md#indent) */ - function indent(doc: Doc): Indent; - - /** @see [indentIfBreak](https://github.com/prettier/prettier/blob/main/commands.md#indentifbreak) */ - function indentIfBreak( - doc: Doc, - opts: { groupId: symbol; negate?: boolean | undefined }, - ): IndentIfBreak; - - /** @see [join](https://github.com/prettier/prettier/blob/main/commands.md#join) */ - function join(sep: Doc, docs: Doc[]): Doc[]; - - /** @see [label](https://github.com/prettier/prettier/blob/main/commands.md#label) */ - function label(label: any | undefined, contents: Doc): Doc; - - /** @see [line](https://github.com/prettier/prettier/blob/main/commands.md#line) */ - const line: Line; - - /** @see [lineSuffix](https://github.com/prettier/prettier/blob/main/commands.md#linesuffix) */ - function lineSuffix(suffix: Doc): LineSuffix; - - /** @see [lineSuffixBoundary](https://github.com/prettier/prettier/blob/main/commands.md#linesuffixboundary) */ - const lineSuffixBoundary: LineSuffixBoundary; - - /** @see [literalline](https://github.com/prettier/prettier/blob/main/commands.md#literalline) */ - const literalline: LiteralLine; - - /** @see [literallineWithoutBreakParent](https://github.com/prettier/prettier/blob/main/commands.md#hardlinewithoutbreakparent-and-literallinewithoutbreakparent) */ - const literallineWithoutBreakParent: LiterallineWithoutBreakParent; - - /** @see [markAsRoot](https://github.com/prettier/prettier/blob/main/commands.md#markasroot) */ - function markAsRoot(doc: Doc): Align; - - /** @see [softline](https://github.com/prettier/prettier/blob/main/commands.md#softline) */ - const softline: Softline; - - /** @see [trim](https://github.com/prettier/prettier/blob/main/commands.md#trim) */ - const trim: Trim; - - /** @see [cursor](https://github.com/prettier/prettier/blob/main/commands.md#cursor) */ - const cursor: Cursor; -} - -export namespace printer { - function printDocToString( - doc: builders.Doc, - options: Options, - ): { - formatted: string; - /** - * This property is a misnomer, and has been since the changes in - * https://github.com/prettier/prettier/pull/15709. - * The region of the document indicated by `cursorNodeStart` and `cursorNodeText` will - * sometimes actually be what lies BETWEEN a pair of leaf nodes in the AST, rather than a node. - */ - cursorNodeStart?: number | undefined; - - /** - * Note that, like cursorNodeStart, this is a misnomer and may actually be the text between two - * leaf nodes in the AST instead of the text of a node. - */ - cursorNodeText?: string | undefined; - }; - interface Options { - /** - * Specify the line length that the printer will wrap on. - * @default 80 - */ - printWidth: number; - /** - * Specify the number of spaces per indentation-level. - * @default 2 - */ - tabWidth: number; - /** - * Indent lines with tabs instead of spaces - * @default false - */ - useTabs?: boolean; - parentParser?: string | undefined; - __embeddedInHtml?: boolean | undefined; - } -} - -export namespace utils { - function willBreak(doc: builders.Doc): boolean; - function traverseDoc( - doc: builders.Doc, - onEnter?: (doc: builders.Doc) => void | boolean, - onExit?: (doc: builders.Doc) => void, - shouldTraverseConditionalGroups?: boolean, - ): void; - function findInDoc( - doc: builders.Doc, - callback: (doc: builders.Doc) => T, - defaultValue: T, - ): T; - function mapDoc( - doc: builders.Doc, - callback: (doc: builders.Doc) => T, - ): T; - function removeLines(doc: builders.Doc): builders.Doc; - function stripTrailingHardline(doc: builders.Doc): builders.Doc; - function replaceEndOfLine( - doc: builders.Doc, - replacement?: builders.Doc, - ): builders.Doc; - function canBreak(doc: builders.Doc): boolean; -} diff --git a/node_modules/prettier/doc.js b/node_modules/prettier/doc.js deleted file mode 100644 index 7ebeb2d..0000000 --- a/node_modules/prettier/doc.js +++ /dev/null @@ -1,1236 +0,0 @@ -(function (factory) { - function interopModuleDefault() { - var module = factory(); - return module.default || module; - } - - if (typeof exports === "object" && typeof module === "object") { - module.exports = interopModuleDefault(); - } else if (typeof define === "function" && define.amd) { - define(interopModuleDefault); - } else { - var root = - typeof globalThis !== "undefined" - ? globalThis - : typeof global !== "undefined" - ? global - : typeof self !== "undefined" - ? self - : this || {}; - root.doc = interopModuleDefault(); - } -})(function () { - "use strict"; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/document/public.js - var public_exports = {}; - __export(public_exports, { - builders: () => builders, - printer: () => printer, - utils: () => utils - }); - - // src/document/constants.js - var DOC_TYPE_STRING = "string"; - var DOC_TYPE_ARRAY = "array"; - var DOC_TYPE_CURSOR = "cursor"; - var DOC_TYPE_INDENT = "indent"; - var DOC_TYPE_ALIGN = "align"; - var DOC_TYPE_TRIM = "trim"; - var DOC_TYPE_GROUP = "group"; - var DOC_TYPE_FILL = "fill"; - var DOC_TYPE_IF_BREAK = "if-break"; - var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break"; - var DOC_TYPE_LINE_SUFFIX = "line-suffix"; - var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary"; - var DOC_TYPE_LINE = "line"; - var DOC_TYPE_LABEL = "label"; - var DOC_TYPE_BREAK_PARENT = "break-parent"; - var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([ - DOC_TYPE_CURSOR, - DOC_TYPE_INDENT, - DOC_TYPE_ALIGN, - DOC_TYPE_TRIM, - DOC_TYPE_GROUP, - DOC_TYPE_FILL, - DOC_TYPE_IF_BREAK, - DOC_TYPE_INDENT_IF_BREAK, - DOC_TYPE_LINE_SUFFIX, - DOC_TYPE_LINE_SUFFIX_BOUNDARY, - DOC_TYPE_LINE, - DOC_TYPE_LABEL, - DOC_TYPE_BREAK_PARENT - ]); - - // src/document/utils/get-doc-type.js - function getDocType(doc) { - if (typeof doc === "string") { - return DOC_TYPE_STRING; - } - if (Array.isArray(doc)) { - return DOC_TYPE_ARRAY; - } - if (!doc) { - return; - } - const { type } = doc; - if (VALID_OBJECT_DOC_TYPES.has(type)) { - return type; - } - } - var get_doc_type_default = getDocType; - - // src/document/invalid-doc-error.js - var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list); - function getDocErrorMessage(doc) { - const type = doc === null ? "null" : typeof doc; - if (type !== "string" && type !== "object") { - return `Unexpected doc '${type}', -Expected it to be 'string' or 'object'.`; - } - if (get_doc_type_default(doc)) { - throw new Error("doc is valid."); - } - const objectType = Object.prototype.toString.call(doc); - if (objectType !== "[object Object]") { - return `Unexpected doc '${objectType}'.`; - } - const EXPECTED_TYPE_VALUES = disjunctionListFormat( - [...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`) - ); - return `Unexpected doc.type '${doc.type}'. -Expected it to be ${EXPECTED_TYPE_VALUES}.`; - } - var InvalidDocError = class extends Error { - name = "InvalidDocError"; - constructor(doc) { - super(getDocErrorMessage(doc)); - this.doc = doc; - } - }; - var invalid_doc_error_default = InvalidDocError; - - // src/document/utils/traverse-doc.js - var traverseDocOnExitStackMarker = {}; - function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) { - const docsStack = [doc]; - while (docsStack.length > 0) { - const doc2 = docsStack.pop(); - if (doc2 === traverseDocOnExitStackMarker) { - onExit(docsStack.pop()); - continue; - } - if (onExit) { - docsStack.push(doc2, traverseDocOnExitStackMarker); - } - const docType = get_doc_type_default(doc2); - if (!docType) { - throw new invalid_doc_error_default(doc2); - } - if ((onEnter == null ? void 0 : onEnter(doc2)) === false) { - continue; - } - switch (docType) { - case DOC_TYPE_ARRAY: - case DOC_TYPE_FILL: { - const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts; - for (let ic = parts.length, i = ic - 1; i >= 0; --i) { - docsStack.push(parts[i]); - } - break; - } - case DOC_TYPE_IF_BREAK: - docsStack.push(doc2.flatContents, doc2.breakContents); - break; - case DOC_TYPE_GROUP: - if (shouldTraverseConditionalGroups && doc2.expandedStates) { - for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) { - docsStack.push(doc2.expandedStates[i]); - } - } else { - docsStack.push(doc2.contents); - } - break; - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - case DOC_TYPE_LINE_SUFFIX: - docsStack.push(doc2.contents); - break; - case DOC_TYPE_STRING: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc2); - } - } - } - var traverse_doc_default = traverseDoc; - - // src/document/utils/assert-doc.js - var noop = () => { - }; - var assertDoc = true ? noop : function(doc) { - traverse_doc_default(doc, (doc2) => { - if (checked.has(doc2)) { - return false; - } - if (typeof doc2 !== "string") { - checked.add(doc2); - } - }); - }; - var assertDocArray = true ? noop : function(docs, optional = false) { - if (optional && !docs) { - return; - } - if (!Array.isArray(docs)) { - throw new TypeError("Unexpected doc array."); - } - for (const doc of docs) { - assertDoc(doc); - } - }; - - // src/document/builders.js - function indent(contents) { - assertDoc(contents); - return { type: DOC_TYPE_INDENT, contents }; - } - function align(widthOrString, contents) { - assertDoc(contents); - return { type: DOC_TYPE_ALIGN, contents, n: widthOrString }; - } - function group(contents, opts = {}) { - assertDoc(contents); - assertDocArray( - opts.expandedStates, - /* optional */ - true - ); - return { - type: DOC_TYPE_GROUP, - id: opts.id, - contents, - break: Boolean(opts.shouldBreak), - expandedStates: opts.expandedStates - }; - } - function dedentToRoot(contents) { - return align(Number.NEGATIVE_INFINITY, contents); - } - function markAsRoot(contents) { - return align({ type: "root" }, contents); - } - function dedent(contents) { - return align(-1, contents); - } - function conditionalGroup(states, opts) { - return group(states[0], { ...opts, expandedStates: states }); - } - function fill(parts) { - assertDocArray(parts); - return { type: DOC_TYPE_FILL, parts }; - } - function ifBreak(breakContents, flatContents = "", opts = {}) { - assertDoc(breakContents); - if (flatContents !== "") { - assertDoc(flatContents); - } - return { - type: DOC_TYPE_IF_BREAK, - breakContents, - flatContents, - groupId: opts.groupId - }; - } - function indentIfBreak(contents, opts) { - assertDoc(contents); - return { - type: DOC_TYPE_INDENT_IF_BREAK, - contents, - groupId: opts.groupId, - negate: opts.negate - }; - } - function lineSuffix(contents) { - assertDoc(contents); - return { type: DOC_TYPE_LINE_SUFFIX, contents }; - } - var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY }; - var breakParent = { type: DOC_TYPE_BREAK_PARENT }; - var trim = { type: DOC_TYPE_TRIM }; - var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true }; - var literallineWithoutBreakParent = { - type: DOC_TYPE_LINE, - hard: true, - literal: true - }; - var line = { type: DOC_TYPE_LINE }; - var softline = { type: DOC_TYPE_LINE, soft: true }; - var hardline = [hardlineWithoutBreakParent, breakParent]; - var literalline = [literallineWithoutBreakParent, breakParent]; - var cursor = { type: DOC_TYPE_CURSOR }; - function join(separator, docs) { - assertDoc(separator); - assertDocArray(docs); - const parts = []; - for (let i = 0; i < docs.length; i++) { - if (i !== 0) { - parts.push(separator); - } - parts.push(docs[i]); - } - return parts; - } - function addAlignmentToDoc(doc, size, tabWidth) { - assertDoc(doc); - let aligned = doc; - if (size > 0) { - for (let i = 0; i < Math.floor(size / tabWidth); ++i) { - aligned = indent(aligned); - } - aligned = align(size % tabWidth, aligned); - aligned = align(Number.NEGATIVE_INFINITY, aligned); - } - return aligned; - } - function label(label2, contents) { - assertDoc(contents); - return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents; - } - - // scripts/build/shims/at.js - var at = (isOptionalObject, object, index) => { - if (isOptionalObject && (object === void 0 || object === null)) { - return; - } - if (Array.isArray(object) || typeof object === "string") { - return object[index < 0 ? object.length + index : index]; - } - return object.at(index); - }; - var at_default = at; - - // scripts/build/shims/string-replace-all.js - var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => { - if (isOptionalObject && (original === void 0 || original === null)) { - return; - } - if (original.replaceAll) { - return original.replaceAll(pattern, replacement); - } - if (pattern.global) { - return original.replace(pattern, replacement); - } - return original.split(pattern).join(replacement); - }; - var string_replace_all_default = stringReplaceAll; - - // src/common/end-of-line.js - function convertEndOfLineToChars(value) { - switch (value) { - case "cr": - return "\r"; - case "crlf": - return "\r\n"; - default: - return "\n"; - } - } - - // node_modules/emoji-regex/index.mjs - var emoji_regex_default = () => { - return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\u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DF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; - }; - - // node_modules/get-east-asian-width/lookup.js - function isFullWidth(x) { - return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510; - } - function isWide(x) { - return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141; - } - - // node_modules/get-east-asian-width/index.js - var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint)); - - // src/utils/get-string-width.js - var notAsciiRegex = /[^\x20-\x7F]/u; - function getStringWidth(text) { - if (!text) { - return 0; - } - if (!notAsciiRegex.test(text)) { - return text.length; - } - text = text.replace(emoji_regex_default(), " "); - let width = 0; - for (const character of text) { - const codePoint = character.codePointAt(0); - if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) { - continue; - } - if (codePoint >= 768 && codePoint <= 879) { - continue; - } - width += _isNarrowWidth(codePoint) ? 1 : 2; - } - return width; - } - var get_string_width_default = getStringWidth; - - // src/document/utils.js - function mapDoc(doc, cb) { - if (typeof doc === "string") { - return cb(doc); - } - const mapped = /* @__PURE__ */ new Map(); - return rec(doc); - function rec(doc2) { - if (mapped.has(doc2)) { - return mapped.get(doc2); - } - const result = process2(doc2); - mapped.set(doc2, result); - return result; - } - function process2(doc2) { - switch (get_doc_type_default(doc2)) { - case DOC_TYPE_ARRAY: - return cb(doc2.map(rec)); - case DOC_TYPE_FILL: - return cb({ ...doc2, parts: doc2.parts.map(rec) }); - case DOC_TYPE_IF_BREAK: - return cb({ - ...doc2, - breakContents: rec(doc2.breakContents), - flatContents: rec(doc2.flatContents) - }); - case DOC_TYPE_GROUP: { - let { expandedStates, contents } = doc2; - if (expandedStates) { - expandedStates = expandedStates.map(rec); - contents = expandedStates[0]; - } else { - contents = rec(contents); - } - return cb({ ...doc2, contents, expandedStates }); - } - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - case DOC_TYPE_LINE_SUFFIX: - return cb({ ...doc2, contents: rec(doc2.contents) }); - case DOC_TYPE_STRING: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_BREAK_PARENT: - return cb(doc2); - default: - throw new invalid_doc_error_default(doc2); - } - } - } - function findInDoc(doc, fn, defaultValue) { - let result = defaultValue; - let shouldSkipFurtherProcessing = false; - function findInDocOnEnterFn(doc2) { - if (shouldSkipFurtherProcessing) { - return false; - } - const maybeResult = fn(doc2); - if (maybeResult !== void 0) { - shouldSkipFurtherProcessing = true; - result = maybeResult; - } - } - traverse_doc_default(doc, findInDocOnEnterFn); - return result; - } - function willBreakFn(doc) { - if (doc.type === DOC_TYPE_GROUP && doc.break) { - return true; - } - if (doc.type === DOC_TYPE_LINE && doc.hard) { - return true; - } - if (doc.type === DOC_TYPE_BREAK_PARENT) { - return true; - } - } - function willBreak(doc) { - return findInDoc(doc, willBreakFn, false); - } - function breakParentGroup(groupStack) { - if (groupStack.length > 0) { - const parentGroup = at_default( - /* isOptionalObject */ - false, - groupStack, - -1 - ); - if (!parentGroup.expandedStates && !parentGroup.break) { - parentGroup.break = "propagated"; - } - } - return null; - } - function propagateBreaks(doc) { - const alreadyVisitedSet = /* @__PURE__ */ new Set(); - const groupStack = []; - function propagateBreaksOnEnterFn(doc2) { - if (doc2.type === DOC_TYPE_BREAK_PARENT) { - breakParentGroup(groupStack); - } - if (doc2.type === DOC_TYPE_GROUP) { - groupStack.push(doc2); - if (alreadyVisitedSet.has(doc2)) { - return false; - } - alreadyVisitedSet.add(doc2); - } - } - function propagateBreaksOnExitFn(doc2) { - if (doc2.type === DOC_TYPE_GROUP) { - const group2 = groupStack.pop(); - if (group2.break) { - breakParentGroup(groupStack); - } - } - } - traverse_doc_default( - doc, - propagateBreaksOnEnterFn, - propagateBreaksOnExitFn, - /* shouldTraverseConditionalGroups */ - true - ); - } - function removeLinesFn(doc) { - if (doc.type === DOC_TYPE_LINE && !doc.hard) { - return doc.soft ? "" : " "; - } - if (doc.type === DOC_TYPE_IF_BREAK) { - return doc.flatContents; - } - return doc; - } - function removeLines(doc) { - return mapDoc(doc, removeLinesFn); - } - function stripTrailingHardlineFromParts(parts) { - parts = [...parts]; - while (parts.length >= 2 && at_default( - /* isOptionalObject */ - false, - parts, - -2 - ).type === DOC_TYPE_LINE && at_default( - /* isOptionalObject */ - false, - parts, - -1 - ).type === DOC_TYPE_BREAK_PARENT) { - parts.length -= 2; - } - if (parts.length > 0) { - const lastPart = stripTrailingHardlineFromDoc(at_default( - /* isOptionalObject */ - false, - parts, - -1 - )); - parts[parts.length - 1] = lastPart; - } - return parts; - } - function stripTrailingHardlineFromDoc(doc) { - switch (get_doc_type_default(doc)) { - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_GROUP: - case DOC_TYPE_LINE_SUFFIX: - case DOC_TYPE_LABEL: { - const contents = stripTrailingHardlineFromDoc(doc.contents); - return { ...doc, contents }; - } - case DOC_TYPE_IF_BREAK: - return { - ...doc, - breakContents: stripTrailingHardlineFromDoc(doc.breakContents), - flatContents: stripTrailingHardlineFromDoc(doc.flatContents) - }; - case DOC_TYPE_FILL: - return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) }; - case DOC_TYPE_ARRAY: - return stripTrailingHardlineFromParts(doc); - case DOC_TYPE_STRING: - return doc.replace(/[\n\r]*$/u, ""); - case DOC_TYPE_ALIGN: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc); - } - return doc; - } - function stripTrailingHardline(doc) { - return stripTrailingHardlineFromDoc(cleanDoc(doc)); - } - function cleanDocFn(doc) { - switch (get_doc_type_default(doc)) { - case DOC_TYPE_FILL: - if (doc.parts.every((part) => part === "")) { - return ""; - } - break; - case DOC_TYPE_GROUP: - if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) { - return ""; - } - if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) { - return doc.contents; - } - break; - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LINE_SUFFIX: - if (!doc.contents) { - return ""; - } - break; - case DOC_TYPE_IF_BREAK: - if (!doc.flatContents && !doc.breakContents) { - return ""; - } - break; - case DOC_TYPE_ARRAY: { - const parts = []; - for (const part of doc) { - if (!part) { - continue; - } - const [currentPart, ...restParts] = Array.isArray(part) ? part : [part]; - if (typeof currentPart === "string" && typeof at_default( - /* isOptionalObject */ - false, - parts, - -1 - ) === "string") { - parts[parts.length - 1] += currentPart; - } else { - parts.push(currentPart); - } - parts.push(...restParts); - } - if (parts.length === 0) { - return ""; - } - if (parts.length === 1) { - return parts[0]; - } - return parts; - } - case DOC_TYPE_STRING: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_LABEL: - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc); - } - return doc; - } - function cleanDoc(doc) { - return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc)); - } - function replaceEndOfLine(doc, replacement = literalline) { - return mapDoc( - doc, - (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc - ); - } - function canBreakFn(doc) { - if (doc.type === DOC_TYPE_LINE) { - return true; - } - } - function canBreak(doc) { - return findInDoc(doc, canBreakFn, false); - } - - // src/document/printer.js - var MODE_BREAK = Symbol("MODE_BREAK"); - var MODE_FLAT = Symbol("MODE_FLAT"); - var CURSOR_PLACEHOLDER = Symbol("cursor"); - var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH"); - function rootIndent() { - return { value: "", length: 0, queue: [] }; - } - function makeIndent(ind, options) { - return generateInd(ind, { type: "indent" }, options); - } - function makeAlign(indent2, widthOrDoc, options) { - if (widthOrDoc === Number.NEGATIVE_INFINITY) { - return indent2.root || rootIndent(); - } - if (widthOrDoc < 0) { - return generateInd(indent2, { type: "dedent" }, options); - } - if (!widthOrDoc) { - return indent2; - } - if (widthOrDoc.type === "root") { - return { ...indent2, root: indent2 }; - } - const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign"; - return generateInd(indent2, { type: alignType, n: widthOrDoc }, options); - } - function generateInd(ind, newPart, options) { - const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart]; - let value = ""; - let length = 0; - let lastTabs = 0; - let lastSpaces = 0; - for (const part of queue) { - switch (part.type) { - case "indent": - flush(); - if (options.useTabs) { - addTabs(1); - } else { - addSpaces(options.tabWidth); - } - break; - case "stringAlign": - flush(); - value += part.n; - length += part.n.length; - break; - case "numberAlign": - lastTabs += 1; - lastSpaces += part.n; - break; - default: - throw new Error(`Unexpected type '${part.type}'`); - } - } - flushSpaces(); - return { ...ind, value, length, queue }; - function addTabs(count) { - value += " ".repeat(count); - length += options.tabWidth * count; - } - function addSpaces(count) { - value += " ".repeat(count); - length += count; - } - function flush() { - if (options.useTabs) { - flushTabs(); - } else { - flushSpaces(); - } - } - function flushTabs() { - if (lastTabs > 0) { - addTabs(lastTabs); - } - resetLast(); - } - function flushSpaces() { - if (lastSpaces > 0) { - addSpaces(lastSpaces); - } - resetLast(); - } - function resetLast() { - lastTabs = 0; - lastSpaces = 0; - } - } - function trim2(out) { - let trimCount = 0; - let cursorCount = 0; - let outIndex = out.length; - outer: while (outIndex--) { - const last = out[outIndex]; - if (last === CURSOR_PLACEHOLDER) { - cursorCount++; - continue; - } - if (false) { - throw new Error(`Unexpected value in trim: '${typeof last}'`); - } - for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) { - const char = last[charIndex]; - if (char === " " || char === " ") { - trimCount++; - } else { - out[outIndex] = last.slice(0, charIndex + 1); - break outer; - } - } - } - if (trimCount > 0 || cursorCount > 0) { - out.length = outIndex + 1; - while (cursorCount-- > 0) { - out.push(CURSOR_PLACEHOLDER); - } - } - return trimCount; - } - function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) { - if (width === Number.POSITIVE_INFINITY) { - return true; - } - let restIdx = restCommands.length; - const cmds = [next]; - const out = []; - while (width >= 0) { - if (cmds.length === 0) { - if (restIdx === 0) { - return true; - } - cmds.push(restCommands[--restIdx]); - continue; - } - const { mode, doc } = cmds.pop(); - const docType = get_doc_type_default(doc); - switch (docType) { - case DOC_TYPE_STRING: - out.push(doc); - width -= get_string_width_default(doc); - break; - case DOC_TYPE_ARRAY: - case DOC_TYPE_FILL: { - const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts; - for (let i = parts.length - 1; i >= 0; i--) { - cmds.push({ mode, doc: parts[i] }); - } - break; - } - case DOC_TYPE_INDENT: - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - cmds.push({ mode, doc: doc.contents }); - break; - case DOC_TYPE_TRIM: - width += trim2(out); - break; - case DOC_TYPE_GROUP: { - if (mustBeFlat && doc.break) { - return false; - } - const groupMode = doc.break ? MODE_BREAK : mode; - const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default( - /* isOptionalObject */ - false, - doc.expandedStates, - -1 - ) : doc.contents; - cmds.push({ mode: groupMode, doc: contents }); - break; - } - case DOC_TYPE_IF_BREAK: { - const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode; - const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents; - if (contents) { - cmds.push({ mode, doc: contents }); - } - break; - } - case DOC_TYPE_LINE: - if (mode === MODE_BREAK || doc.hard) { - return true; - } - if (!doc.soft) { - out.push(" "); - width--; - } - break; - case DOC_TYPE_LINE_SUFFIX: - hasLineSuffix = true; - break; - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - if (hasLineSuffix) { - return false; - } - break; - } - } - return false; - } - function printDocToString(doc, options) { - const groupModeMap = {}; - const width = options.printWidth; - const newLine = convertEndOfLineToChars(options.endOfLine); - let pos = 0; - const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }]; - const out = []; - let shouldRemeasure = false; - const lineSuffix2 = []; - let printedCursorCount = 0; - propagateBreaks(doc); - while (cmds.length > 0) { - const { ind, mode, doc: doc2 } = cmds.pop(); - switch (get_doc_type_default(doc2)) { - case DOC_TYPE_STRING: { - const formatted = newLine !== "\n" ? string_replace_all_default( - /* isOptionalObject */ - false, - doc2, - "\n", - newLine - ) : doc2; - out.push(formatted); - if (cmds.length > 0) { - pos += get_string_width_default(formatted); - } - break; - } - case DOC_TYPE_ARRAY: - for (let i = doc2.length - 1; i >= 0; i--) { - cmds.push({ ind, mode, doc: doc2[i] }); - } - break; - case DOC_TYPE_CURSOR: - if (printedCursorCount >= 2) { - throw new Error("There are too many 'cursor' in doc."); - } - out.push(CURSOR_PLACEHOLDER); - printedCursorCount++; - break; - case DOC_TYPE_INDENT: - cmds.push({ ind: makeIndent(ind, options), mode, doc: doc2.contents }); - break; - case DOC_TYPE_ALIGN: - cmds.push({ - ind: makeAlign(ind, doc2.n, options), - mode, - doc: doc2.contents - }); - break; - case DOC_TYPE_TRIM: - pos -= trim2(out); - break; - case DOC_TYPE_GROUP: - switch (mode) { - case MODE_FLAT: - if (!shouldRemeasure) { - cmds.push({ - ind, - mode: doc2.break ? MODE_BREAK : MODE_FLAT, - doc: doc2.contents - }); - break; - } - // fallthrough - case MODE_BREAK: { - shouldRemeasure = false; - const next = { ind, mode: MODE_FLAT, doc: doc2.contents }; - const rem = width - pos; - const hasLineSuffix = lineSuffix2.length > 0; - if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) { - cmds.push(next); - } else { - if (doc2.expandedStates) { - const mostExpanded = at_default( - /* isOptionalObject */ - false, - doc2.expandedStates, - -1 - ); - if (doc2.break) { - cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded }); - break; - } else { - for (let i = 1; i < doc2.expandedStates.length + 1; i++) { - if (i >= doc2.expandedStates.length) { - cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded }); - break; - } else { - const state = doc2.expandedStates[i]; - const cmd = { ind, mode: MODE_FLAT, doc: state }; - if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) { - cmds.push(cmd); - break; - } - } - } - } - } else { - cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents }); - } - } - break; - } - } - if (doc2.id) { - groupModeMap[doc2.id] = at_default( - /* isOptionalObject */ - false, - cmds, - -1 - ).mode; - } - break; - // Fills each line with as much code as possible before moving to a new - // line with the same indentation. - // - // Expects doc.parts to be an array of alternating content and - // whitespace. The whitespace contains the linebreaks. - // - // For example: - // ["I", line, "love", line, "monkeys"] - // or - // [{ type: group, ... }, softline, { type: group, ... }] - // - // It uses this parts structure to handle three main layout cases: - // * The first two content items fit on the same line without - // breaking - // -> output the first content item and the whitespace "flat". - // * Only the first content item fits on the line without breaking - // -> output the first content item "flat" and the whitespace with - // "break". - // * Neither content item fits on the line without breaking - // -> output the first content item and the whitespace with "break". - case DOC_TYPE_FILL: { - const rem = width - pos; - const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0; - const { parts } = doc2; - const length = parts.length - offset; - if (length === 0) { - break; - } - const content = parts[offset + 0]; - const whitespace = parts[offset + 1]; - const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content }; - const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content }; - const contentFits = fits( - contentFlatCmd, - [], - rem, - lineSuffix2.length > 0, - groupModeMap, - true - ); - if (length === 1) { - if (contentFits) { - cmds.push(contentFlatCmd); - } else { - cmds.push(contentBreakCmd); - } - break; - } - const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace }; - const whitespaceBreakCmd = { ind, mode: MODE_BREAK, doc: whitespace }; - if (length === 2) { - if (contentFits) { - cmds.push(whitespaceFlatCmd, contentFlatCmd); - } else { - cmds.push(whitespaceBreakCmd, contentBreakCmd); - } - break; - } - const secondContent = parts[offset + 2]; - const remainingCmd = { - ind, - mode, - doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 } - }; - const firstAndSecondContentFlatCmd = { - ind, - mode: MODE_FLAT, - doc: [content, whitespace, secondContent] - }; - const firstAndSecondContentFits = fits( - firstAndSecondContentFlatCmd, - [], - rem, - lineSuffix2.length > 0, - groupModeMap, - true - ); - if (firstAndSecondContentFits) { - cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd); - } else if (contentFits) { - cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd); - } else { - cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd); - } - break; - } - case DOC_TYPE_IF_BREAK: - case DOC_TYPE_INDENT_IF_BREAK: { - const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode; - if (groupMode === MODE_BREAK) { - const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents); - if (breakContents) { - cmds.push({ ind, mode, doc: breakContents }); - } - } - if (groupMode === MODE_FLAT) { - const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents; - if (flatContents) { - cmds.push({ ind, mode, doc: flatContents }); - } - } - break; - } - case DOC_TYPE_LINE_SUFFIX: - lineSuffix2.push({ ind, mode, doc: doc2.contents }); - break; - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - if (lineSuffix2.length > 0) { - cmds.push({ ind, mode, doc: hardlineWithoutBreakParent }); - } - break; - case DOC_TYPE_LINE: - switch (mode) { - case MODE_FLAT: - if (!doc2.hard) { - if (!doc2.soft) { - out.push(" "); - pos += 1; - } - break; - } else { - shouldRemeasure = true; - } - // fallthrough - case MODE_BREAK: - if (lineSuffix2.length > 0) { - cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse()); - lineSuffix2.length = 0; - break; - } - if (doc2.literal) { - if (ind.root) { - out.push(newLine, ind.root.value); - pos = ind.root.length; - } else { - out.push(newLine); - pos = 0; - } - } else { - pos -= trim2(out); - out.push(newLine + ind.value); - pos = ind.length; - } - break; - } - break; - case DOC_TYPE_LABEL: - cmds.push({ ind, mode, doc: doc2.contents }); - break; - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc2); - } - if (cmds.length === 0 && lineSuffix2.length > 0) { - cmds.push(...lineSuffix2.reverse()); - lineSuffix2.length = 0; - } - } - const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER); - if (cursorPlaceholderIndex !== -1) { - const otherCursorPlaceholderIndex = out.indexOf( - CURSOR_PLACEHOLDER, - cursorPlaceholderIndex + 1 - ); - if (otherCursorPlaceholderIndex === -1) { - return { - formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("") - }; - } - const beforeCursor = out.slice(0, cursorPlaceholderIndex).join(""); - const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join(""); - const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join(""); - return { - formatted: beforeCursor + aroundCursor + afterCursor, - cursorNodeStart: beforeCursor.length, - cursorNodeText: aroundCursor - }; - } - return { formatted: out.join("") }; - } - - // src/document/public.js - var builders = { - join, - line, - softline, - hardline, - literalline, - group, - conditionalGroup, - fill, - lineSuffix, - lineSuffixBoundary, - cursor, - breakParent, - ifBreak, - trim, - indent, - indentIfBreak, - align, - addAlignmentToDoc, - markAsRoot, - dedentToRoot, - dedent, - hardlineWithoutBreakParent, - literallineWithoutBreakParent, - label, - // TODO: Remove this in v4 - concat: (parts) => parts - }; - var printer = { printDocToString }; - var utils = { - willBreak, - traverseDoc: traverse_doc_default, - findInDoc, - mapDoc, - removeLines, - stripTrailingHardline, - replaceEndOfLine, - canBreak - }; - return __toCommonJS(public_exports); -}); \ No newline at end of file diff --git a/node_modules/prettier/doc.mjs b/node_modules/prettier/doc.mjs deleted file mode 100644 index f977728..0000000 --- a/node_modules/prettier/doc.mjs +++ /dev/null @@ -1,1208 +0,0 @@ -var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; - -// src/document/public.js -var public_exports = {}; -__export(public_exports, { - builders: () => builders, - printer: () => printer, - utils: () => utils -}); - -// src/document/constants.js -var DOC_TYPE_STRING = "string"; -var DOC_TYPE_ARRAY = "array"; -var DOC_TYPE_CURSOR = "cursor"; -var DOC_TYPE_INDENT = "indent"; -var DOC_TYPE_ALIGN = "align"; -var DOC_TYPE_TRIM = "trim"; -var DOC_TYPE_GROUP = "group"; -var DOC_TYPE_FILL = "fill"; -var DOC_TYPE_IF_BREAK = "if-break"; -var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break"; -var DOC_TYPE_LINE_SUFFIX = "line-suffix"; -var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary"; -var DOC_TYPE_LINE = "line"; -var DOC_TYPE_LABEL = "label"; -var DOC_TYPE_BREAK_PARENT = "break-parent"; -var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([ - DOC_TYPE_CURSOR, - DOC_TYPE_INDENT, - DOC_TYPE_ALIGN, - DOC_TYPE_TRIM, - DOC_TYPE_GROUP, - DOC_TYPE_FILL, - DOC_TYPE_IF_BREAK, - DOC_TYPE_INDENT_IF_BREAK, - DOC_TYPE_LINE_SUFFIX, - DOC_TYPE_LINE_SUFFIX_BOUNDARY, - DOC_TYPE_LINE, - DOC_TYPE_LABEL, - DOC_TYPE_BREAK_PARENT -]); - -// src/document/utils/get-doc-type.js -function getDocType(doc) { - if (typeof doc === "string") { - return DOC_TYPE_STRING; - } - if (Array.isArray(doc)) { - return DOC_TYPE_ARRAY; - } - if (!doc) { - return; - } - const { type } = doc; - if (VALID_OBJECT_DOC_TYPES.has(type)) { - return type; - } -} -var get_doc_type_default = getDocType; - -// src/document/invalid-doc-error.js -var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list); -function getDocErrorMessage(doc) { - const type = doc === null ? "null" : typeof doc; - if (type !== "string" && type !== "object") { - return `Unexpected doc '${type}', -Expected it to be 'string' or 'object'.`; - } - if (get_doc_type_default(doc)) { - throw new Error("doc is valid."); - } - const objectType = Object.prototype.toString.call(doc); - if (objectType !== "[object Object]") { - return `Unexpected doc '${objectType}'.`; - } - const EXPECTED_TYPE_VALUES = disjunctionListFormat( - [...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`) - ); - return `Unexpected doc.type '${doc.type}'. -Expected it to be ${EXPECTED_TYPE_VALUES}.`; -} -var InvalidDocError = class extends Error { - name = "InvalidDocError"; - constructor(doc) { - super(getDocErrorMessage(doc)); - this.doc = doc; - } -}; -var invalid_doc_error_default = InvalidDocError; - -// src/document/utils/traverse-doc.js -var traverseDocOnExitStackMarker = {}; -function traverseDoc(doc, onEnter, onExit, shouldTraverseConditionalGroups) { - const docsStack = [doc]; - while (docsStack.length > 0) { - const doc2 = docsStack.pop(); - if (doc2 === traverseDocOnExitStackMarker) { - onExit(docsStack.pop()); - continue; - } - if (onExit) { - docsStack.push(doc2, traverseDocOnExitStackMarker); - } - const docType = get_doc_type_default(doc2); - if (!docType) { - throw new invalid_doc_error_default(doc2); - } - if ((onEnter == null ? void 0 : onEnter(doc2)) === false) { - continue; - } - switch (docType) { - case DOC_TYPE_ARRAY: - case DOC_TYPE_FILL: { - const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts; - for (let ic = parts.length, i = ic - 1; i >= 0; --i) { - docsStack.push(parts[i]); - } - break; - } - case DOC_TYPE_IF_BREAK: - docsStack.push(doc2.flatContents, doc2.breakContents); - break; - case DOC_TYPE_GROUP: - if (shouldTraverseConditionalGroups && doc2.expandedStates) { - for (let ic = doc2.expandedStates.length, i = ic - 1; i >= 0; --i) { - docsStack.push(doc2.expandedStates[i]); - } - } else { - docsStack.push(doc2.contents); - } - break; - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - case DOC_TYPE_LINE_SUFFIX: - docsStack.push(doc2.contents); - break; - case DOC_TYPE_STRING: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc2); - } - } -} -var traverse_doc_default = traverseDoc; - -// src/document/utils/assert-doc.js -var noop = () => { -}; -var assertDoc = true ? noop : function(doc) { - traverse_doc_default(doc, (doc2) => { - if (checked.has(doc2)) { - return false; - } - if (typeof doc2 !== "string") { - checked.add(doc2); - } - }); -}; -var assertDocArray = true ? noop : function(docs, optional = false) { - if (optional && !docs) { - return; - } - if (!Array.isArray(docs)) { - throw new TypeError("Unexpected doc array."); - } - for (const doc of docs) { - assertDoc(doc); - } -}; - -// src/document/builders.js -function indent(contents) { - assertDoc(contents); - return { type: DOC_TYPE_INDENT, contents }; -} -function align(widthOrString, contents) { - assertDoc(contents); - return { type: DOC_TYPE_ALIGN, contents, n: widthOrString }; -} -function group(contents, opts = {}) { - assertDoc(contents); - assertDocArray( - opts.expandedStates, - /* optional */ - true - ); - return { - type: DOC_TYPE_GROUP, - id: opts.id, - contents, - break: Boolean(opts.shouldBreak), - expandedStates: opts.expandedStates - }; -} -function dedentToRoot(contents) { - return align(Number.NEGATIVE_INFINITY, contents); -} -function markAsRoot(contents) { - return align({ type: "root" }, contents); -} -function dedent(contents) { - return align(-1, contents); -} -function conditionalGroup(states, opts) { - return group(states[0], { ...opts, expandedStates: states }); -} -function fill(parts) { - assertDocArray(parts); - return { type: DOC_TYPE_FILL, parts }; -} -function ifBreak(breakContents, flatContents = "", opts = {}) { - assertDoc(breakContents); - if (flatContents !== "") { - assertDoc(flatContents); - } - return { - type: DOC_TYPE_IF_BREAK, - breakContents, - flatContents, - groupId: opts.groupId - }; -} -function indentIfBreak(contents, opts) { - assertDoc(contents); - return { - type: DOC_TYPE_INDENT_IF_BREAK, - contents, - groupId: opts.groupId, - negate: opts.negate - }; -} -function lineSuffix(contents) { - assertDoc(contents); - return { type: DOC_TYPE_LINE_SUFFIX, contents }; -} -var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY }; -var breakParent = { type: DOC_TYPE_BREAK_PARENT }; -var trim = { type: DOC_TYPE_TRIM }; -var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true }; -var literallineWithoutBreakParent = { - type: DOC_TYPE_LINE, - hard: true, - literal: true -}; -var line = { type: DOC_TYPE_LINE }; -var softline = { type: DOC_TYPE_LINE, soft: true }; -var hardline = [hardlineWithoutBreakParent, breakParent]; -var literalline = [literallineWithoutBreakParent, breakParent]; -var cursor = { type: DOC_TYPE_CURSOR }; -function join(separator, docs) { - assertDoc(separator); - assertDocArray(docs); - const parts = []; - for (let i = 0; i < docs.length; i++) { - if (i !== 0) { - parts.push(separator); - } - parts.push(docs[i]); - } - return parts; -} -function addAlignmentToDoc(doc, size, tabWidth) { - assertDoc(doc); - let aligned = doc; - if (size > 0) { - for (let i = 0; i < Math.floor(size / tabWidth); ++i) { - aligned = indent(aligned); - } - aligned = align(size % tabWidth, aligned); - aligned = align(Number.NEGATIVE_INFINITY, aligned); - } - return aligned; -} -function label(label2, contents) { - assertDoc(contents); - return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents; -} - -// scripts/build/shims/at.js -var at = (isOptionalObject, object, index) => { - if (isOptionalObject && (object === void 0 || object === null)) { - return; - } - if (Array.isArray(object) || typeof object === "string") { - return object[index < 0 ? object.length + index : index]; - } - return object.at(index); -}; -var at_default = at; - -// scripts/build/shims/string-replace-all.js -var stringReplaceAll = (isOptionalObject, original, pattern, replacement) => { - if (isOptionalObject && (original === void 0 || original === null)) { - return; - } - if (original.replaceAll) { - return original.replaceAll(pattern, replacement); - } - if (pattern.global) { - return original.replace(pattern, replacement); - } - return original.split(pattern).join(replacement); -}; -var string_replace_all_default = stringReplaceAll; - -// src/common/end-of-line.js -function convertEndOfLineToChars(value) { - switch (value) { - case "cr": - return "\r"; - case "crlf": - return "\r\n"; - default: - return "\n"; - } -} - -// node_modules/emoji-regex/index.mjs -var emoji_regex_default = () => { - return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?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C3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; -}; - -// node_modules/get-east-asian-width/lookup.js -function isFullWidth(x) { - return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510; -} -function isWide(x) { - return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141; -} - -// node_modules/get-east-asian-width/index.js -var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint)); - -// src/utils/get-string-width.js -var notAsciiRegex = /[^\x20-\x7F]/u; -function getStringWidth(text) { - if (!text) { - return 0; - } - if (!notAsciiRegex.test(text)) { - return text.length; - } - text = text.replace(emoji_regex_default(), " "); - let width = 0; - for (const character of text) { - const codePoint = character.codePointAt(0); - if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) { - continue; - } - if (codePoint >= 768 && codePoint <= 879) { - continue; - } - width += _isNarrowWidth(codePoint) ? 1 : 2; - } - return width; -} -var get_string_width_default = getStringWidth; - -// src/document/utils.js -function mapDoc(doc, cb) { - if (typeof doc === "string") { - return cb(doc); - } - const mapped = /* @__PURE__ */ new Map(); - return rec(doc); - function rec(doc2) { - if (mapped.has(doc2)) { - return mapped.get(doc2); - } - const result = process2(doc2); - mapped.set(doc2, result); - return result; - } - function process2(doc2) { - switch (get_doc_type_default(doc2)) { - case DOC_TYPE_ARRAY: - return cb(doc2.map(rec)); - case DOC_TYPE_FILL: - return cb({ ...doc2, parts: doc2.parts.map(rec) }); - case DOC_TYPE_IF_BREAK: - return cb({ - ...doc2, - breakContents: rec(doc2.breakContents), - flatContents: rec(doc2.flatContents) - }); - case DOC_TYPE_GROUP: { - let { expandedStates, contents } = doc2; - if (expandedStates) { - expandedStates = expandedStates.map(rec); - contents = expandedStates[0]; - } else { - contents = rec(contents); - } - return cb({ ...doc2, contents, expandedStates }); - } - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - case DOC_TYPE_LINE_SUFFIX: - return cb({ ...doc2, contents: rec(doc2.contents) }); - case DOC_TYPE_STRING: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_BREAK_PARENT: - return cb(doc2); - default: - throw new invalid_doc_error_default(doc2); - } - } -} -function findInDoc(doc, fn, defaultValue) { - let result = defaultValue; - let shouldSkipFurtherProcessing = false; - function findInDocOnEnterFn(doc2) { - if (shouldSkipFurtherProcessing) { - return false; - } - const maybeResult = fn(doc2); - if (maybeResult !== void 0) { - shouldSkipFurtherProcessing = true; - result = maybeResult; - } - } - traverse_doc_default(doc, findInDocOnEnterFn); - return result; -} -function willBreakFn(doc) { - if (doc.type === DOC_TYPE_GROUP && doc.break) { - return true; - } - if (doc.type === DOC_TYPE_LINE && doc.hard) { - return true; - } - if (doc.type === DOC_TYPE_BREAK_PARENT) { - return true; - } -} -function willBreak(doc) { - return findInDoc(doc, willBreakFn, false); -} -function breakParentGroup(groupStack) { - if (groupStack.length > 0) { - const parentGroup = at_default( - /* isOptionalObject */ - false, - groupStack, - -1 - ); - if (!parentGroup.expandedStates && !parentGroup.break) { - parentGroup.break = "propagated"; - } - } - return null; -} -function propagateBreaks(doc) { - const alreadyVisitedSet = /* @__PURE__ */ new Set(); - const groupStack = []; - function propagateBreaksOnEnterFn(doc2) { - if (doc2.type === DOC_TYPE_BREAK_PARENT) { - breakParentGroup(groupStack); - } - if (doc2.type === DOC_TYPE_GROUP) { - groupStack.push(doc2); - if (alreadyVisitedSet.has(doc2)) { - return false; - } - alreadyVisitedSet.add(doc2); - } - } - function propagateBreaksOnExitFn(doc2) { - if (doc2.type === DOC_TYPE_GROUP) { - const group2 = groupStack.pop(); - if (group2.break) { - breakParentGroup(groupStack); - } - } - } - traverse_doc_default( - doc, - propagateBreaksOnEnterFn, - propagateBreaksOnExitFn, - /* shouldTraverseConditionalGroups */ - true - ); -} -function removeLinesFn(doc) { - if (doc.type === DOC_TYPE_LINE && !doc.hard) { - return doc.soft ? "" : " "; - } - if (doc.type === DOC_TYPE_IF_BREAK) { - return doc.flatContents; - } - return doc; -} -function removeLines(doc) { - return mapDoc(doc, removeLinesFn); -} -function stripTrailingHardlineFromParts(parts) { - parts = [...parts]; - while (parts.length >= 2 && at_default( - /* isOptionalObject */ - false, - parts, - -2 - ).type === DOC_TYPE_LINE && at_default( - /* isOptionalObject */ - false, - parts, - -1 - ).type === DOC_TYPE_BREAK_PARENT) { - parts.length -= 2; - } - if (parts.length > 0) { - const lastPart = stripTrailingHardlineFromDoc(at_default( - /* isOptionalObject */ - false, - parts, - -1 - )); - parts[parts.length - 1] = lastPart; - } - return parts; -} -function stripTrailingHardlineFromDoc(doc) { - switch (get_doc_type_default(doc)) { - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_GROUP: - case DOC_TYPE_LINE_SUFFIX: - case DOC_TYPE_LABEL: { - const contents = stripTrailingHardlineFromDoc(doc.contents); - return { ...doc, contents }; - } - case DOC_TYPE_IF_BREAK: - return { - ...doc, - breakContents: stripTrailingHardlineFromDoc(doc.breakContents), - flatContents: stripTrailingHardlineFromDoc(doc.flatContents) - }; - case DOC_TYPE_FILL: - return { ...doc, parts: stripTrailingHardlineFromParts(doc.parts) }; - case DOC_TYPE_ARRAY: - return stripTrailingHardlineFromParts(doc); - case DOC_TYPE_STRING: - return doc.replace(/[\n\r]*$/u, ""); - case DOC_TYPE_ALIGN: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc); - } - return doc; -} -function stripTrailingHardline(doc) { - return stripTrailingHardlineFromDoc(cleanDoc(doc)); -} -function cleanDocFn(doc) { - switch (get_doc_type_default(doc)) { - case DOC_TYPE_FILL: - if (doc.parts.every((part) => part === "")) { - return ""; - } - break; - case DOC_TYPE_GROUP: - if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) { - return ""; - } - if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) { - return doc.contents; - } - break; - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LINE_SUFFIX: - if (!doc.contents) { - return ""; - } - break; - case DOC_TYPE_IF_BREAK: - if (!doc.flatContents && !doc.breakContents) { - return ""; - } - break; - case DOC_TYPE_ARRAY: { - const parts = []; - for (const part of doc) { - if (!part) { - continue; - } - const [currentPart, ...restParts] = Array.isArray(part) ? part : [part]; - if (typeof currentPart === "string" && typeof at_default( - /* isOptionalObject */ - false, - parts, - -1 - ) === "string") { - parts[parts.length - 1] += currentPart; - } else { - parts.push(currentPart); - } - parts.push(...restParts); - } - if (parts.length === 0) { - return ""; - } - if (parts.length === 1) { - return parts[0]; - } - return parts; - } - case DOC_TYPE_STRING: - case DOC_TYPE_CURSOR: - case DOC_TYPE_TRIM: - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - case DOC_TYPE_LINE: - case DOC_TYPE_LABEL: - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc); - } - return doc; -} -function cleanDoc(doc) { - return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc)); -} -function replaceEndOfLine(doc, replacement = literalline) { - return mapDoc( - doc, - (currentDoc) => typeof currentDoc === "string" ? join(replacement, currentDoc.split("\n")) : currentDoc - ); -} -function canBreakFn(doc) { - if (doc.type === DOC_TYPE_LINE) { - return true; - } -} -function canBreak(doc) { - return findInDoc(doc, canBreakFn, false); -} - -// src/document/printer.js -var MODE_BREAK = Symbol("MODE_BREAK"); -var MODE_FLAT = Symbol("MODE_FLAT"); -var CURSOR_PLACEHOLDER = Symbol("cursor"); -var DOC_FILL_PRINTED_LENGTH = Symbol("DOC_FILL_PRINTED_LENGTH"); -function rootIndent() { - return { value: "", length: 0, queue: [] }; -} -function makeIndent(ind, options) { - return generateInd(ind, { type: "indent" }, options); -} -function makeAlign(indent2, widthOrDoc, options) { - if (widthOrDoc === Number.NEGATIVE_INFINITY) { - return indent2.root || rootIndent(); - } - if (widthOrDoc < 0) { - return generateInd(indent2, { type: "dedent" }, options); - } - if (!widthOrDoc) { - return indent2; - } - if (widthOrDoc.type === "root") { - return { ...indent2, root: indent2 }; - } - const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign"; - return generateInd(indent2, { type: alignType, n: widthOrDoc }, options); -} -function generateInd(ind, newPart, options) { - const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart]; - let value = ""; - let length = 0; - let lastTabs = 0; - let lastSpaces = 0; - for (const part of queue) { - switch (part.type) { - case "indent": - flush(); - if (options.useTabs) { - addTabs(1); - } else { - addSpaces(options.tabWidth); - } - break; - case "stringAlign": - flush(); - value += part.n; - length += part.n.length; - break; - case "numberAlign": - lastTabs += 1; - lastSpaces += part.n; - break; - default: - throw new Error(`Unexpected type '${part.type}'`); - } - } - flushSpaces(); - return { ...ind, value, length, queue }; - function addTabs(count) { - value += " ".repeat(count); - length += options.tabWidth * count; - } - function addSpaces(count) { - value += " ".repeat(count); - length += count; - } - function flush() { - if (options.useTabs) { - flushTabs(); - } else { - flushSpaces(); - } - } - function flushTabs() { - if (lastTabs > 0) { - addTabs(lastTabs); - } - resetLast(); - } - function flushSpaces() { - if (lastSpaces > 0) { - addSpaces(lastSpaces); - } - resetLast(); - } - function resetLast() { - lastTabs = 0; - lastSpaces = 0; - } -} -function trim2(out) { - let trimCount = 0; - let cursorCount = 0; - let outIndex = out.length; - outer: while (outIndex--) { - const last = out[outIndex]; - if (last === CURSOR_PLACEHOLDER) { - cursorCount++; - continue; - } - if (false) { - throw new Error(`Unexpected value in trim: '${typeof last}'`); - } - for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) { - const char = last[charIndex]; - if (char === " " || char === " ") { - trimCount++; - } else { - out[outIndex] = last.slice(0, charIndex + 1); - break outer; - } - } - } - if (trimCount > 0 || cursorCount > 0) { - out.length = outIndex + 1; - while (cursorCount-- > 0) { - out.push(CURSOR_PLACEHOLDER); - } - } - return trimCount; -} -function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) { - if (width === Number.POSITIVE_INFINITY) { - return true; - } - let restIdx = restCommands.length; - const cmds = [next]; - const out = []; - while (width >= 0) { - if (cmds.length === 0) { - if (restIdx === 0) { - return true; - } - cmds.push(restCommands[--restIdx]); - continue; - } - const { mode, doc } = cmds.pop(); - const docType = get_doc_type_default(doc); - switch (docType) { - case DOC_TYPE_STRING: - out.push(doc); - width -= get_string_width_default(doc); - break; - case DOC_TYPE_ARRAY: - case DOC_TYPE_FILL: { - const parts = docType === DOC_TYPE_ARRAY ? doc : doc.parts; - for (let i = parts.length - 1; i >= 0; i--) { - cmds.push({ mode, doc: parts[i] }); - } - break; - } - case DOC_TYPE_INDENT: - case DOC_TYPE_ALIGN: - case DOC_TYPE_INDENT_IF_BREAK: - case DOC_TYPE_LABEL: - cmds.push({ mode, doc: doc.contents }); - break; - case DOC_TYPE_TRIM: - width += trim2(out); - break; - case DOC_TYPE_GROUP: { - if (mustBeFlat && doc.break) { - return false; - } - const groupMode = doc.break ? MODE_BREAK : mode; - const contents = doc.expandedStates && groupMode === MODE_BREAK ? at_default( - /* isOptionalObject */ - false, - doc.expandedStates, - -1 - ) : doc.contents; - cmds.push({ mode: groupMode, doc: contents }); - break; - } - case DOC_TYPE_IF_BREAK: { - const groupMode = doc.groupId ? groupModeMap[doc.groupId] || MODE_FLAT : mode; - const contents = groupMode === MODE_BREAK ? doc.breakContents : doc.flatContents; - if (contents) { - cmds.push({ mode, doc: contents }); - } - break; - } - case DOC_TYPE_LINE: - if (mode === MODE_BREAK || doc.hard) { - return true; - } - if (!doc.soft) { - out.push(" "); - width--; - } - break; - case DOC_TYPE_LINE_SUFFIX: - hasLineSuffix = true; - break; - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - if (hasLineSuffix) { - return false; - } - break; - } - } - return false; -} -function printDocToString(doc, options) { - const groupModeMap = {}; - const width = options.printWidth; - const newLine = convertEndOfLineToChars(options.endOfLine); - let pos = 0; - const cmds = [{ ind: rootIndent(), mode: MODE_BREAK, doc }]; - const out = []; - let shouldRemeasure = false; - const lineSuffix2 = []; - let printedCursorCount = 0; - propagateBreaks(doc); - while (cmds.length > 0) { - const { ind, mode, doc: doc2 } = cmds.pop(); - switch (get_doc_type_default(doc2)) { - case DOC_TYPE_STRING: { - const formatted = newLine !== "\n" ? string_replace_all_default( - /* isOptionalObject */ - false, - doc2, - "\n", - newLine - ) : doc2; - out.push(formatted); - if (cmds.length > 0) { - pos += get_string_width_default(formatted); - } - break; - } - case DOC_TYPE_ARRAY: - for (let i = doc2.length - 1; i >= 0; i--) { - cmds.push({ ind, mode, doc: doc2[i] }); - } - break; - case DOC_TYPE_CURSOR: - if (printedCursorCount >= 2) { - throw new Error("There are too many 'cursor' in doc."); - } - out.push(CURSOR_PLACEHOLDER); - printedCursorCount++; - break; - case DOC_TYPE_INDENT: - cmds.push({ ind: makeIndent(ind, options), mode, doc: doc2.contents }); - break; - case DOC_TYPE_ALIGN: - cmds.push({ - ind: makeAlign(ind, doc2.n, options), - mode, - doc: doc2.contents - }); - break; - case DOC_TYPE_TRIM: - pos -= trim2(out); - break; - case DOC_TYPE_GROUP: - switch (mode) { - case MODE_FLAT: - if (!shouldRemeasure) { - cmds.push({ - ind, - mode: doc2.break ? MODE_BREAK : MODE_FLAT, - doc: doc2.contents - }); - break; - } - // fallthrough - case MODE_BREAK: { - shouldRemeasure = false; - const next = { ind, mode: MODE_FLAT, doc: doc2.contents }; - const rem = width - pos; - const hasLineSuffix = lineSuffix2.length > 0; - if (!doc2.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) { - cmds.push(next); - } else { - if (doc2.expandedStates) { - const mostExpanded = at_default( - /* isOptionalObject */ - false, - doc2.expandedStates, - -1 - ); - if (doc2.break) { - cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded }); - break; - } else { - for (let i = 1; i < doc2.expandedStates.length + 1; i++) { - if (i >= doc2.expandedStates.length) { - cmds.push({ ind, mode: MODE_BREAK, doc: mostExpanded }); - break; - } else { - const state = doc2.expandedStates[i]; - const cmd = { ind, mode: MODE_FLAT, doc: state }; - if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) { - cmds.push(cmd); - break; - } - } - } - } - } else { - cmds.push({ ind, mode: MODE_BREAK, doc: doc2.contents }); - } - } - break; - } - } - if (doc2.id) { - groupModeMap[doc2.id] = at_default( - /* isOptionalObject */ - false, - cmds, - -1 - ).mode; - } - break; - // Fills each line with as much code as possible before moving to a new - // line with the same indentation. - // - // Expects doc.parts to be an array of alternating content and - // whitespace. The whitespace contains the linebreaks. - // - // For example: - // ["I", line, "love", line, "monkeys"] - // or - // [{ type: group, ... }, softline, { type: group, ... }] - // - // It uses this parts structure to handle three main layout cases: - // * The first two content items fit on the same line without - // breaking - // -> output the first content item and the whitespace "flat". - // * Only the first content item fits on the line without breaking - // -> output the first content item "flat" and the whitespace with - // "break". - // * Neither content item fits on the line without breaking - // -> output the first content item and the whitespace with "break". - case DOC_TYPE_FILL: { - const rem = width - pos; - const offset = doc2[DOC_FILL_PRINTED_LENGTH] ?? 0; - const { parts } = doc2; - const length = parts.length - offset; - if (length === 0) { - break; - } - const content = parts[offset + 0]; - const whitespace = parts[offset + 1]; - const contentFlatCmd = { ind, mode: MODE_FLAT, doc: content }; - const contentBreakCmd = { ind, mode: MODE_BREAK, doc: content }; - const contentFits = fits( - contentFlatCmd, - [], - rem, - lineSuffix2.length > 0, - groupModeMap, - true - ); - if (length === 1) { - if (contentFits) { - cmds.push(contentFlatCmd); - } else { - cmds.push(contentBreakCmd); - } - break; - } - const whitespaceFlatCmd = { ind, mode: MODE_FLAT, doc: whitespace }; - const whitespaceBreakCmd = { ind, mode: MODE_BREAK, doc: whitespace }; - if (length === 2) { - if (contentFits) { - cmds.push(whitespaceFlatCmd, contentFlatCmd); - } else { - cmds.push(whitespaceBreakCmd, contentBreakCmd); - } - break; - } - const secondContent = parts[offset + 2]; - const remainingCmd = { - ind, - mode, - doc: { ...doc2, [DOC_FILL_PRINTED_LENGTH]: offset + 2 } - }; - const firstAndSecondContentFlatCmd = { - ind, - mode: MODE_FLAT, - doc: [content, whitespace, secondContent] - }; - const firstAndSecondContentFits = fits( - firstAndSecondContentFlatCmd, - [], - rem, - lineSuffix2.length > 0, - groupModeMap, - true - ); - if (firstAndSecondContentFits) { - cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd); - } else if (contentFits) { - cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd); - } else { - cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd); - } - break; - } - case DOC_TYPE_IF_BREAK: - case DOC_TYPE_INDENT_IF_BREAK: { - const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] : mode; - if (groupMode === MODE_BREAK) { - const breakContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.breakContents : doc2.negate ? doc2.contents : indent(doc2.contents); - if (breakContents) { - cmds.push({ ind, mode, doc: breakContents }); - } - } - if (groupMode === MODE_FLAT) { - const flatContents = doc2.type === DOC_TYPE_IF_BREAK ? doc2.flatContents : doc2.negate ? indent(doc2.contents) : doc2.contents; - if (flatContents) { - cmds.push({ ind, mode, doc: flatContents }); - } - } - break; - } - case DOC_TYPE_LINE_SUFFIX: - lineSuffix2.push({ ind, mode, doc: doc2.contents }); - break; - case DOC_TYPE_LINE_SUFFIX_BOUNDARY: - if (lineSuffix2.length > 0) { - cmds.push({ ind, mode, doc: hardlineWithoutBreakParent }); - } - break; - case DOC_TYPE_LINE: - switch (mode) { - case MODE_FLAT: - if (!doc2.hard) { - if (!doc2.soft) { - out.push(" "); - pos += 1; - } - break; - } else { - shouldRemeasure = true; - } - // fallthrough - case MODE_BREAK: - if (lineSuffix2.length > 0) { - cmds.push({ ind, mode, doc: doc2 }, ...lineSuffix2.reverse()); - lineSuffix2.length = 0; - break; - } - if (doc2.literal) { - if (ind.root) { - out.push(newLine, ind.root.value); - pos = ind.root.length; - } else { - out.push(newLine); - pos = 0; - } - } else { - pos -= trim2(out); - out.push(newLine + ind.value); - pos = ind.length; - } - break; - } - break; - case DOC_TYPE_LABEL: - cmds.push({ ind, mode, doc: doc2.contents }); - break; - case DOC_TYPE_BREAK_PARENT: - break; - default: - throw new invalid_doc_error_default(doc2); - } - if (cmds.length === 0 && lineSuffix2.length > 0) { - cmds.push(...lineSuffix2.reverse()); - lineSuffix2.length = 0; - } - } - const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER); - if (cursorPlaceholderIndex !== -1) { - const otherCursorPlaceholderIndex = out.indexOf( - CURSOR_PLACEHOLDER, - cursorPlaceholderIndex + 1 - ); - if (otherCursorPlaceholderIndex === -1) { - return { - formatted: out.filter((char) => char !== CURSOR_PLACEHOLDER).join("") - }; - } - const beforeCursor = out.slice(0, cursorPlaceholderIndex).join(""); - const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join(""); - const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join(""); - return { - formatted: beforeCursor + aroundCursor + afterCursor, - cursorNodeStart: beforeCursor.length, - cursorNodeText: aroundCursor - }; - } - return { formatted: out.join("") }; -} - -// src/document/public.js -var builders = { - join, - line, - softline, - hardline, - literalline, - group, - conditionalGroup, - fill, - lineSuffix, - lineSuffixBoundary, - cursor, - breakParent, - ifBreak, - trim, - indent, - indentIfBreak, - align, - addAlignmentToDoc, - markAsRoot, - dedentToRoot, - dedent, - hardlineWithoutBreakParent, - literallineWithoutBreakParent, - label, - // TODO: Remove this in v4 - concat: (parts) => parts -}; -var printer = { printDocToString }; -var utils = { - willBreak, - traverseDoc: traverse_doc_default, - findInDoc, - mapDoc, - removeLines, - stripTrailingHardline, - replaceEndOfLine, - canBreak -}; - -// with-default-export:src/document/public.js -var public_default = public_exports; -export { - builders, - public_default as default, - printer, - utils -}; diff --git a/node_modules/prettier/index.cjs b/node_modules/prettier/index.cjs deleted file mode 100644 index b0dd894..0000000 --- a/node_modules/prettier/index.cjs +++ /dev/null @@ -1,674 +0,0 @@ -"use strict"; -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 __esm = (fn, res) => function __init() { - return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; -}; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/utils/skip.js -function skip(characters) { - return (text, startIndex, options) => { - const backwards = Boolean(options == null ? void 0 : options.backwards); - if (startIndex === false) { - return false; - } - const { length } = text; - let cursor = startIndex; - while (cursor >= 0 && cursor < length) { - const character = text.charAt(cursor); - if (characters instanceof RegExp) { - if (!characters.test(character)) { - return cursor; - } - } else if (!characters.includes(character)) { - return cursor; - } - backwards ? cursor-- : cursor++; - } - if (cursor === -1 || cursor === length) { - return cursor; - } - return false; - }; -} -var skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine; -var init_skip = __esm({ - "src/utils/skip.js"() { - skipWhitespace = skip(/\s/u); - skipSpaces = skip(" "); - skipToLineEnd = skip(",; "); - skipEverythingButNewLine = skip(/[^\n\r]/u); - } -}); - -// src/utils/skip-inline-comment.js -function skipInlineComment(text, startIndex) { - if (startIndex === false) { - return false; - } - if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "*") { - for (let i = startIndex + 2; i < text.length; ++i) { - if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") { - return i + 2; - } - } - } - return startIndex; -} -var skip_inline_comment_default; -var init_skip_inline_comment = __esm({ - "src/utils/skip-inline-comment.js"() { - skip_inline_comment_default = skipInlineComment; - } -}); - -// src/utils/skip-newline.js -function skipNewline(text, startIndex, options) { - const backwards = Boolean(options == null ? void 0 : options.backwards); - if (startIndex === false) { - return false; - } - const character = text.charAt(startIndex); - if (backwards) { - if (text.charAt(startIndex - 1) === "\r" && character === "\n") { - return startIndex - 2; - } - if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") { - return startIndex - 1; - } - } else { - if (character === "\r" && text.charAt(startIndex + 1) === "\n") { - return startIndex + 2; - } - if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") { - return startIndex + 1; - } - } - return startIndex; -} -var skip_newline_default; -var init_skip_newline = __esm({ - "src/utils/skip-newline.js"() { - skip_newline_default = skipNewline; - } -}); - -// src/utils/skip-trailing-comment.js -function skipTrailingComment(text, startIndex) { - if (startIndex === false) { - return false; - } - if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "/") { - return skipEverythingButNewLine(text, startIndex); - } - return startIndex; -} -var skip_trailing_comment_default; -var init_skip_trailing_comment = __esm({ - "src/utils/skip-trailing-comment.js"() { - init_skip(); - skip_trailing_comment_default = skipTrailingComment; - } -}); - -// src/utils/get-next-non-space-non-comment-character-index.js -function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) { - let oldIdx = null; - let nextIdx = startIndex; - while (nextIdx !== oldIdx) { - oldIdx = nextIdx; - nextIdx = skipSpaces(text, nextIdx); - nextIdx = skip_inline_comment_default(text, nextIdx); - nextIdx = skip_trailing_comment_default(text, nextIdx); - nextIdx = skip_newline_default(text, nextIdx); - } - return nextIdx; -} -var get_next_non_space_non_comment_character_index_default; -var init_get_next_non_space_non_comment_character_index = __esm({ - "src/utils/get-next-non-space-non-comment-character-index.js"() { - init_skip(); - init_skip_inline_comment(); - init_skip_newline(); - init_skip_trailing_comment(); - get_next_non_space_non_comment_character_index_default = getNextNonSpaceNonCommentCharacterIndex; - } -}); - -// src/utils/has-newline.js -function hasNewline(text, startIndex, options = {}) { - const idx = skipSpaces( - text, - options.backwards ? startIndex - 1 : startIndex, - options - ); - const idx2 = skip_newline_default(text, idx, options); - return idx !== idx2; -} -var has_newline_default; -var init_has_newline = __esm({ - "src/utils/has-newline.js"() { - init_skip(); - init_skip_newline(); - has_newline_default = hasNewline; - } -}); - -// src/utils/is-next-line-empty.js -function isNextLineEmpty(text, startIndex) { - let oldIdx = null; - let idx = startIndex; - while (idx !== oldIdx) { - oldIdx = idx; - idx = skipToLineEnd(text, idx); - idx = skip_inline_comment_default(text, idx); - idx = skipSpaces(text, idx); - } - idx = skip_trailing_comment_default(text, idx); - idx = skip_newline_default(text, idx); - return idx !== false && has_newline_default(text, idx); -} -var is_next_line_empty_default; -var init_is_next_line_empty = __esm({ - "src/utils/is-next-line-empty.js"() { - init_has_newline(); - init_skip(); - init_skip_inline_comment(); - init_skip_newline(); - init_skip_trailing_comment(); - is_next_line_empty_default = isNextLineEmpty; - } -}); - -// src/utils/is-previous-line-empty.js -function isPreviousLineEmpty(text, startIndex) { - let idx = startIndex - 1; - idx = skipSpaces(text, idx, { backwards: true }); - idx = skip_newline_default(text, idx, { backwards: true }); - idx = skipSpaces(text, idx, { backwards: true }); - const idx2 = skip_newline_default(text, idx, { backwards: true }); - return idx !== idx2; -} -var is_previous_line_empty_default; -var init_is_previous_line_empty = __esm({ - "src/utils/is-previous-line-empty.js"() { - init_skip(); - init_skip_newline(); - is_previous_line_empty_default = isPreviousLineEmpty; - } -}); - -// src/main/comments/utils.js -function describeNodeForDebugging(node) { - const nodeType = node.type || node.kind || "(unknown type)"; - let nodeName = String( - node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "" - ); - if (nodeName.length > 20) { - nodeName = nodeName.slice(0, 19) + "\u2026"; - } - return nodeType + (nodeName ? " " + nodeName : ""); -} -function addCommentHelper(node, comment) { - const comments = node.comments ?? (node.comments = []); - comments.push(comment); - comment.printed = false; - comment.nodeDescription = describeNodeForDebugging(node); -} -function addLeadingComment(node, comment) { - comment.leading = true; - comment.trailing = false; - addCommentHelper(node, comment); -} -function addDanglingComment(node, comment, marker) { - comment.leading = false; - comment.trailing = false; - if (marker) { - comment.marker = marker; - } - addCommentHelper(node, comment); -} -function addTrailingComment(node, comment) { - comment.leading = false; - comment.trailing = true; - addCommentHelper(node, comment); -} -var init_utils = __esm({ - "src/main/comments/utils.js"() { - } -}); - -// src/utils/get-alignment-size.js -function getAlignmentSize(text, tabWidth, startIndex = 0) { - let size = 0; - for (let i = startIndex; i < text.length; ++i) { - if (text[i] === " ") { - size = size + tabWidth - size % tabWidth; - } else { - size++; - } - } - return size; -} -var get_alignment_size_default; -var init_get_alignment_size = __esm({ - "src/utils/get-alignment-size.js"() { - get_alignment_size_default = getAlignmentSize; - } -}); - -// src/utils/get-indent-size.js -function getIndentSize(value, tabWidth) { - const lastNewlineIndex = value.lastIndexOf("\n"); - if (lastNewlineIndex === -1) { - return 0; - } - return get_alignment_size_default( - // All the leading whitespaces - value.slice(lastNewlineIndex + 1).match(/^[\t ]*/u)[0], - tabWidth - ); -} -var get_indent_size_default; -var init_get_indent_size = __esm({ - "src/utils/get-indent-size.js"() { - init_get_alignment_size(); - get_indent_size_default = getIndentSize; - } -}); - -// node_modules/escape-string-regexp/index.js -function escapeStringRegexp(string) { - if (typeof string !== "string") { - throw new TypeError("Expected a string"); - } - return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); -} -var init_escape_string_regexp = __esm({ - "node_modules/escape-string-regexp/index.js"() { - } -}); - -// src/utils/get-max-continuous-count.js -function getMaxContinuousCount(text, searchString) { - const results = text.match( - new RegExp(`(${escapeStringRegexp(searchString)})+`, "gu") - ); - if (results === null) { - return 0; - } - return results.reduce( - (maxCount, result) => Math.max(maxCount, result.length / searchString.length), - 0 - ); -} -var get_max_continuous_count_default; -var init_get_max_continuous_count = __esm({ - "src/utils/get-max-continuous-count.js"() { - init_escape_string_regexp(); - get_max_continuous_count_default = getMaxContinuousCount; - } -}); - -// src/utils/get-next-non-space-non-comment-character.js -function getNextNonSpaceNonCommentCharacter(text, startIndex) { - const index = get_next_non_space_non_comment_character_index_default(text, startIndex); - return index === false ? "" : text.charAt(index); -} -var get_next_non_space_non_comment_character_default; -var init_get_next_non_space_non_comment_character = __esm({ - "src/utils/get-next-non-space-non-comment-character.js"() { - init_get_next_non_space_non_comment_character_index(); - get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter; - } -}); - -// src/utils/get-preferred-quote.js -function getPreferredQuote(text, preferredQuoteOrPreferSingleQuote) { - const preferred = preferredQuoteOrPreferSingleQuote === true || preferredQuoteOrPreferSingleQuote === SINGLE_QUOTE ? SINGLE_QUOTE : DOUBLE_QUOTE; - const alternate = preferred === SINGLE_QUOTE ? DOUBLE_QUOTE : SINGLE_QUOTE; - let preferredQuoteCount = 0; - let alternateQuoteCount = 0; - for (const character of text) { - if (character === preferred) { - preferredQuoteCount++; - } else if (character === alternate) { - alternateQuoteCount++; - } - } - return preferredQuoteCount > alternateQuoteCount ? alternate : preferred; -} -var SINGLE_QUOTE, DOUBLE_QUOTE, get_preferred_quote_default; -var init_get_preferred_quote = __esm({ - "src/utils/get-preferred-quote.js"() { - SINGLE_QUOTE = "'"; - DOUBLE_QUOTE = '"'; - get_preferred_quote_default = getPreferredQuote; - } -}); - -// node_modules/emoji-regex/index.mjs -var emoji_regex_default; -var init_emoji_regex = __esm({ - "node_modules/emoji-regex/index.mjs"() { - emoji_regex_default = () => { - return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7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?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; - }; - } -}); - -// node_modules/get-east-asian-width/lookup.js -function isFullWidth(x) { - return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510; -} -function isWide(x) { - return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141; -} -var init_lookup = __esm({ - "node_modules/get-east-asian-width/lookup.js"() { - } -}); - -// node_modules/get-east-asian-width/index.js -var _isNarrowWidth; -var init_get_east_asian_width = __esm({ - "node_modules/get-east-asian-width/index.js"() { - init_lookup(); - _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint)); - } -}); - -// src/utils/get-string-width.js -function getStringWidth(text) { - if (!text) { - return 0; - } - if (!notAsciiRegex.test(text)) { - return text.length; - } - text = text.replace(emoji_regex_default(), " "); - let width = 0; - for (const character of text) { - const codePoint = character.codePointAt(0); - if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) { - continue; - } - if (codePoint >= 768 && codePoint <= 879) { - continue; - } - width += _isNarrowWidth(codePoint) ? 1 : 2; - } - return width; -} -var notAsciiRegex, get_string_width_default; -var init_get_string_width = __esm({ - "src/utils/get-string-width.js"() { - init_emoji_regex(); - init_get_east_asian_width(); - notAsciiRegex = /[^\x20-\x7F]/u; - get_string_width_default = getStringWidth; - } -}); - -// src/utils/has-newline-in-range.js -function hasNewlineInRange(text, startIndex, endIndex) { - for (let i = startIndex; i < endIndex; ++i) { - if (text.charAt(i) === "\n") { - return true; - } - } - return false; -} -var has_newline_in_range_default; -var init_has_newline_in_range = __esm({ - "src/utils/has-newline-in-range.js"() { - has_newline_in_range_default = hasNewlineInRange; - } -}); - -// src/utils/has-spaces.js -function hasSpaces(text, startIndex, options = {}) { - const idx = skipSpaces( - text, - options.backwards ? startIndex - 1 : startIndex, - options - ); - return idx !== startIndex; -} -var has_spaces_default; -var init_has_spaces = __esm({ - "src/utils/has-spaces.js"() { - init_skip(); - has_spaces_default = hasSpaces; - } -}); - -// scripts/build/shims/string-replace-all.js -var stringReplaceAll, string_replace_all_default; -var init_string_replace_all = __esm({ - "scripts/build/shims/string-replace-all.js"() { - stringReplaceAll = (isOptionalObject, original, pattern, replacement) => { - if (isOptionalObject && (original === void 0 || original === null)) { - return; - } - if (original.replaceAll) { - return original.replaceAll(pattern, replacement); - } - if (pattern.global) { - return original.replace(pattern, replacement); - } - return original.split(pattern).join(replacement); - }; - string_replace_all_default = stringReplaceAll; - } -}); - -// src/utils/make-string.js -function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) { - const otherQuote = enclosingQuote === '"' ? "'" : '"'; - const regex = /\\(.)|(["'])/gsu; - const raw = string_replace_all_default( - /* isOptionalObject */ - false, - rawText, - regex, - (match, escaped, quote) => { - if (escaped === otherQuote) { - return escaped; - } - if (quote === enclosingQuote) { - return "\\" + quote; - } - if (quote) { - return quote; - } - return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(escaped) ? escaped : "\\" + escaped; - } - ); - return enclosingQuote + raw + enclosingQuote; -} -var make_string_default; -var init_make_string = __esm({ - "src/utils/make-string.js"() { - init_string_replace_all(); - make_string_default = makeString; - } -}); - -// src/utils/public.js -var public_exports = {}; -__export(public_exports, { - addDanglingComment: () => addDanglingComment, - addLeadingComment: () => addLeadingComment, - addTrailingComment: () => addTrailingComment, - getAlignmentSize: () => get_alignment_size_default, - getIndentSize: () => get_indent_size_default, - getMaxContinuousCount: () => get_max_continuous_count_default, - getNextNonSpaceNonCommentCharacter: () => get_next_non_space_non_comment_character_default, - getNextNonSpaceNonCommentCharacterIndex: () => getNextNonSpaceNonCommentCharacterIndex2, - getPreferredQuote: () => get_preferred_quote_default, - getStringWidth: () => get_string_width_default, - hasNewline: () => has_newline_default, - hasNewlineInRange: () => has_newline_in_range_default, - hasSpaces: () => has_spaces_default, - isNextLineEmpty: () => isNextLineEmpty2, - isNextLineEmptyAfterIndex: () => is_next_line_empty_default, - isPreviousLineEmpty: () => isPreviousLineEmpty2, - makeString: () => make_string_default, - skip: () => skip, - skipEverythingButNewLine: () => skipEverythingButNewLine, - skipInlineComment: () => skip_inline_comment_default, - skipNewline: () => skip_newline_default, - skipSpaces: () => skipSpaces, - skipToLineEnd: () => skipToLineEnd, - skipTrailingComment: () => skip_trailing_comment_default, - skipWhitespace: () => skipWhitespace -}); -function legacyGetNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) { - return get_next_non_space_non_comment_character_index_default( - text, - locEnd(node) - ); -} -function getNextNonSpaceNonCommentCharacterIndex2(text, startIndex) { - return arguments.length === 2 || typeof startIndex === "number" ? get_next_non_space_non_comment_character_index_default(text, startIndex) : ( - // @ts-expect-error -- expected - // eslint-disable-next-line prefer-rest-params - legacyGetNextNonSpaceNonCommentCharacterIndex(...arguments) - ); -} -function legacyIsPreviousLineEmpty(text, node, locStart) { - return is_previous_line_empty_default(text, locStart(node)); -} -function isPreviousLineEmpty2(text, startIndex) { - return arguments.length === 2 || typeof startIndex === "number" ? is_previous_line_empty_default(text, startIndex) : ( - // @ts-expect-error -- expected - // eslint-disable-next-line prefer-rest-params - legacyIsPreviousLineEmpty(...arguments) - ); -} -function legacyIsNextLineEmpty(text, node, locEnd) { - return is_next_line_empty_default(text, locEnd(node)); -} -function isNextLineEmpty2(text, startIndex) { - return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : ( - // @ts-expect-error -- expected - // eslint-disable-next-line prefer-rest-params - legacyIsNextLineEmpty(...arguments) - ); -} -var init_public = __esm({ - "src/utils/public.js"() { - init_get_next_non_space_non_comment_character_index(); - init_is_next_line_empty(); - init_is_previous_line_empty(); - init_utils(); - init_get_alignment_size(); - init_get_indent_size(); - init_get_max_continuous_count(); - init_get_next_non_space_non_comment_character(); - init_get_preferred_quote(); - init_get_string_width(); - init_has_newline(); - init_has_newline_in_range(); - init_has_spaces(); - init_make_string(); - init_skip(); - init_skip_inline_comment(); - init_skip_newline(); - init_skip_trailing_comment(); - } -}); - -// src/main/version.evaluate.cjs -var require_version_evaluate = __commonJS({ - "src/main/version.evaluate.cjs"(exports2, module2) { - module2.exports = "3.4.1"; - } -}); - -// src/index.cjs -var prettierPromise = import("./index.mjs"); -var functionNames = [ - "formatWithCursor", - "format", - "check", - "resolveConfig", - "resolveConfigFile", - "clearConfigCache", - "getFileInfo", - "getSupportInfo" -]; -var prettier = /* @__PURE__ */ Object.create(null); -for (const name of functionNames) { - prettier[name] = async (...args) => { - const prettier2 = await prettierPromise; - return prettier2[name](...args); - }; -} -var debugApiFunctionNames = [ - "parse", - "formatAST", - "formatDoc", - "printToDoc", - "printDocToString" -]; -var debugApis = /* @__PURE__ */ Object.create(null); -for (const name of debugApiFunctionNames) { - debugApis[name] = async (...args) => { - const prettier2 = await prettierPromise; - return prettier2.__debug[name](...args); - }; -} -prettier.__debug = debugApis; -if (true) { - prettier.util = (init_public(), __toCommonJS(public_exports)); - prettier.doc = require("./doc.js"); -} else { - Object.defineProperties(prettier, { - util: { - get() { - throw new Error( - "prettier.util is not available in development CommonJS version" - ); - } - }, - doc: { - get() { - throw new Error( - "prettier.doc is not available in development CommonJS version" - ); - } - } - }); -} -prettier.version = require_version_evaluate(); -module.exports = prettier; diff --git a/node_modules/prettier/index.d.ts b/node_modules/prettier/index.d.ts deleted file mode 100644 index badac40..0000000 --- a/node_modules/prettier/index.d.ts +++ /dev/null @@ -1,946 +0,0 @@ -// Copied from `@types/prettier` -// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5bb07fc4b087cb7ee91084afa6fe750551a7bbb1/types/prettier/index.d.ts - -// Minimum TypeScript Version: 4.2 - -// Add `export {}` here to shut off automatic exporting from index.d.ts. There -// are quite a few utility types here that don't need to be shipped with the -// exported module. -export {}; - -import { builders, printer, utils } from "./doc.js"; - -export namespace doc { - export { builders, printer, utils }; -} - -// This utility is here to handle the case where you have an explicit union -// between string literals and the generic string type. It would normally -// resolve out to just the string type, but this generic LiteralUnion maintains -// the intellisense of the original union. -// -// It comes from this issue: microsoft/TypeScript#29729: -// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-700527227 -export type LiteralUnion = - | T - | (Pick & { _?: never | undefined }); - -export type AST = any; -export type Doc = doc.builders.Doc; - -// The type of elements that make up the given array T. -type ArrayElement = T extends Array ? E : never; - -// A union of the properties of the given object that are arrays. -type ArrayProperties = { - [K in keyof T]: NonNullable extends readonly any[] ? K : never; -}[keyof T]; - -// A union of the properties of the given array T that can be used to index it. -// If the array is a tuple, then that's going to be the explicit indices of the -// array, otherwise it's going to just be number. -type IndexProperties = - IsTuple extends true ? Exclude["length"], T["length"]> : number; - -// Effectively performing T[P], except that it's telling TypeScript that it's -// safe to do this for tuples, arrays, or objects. -type IndexValue = T extends any[] - ? P extends number - ? T[P] - : never - : P extends keyof T - ? T[P] - : never; - -// Determines if an object T is an array like string[] (in which case this -// evaluates to false) or a tuple like [string] (in which case this evaluates to -// true). -// eslint-disable-next-line @typescript-eslint/no-unused-vars -type IsTuple = T extends [] - ? true - : T extends [infer First, ...infer Remain] - ? IsTuple - : false; - -type CallProperties = T extends any[] ? IndexProperties : keyof T; -type IterProperties = T extends any[] - ? IndexProperties - : ArrayProperties; - -type CallCallback = (path: AstPath, index: number, value: any) => U; -type EachCallback = ( - path: AstPath>, - index: number, - value: any, -) => void; -type MapCallback = ( - path: AstPath>, - index: number, - value: any, -) => U; - -// https://github.com/prettier/prettier/blob/next/src/common/ast-path.js -export class AstPath { - constructor(value: T); - - get key(): string | null; - get index(): number | null; - get node(): T; - get parent(): T | null; - get grandparent(): T | null; - get isInArray(): boolean; - get siblings(): T[] | null; - get next(): T | null; - get previous(): T | null; - get isFirst(): boolean; - get isLast(): boolean; - get isRoot(): boolean; - get root(): T; - get ancestors(): T[]; - - stack: T[]; - - callParent(callback: (path: this) => U, count?: number): U; - - /** - * @deprecated Please use `AstPath#key` or `AstPath#index` - */ - getName(): PropertyKey | null; - - /** - * @deprecated Please use `AstPath#node` or `AstPath#siblings` - */ - getValue(): T; - - getNode(count?: number): T | null; - - getParentNode(count?: number): T | null; - - match( - ...predicates: Array< - (node: any, name: string | null, number: number | null) => boolean - > - ): boolean; - - // For each of the tree walk functions (call, each, and map) this provides 5 - // strict type signatures, along with a fallback at the end if you end up - // calling more than 5 properties deep. This helps a lot with typing because - // for the majority of cases you're calling fewer than 5 properties, so the - // tree walk functions have a clearer understanding of what you're doing. - // - // Note that resolving these types is somewhat complicated, and it wasn't - // even supported until TypeScript 4.2 (before it would just say that the - // type instantiation was excessively deep and possibly infinite). - - call(callback: CallCallback): U; - call>( - callback: CallCallback, U>, - prop1: P1, - ): U; - call>( - callback: CallCallback, P2>, U>, - prop1: P1, - prop2: P2, - ): U; - call< - U, - P1 extends keyof T, - P2 extends CallProperties, - P3 extends CallProperties>, - >( - callback: CallCallback< - IndexValue, P2>, P3>, - U - >, - prop1: P1, - prop2: P2, - prop3: P3, - ): U; - call< - U, - P1 extends keyof T, - P2 extends CallProperties, - P3 extends CallProperties>, - P4 extends CallProperties, P3>>, - >( - callback: CallCallback< - IndexValue, P2>, P3>, P4>, - U - >, - prop1: P1, - prop2: P2, - prop3: P3, - prop4: P4, - ): U; - call( - callback: CallCallback, - prop1: P, - prop2: P, - prop3: P, - prop4: P, - ...props: P[] - ): U; - - each(callback: EachCallback): void; - each>( - callback: EachCallback>, - prop1: P1, - ): void; - each>( - callback: EachCallback, P2>>, - prop1: P1, - prop2: P2, - ): void; - each< - P1 extends keyof T, - P2 extends IterProperties, - P3 extends IterProperties>, - >( - callback: EachCallback, P2>, P3>>, - prop1: P1, - prop2: P2, - prop3: P3, - ): void; - each< - P1 extends keyof T, - P2 extends IterProperties, - P3 extends IterProperties>, - P4 extends IterProperties, P3>>, - >( - callback: EachCallback< - IndexValue, P2>, P3>, P4> - >, - prop1: P1, - prop2: P2, - prop3: P3, - prop4: P4, - ): void; - each( - callback: EachCallback, - prop1: PropertyKey, - prop2: PropertyKey, - prop3: PropertyKey, - prop4: PropertyKey, - ...props: PropertyKey[] - ): void; - - map(callback: MapCallback): U[]; - map>( - callback: MapCallback, U>, - prop1: P1, - ): U[]; - map>( - callback: MapCallback, P2>, U>, - prop1: P1, - prop2: P2, - ): U[]; - map< - U, - P1 extends keyof T, - P2 extends IterProperties, - P3 extends IterProperties>, - >( - callback: MapCallback, P2>, P3>, U>, - prop1: P1, - prop2: P2, - prop3: P3, - ): U[]; - map< - U, - P1 extends keyof T, - P2 extends IterProperties, - P3 extends IterProperties>, - P4 extends IterProperties, P3>>, - >( - callback: MapCallback< - IndexValue, P2>, P3>, P4>, - U - >, - prop1: P1, - prop2: P2, - prop3: P3, - prop4: P4, - ): U[]; - map( - callback: MapCallback, - prop1: PropertyKey, - prop2: PropertyKey, - prop3: PropertyKey, - prop4: PropertyKey, - ...props: PropertyKey[] - ): U[]; -} - -/** @deprecated `FastPath` was renamed to `AstPath` */ -export type FastPath = AstPath; - -export type BuiltInParser = (text: string, options?: any) => AST; -export type BuiltInParserName = - | "acorn" - | "angular" - | "babel-flow" - | "babel-ts" - | "babel" - | "css" - | "espree" - | "flow" - | "glimmer" - | "graphql" - | "html" - | "json-stringify" - | "json" - | "json5" - | "jsonc" - | "less" - | "lwc" - | "markdown" - | "mdx" - | "meriyah" - | "scss" - | "typescript" - | "vue" - | "yaml"; -export type BuiltInParsers = Record; - -/** - * For use in `.prettierrc.js`, `.prettierrc.cjs`, `prettierrc.mjs`, `prettier.config.js`, `prettier.config.cjs`, `prettier.config.mjs` - */ -export interface Config extends Options { - overrides?: Array<{ - files: string | string[]; - excludeFiles?: string | string[]; - options?: Options; - }>; -} - -export interface Options extends Partial {} - -export interface RequiredOptions extends doc.printer.Options { - /** - * Print semicolons at the ends of statements. - * @default true - */ - semi: boolean; - /** - * Use single quotes instead of double quotes. - * @default false - */ - singleQuote: boolean; - /** - * Use single quotes in JSX. - * @default false - */ - jsxSingleQuote: boolean; - /** - * Print trailing commas wherever possible. - * @default "all" - */ - trailingComma: "none" | "es5" | "all"; - /** - * Print spaces between brackets in object literals. - * @default true - */ - bracketSpacing: boolean; - /** - * Put the `>` of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being - * alone on the next line (does not apply to self closing elements). - * @default false - */ - bracketSameLine: boolean; - /** - * Format only a segment of a file. - * @default 0 - */ - rangeStart: number; - /** - * Format only a segment of a file. - * @default Number.POSITIVE_INFINITY - */ - rangeEnd: number; - /** - * Specify which parser to use. - */ - parser: LiteralUnion; - /** - * Specify the input filepath. This will be used to do parser inference. - */ - filepath: string; - /** - * Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file. - * This is very useful when gradually transitioning large, unformatted codebases to prettier. - * @default false - */ - requirePragma: boolean; - /** - * Prettier can insert a special @format marker at the top of files specifying that - * the file has been formatted with prettier. This works well when used in tandem with - * the --require-pragma option. If there is already a docblock at the top of - * the file then this option will add a newline to it with the @format marker. - * @default false - */ - insertPragma: boolean; - /** - * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer. - * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out. - * @default "preserve" - */ - proseWrap: "always" | "never" | "preserve"; - /** - * Include parentheses around a sole arrow function parameter. - * @default "always" - */ - arrowParens: "avoid" | "always"; - /** - * Provide ability to support new languages to prettier. - */ - plugins: Array; - /** - * How to handle whitespaces in HTML. - * @default "css" - */ - htmlWhitespaceSensitivity: "css" | "strict" | "ignore"; - /** - * Which end of line characters to apply. - * @default "lf" - */ - endOfLine: "auto" | "lf" | "crlf" | "cr"; - /** - * Change when properties in objects are quoted. - * @default "as-needed" - */ - quoteProps: "as-needed" | "consistent" | "preserve"; - /** - * Whether or not to indent the code inside - --------------------------------------------------------------------------------- - - - - - -## Table of Contents - -- [Examples](#examples) - - [Consuming a source map](#consuming-a-source-map) - - [Generating a source map](#generating-a-source-map) - - [With SourceNode (high level API)](#with-sourcenode-high-level-api) - - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) -- [API](#api) - - [SourceMapConsumer](#sourcemapconsumer) - - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) - - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) - - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) - - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) - - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) - - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) - - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) - - [SourceMapGenerator](#sourcemapgenerator) - - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) - - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) - - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) - - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) - - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) - - [SourceNode](#sourcenode) - - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) - - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) - - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) - - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) - - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) - - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) - - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) - - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) - - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) - - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) - - - -## Examples - -### Consuming a source map - -```js -var rawSourceMap = { - version: 3, - file: 'min.js', - names: ['bar', 'baz', 'n'], - sources: ['one.js', 'two.js'], - sourceRoot: 'http://example.com/www/js/', - mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' -}; - -var smc = new SourceMapConsumer(rawSourceMap); - -console.log(smc.sources); -// [ 'http://example.com/www/js/one.js', -// 'http://example.com/www/js/two.js' ] - -console.log(smc.originalPositionFor({ - line: 2, - column: 28 -})); -// { source: 'http://example.com/www/js/two.js', -// line: 2, -// column: 10, -// name: 'n' } - -console.log(smc.generatedPositionFor({ - source: 'http://example.com/www/js/two.js', - line: 2, - column: 10 -})); -// { line: 2, column: 28 } - -smc.eachMapping(function (m) { - // ... -}); -``` - -### Generating a source map - -In depth guide: -[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) - -#### With SourceNode (high level API) - -```js -function compile(ast) { - switch (ast.type) { - case 'BinaryExpression': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - [compile(ast.left), " + ", compile(ast.right)] - ); - case 'Literal': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - String(ast.value) - ); - // ... - default: - throw new Error("Bad AST"); - } -} - -var ast = parse("40 + 2", "add.js"); -console.log(compile(ast).toStringWithSourceMap({ - file: 'add.js' -})); -// { code: '40 + 2', -// map: [object SourceMapGenerator] } -``` - -#### With SourceMapGenerator (low level API) - -```js -var map = new SourceMapGenerator({ - file: "source-mapped.js" -}); - -map.addMapping({ - generated: { - line: 10, - column: 35 - }, - source: "foo.js", - original: { - line: 33, - column: 2 - }, - name: "christopher" -}); - -console.log(map.toString()); -// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' -``` - -## API - -Get a reference to the module: - -```js -// Node.js -var sourceMap = require('source-map'); - -// Browser builds -var sourceMap = window.sourceMap; - -// Inside Firefox -const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); -``` - -### SourceMapConsumer - -A SourceMapConsumer instance represents a parsed source map which we can query -for information about the original file positions by giving it a file position -in the generated source. - -#### new SourceMapConsumer(rawSourceMap) - -The only parameter is the raw source map (either as a string which can be -`JSON.parse`'d, or an object). According to the spec, source maps have the -following attributes: - -* `version`: Which version of the source map spec this map is following. - -* `sources`: An array of URLs to the original source files. - -* `names`: An array of identifiers which can be referenced by individual - mappings. - -* `sourceRoot`: Optional. The URL root from which all sources are relative. - -* `sourcesContent`: Optional. An array of contents of the original source files. - -* `mappings`: A string of base64 VLQs which contain the actual mappings. - -* `file`: Optional. The generated filename this source map is associated with. - -```js -var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); -``` - -#### SourceMapConsumer.prototype.computeColumnSpans() - -Compute the last column for each generated mapping. The last column is -inclusive. - -```js -// Before: -consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] - -consumer.computeColumnSpans(); - -// After: -consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1, -// lastColumn: 9 }, -// { line: 2, -// column: 10, -// lastColumn: 19 }, -// { line: 2, -// column: 20, -// lastColumn: Infinity } ] - -``` - -#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) - -Returns the original source, line, and column information for the generated -source's line and column positions provided. The only argument is an object with -the following properties: - -* `line`: The line number in the generated source. Line numbers in - this library are 1-based (note that the underlying source map - specification uses 0-based line numbers -- this library handles the - translation). - -* `column`: The column number in the generated source. Column numbers - in this library are 0-based. - -* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or - `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest - element that is smaller than or greater than the one we are searching for, - respectively, if the exact element cannot be found. Defaults to - `SourceMapConsumer.GREATEST_LOWER_BOUND`. - -and an object is returned with the following properties: - -* `source`: The original source file, or null if this information is not - available. - -* `line`: The line number in the original source, or null if this information is - not available. The line number is 1-based. - -* `column`: The column number in the original source, or null if this - information is not available. The column number is 0-based. - -* `name`: The original identifier, or null if this information is not available. - -```js -consumer.originalPositionFor({ line: 2, column: 10 }) -// { source: 'foo.coffee', -// line: 2, -// column: 2, -// name: null } - -consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) -// { source: null, -// line: null, -// column: null, -// name: null } -``` - -#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) - -Returns the generated line and column information for the original source, -line, and column positions provided. The only argument is an object with -the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. The line number is - 1-based. - -* `column`: The column number in the original source. The column - number is 0-based. - -and an object is returned with the following properties: - -* `line`: The line number in the generated source, or null. The line - number is 1-based. - -* `column`: The column number in the generated source, or null. The - column number is 0-based. - -```js -consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) -// { line: 1, -// column: 56 } -``` - -#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) - -Returns all generated line and column information for the original source, line, -and column provided. If no column is provided, returns all mappings -corresponding to a either the line we are searching for or the next closest line -that has any mappings. Otherwise, returns all mappings corresponding to the -given line and either the column we are searching for or the next closest column -that has any offsets. - -The only argument is an object with the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. The line number is - 1-based. - -* `column`: Optional. The column number in the original source. The - column number is 0-based. - -and an array of objects is returned, each with the following properties: - -* `line`: The line number in the generated source, or null. The line - number is 1-based. - -* `column`: The column number in the generated source, or null. The - column number is 0-based. - -```js -consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] -``` - -#### SourceMapConsumer.prototype.hasContentsOfAllSources() - -Return true if we have the embedded source content for every source listed in -the source map, false otherwise. - -In other words, if this method returns `true`, then -`consumer.sourceContentFor(s)` will succeed for every source `s` in -`consumer.sources`. - -```js -// ... -if (consumer.hasContentsOfAllSources()) { - consumerReadyCallback(consumer); -} else { - fetchSources(consumer, consumerReadyCallback); -} -// ... -``` - -#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) - -Returns the original source content for the source provided. The only -argument is the URL of the original source file. - -If the source content for the given source is not found, then an error is -thrown. Optionally, pass `true` as the second param to have `null` returned -instead. - -```js -consumer.sources -// [ "my-cool-lib.clj" ] - -consumer.sourceContentFor("my-cool-lib.clj") -// "..." - -consumer.sourceContentFor("this is not in the source map"); -// Error: "this is not in the source map" is not in the source map - -consumer.sourceContentFor("this is not in the source map", true); -// null -``` - -#### SourceMapConsumer.prototype.eachMapping(callback, context, order) - -Iterate over each mapping between an original source/line/column and a -generated line/column in this source map. - -* `callback`: The function that is called with each mapping. Mappings have the - form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, - name }` - -* `context`: Optional. If specified, this object will be the value of `this` - every time that `callback` is called. - -* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or - `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over - the mappings sorted by the generated file's line/column order or the - original's source/line/column order, respectively. Defaults to - `SourceMapConsumer.GENERATED_ORDER`. - -```js -consumer.eachMapping(function (m) { console.log(m); }) -// ... -// { source: 'illmatic.js', -// generatedLine: 1, -// generatedColumn: 0, -// originalLine: 1, -// originalColumn: 0, -// name: null } -// { source: 'illmatic.js', -// generatedLine: 2, -// generatedColumn: 0, -// originalLine: 2, -// originalColumn: 0, -// name: null } -// ... -``` -### SourceMapGenerator - -An instance of the SourceMapGenerator represents a source map which is being -built incrementally. - -#### new SourceMapGenerator([startOfSourceMap]) - -You may pass an object with the following properties: - -* `file`: The filename of the generated source that this source map is - associated with. - -* `sourceRoot`: A root for all relative URLs in this source map. - -* `skipValidation`: Optional. When `true`, disables validation of mappings as - they are added. This can improve performance but should be used with - discretion, as a last resort. Even then, one should avoid using this flag when - running tests, if possible. - -```js -var generator = new sourceMap.SourceMapGenerator({ - file: "my-generated-javascript-file.js", - sourceRoot: "http://example.com/app/js/" -}); -``` - -#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) - -Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. - -* `sourceMapConsumer` The SourceMap. - -```js -var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); -``` - -#### SourceMapGenerator.prototype.addMapping(mapping) - -Add a single mapping from original source line and column to the generated -source's line and column for this source map being created. The mapping object -should have the following properties: - -* `generated`: An object with the generated line and column positions. - -* `original`: An object with the original line and column positions. - -* `source`: The original source file (relative to the sourceRoot). - -* `name`: An optional original token name for this mapping. - -```js -generator.addMapping({ - source: "module-one.scm", - original: { line: 128, column: 0 }, - generated: { line: 3, column: 456 } -}) -``` - -#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for an original source file. - -* `sourceFile` the URL of the original source file. - -* `sourceContent` the content of the source file. - -```js -generator.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) - -Applies a SourceMap for a source file to the SourceMap. -Each mapping to the supplied source file is rewritten using the -supplied SourceMap. Note: The resolution for the resulting mappings -is the minimum of this map and the supplied map. - -* `sourceMapConsumer`: The SourceMap to be applied. - -* `sourceFile`: Optional. The filename of the source file. - If omitted, sourceMapConsumer.file will be used, if it exists. - Otherwise an error will be thrown. - -* `sourceMapPath`: Optional. The dirname of the path to the SourceMap - to be applied. If relative, it is relative to the SourceMap. - - This parameter is needed when the two SourceMaps aren't in the same - directory, and the SourceMap to be applied contains relative source - paths. If so, those relative source paths need to be rewritten - relative to the SourceMap. - - If omitted, it is assumed that both SourceMaps are in the same directory, - thus not needing any rewriting. (Supplying `'.'` has the same effect.) - -#### SourceMapGenerator.prototype.toString() - -Renders the source map being generated to a string. - -```js -generator.toString() -// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' -``` - -### SourceNode - -SourceNodes provide a way to abstract over interpolating and/or concatenating -snippets of generated JavaScript source code, while maintaining the line and -column information associated between those snippets and the original source -code. This is useful as the final intermediate representation a compiler might -use before outputting the generated JS and source map. - -#### new SourceNode([line, column, source[, chunk[, name]]]) - -* `line`: The original line number associated with this source node, or null if - it isn't associated with an original line. The line number is 1-based. - -* `column`: The original column number associated with this source node, or null - if it isn't associated with an original column. The column number - is 0-based. - -* `source`: The original source's filename; null if no filename is provided. - -* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see - below. - -* `name`: Optional. The original identifier. - -```js -var node = new SourceNode(1, 2, "a.cpp", [ - new SourceNode(3, 4, "b.cpp", "extern int status;\n"), - new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), - new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), -]); -``` - -#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) - -Creates a SourceNode from generated code and a SourceMapConsumer. - -* `code`: The generated code - -* `sourceMapConsumer` The SourceMap for the generated code - -* `relativePath` The optional path that relative sources in `sourceMapConsumer` - should be relative to. - -```js -var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); -var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), - consumer); -``` - -#### SourceNode.prototype.add(chunk) - -Add a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.add(" + "); -node.add(otherNode); -node.add([leftHandOperandNode, " + ", rightHandOperandNode]); -``` - -#### SourceNode.prototype.prepend(chunk) - -Prepend a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.prepend("/** Build Id: f783haef86324gf **/\n\n"); -``` - -#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for a source file. This will be added to the -`SourceMap` in the `sourcesContent` field. - -* `sourceFile`: The filename of the source file - -* `sourceContent`: The content of the source file - -```js -node.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceNode.prototype.walk(fn) - -Walk over the tree of JS snippets in this node and its children. The walking -function is called once for each snippet of JS and is passed that snippet and -the its original associated source's line/column location. - -* `fn`: The traversal function. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.walk(function (code, loc) { console.log("WALK:", code, loc); }) -// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } -// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } -// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } -// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } -``` - -#### SourceNode.prototype.walkSourceContents(fn) - -Walk over the tree of SourceNodes. The walking function is called for each -source file content and is passed the filename and source content. - -* `fn`: The traversal function. - -```js -var a = new SourceNode(1, 2, "a.js", "generated from a"); -a.setSourceContent("a.js", "original a"); -var b = new SourceNode(1, 2, "b.js", "generated from b"); -b.setSourceContent("b.js", "original b"); -var c = new SourceNode(1, 2, "c.js", "generated from c"); -c.setSourceContent("c.js", "original c"); - -var node = new SourceNode(null, null, null, [a, b, c]); -node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) -// WALK: a.js : original a -// WALK: b.js : original b -// WALK: c.js : original c -``` - -#### SourceNode.prototype.join(sep) - -Like `Array.prototype.join` except for SourceNodes. Inserts the separator -between each of this source node's children. - -* `sep`: The separator. - -```js -var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); -var operand = new SourceNode(3, 4, "a.rs", "="); -var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); - -var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); -var joinedNode = node.join(" "); -``` - -#### SourceNode.prototype.replaceRight(pattern, replacement) - -Call `String.prototype.replace` on the very right-most source snippet. Useful -for trimming white space from the end of a source node, etc. - -* `pattern`: The pattern to replace. - -* `replacement`: The thing to replace the pattern with. - -```js -// Trim trailing white space. -node.replaceRight(/\s*$/, ""); -``` - -#### SourceNode.prototype.toString() - -Return the string representation of this source node. Walks over the tree and -concatenates all the various snippets together to one string. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toString() -// 'unodostresquatro' -``` - -#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) - -Returns the string representation of this tree of source nodes, plus a -SourceMapGenerator which contains all the mappings between the generated and -original sources. - -The arguments are the same as those to `new SourceMapGenerator`. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toStringWithSourceMap({ file: "my-output-file.js" }) -// { code: 'unodostresquatro', -// map: [object SourceMapGenerator] } -``` diff --git a/node_modules/source-map/dist/source-map.debug.js b/node_modules/source-map/dist/source-map.debug.js deleted file mode 100644 index aad0620..0000000 --- a/node_modules/source-map/dist/source-map.debug.js +++ /dev/null @@ -1,3234 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ - exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { - throw new Error( - 'original.line and original.column are not numbers -- you probably meant to omit ' + - 'the original mapping entirely and only map the generated position. If so, pass ' + - 'null for the original mapping instead of an object with empty or null values.' - ); - } - - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. 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 Google Inc. 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 - * OWNER 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. - */ - - var base64 = __webpack_require__(3); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || urlRegexp.test(aPath); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); - }()); - - function identity (s) { - return s; - } - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - - return aStr; - } - exports.toSetString = supportsNullProto ? identity : toSetString; - - function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; - } - exports.fromSetString = supportsNullProto ? identity : fromSetString; - - function isProtoString(s) { - if (!s) { - return false; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; - } - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 === null) { - return 1; // aStr2 !== null - } - - if (aStr2 === null) { - return -1; // aStr1 !== null - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - - /** - * Strip any JSON XSSI avoidance prefix from the string (as documented - * in the source maps specification), and then parse the string as - * JSON. - */ - function parseSourceMapInput(str) { - return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); - } - exports.parseSourceMapInput = parseSourceMapInput; - - /** - * Compute the URL of a source given the the source root, the source's - * URL, and the source map's URL. - */ - function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { - sourceURL = sourceURL || ''; - - if (sourceRoot) { - // This follows what Chrome does. - if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { - sourceRoot += '/'; - } - // The spec says: - // Line 4: An optional source root, useful for relocating source - // files on a server or removing repeated values in the - // “sources” entry. This value is prepended to the individual - // entries in the “source” field. - sourceURL = sourceRoot + sourceURL; - } - - // Historically, SourceMapConsumer did not take the sourceMapURL as - // a parameter. This mode is still somewhat supported, which is why - // this code block is conditional. However, it's preferable to pass - // the source map URL to SourceMapConsumer, so that this function - // can implement the source URL resolution algorithm as outlined in - // the spec. This block is basically the equivalent of: - // new URL(sourceURL, sourceMapURL).toString() - // ... except it avoids using URL, which wasn't available in the - // older releases of node still supported by this library. - // - // The spec says: - // If the sources are not absolute URLs after prepending of the - // “sourceRoot”, the sources are resolved relative to the - // SourceMap (like resolving script src in a html document). - if (sourceMapURL) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var index = parsed.path.lastIndexOf('/'); - if (index >= 0) { - parsed.path = parsed.path.substring(0, index + 1); - } - } - sourceURL = join(urlGenerate(parsed), sourceURL); - } - - return normalize(sourceURL); - } - exports.computeSourceURL = computeSourceURL; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number is 1-based. - * - column: Optional. the column number in the original source. - * The column number is 0-based. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - needle.source = this._findSourceIndex(needle.source); - if (needle.source < 0) { - return []; - } - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The first parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - if (sourceRoot) { - sourceRoot = util.normalize(sourceRoot); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ - BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - if (this._sources.has(relativeSource)) { - return this._sources.indexOf(relativeSource); - } - - // Maybe aSource is an absolute URL as returned by |sources|. In - // this case we can't simply undo the transform. - var i; - for (i = 0; i < this._absoluteSources.length; ++i) { - if (this._absoluteSources[i] == aSource) { - return i; - } - } - - return -1; - }; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @param String aSourceMapURL - * The URL at which the source map can be found (optional) - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + relativeSource)) { - return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + relativeSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The first parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - } - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[remainingLinesIndex] || ''; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[remainingLinesIndex] || ''; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCAxNjI0YzcyOTliODg3ZjdiZGY2NCIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2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gIH1cbiAgICAgICAgICBuZXh0ICs9ICcsJztcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUobWFwcGluZy5nZW5lcmF0ZWRDb2x1bW5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4pO1xuICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgaWYgKG1hcHBpbmcuc291cmNlICE9IG51bGwpIHtcbiAgICAgICAgc291cmNlSWR4ID0gdGhpcy5fc291cmNlcy5pbmRleE9mKG1hcHBpbmcuc291cmNlKTtcbiAgICAgICAgbmV4dCArPSBiYXNlNjRWTFEuZW5jb2RlKHNvdXJjZUlkeCAtIHByZXZpb3VzU291cmNlKTtcbiAgICAgICAgcHJldmlvdXNTb3VyY2UgPSBzb3VyY2VJZHg7XG5cbiAgICAgICAgLy8gbGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkIGluIFNvdXJjZU1hcCBzcGVjIHZlcnNpb24gM1xuICAgICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUobWFwcGluZy5vcmlnaW5hbExpbmUgLSAxXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC0gcHJldmlvdXNPcmlnaW5hbExpbmUpO1xuICAgICAgICBwcmV2aW91c09yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luYWxMaW5lIC0gMTtcblxuICAgICAgICBuZXh0ICs9IGJhc2U2NFZMUS5lbmNvZGUobWFwcGluZy5vcmlnaW5hbENvbHVtblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAtIHByZXZpb3VzT3JpZ2luYWxDb2x1bW4pO1xuICAgICAgICBwcmV2aW91c09yaWdpbmFsQ29sdW1uID0gbWFwcGluZy5vcmlnaW5hbENvbHVtbjtc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ybiBbXTtcbiAgICB9XG5cbiAgICB2YXIgbWFwcGluZ3MgPSBbXTtcblxuICAgIHZhciBpbmRleCA9IHRoaXMuX2ZpbmRNYXBwaW5nKG5lZWRsZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9vcmlnaW5hbE1hcHBpbmdzLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwib3JpZ2luYWxMaW5lXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcmlnaW5hbENvbHVtblwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHV0aWwuY29tcGFyZUJ5T3JpZ2luYWxQb3NpdGlvbnMsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmluYXJ5U2VhcmNoLkxFQVNUX1VQUEVSX0JPVU5EKTtcbiAgICBpZiAoaW5kZXggPj0gMCkge1xuICAgICAgdmFyIG1hcHBpbmcgPSB0aGlzLl9vcmlnaW5hbE1hcHBpbmdzW2luZGV4XTtcblxuICAgICAgaWYgKGFBcmdzLmNvbHVtbiA9PT0gdW5kZWZpbmVkKSB7XG4gICAgICAgIHZhciBvcmlnaW5hbExpbmUgPSBtYXBwaW5nLm9yaWdpbmFsTGluZTtcblxuICAgICAgICAvLyBJdGVyYXRlIHVudGlsIGVpdGhlciB3ZSBydW4gb3V0IG9mIG1hcHBpbmdzLCBvciB3ZSBydW4gaW50b1xuICAgICAgICAvLyBhIG1hcHBpbmcgZm9yIGEgZGlmZmVyZW50IGxpbmUgdGhhbiB0aGUgb25lIHdlIGZvdW5kLiBTaW5jZVxuICAgICAgICAvLyBtYXBwaW5ncyBhcmUgc29ydGVkLCB0aGlzIGlzIGd1YXJhbnRlZWQgdG8gZmluZCBhbGwgbWFwcGluZ3MgZm9yXG4gICAgICAgIC8vIHRoZSBsaW5lIHdlIGZvdW5kLlxuICAgICAgICB3aGlsZSAobWFwcGluZyAmJiBtYXBwaW5nLm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AgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBzdHIgPSBhU3RyLnNsaWNlKGluZGV4LCBlbmQpO1xuXG4gICAgICAgIHNlZ21lbnQgPSBjYWNoZWRTZWdtZW50c1tzdHJdO1xuICAgICAgICBpZiAoc2VnbWVudCkge1xuICAgICAgICAgIGluZGV4ICs9IHN0ci5sZW5ndGg7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc2VnbWVudCA9IFtdO1xuICAgICAgICAgIHdoaWxlIChpbmRleCA8IGVuZCkge1xuICAgICAgICAgICAgYmFzZTY0VkxRLmRlY29kZShhU3RyLCBpbmRleCwgdGVtcCk7XG4gICAgICAgICAgICB2YWx1ZSA9IHRlbXAudmFsdWU7XG4gICAgICAgICAgICBpbmRleCA9IHRlbXAucmVzdDtcbiAgICAgICAgICAgIHNlZ21lbnQucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAyKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlLCBidXQgbm8gbGluZSBhbmQgY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlIGFuZCBsaW5lLCBidXQgbm8gY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY2FjaGVkU2VnbWVudHNbc3RyXSA9IHNlZ21lbnQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBHZW5lcmF0ZWQgY29sdW1uLlxuICAgICAgICBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiA9IHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uICsgc2VnbWVudFswXTtcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgLy8gT3JpZ2luYWwgc291cmNlLlxuICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gcHJldmlvdXNTb3VyY2UgKyBzZWdtZW50WzFdO1xuICAgICAgICAgIHByZXZpb3VzU291cmNlICs9IHNlZ21lbnRbMV07XG5cbiAgICAgICAgICAvLyBPcmlnaW5hbCBsaW5lLlxuICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxMaW5lID0gcHJldmlvdXNPcmlnaW5hbExpbmUgKyBzZWdtZW50WzJdO1xuICAgICAgICAgIHByZXZpb3VzT3JpZ2luYWxMaW5lID0gbWFwcGluZy5vcmlnaW5hbExpbmU7XG4gICAgICAgICAgLy8gTGluZXMgYXJlIHN0b3JlZCAwLWJhc2VkXG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbExpbmUgKz0gMTtcblxuICAgICAgICAgIC8vIE9yaWdpbmFsIGNvbHVtbi5cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsQ29sdW1uID0gcHJldmlvdXNPcmlnaW5hbENvbHVtbiArIHNlZ21lbnRbM107XG4gICAgICAgICAgcHJldmlvdXNPcmlnaW5hbENvbHVtbiA9IG1hcHBpbmcub3JpZ2luYWxDb2x1bW47XG5cbiAgICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiA0KSB7XG4gICAgICAgICAgICAvLyBPcmlnaW5hbCBuYW1lLlxuICAgICAgICAgICAgbWFwcGluZy5uYW1lID0gcHJldmlvdXNOYW1lICsgc2VnbWVudFs0XTtcbiAgICAgICAgICAgIHByZXZpb3VzTmFtZSArPSBzZWdtZW50WzRdO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGdlbmVyYXRlZE1hcHBpbmdzLnB1c2gobWFwcGluZyk7XG4gICAgICAgIGlmICh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HNvdXJjZSA9IGFSZWxhdGl2ZVBhdGhcbiAgICAgICAgICA/IHV0aWwuam9pbihhUmVsYXRpdmVQYXRoLCBtYXBwaW5nLnNvdXJjZSlcbiAgICAgICAgICA6IG1hcHBpbmcuc291cmNlO1xuICAgICAgICBub2RlLmFkZChuZXcgU291cmNlTm9kZShtYXBwaW5nLm9yaWdpbmFsTGluZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXBwaW5nLm5hbWUpKTtcbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbi8qKlxuICogQWRkIGEgY2h1bmsgb2YgZ2VuZXJhdGVkIEpTIHRvIHRoaXMgc291cmNlIG5vZGUuXG4gKlxuICogQHBhcmFtIGFDaHVuayBBIHN0cmluZyBzbmlwcGV0IG9mIGdlbmVyYXRlZCBKUyBjb2RlLCBhbm90aGVyIGluc3RhbmNlIG9mXG4gKiAgICAgICAgU291cmNlTm9kZSwgb3IgYW4gYXJyYXkgd2hlcmUgZWFjaCBtZW1iZXIgaXMgb25lIG9mIHRob3NlIHRoaW5ncy5cbiAqL1xuU291cmNlTm9kZS5wcm90b3R5cGUuYWRkID0gZnVuY3Rpb24gU291cmNlTm9kZV9hZGQoYUNodW5rKSB7XG4gIGlmIChBcnJheS5pc0FycmF5KGFDaHVuaykpIHtcbiAgICBhQ2h1bmsuZm9yRWFjaChmdW5jdGlvbiAoY2h1bmspIHtcbiAgICAgIHRoaXMuYWRkKGNodW5rKTtcbiAgICB9LCB0aGlzKTtcbiAgfVxuICBlbHNlIGlmIChhQ2h1bmtbaXNTb3VyY2VOb2RlXSB8fCB0eXBlb2YgYUNodW5rID09PSBcInN0cmluZ1wiKSB7XG4gICAgaWYgKG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saW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgY29sdW1uOiBnZW5lcmF0ZWQuY29sdW1uXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBnZW5lcmF0ZWQuY29sdW1uKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbiAgdGhpcy53YWxrU291cmNlQ29udGVudHMoZnVuY3Rpb24gKHNvdXJjZUZpbGUsIHNvdXJjZUNvbnRlbnQpIHtcbiAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHsgY29kZTogZ2VuZXJhdGVkLmNvZGUsIG1hcDogbWFwIH07XG59O1xuXG5leHBvcnRzLlNvdXJjZU5vZGUgPSBTb3VyY2VOb2RlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW5vZGUuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/node_modules/source-map/dist/source-map.js b/node_modules/source-map/dist/source-map.js deleted file mode 100644 index b4eb087..0000000 --- a/node_modules/source-map/dist/source-map.js +++ /dev/null @@ -1,3233 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ - exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { - throw new Error( - 'original.line and original.column are not numbers -- you probably meant to omit ' + - 'the original mapping entirely and only map the generated position. If so, pass ' + - 'null for the original mapping instead of an object with empty or null values.' - ); - } - - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. 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 Google Inc. 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 - * OWNER 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. - */ - - var base64 = __webpack_require__(3); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || urlRegexp.test(aPath); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); - }()); - - function identity (s) { - return s; - } - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - - return aStr; - } - exports.toSetString = supportsNullProto ? identity : toSetString; - - function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; - } - exports.fromSetString = supportsNullProto ? identity : fromSetString; - - function isProtoString(s) { - if (!s) { - return false; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; - } - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 === null) { - return 1; // aStr2 !== null - } - - if (aStr2 === null) { - return -1; // aStr1 !== null - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - - /** - * Strip any JSON XSSI avoidance prefix from the string (as documented - * in the source maps specification), and then parse the string as - * JSON. - */ - function parseSourceMapInput(str) { - return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); - } - exports.parseSourceMapInput = parseSourceMapInput; - - /** - * Compute the URL of a source given the the source root, the source's - * URL, and the source map's URL. - */ - function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { - sourceURL = sourceURL || ''; - - if (sourceRoot) { - // This follows what Chrome does. - if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { - sourceRoot += '/'; - } - // The spec says: - // Line 4: An optional source root, useful for relocating source - // files on a server or removing repeated values in the - // “sources” entry. This value is prepended to the individual - // entries in the “source” field. - sourceURL = sourceRoot + sourceURL; - } - - // Historically, SourceMapConsumer did not take the sourceMapURL as - // a parameter. This mode is still somewhat supported, which is why - // this code block is conditional. However, it's preferable to pass - // the source map URL to SourceMapConsumer, so that this function - // can implement the source URL resolution algorithm as outlined in - // the spec. This block is basically the equivalent of: - // new URL(sourceURL, sourceMapURL).toString() - // ... except it avoids using URL, which wasn't available in the - // older releases of node still supported by this library. - // - // The spec says: - // If the sources are not absolute URLs after prepending of the - // “sourceRoot”, the sources are resolved relative to the - // SourceMap (like resolving script src in a html document). - if (sourceMapURL) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var index = parsed.path.lastIndexOf('/'); - if (index >= 0) { - parsed.path = parsed.path.substring(0, index + 1); - } - } - sourceURL = join(urlGenerate(parsed), sourceURL); - } - - return normalize(sourceURL); - } - exports.computeSourceURL = computeSourceURL; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number is 1-based. - * - column: Optional. the column number in the original source. - * The column number is 0-based. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - needle.source = this._findSourceIndex(needle.source); - if (needle.source < 0) { - return []; - } - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The first parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - if (sourceRoot) { - sourceRoot = util.normalize(sourceRoot); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ - BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - if (this._sources.has(relativeSource)) { - return this._sources.indexOf(relativeSource); - } - - // Maybe aSource is an absolute URL as returned by |sources|. In - // this case we can't simply undo the transform. - var i; - for (i = 0; i < this._absoluteSources.length; ++i) { - if (this._absoluteSources[i] == aSource) { - return i; - } - } - - return -1; - }; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @param String aSourceMapURL - * The URL at which the source map can be found (optional) - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + relativeSource)) { - return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + relativeSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The first parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - } - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[remainingLinesIndex] || ''; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[remainingLinesIndex] || ''; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; \ No newline at end of file diff --git a/node_modules/source-map/dist/source-map.min.js b/node_modules/source-map/dist/source-map.min.js deleted file mode 100644 index c7c72da..0000000 --- a/node_modules/source-map/dist/source-map.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sourceMap=n():e.sourceMap=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){n.SourceMapGenerator=r(1).SourceMapGenerator,n.SourceMapConsumer=r(7).SourceMapConsumer,n.SourceNode=r(10).SourceNode},function(e,n,r){function t(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new a,this._sourcesContents=null}var o=r(2),i=r(4),s=r(5).ArraySet,a=r(6).MappingList;t.prototype._version=3,t.fromSourceMap=function(e){var n=e.sourceRoot,r=new t({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)}),e.sources.forEach(function(t){var o=t;null!==n&&(o=i.relative(n,t)),r._sources.has(o)||r._sources.add(o);var s=e.sourceContentFor(t);null!=s&&r.setSourceContent(t,s)}),r},t.prototype.addMapping=function(e){var n=i.getArg(e,"generated"),r=i.getArg(e,"original",null),t=i.getArg(e,"source",null),o=i.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,t,o),null!=t&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:t,name:o})},t.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=i.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},t.prototype.applySourceMap=function(e,n,r){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var o=this._sourceRoot;null!=o&&(t=i.relative(o,t));var a=new s,u=new s;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var s=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=s.source&&(n.source=s.source,null!=r&&(n.source=i.join(r,n.source)),null!=o&&(n.source=i.relative(o,n.source)),n.originalLine=s.line,n.originalColumn=s.column,null!=s.name&&(n.name=s.name))}var l=n.source;null==l||a.has(l)||a.add(l);var c=n.name;null==c||u.has(c)||u.add(c)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=r&&(n=i.join(r,n)),null!=o&&(n=i.relative(o,n)),this.setSourceContent(n,t))},this)},t.prototype._validateMapping=function(e,n,r,t){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||n||r||t)&&!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:t}))},t.prototype._serializeMappings=function(){for(var e,n,r,t,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),f=0,d=h.length;f0){if(!i.compareByGeneratedPositionsInflated(n,h[f-1]))continue;e+=","}e+=o.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(t=this._sources.indexOf(n.source),e+=o.encode(t-g),g=t,e+=o.encode(n.originalLine-1-l),l=n.originalLine-1,e+=o.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=o.encode(r-c),c=r)),p+=e}return p},t.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=i.relative(n,e));var r=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},t.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},t.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=t},function(e,n,r){function t(e){return e<0?(-e<<1)+1:(e<<1)+0}function o(e){var n=1===(1&e),r=e>>1;return n?-r:r}var i=r(3),s=5,a=1<>>=s,o>0&&(n|=l),r+=i.encode(n);while(o>0);return r},n.decode=function(e,n,r){var t,a,c=e.length,g=0,p=0;do{if(n>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(a=i.decode(e.charCodeAt(n++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=0;c--)s=u[c],"."===s?u.splice(c,1):".."===s?l++:l>0&&(""===s?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return r=u.join("/"),""===r&&(r=a?"/":"."),i?(i.path=r,o(i)):r}function s(e,n){""===e&&(e="."),""===n&&(n=".");var r=t(n),s=t(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||n.match(y))return n;if(s&&!s.host&&!s.path)return s.host=n,o(s);var a="/"===n.charAt(0)?n:i(e.replace(/\/+$/,"")+"/"+n);return s?(s.path=a,o(s)):a}function a(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==n.indexOf(e+"/");){var t=e.lastIndexOf("/");if(t<0)return n;if(e=e.slice(0,t),e.match(/^([^\/]+:\/)?\/*$/))return n;++r}return Array(r+1).join("../")+n.substr(e.length+1)}function u(e){return e}function l(e){return g(e)?"$"+e:e}function c(e){return g(e)?e.slice(1):e}function g(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(e,n,r){var t=f(e.source,n.source);return 0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t||r?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=e.generatedLine-n.generatedLine,0!==t?t:f(e.name,n.name)))))}function h(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t||r?t:(t=f(e.source,n.source),0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:f(e.name,n.name)))))}function f(e,n){return e===n?0:null===e?1:null===n?-1:e>n?1:-1}function d(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=f(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:f(e.name,n.name)))))}function m(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}function _(e,n,r){if(n=n||"",e&&("/"!==e[e.length-1]&&"/"!==n[0]&&(e+="/"),n=e+n),r){var a=t(r);if(!a)throw new Error("sourceMapURL could not be parsed");if(a.path){var u=a.path.lastIndexOf("/");u>=0&&(a.path=a.path.substring(0,u+1))}n=s(o(a),n)}return i(n)}n.getArg=r;var v=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,y=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||v.test(e)},n.relative=a;var C=function(){var e=Object.create(null);return!("__proto__"in e)}();n.toSetString=C?u:l,n.fromSetString=C?u:c,n.compareByOriginalPositions=p,n.compareByGeneratedPositionsDeflated=h,n.compareByGeneratedPositionsInflated=d,n.parseSourceMapInput=m,n.computeSourceURL=_},function(e,n,r){function t(){this._array=[],this._set=s?new Map:Object.create(null)}var o=r(4),i=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;o=0)return n}else{var r=o.toSetString(e);if(i.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},t.prototype.at=function(e){if(e>=0&&er||t==r&&s>=o||i.compareByGeneratedPositionsInflated(e,n)<=0}function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=r(4);o.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},o.prototype.add=function(e){t(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},o.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=o},function(e,n,r){function t(e,n){var r=e;return"string"==typeof e&&(r=a.parseSourceMapInput(e)),null!=r.sections?new s(r,n):new o(r,n)}function o(e,n){var r=e;"string"==typeof e&&(r=a.parseSourceMapInput(e));var t=a.getArg(r,"version"),o=a.getArg(r,"sources"),i=a.getArg(r,"names",[]),s=a.getArg(r,"sourceRoot",null),u=a.getArg(r,"sourcesContent",null),c=a.getArg(r,"mappings"),g=a.getArg(r,"file",null);if(t!=this._version)throw new Error("Unsupported version: "+t);s&&(s=a.normalize(s)),o=o.map(String).map(a.normalize).map(function(e){return s&&a.isAbsolute(s)&&a.isAbsolute(e)?a.relative(s,e):e}),this._names=l.fromArray(i.map(String),!0),this._sources=l.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(e){return a.computeSourceURL(s,e,n)}),this.sourceRoot=s,this.sourcesContent=u,this._mappings=c,this._sourceMapURL=n,this.file=g}function i(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e,n){var r=e;"string"==typeof e&&(r=a.parseSourceMapInput(e));var o=a.getArg(r,"version"),i=a.getArg(r,"sections");if(o!=this._version)throw new Error("Unsupported version: "+o);this._sources=new l,this._names=new l;var s={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var r=a.getArg(e,"offset"),o=a.getArg(r,"line"),i=a.getArg(r,"column");if(o=0){var i=this._originalMappings[o];if(void 0===e.column)for(var s=i.originalLine;i&&i.originalLine===s;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var l=i.originalColumn;i&&i.originalLine===n&&i.originalColumn==l;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return t},n.SourceMapConsumer=t,o.prototype=Object.create(t.prototype),o.prototype.consumer=t,o.prototype._findSourceIndex=function(e){var n=e;if(null!=this.sourceRoot&&(n=a.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);var r;for(r=0;r1&&(r.source=d+o[1],d+=o[1],r.originalLine=h+o[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=m+o[4],m+=o[4])),A.push(r),"number"==typeof r.originalLine&&S.push(r)}g(A,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=A,g(S,a.compareByOriginalPositions),this.__originalMappings=S},o.prototype._findMapping=function(e,n,r,t,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return u.search(e,n,o,i)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=a.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),i=a.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=a.getArg(o,"name",null);return null!==s&&(s=this._names.at(s)),{source:i,line:a.getArg(o,"originalLine",null),column:a.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},o.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var t=e;null!=this.sourceRoot&&(t=a.relative(this.sourceRoot,t));var o;if(null!=this.sourceRoot&&(o=a.urlParse(this.sourceRoot))){var i=t.replace(/^file:\/\//,"");if("file"==o.scheme&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!o.path||"/"==o.path)&&this._sources.has("/"+t))return this.sourcesContent[this._sources.indexOf("/"+t)]}if(n)return null;throw new Error('"'+t+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var n=a.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",t.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=o,s.prototype=Object.create(t.prototype),s.prototype.constructor=t,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],n=0;n0?t-u>1?r(u,t,o,i,s,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,o,i,s,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,o,i){if(0===t.length)return-1;var s=r(-1,t.length,e,t,o,i||n.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===o(t[s],t[s-1],!0);)--s;return s}},function(e,n){function r(e,n,r){var t=e[n];e[n]=e[r],e[r]=t}function t(e,n){return Math.round(e+Math.random()*(n-e))}function o(e,n,i,s){if(i=0;n--)this.prepend(e[n]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},t.prototype.walk=function(e){for(var n,r=0,t=this.children.length;r0){for(n=[],r=0;r 0 && aGenerated.column >= 0\n\t && !aOriginal && !aSource && !aName) {\n\t // Case 1.\n\t return;\n\t }\n\t else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n\t && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n\t && aGenerated.line > 0 && aGenerated.column >= 0\n\t && aOriginal.line > 0 && aOriginal.column >= 0\n\t && aSource) {\n\t // Cases 2 and 3.\n\t return;\n\t }\n\t else {\n\t throw new Error('Invalid mapping: ' + JSON.stringify({\n\t generated: aGenerated,\n\t source: aSource,\n\t original: aOriginal,\n\t name: aName\n\t }));\n\t }\n\t };\n\t\n\t/**\n\t * Serialize the accumulated mappings in to the stream of base 64 VLQs\n\t * specified by the source map format.\n\t */\n\tSourceMapGenerator.prototype._serializeMappings =\n\t function SourceMapGenerator_serializeMappings() {\n\t var previousGeneratedColumn = 0;\n\t var previousGeneratedLine = 1;\n\t var previousOriginalColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousName = 0;\n\t var previousSource = 0;\n\t var result = '';\n\t var next;\n\t var mapping;\n\t var nameIdx;\n\t var sourceIdx;\n\t\n\t var mappings = this._mappings.toArray();\n\t for (var i = 0, len = mappings.length; i < len; i++) {\n\t mapping = mappings[i];\n\t next = ''\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t next += ';';\n\t previousGeneratedLine++;\n\t }\n\t }\n\t else {\n\t if (i > 0) {\n\t if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n\t continue;\n\t }\n\t next += ',';\n\t }\n\t }\n\t\n\t next += base64VLQ.encode(mapping.generatedColumn\n\t - previousGeneratedColumn);\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (mapping.source != null) {\n\t sourceIdx = this._sources.indexOf(mapping.source);\n\t next += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t next += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t next += base64VLQ.encode(mapping.originalColumn\n\t - previousOriginalColumn);\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (mapping.name != null) {\n\t nameIdx = this._names.indexOf(mapping.name);\n\t next += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t\n\t result += next;\n\t }\n\t\n\t return result;\n\t };\n\t\n\tSourceMapGenerator.prototype._generateSourcesContent =\n\t function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n\t return aSources.map(function (source) {\n\t if (!this._sourcesContents) {\n\t return null;\n\t }\n\t if (aSourceRoot != null) {\n\t source = util.relative(aSourceRoot, source);\n\t }\n\t var key = util.toSetString(source);\n\t return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n\t ? this._sourcesContents[key]\n\t : null;\n\t }, this);\n\t };\n\t\n\t/**\n\t * Externalize the source map.\n\t */\n\tSourceMapGenerator.prototype.toJSON =\n\t function SourceMapGenerator_toJSON() {\n\t var map = {\n\t version: this._version,\n\t sources: this._sources.toArray(),\n\t names: this._names.toArray(),\n\t mappings: this._serializeMappings()\n\t };\n\t if (this._file != null) {\n\t map.file = this._file;\n\t }\n\t if (this._sourceRoot != null) {\n\t map.sourceRoot = this._sourceRoot;\n\t }\n\t if (this._sourcesContents) {\n\t map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n\t }\n\t\n\t return map;\n\t };\n\t\n\t/**\n\t * Render the source map being generated to a string.\n\t */\n\tSourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\texports.SourceMapGenerator = SourceMapGenerator;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t *\n\t * Based on the Base 64 VLQ implementation in Closure Compiler:\n\t * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n\t *\n\t * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n\t * Redistribution and use in source and binary forms, with or without\n\t * modification, are permitted provided that the following conditions are\n\t * met:\n\t *\n\t * * Redistributions of source code must retain the above copyright\n\t * notice, this list of conditions and the following disclaimer.\n\t * * Redistributions in binary form must reproduce the above\n\t * copyright notice, this list of conditions and the following\n\t * disclaimer in the documentation and/or other materials provided\n\t * with the distribution.\n\t * * Neither the name of Google Inc. nor the names of its\n\t * contributors may be used to endorse or promote products derived\n\t * from this software without specific prior written permission.\n\t *\n\t * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\t * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\t * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\t * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\t * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\t * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\t * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\t * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\t * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t */\n\t\n\tvar base64 = __webpack_require__(3);\n\t\n\t// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n\t// length quantities we use in the source map spec, the first bit is the sign,\n\t// the next four bits are the actual value, and the 6th bit is the\n\t// continuation bit. The continuation bit tells us whether there are more\n\t// digits in this value following this digit.\n\t//\n\t// Continuation\n\t// | Sign\n\t// | |\n\t// V V\n\t// 101011\n\t\n\tvar VLQ_BASE_SHIFT = 5;\n\t\n\t// binary: 100000\n\tvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t// binary: 011111\n\tvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t// binary: 100000\n\tvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\t\n\t/**\n\t * Converts from a two-complement value to a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n\t * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n\t */\n\tfunction toVLQSigned(aValue) {\n\t return aValue < 0\n\t ? ((-aValue) << 1) + 1\n\t : (aValue << 1) + 0;\n\t}\n\t\n\t/**\n\t * Converts to a two-complement value from a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n\t * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n\t */\n\tfunction fromVLQSigned(aValue) {\n\t var isNegative = (aValue & 1) === 1;\n\t var shifted = aValue >> 1;\n\t return isNegative\n\t ? -shifted\n\t : shifted;\n\t}\n\t\n\t/**\n\t * Returns the base 64 VLQ encoded value.\n\t */\n\texports.encode = function base64VLQ_encode(aValue) {\n\t var encoded = \"\";\n\t var digit;\n\t\n\t var vlq = toVLQSigned(aValue);\n\t\n\t do {\n\t digit = vlq & VLQ_BASE_MASK;\n\t vlq >>>= VLQ_BASE_SHIFT;\n\t if (vlq > 0) {\n\t // There are still more digits in this value, so we must make sure the\n\t // continuation bit is marked.\n\t digit |= VLQ_CONTINUATION_BIT;\n\t }\n\t encoded += base64.encode(digit);\n\t } while (vlq > 0);\n\t\n\t return encoded;\n\t};\n\t\n\t/**\n\t * Decodes the next base 64 VLQ value from the given string and returns the\n\t * value and the rest of the string via the out parameter.\n\t */\n\texports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n\t var strLen = aStr.length;\n\t var result = 0;\n\t var shift = 0;\n\t var continuation, digit;\n\t\n\t do {\n\t if (aIndex >= strLen) {\n\t throw new Error(\"Expected more digits in base 64 VLQ value.\");\n\t }\n\t\n\t digit = base64.decode(aStr.charCodeAt(aIndex++));\n\t if (digit === -1) {\n\t throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n\t }\n\t\n\t continuation = !!(digit & VLQ_CONTINUATION_BIT);\n\t digit &= VLQ_BASE_MASK;\n\t result = result + (digit << shift);\n\t shift += VLQ_BASE_SHIFT;\n\t } while (continuation);\n\t\n\t aOutParam.value = fromVLQSigned(result);\n\t aOutParam.rest = aIndex;\n\t};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\t\n\t/**\n\t * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n\t */\n\texports.encode = function (number) {\n\t if (0 <= number && number < intToCharMap.length) {\n\t return intToCharMap[number];\n\t }\n\t throw new TypeError(\"Must be between 0 and 63: \" + number);\n\t};\n\t\n\t/**\n\t * Decode a single base 64 character code digit to an integer. Returns -1 on\n\t * failure.\n\t */\n\texports.decode = function (charCode) {\n\t var bigA = 65; // 'A'\n\t var bigZ = 90; // 'Z'\n\t\n\t var littleA = 97; // 'a'\n\t var littleZ = 122; // 'z'\n\t\n\t var zero = 48; // '0'\n\t var nine = 57; // '9'\n\t\n\t var plus = 43; // '+'\n\t var slash = 47; // '/'\n\t\n\t var littleOffset = 26;\n\t var numberOffset = 52;\n\t\n\t // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\t if (bigA <= charCode && charCode <= bigZ) {\n\t return (charCode - bigA);\n\t }\n\t\n\t // 26 - 51: abcdefghijklmnopqrstuvwxyz\n\t if (littleA <= charCode && charCode <= littleZ) {\n\t return (charCode - littleA + littleOffset);\n\t }\n\t\n\t // 52 - 61: 0123456789\n\t if (zero <= charCode && charCode <= nine) {\n\t return (charCode - zero + numberOffset);\n\t }\n\t\n\t // 62: +\n\t if (charCode == plus) {\n\t return 62;\n\t }\n\t\n\t // 63: /\n\t if (charCode == slash) {\n\t return 63;\n\t }\n\t\n\t // Invalid base64 digit.\n\t return -1;\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t/**\n\t * This is a helper function for getting values from parameter/options\n\t * objects.\n\t *\n\t * @param args The object we are extracting values from\n\t * @param name The name of the property we are getting.\n\t * @param defaultValue An optional value to return if the property is missing\n\t * from the object. If this is not specified and the property is missing, an\n\t * error will be thrown.\n\t */\n\tfunction getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}\n\texports.getArg = getArg;\n\t\n\tvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\n\tvar dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\tfunction urlParse(aUrl) {\n\t var match = aUrl.match(urlRegexp);\n\t if (!match) {\n\t return null;\n\t }\n\t return {\n\t scheme: match[1],\n\t auth: match[2],\n\t host: match[3],\n\t port: match[4],\n\t path: match[5]\n\t };\n\t}\n\texports.urlParse = urlParse;\n\t\n\tfunction urlGenerate(aParsedUrl) {\n\t var url = '';\n\t if (aParsedUrl.scheme) {\n\t url += aParsedUrl.scheme + ':';\n\t }\n\t url += '//';\n\t if (aParsedUrl.auth) {\n\t url += aParsedUrl.auth + '@';\n\t }\n\t if (aParsedUrl.host) {\n\t url += aParsedUrl.host;\n\t }\n\t if (aParsedUrl.port) {\n\t url += \":\" + aParsedUrl.port\n\t }\n\t if (aParsedUrl.path) {\n\t url += aParsedUrl.path;\n\t }\n\t return url;\n\t}\n\texports.urlGenerate = urlGenerate;\n\t\n\t/**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consecutive slashes with one slash.\n\t * - Removes unnecessary '.' parts.\n\t * - Removes unnecessary '/..' parts.\n\t *\n\t * Based on code in the Node.js 'path' core module.\n\t *\n\t * @param aPath The path or url to normalize.\n\t */\n\tfunction normalize(aPath) {\n\t var path = aPath;\n\t var url = urlParse(aPath);\n\t if (url) {\n\t if (!url.path) {\n\t return aPath;\n\t }\n\t path = url.path;\n\t }\n\t var isAbsolute = exports.isAbsolute(path);\n\t\n\t var parts = path.split(/\\/+/);\n\t for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n\t part = parts[i];\n\t if (part === '.') {\n\t parts.splice(i, 1);\n\t } else if (part === '..') {\n\t up++;\n\t } else if (up > 0) {\n\t if (part === '') {\n\t // The first part is blank if the path is absolute. Trying to go\n\t // above the root is a no-op. Therefore we can remove all '..' parts\n\t // directly after the root.\n\t parts.splice(i + 1, up);\n\t up = 0;\n\t } else {\n\t parts.splice(i, 2);\n\t up--;\n\t }\n\t }\n\t }\n\t path = parts.join('/');\n\t\n\t if (path === '') {\n\t path = isAbsolute ? '/' : '.';\n\t }\n\t\n\t if (url) {\n\t url.path = path;\n\t return urlGenerate(url);\n\t }\n\t return path;\n\t}\n\texports.normalize = normalize;\n\t\n\t/**\n\t * Joins two paths/URLs.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be joined with the root.\n\t *\n\t * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n\t * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n\t * first.\n\t * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n\t * is updated with the result and aRoot is returned. Otherwise the result\n\t * is returned.\n\t * - If aPath is absolute, the result is aPath.\n\t * - Otherwise the two paths are joined with a slash.\n\t * - Joining for example 'http://' and 'www.example.com' is also supported.\n\t */\n\tfunction join(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t if (aPath === \"\") {\n\t aPath = \".\";\n\t }\n\t var aPathUrl = urlParse(aPath);\n\t var aRootUrl = urlParse(aRoot);\n\t if (aRootUrl) {\n\t aRoot = aRootUrl.path || '/';\n\t }\n\t\n\t // `join(foo, '//www.example.org')`\n\t if (aPathUrl && !aPathUrl.scheme) {\n\t if (aRootUrl) {\n\t aPathUrl.scheme = aRootUrl.scheme;\n\t }\n\t return urlGenerate(aPathUrl);\n\t }\n\t\n\t if (aPathUrl || aPath.match(dataUrlRegexp)) {\n\t return aPath;\n\t }\n\t\n\t // `join('http://', 'www.example.com')`\n\t if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n\t aRootUrl.host = aPath;\n\t return urlGenerate(aRootUrl);\n\t }\n\t\n\t var joined = aPath.charAt(0) === '/'\n\t ? aPath\n\t : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\t\n\t if (aRootUrl) {\n\t aRootUrl.path = joined;\n\t return urlGenerate(aRootUrl);\n\t }\n\t return joined;\n\t}\n\texports.join = join;\n\t\n\texports.isAbsolute = function (aPath) {\n\t return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n\t};\n\t\n\t/**\n\t * Make a path relative to a URL or another path.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be made relative to aRoot.\n\t */\n\tfunction relative(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t\n\t aRoot = aRoot.replace(/\\/$/, '');\n\t\n\t // It is possible for the path to be above the root. In this case, simply\n\t // checking whether the root is a prefix of the path won't work. Instead, we\n\t // need to remove components from the root one by one, until either we find\n\t // a prefix that fits, or we run out of components to remove.\n\t var level = 0;\n\t while (aPath.indexOf(aRoot + '/') !== 0) {\n\t var index = aRoot.lastIndexOf(\"/\");\n\t if (index < 0) {\n\t return aPath;\n\t }\n\t\n\t // If the only part of the root that is left is the scheme (i.e. http://,\n\t // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n\t // have exhausted all components, so the path is not relative to the root.\n\t aRoot = aRoot.slice(0, index);\n\t if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n\t return aPath;\n\t }\n\t\n\t ++level;\n\t }\n\t\n\t // Make sure we add a \"../\" for each component we removed from the root.\n\t return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n\t}\n\texports.relative = relative;\n\t\n\tvar supportsNullProto = (function () {\n\t var obj = Object.create(null);\n\t return !('__proto__' in obj);\n\t}());\n\t\n\tfunction identity (s) {\n\t return s;\n\t}\n\t\n\t/**\n\t * Because behavior goes wacky when you set `__proto__` on objects, we\n\t * have to prefix all the strings in our set with an arbitrary character.\n\t *\n\t * See https://github.com/mozilla/source-map/pull/31 and\n\t * https://github.com/mozilla/source-map/issues/30\n\t *\n\t * @param String aStr\n\t */\n\tfunction toSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return '$' + aStr;\n\t }\n\t\n\t return aStr;\n\t}\n\texports.toSetString = supportsNullProto ? identity : toSetString;\n\t\n\tfunction fromSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return aStr.slice(1);\n\t }\n\t\n\t return aStr;\n\t}\n\texports.fromSetString = supportsNullProto ? identity : fromSetString;\n\t\n\tfunction isProtoString(s) {\n\t if (!s) {\n\t return false;\n\t }\n\t\n\t var length = s.length;\n\t\n\t if (length < 9 /* \"__proto__\".length */) {\n\t return false;\n\t }\n\t\n\t if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n\t s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n\t s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n\t s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 9) !== 95 /* '_' */) {\n\t return false;\n\t }\n\t\n\t for (var i = length - 10; i >= 0; i--) {\n\t if (s.charCodeAt(i) !== 36 /* '$' */) {\n\t return false;\n\t }\n\t }\n\t\n\t return true;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings where the original positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same original source/line/column, but different generated\n\t * line and column the same. Useful when searching for a mapping with a\n\t * stubbed out mapping.\n\t */\n\tfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n\t var cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0 || onlyCompareOriginal) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByOriginalPositions = compareByOriginalPositions;\n\t\n\t/**\n\t * Comparator between two mappings with deflated source and name indices where\n\t * the generated positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same generated line and column, but different\n\t * source/name/original line and column the same. Useful when searching for a\n\t * mapping with a stubbed out mapping.\n\t */\n\tfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0 || onlyCompareGenerated) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\tfunction strcmp(aStr1, aStr2) {\n\t if (aStr1 === aStr2) {\n\t return 0;\n\t }\n\t\n\t if (aStr1 === null) {\n\t return 1; // aStr2 !== null\n\t }\n\t\n\t if (aStr2 === null) {\n\t return -1; // aStr1 !== null\n\t }\n\t\n\t if (aStr1 > aStr2) {\n\t return 1;\n\t }\n\t\n\t return -1;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings with inflated source and name strings where\n\t * the generated positions are compared.\n\t */\n\tfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\t\n\t/**\n\t * Strip any JSON XSSI avoidance prefix from the string (as documented\n\t * in the source maps specification), and then parse the string as\n\t * JSON.\n\t */\n\tfunction parseSourceMapInput(str) {\n\t return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n\t}\n\texports.parseSourceMapInput = parseSourceMapInput;\n\t\n\t/**\n\t * Compute the URL of a source given the the source root, the source's\n\t * URL, and the source map's URL.\n\t */\n\tfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n\t sourceURL = sourceURL || '';\n\t\n\t if (sourceRoot) {\n\t // This follows what Chrome does.\n\t if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n\t sourceRoot += '/';\n\t }\n\t // The spec says:\n\t // Line 4: An optional source root, useful for relocating source\n\t // files on a server or removing repeated values in the\n\t // “sources” entry. This value is prepended to the individual\n\t // entries in the “source” field.\n\t sourceURL = sourceRoot + sourceURL;\n\t }\n\t\n\t // Historically, SourceMapConsumer did not take the sourceMapURL as\n\t // a parameter. This mode is still somewhat supported, which is why\n\t // this code block is conditional. However, it's preferable to pass\n\t // the source map URL to SourceMapConsumer, so that this function\n\t // can implement the source URL resolution algorithm as outlined in\n\t // the spec. This block is basically the equivalent of:\n\t // new URL(sourceURL, sourceMapURL).toString()\n\t // ... except it avoids using URL, which wasn't available in the\n\t // older releases of node still supported by this library.\n\t //\n\t // The spec says:\n\t // If the sources are not absolute URLs after prepending of the\n\t // “sourceRoot”, the sources are resolved relative to the\n\t // SourceMap (like resolving script src in a html document).\n\t if (sourceMapURL) {\n\t var parsed = urlParse(sourceMapURL);\n\t if (!parsed) {\n\t throw new Error(\"sourceMapURL could not be parsed\");\n\t }\n\t if (parsed.path) {\n\t // Strip the last path component, but keep the \"/\".\n\t var index = parsed.path.lastIndexOf('/');\n\t if (index >= 0) {\n\t parsed.path = parsed.path.substring(0, index + 1);\n\t }\n\t }\n\t sourceURL = join(urlGenerate(parsed), sourceURL);\n\t }\n\t\n\t return normalize(sourceURL);\n\t}\n\texports.computeSourceURL = computeSourceURL;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar hasNativeMap = typeof Map !== \"undefined\";\n\t\n\t/**\n\t * A data structure which is a combination of an array and a set. Adding a new\n\t * member is O(1), testing for membership is O(1), and finding the index of an\n\t * element is O(1). Removing elements from the set is not supported. Only\n\t * strings are supported for membership.\n\t */\n\tfunction ArraySet() {\n\t this._array = [];\n\t this._set = hasNativeMap ? new Map() : Object.create(null);\n\t}\n\t\n\t/**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\tArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n\t var set = new ArraySet();\n\t for (var i = 0, len = aArray.length; i < len; i++) {\n\t set.add(aArray[i], aAllowDuplicates);\n\t }\n\t return set;\n\t};\n\t\n\t/**\n\t * Return how many unique items are in this ArraySet. If duplicates have been\n\t * added, than those do not count towards the size.\n\t *\n\t * @returns Number\n\t */\n\tArraySet.prototype.size = function ArraySet_size() {\n\t return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n\t};\n\t\n\t/**\n\t * Add the given string to this set.\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n\t var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n\t var idx = this._array.length;\n\t if (!isDuplicate || aAllowDuplicates) {\n\t this._array.push(aStr);\n\t }\n\t if (!isDuplicate) {\n\t if (hasNativeMap) {\n\t this._set.set(aStr, idx);\n\t } else {\n\t this._set[sStr] = idx;\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Is the given string a member of this set?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.has = function ArraySet_has(aStr) {\n\t if (hasNativeMap) {\n\t return this._set.has(aStr);\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t return has.call(this._set, sStr);\n\t }\n\t};\n\t\n\t/**\n\t * What is the index of the given string in the array?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t if (hasNativeMap) {\n\t var idx = this._set.get(aStr);\n\t if (idx >= 0) {\n\t return idx;\n\t }\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t if (has.call(this._set, sStr)) {\n\t return this._set[sStr];\n\t }\n\t }\n\t\n\t throw new Error('\"' + aStr + '\" is not in the set.');\n\t};\n\t\n\t/**\n\t * What is the element at the given index?\n\t *\n\t * @param Number aIdx\n\t */\n\tArraySet.prototype.at = function ArraySet_at(aIdx) {\n\t if (aIdx >= 0 && aIdx < this._array.length) {\n\t return this._array[aIdx];\n\t }\n\t throw new Error('No element indexed by ' + aIdx);\n\t};\n\t\n\t/**\n\t * Returns the array representation of this set (which has the proper indices\n\t * indicated by indexOf). Note that this is a copy of the internal array used\n\t * for storing the members so that no one can mess with internal state.\n\t */\n\tArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t};\n\t\n\texports.ArraySet = ArraySet;\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2014 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\t\n\t/**\n\t * Determine whether mappingB is after mappingA with respect to generated\n\t * position.\n\t */\n\tfunction generatedPositionAfter(mappingA, mappingB) {\n\t // Optimized for most common case\n\t var lineA = mappingA.generatedLine;\n\t var lineB = mappingB.generatedLine;\n\t var columnA = mappingA.generatedColumn;\n\t var columnB = mappingB.generatedColumn;\n\t return lineB > lineA || lineB == lineA && columnB >= columnA ||\n\t util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n\t}\n\t\n\t/**\n\t * A data structure to provide a sorted view of accumulated mappings in a\n\t * performance conscious manner. It trades a neglibable overhead in general\n\t * case for a large speedup in case of mappings being added in order.\n\t */\n\tfunction MappingList() {\n\t this._array = [];\n\t this._sorted = true;\n\t // Serves as infimum\n\t this._last = {generatedLine: -1, generatedColumn: 0};\n\t}\n\t\n\t/**\n\t * Iterate through internal items. This method takes the same arguments that\n\t * `Array.prototype.forEach` takes.\n\t *\n\t * NOTE: The order of the mappings is NOT guaranteed.\n\t */\n\tMappingList.prototype.unsortedForEach =\n\t function MappingList_forEach(aCallback, aThisArg) {\n\t this._array.forEach(aCallback, aThisArg);\n\t };\n\t\n\t/**\n\t * Add the given source mapping.\n\t *\n\t * @param Object aMapping\n\t */\n\tMappingList.prototype.add = function MappingList_add(aMapping) {\n\t if (generatedPositionAfter(this._last, aMapping)) {\n\t this._last = aMapping;\n\t this._array.push(aMapping);\n\t } else {\n\t this._sorted = false;\n\t this._array.push(aMapping);\n\t }\n\t};\n\t\n\t/**\n\t * Returns the flat, sorted array of mappings. The mappings are sorted by\n\t * generated position.\n\t *\n\t * WARNING: This method returns internal data without copying, for\n\t * performance. The return value must NOT be mutated, and should be treated as\n\t * an immutable borrow. If you want to take ownership, you must make your own\n\t * copy.\n\t */\n\tMappingList.prototype.toArray = function MappingList_toArray() {\n\t if (!this._sorted) {\n\t this._array.sort(util.compareByGeneratedPositionsInflated);\n\t this._sorted = true;\n\t }\n\t return this._array;\n\t};\n\t\n\texports.MappingList = MappingList;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar binarySearch = __webpack_require__(8);\n\tvar ArraySet = __webpack_require__(5).ArraySet;\n\tvar base64VLQ = __webpack_require__(2);\n\tvar quickSort = __webpack_require__(9).quickSort;\n\t\n\tfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = util.parseSourceMapInput(aSourceMap);\n\t }\n\t\n\t return sourceMap.sections != null\n\t ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n\t : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n\t}\n\t\n\tSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n\t return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n\t}\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tSourceMapConsumer.prototype._version = 3;\n\t\n\t// `__generatedMappings` and `__originalMappings` are arrays that hold the\n\t// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n\t// are lazily instantiated, accessed via the `_generatedMappings` and\n\t// `_originalMappings` getters respectively, and we only parse the mappings\n\t// and create these arrays once queried for a source location. We jump through\n\t// these hoops because there can be many thousands of mappings, and parsing\n\t// them is expensive, so we only want to do it if we must.\n\t//\n\t// Each object in the arrays is of the form:\n\t//\n\t// {\n\t// generatedLine: The line number in the generated code,\n\t// generatedColumn: The column number in the generated code,\n\t// source: The path to the original source file that generated this\n\t// chunk of code,\n\t// originalLine: The line number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// originalColumn: The column number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// name: The name of the original symbol which generated this chunk of\n\t// code.\n\t// }\n\t//\n\t// All properties except for `generatedLine` and `generatedColumn` can be\n\t// `null`.\n\t//\n\t// `_generatedMappings` is ordered by the generated positions.\n\t//\n\t// `_originalMappings` is ordered by the original positions.\n\t\n\tSourceMapConsumer.prototype.__generatedMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n\t configurable: true,\n\t enumerable: true,\n\t get: function () {\n\t if (!this.__generatedMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__generatedMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype.__originalMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n\t configurable: true,\n\t enumerable: true,\n\t get: function () {\n\t if (!this.__originalMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__originalMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype._charIsMappingSeparator =\n\t function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n\t var c = aStr.charAt(index);\n\t return c === \";\" || c === \",\";\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\tSourceMapConsumer.GENERATED_ORDER = 1;\n\tSourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\tSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\tSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Iterate over each mapping between an original source/line/column and a\n\t * generated line/column in this source map.\n\t *\n\t * @param Function aCallback\n\t * The function that is called with each mapping.\n\t * @param Object aContext\n\t * Optional. If specified, this object will be the value of `this` every\n\t * time that `aCallback` is called.\n\t * @param aOrder\n\t * Either `SourceMapConsumer.GENERATED_ORDER` or\n\t * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n\t * iterate over the mappings sorted by the generated file's line/column\n\t * order or the original's source/line/column order, respectively. Defaults to\n\t * `SourceMapConsumer.GENERATED_ORDER`.\n\t */\n\tSourceMapConsumer.prototype.eachMapping =\n\t function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n\t var context = aContext || null;\n\t var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\t\n\t var mappings;\n\t switch (order) {\n\t case SourceMapConsumer.GENERATED_ORDER:\n\t mappings = this._generatedMappings;\n\t break;\n\t case SourceMapConsumer.ORIGINAL_ORDER:\n\t mappings = this._originalMappings;\n\t break;\n\t default:\n\t throw new Error(\"Unknown order of iteration.\");\n\t }\n\t\n\t var sourceRoot = this.sourceRoot;\n\t mappings.map(function (mapping) {\n\t var source = mapping.source === null ? null : this._sources.at(mapping.source);\n\t source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n\t return {\n\t source: source,\n\t generatedLine: mapping.generatedLine,\n\t generatedColumn: mapping.generatedColumn,\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: mapping.name === null ? null : this._names.at(mapping.name)\n\t };\n\t }, this).forEach(aCallback, context);\n\t };\n\t\n\t/**\n\t * Returns all generated line and column information for the original source,\n\t * line, and column provided. If no column is provided, returns all mappings\n\t * corresponding to a either the line we are searching for or the next\n\t * closest line that has any mappings. Otherwise, returns all mappings\n\t * corresponding to the given line and either the column we are searching for\n\t * or the next closest column that has any offsets.\n\t *\n\t * The only argument is an object with the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source. The line number is 1-based.\n\t * - column: Optional. the column number in the original source.\n\t * The column number is 0-based.\n\t *\n\t * and an array of objects is returned, each with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the generated source, or null.\n\t * The column number is 0-based.\n\t */\n\tSourceMapConsumer.prototype.allGeneratedPositionsFor =\n\t function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n\t var line = util.getArg(aArgs, 'line');\n\t\n\t // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n\t // returns the index of the closest mapping less than the needle. By\n\t // setting needle.originalColumn to 0, we thus find the last mapping for\n\t // the given line, provided such a mapping exists.\n\t var needle = {\n\t source: util.getArg(aArgs, 'source'),\n\t originalLine: line,\n\t originalColumn: util.getArg(aArgs, 'column', 0)\n\t };\n\t\n\t needle.source = this._findSourceIndex(needle.source);\n\t if (needle.source < 0) {\n\t return [];\n\t }\n\t\n\t var mappings = [];\n\t\n\t var index = this._findMapping(needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t binarySearch.LEAST_UPPER_BOUND);\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (aArgs.column === undefined) {\n\t var originalLine = mapping.originalLine;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we found. Since\n\t // mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we found.\n\t while (mapping && mapping.originalLine === originalLine) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t } else {\n\t var originalColumn = mapping.originalColumn;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we were searching for.\n\t // Since mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we are searching for.\n\t while (mapping &&\n\t mapping.originalLine === line &&\n\t mapping.originalColumn == originalColumn) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t }\n\t }\n\t\n\t return mappings;\n\t };\n\t\n\texports.SourceMapConsumer = SourceMapConsumer;\n\t\n\t/**\n\t * A BasicSourceMapConsumer instance represents a parsed source map which we can\n\t * query for information about the original file positions by giving it a file\n\t * position in the generated source.\n\t *\n\t * The first parameter is the raw source map (either as a JSON string, or\n\t * already parsed to an object). According to the spec, source maps have the\n\t * following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - sources: An array of URLs to the original source files.\n\t * - names: An array of identifiers which can be referrenced by individual mappings.\n\t * - sourceRoot: Optional. The URL root from which all sources are relative.\n\t * - sourcesContent: Optional. An array of contents of the original source files.\n\t * - mappings: A string of base64 VLQs which contain the actual mappings.\n\t * - file: Optional. The generated file this source map is associated with.\n\t *\n\t * Here is an example source map, taken from the source map spec[0]:\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"out.js\",\n\t * sourceRoot : \"\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AA,AB;;ABCDE;\"\n\t * }\n\t *\n\t * The second parameter, if given, is a string whose value is the URL\n\t * at which the source map was found. This URL is used to compute the\n\t * sources array.\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n\t */\n\tfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = util.parseSourceMapInput(aSourceMap);\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sources = util.getArg(sourceMap, 'sources');\n\t // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n\t // requires the array) to play nice here.\n\t var names = util.getArg(sourceMap, 'names', []);\n\t var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n\t var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n\t var mappings = util.getArg(sourceMap, 'mappings');\n\t var file = util.getArg(sourceMap, 'file', null);\n\t\n\t // Once again, Sass deviates from the spec and supplies the version as a\n\t // string rather than a number, so we use loose equality checking here.\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t if (sourceRoot) {\n\t sourceRoot = util.normalize(sourceRoot);\n\t }\n\t\n\t sources = sources\n\t .map(String)\n\t // Some source maps produce relative source paths like \"./foo.js\" instead of\n\t // \"foo.js\". Normalize these first so that future comparisons will succeed.\n\t // See bugzil.la/1090768.\n\t .map(util.normalize)\n\t // Always ensure that absolute sources are internally stored relative to\n\t // the source root, if the source root is absolute. Not doing this would\n\t // be particularly problematic when the source root is a prefix of the\n\t // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n\t .map(function (source) {\n\t return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n\t ? util.relative(sourceRoot, source)\n\t : source;\n\t });\n\t\n\t // Pass `true` below to allow duplicate names and sources. While source maps\n\t // are intended to be compressed and deduplicated, the TypeScript compiler\n\t // sometimes generates source maps with duplicates in them. See Github issue\n\t // #72 and bugzil.la/889492.\n\t this._names = ArraySet.fromArray(names.map(String), true);\n\t this._sources = ArraySet.fromArray(sources, true);\n\t\n\t this._absoluteSources = this._sources.toArray().map(function (s) {\n\t return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n\t });\n\t\n\t this.sourceRoot = sourceRoot;\n\t this.sourcesContent = sourcesContent;\n\t this._mappings = mappings;\n\t this._sourceMapURL = aSourceMapURL;\n\t this.file = file;\n\t}\n\t\n\tBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\t\n\t/**\n\t * Utility function to find the index of a source. Returns -1 if not\n\t * found.\n\t */\n\tBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n\t var relativeSource = aSource;\n\t if (this.sourceRoot != null) {\n\t relativeSource = util.relative(this.sourceRoot, relativeSource);\n\t }\n\t\n\t if (this._sources.has(relativeSource)) {\n\t return this._sources.indexOf(relativeSource);\n\t }\n\t\n\t // Maybe aSource is an absolute URL as returned by |sources|. In\n\t // this case we can't simply undo the transform.\n\t var i;\n\t for (i = 0; i < this._absoluteSources.length; ++i) {\n\t if (this._absoluteSources[i] == aSource) {\n\t return i;\n\t }\n\t }\n\t\n\t return -1;\n\t};\n\t\n\t/**\n\t * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n\t *\n\t * @param SourceMapGenerator aSourceMap\n\t * The source map that will be consumed.\n\t * @param String aSourceMapURL\n\t * The URL at which the source map can be found (optional)\n\t * @returns BasicSourceMapConsumer\n\t */\n\tBasicSourceMapConsumer.fromSourceMap =\n\t function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n\t var smc = Object.create(BasicSourceMapConsumer.prototype);\n\t\n\t var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n\t var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n\t smc.sourceRoot = aSourceMap._sourceRoot;\n\t smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n\t smc.sourceRoot);\n\t smc.file = aSourceMap._file;\n\t smc._sourceMapURL = aSourceMapURL;\n\t smc._absoluteSources = smc._sources.toArray().map(function (s) {\n\t return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n\t });\n\t\n\t // Because we are modifying the entries (by converting string sources and\n\t // names to indices into the sources and names ArraySets), we have to make\n\t // a copy of the entry or else bad things happen. Shared mutable state\n\t // strikes again! See github issue #191.\n\t\n\t var generatedMappings = aSourceMap._mappings.toArray().slice();\n\t var destGeneratedMappings = smc.__generatedMappings = [];\n\t var destOriginalMappings = smc.__originalMappings = [];\n\t\n\t for (var i = 0, length = generatedMappings.length; i < length; i++) {\n\t var srcMapping = generatedMappings[i];\n\t var destMapping = new Mapping;\n\t destMapping.generatedLine = srcMapping.generatedLine;\n\t destMapping.generatedColumn = srcMapping.generatedColumn;\n\t\n\t if (srcMapping.source) {\n\t destMapping.source = sources.indexOf(srcMapping.source);\n\t destMapping.originalLine = srcMapping.originalLine;\n\t destMapping.originalColumn = srcMapping.originalColumn;\n\t\n\t if (srcMapping.name) {\n\t destMapping.name = names.indexOf(srcMapping.name);\n\t }\n\t\n\t destOriginalMappings.push(destMapping);\n\t }\n\t\n\t destGeneratedMappings.push(destMapping);\n\t }\n\t\n\t quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\t\n\t return smc;\n\t };\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tBasicSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t return this._absoluteSources.slice();\n\t }\n\t});\n\t\n\t/**\n\t * Provide the JIT with a nice shape / hidden class.\n\t */\n\tfunction Mapping() {\n\t this.generatedLine = 0;\n\t this.generatedColumn = 0;\n\t this.source = null;\n\t this.originalLine = null;\n\t this.originalColumn = null;\n\t this.name = null;\n\t}\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tBasicSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t var generatedLine = 1;\n\t var previousGeneratedColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousOriginalColumn = 0;\n\t var previousSource = 0;\n\t var previousName = 0;\n\t var length = aStr.length;\n\t var index = 0;\n\t var cachedSegments = {};\n\t var temp = {};\n\t var originalMappings = [];\n\t var generatedMappings = [];\n\t var mapping, str, segment, end, value;\n\t\n\t while (index < length) {\n\t if (aStr.charAt(index) === ';') {\n\t generatedLine++;\n\t index++;\n\t previousGeneratedColumn = 0;\n\t }\n\t else if (aStr.charAt(index) === ',') {\n\t index++;\n\t }\n\t else {\n\t mapping = new Mapping();\n\t mapping.generatedLine = generatedLine;\n\t\n\t // Because each offset is encoded relative to the previous one,\n\t // many segments often have the same encoding. We can exploit this\n\t // fact by caching the parsed variable length fields of each segment,\n\t // allowing us to avoid a second parse if we encounter the same\n\t // segment again.\n\t for (end = index; end < length; end++) {\n\t if (this._charIsMappingSeparator(aStr, end)) {\n\t break;\n\t }\n\t }\n\t str = aStr.slice(index, end);\n\t\n\t segment = cachedSegments[str];\n\t if (segment) {\n\t index += str.length;\n\t } else {\n\t segment = [];\n\t while (index < end) {\n\t base64VLQ.decode(aStr, index, temp);\n\t value = temp.value;\n\t index = temp.rest;\n\t segment.push(value);\n\t }\n\t\n\t if (segment.length === 2) {\n\t throw new Error('Found a source, but no line and column');\n\t }\n\t\n\t if (segment.length === 3) {\n\t throw new Error('Found a source and line, but no column');\n\t }\n\t\n\t cachedSegments[str] = segment;\n\t }\n\t\n\t // Generated column.\n\t mapping.generatedColumn = previousGeneratedColumn + segment[0];\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (segment.length > 1) {\n\t // Original source.\n\t mapping.source = previousSource + segment[1];\n\t previousSource += segment[1];\n\t\n\t // Original line.\n\t mapping.originalLine = previousOriginalLine + segment[2];\n\t previousOriginalLine = mapping.originalLine;\n\t // Lines are stored 0-based\n\t mapping.originalLine += 1;\n\t\n\t // Original column.\n\t mapping.originalColumn = previousOriginalColumn + segment[3];\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (segment.length > 4) {\n\t // Original name.\n\t mapping.name = previousName + segment[4];\n\t previousName += segment[4];\n\t }\n\t }\n\t\n\t generatedMappings.push(mapping);\n\t if (typeof mapping.originalLine === 'number') {\n\t originalMappings.push(mapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t this.__generatedMappings = generatedMappings;\n\t\n\t quickSort(originalMappings, util.compareByOriginalPositions);\n\t this.__originalMappings = originalMappings;\n\t };\n\t\n\t/**\n\t * Find the mapping that best matches the hypothetical \"needle\" mapping that\n\t * we are searching for in the given \"haystack\" of mappings.\n\t */\n\tBasicSourceMapConsumer.prototype._findMapping =\n\t function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n\t aColumnName, aComparator, aBias) {\n\t // To return the position we are searching for, we must first find the\n\t // mapping for the given position and then return the opposite position it\n\t // points to. Because the mappings are sorted, we can use binary search to\n\t // find the best mapping.\n\t\n\t if (aNeedle[aLineName] <= 0) {\n\t throw new TypeError('Line must be greater than or equal to 1, got '\n\t + aNeedle[aLineName]);\n\t }\n\t if (aNeedle[aColumnName] < 0) {\n\t throw new TypeError('Column must be greater than or equal to 0, got '\n\t + aNeedle[aColumnName]);\n\t }\n\t\n\t return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n\t };\n\t\n\t/**\n\t * Compute the last column for each generated mapping. The last column is\n\t * inclusive.\n\t */\n\tBasicSourceMapConsumer.prototype.computeColumnSpans =\n\t function SourceMapConsumer_computeColumnSpans() {\n\t for (var index = 0; index < this._generatedMappings.length; ++index) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t // Mappings do not contain a field for the last generated columnt. We\n\t // can come up with an optimistic estimate, however, by assuming that\n\t // mappings are contiguous (i.e. given two consecutive mappings, the\n\t // first mapping ends where the second one starts).\n\t if (index + 1 < this._generatedMappings.length) {\n\t var nextMapping = this._generatedMappings[index + 1];\n\t\n\t if (mapping.generatedLine === nextMapping.generatedLine) {\n\t mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n\t continue;\n\t }\n\t }\n\t\n\t // The last mapping for each line spans the entire line.\n\t mapping.lastGeneratedColumn = Infinity;\n\t }\n\t };\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source. The line number\n\t * is 1-based.\n\t * - column: The column number in the generated source. The column\n\t * number is 0-based.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the original source, or null. The\n\t * column number is 0-based.\n\t * - name: The original identifier, or null.\n\t */\n\tBasicSourceMapConsumer.prototype.originalPositionFor =\n\t function SourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._generatedMappings,\n\t \"generatedLine\",\n\t \"generatedColumn\",\n\t util.compareByGeneratedPositionsDeflated,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t if (mapping.generatedLine === needle.generatedLine) {\n\t var source = util.getArg(mapping, 'source', null);\n\t if (source !== null) {\n\t source = this._sources.at(source);\n\t source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n\t }\n\t var name = util.getArg(mapping, 'name', null);\n\t if (name !== null) {\n\t name = this._names.at(name);\n\t }\n\t return {\n\t source: source,\n\t line: util.getArg(mapping, 'originalLine', null),\n\t column: util.getArg(mapping, 'originalColumn', null),\n\t name: name\n\t };\n\t }\n\t }\n\t\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function BasicSourceMapConsumer_hasContentsOfAllSources() {\n\t if (!this.sourcesContent) {\n\t return false;\n\t }\n\t return this.sourcesContent.length >= this._sources.size() &&\n\t !this.sourcesContent.some(function (sc) { return sc == null; });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tBasicSourceMapConsumer.prototype.sourceContentFor =\n\t function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t if (!this.sourcesContent) {\n\t return null;\n\t }\n\t\n\t var index = this._findSourceIndex(aSource);\n\t if (index >= 0) {\n\t return this.sourcesContent[index];\n\t }\n\t\n\t var relativeSource = aSource;\n\t if (this.sourceRoot != null) {\n\t relativeSource = util.relative(this.sourceRoot, relativeSource);\n\t }\n\t\n\t var url;\n\t if (this.sourceRoot != null\n\t && (url = util.urlParse(this.sourceRoot))) {\n\t // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n\t // many users. We can help them out when they expect file:// URIs to\n\t // behave like it would if they were running a local HTTP server. See\n\t // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n\t var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n\t if (url.scheme == \"file\"\n\t && this._sources.has(fileUriAbsPath)) {\n\t return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n\t }\n\t\n\t if ((!url.path || url.path == \"/\")\n\t && this._sources.has(\"/\" + relativeSource)) {\n\t return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n\t }\n\t }\n\t\n\t // This function is used recursively from\n\t // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n\t // don't want to throw if we can't find the source - we just want to\n\t // return null, so we provide a flag to exit gracefully.\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source. The line number\n\t * is 1-based.\n\t * - column: The column number in the original source. The column\n\t * number is 0-based.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the generated source, or null.\n\t * The column number is 0-based.\n\t */\n\tBasicSourceMapConsumer.prototype.generatedPositionFor =\n\t function SourceMapConsumer_generatedPositionFor(aArgs) {\n\t var source = util.getArg(aArgs, 'source');\n\t source = this._findSourceIndex(source);\n\t if (source < 0) {\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t }\n\t\n\t var needle = {\n\t source: source,\n\t originalLine: util.getArg(aArgs, 'line'),\n\t originalColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (mapping.source === needle.source) {\n\t return {\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t };\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t };\n\t\n\texports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\t\n\t/**\n\t * An IndexedSourceMapConsumer instance represents a parsed source map which\n\t * we can query for information. It differs from BasicSourceMapConsumer in\n\t * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n\t * input.\n\t *\n\t * The first parameter is a raw source map (either as a JSON string, or already\n\t * parsed to an object). According to the spec for indexed source maps, they\n\t * have the following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - file: Optional. The generated file this source map is associated with.\n\t * - sections: A list of section definitions.\n\t *\n\t * Each value under the \"sections\" field has two fields:\n\t * - offset: The offset into the original specified at which this section\n\t * begins to apply, defined as an object with a \"line\" and \"column\"\n\t * field.\n\t * - map: A source map definition. This source map could also be indexed,\n\t * but doesn't have to be.\n\t *\n\t * Instead of the \"map\" field, it's also possible to have a \"url\" field\n\t * specifying a URL to retrieve a source map from, but that's currently\n\t * unsupported.\n\t *\n\t * Here's an example source map, taken from the source map spec[0], but\n\t * modified to omit a section which uses the \"url\" field.\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"app.js\",\n\t * sections: [{\n\t * offset: {line:100, column:10},\n\t * map: {\n\t * version : 3,\n\t * file: \"section.js\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AAAA,E;;ABCDE;\"\n\t * }\n\t * }],\n\t * }\n\t *\n\t * The second parameter, if given, is a string whose value is the URL\n\t * at which the source map was found. This URL is used to compute the\n\t * sources array.\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n\t */\n\tfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = util.parseSourceMapInput(aSourceMap);\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sections = util.getArg(sourceMap, 'sections');\n\t\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t this._sources = new ArraySet();\n\t this._names = new ArraySet();\n\t\n\t var lastOffset = {\n\t line: -1,\n\t column: 0\n\t };\n\t this._sections = sections.map(function (s) {\n\t if (s.url) {\n\t // The url field will require support for asynchronicity.\n\t // See https://github.com/mozilla/source-map/issues/16\n\t throw new Error('Support for url field in sections not implemented.');\n\t }\n\t var offset = util.getArg(s, 'offset');\n\t var offsetLine = util.getArg(offset, 'line');\n\t var offsetColumn = util.getArg(offset, 'column');\n\t\n\t if (offsetLine < lastOffset.line ||\n\t (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n\t throw new Error('Section offsets must be ordered and non-overlapping.');\n\t }\n\t lastOffset = offset;\n\t\n\t return {\n\t generatedOffset: {\n\t // The offset fields are 0-based, but we use 1-based indices when\n\t // encoding/decoding from VLQ.\n\t generatedLine: offsetLine + 1,\n\t generatedColumn: offsetColumn + 1\n\t },\n\t consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n\t }\n\t });\n\t}\n\t\n\tIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tIndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t var sources = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n\t sources.push(this._sections[i].consumer.sources[j]);\n\t }\n\t }\n\t return sources;\n\t }\n\t});\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source. The line number\n\t * is 1-based.\n\t * - column: The column number in the generated source. The column\n\t * number is 0-based.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null. The\n\t * line number is 1-based.\n\t * - column: The column number in the original source, or null. The\n\t * column number is 0-based.\n\t * - name: The original identifier, or null.\n\t */\n\tIndexedSourceMapConsumer.prototype.originalPositionFor =\n\t function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t // Find the section containing the generated position we're trying to map\n\t // to an original position.\n\t var sectionIndex = binarySearch.search(needle, this._sections,\n\t function(needle, section) {\n\t var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n\t if (cmp) {\n\t return cmp;\n\t }\n\t\n\t return (needle.generatedColumn -\n\t section.generatedOffset.generatedColumn);\n\t });\n\t var section = this._sections[sectionIndex];\n\t\n\t if (!section) {\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t }\n\t\n\t return section.consumer.originalPositionFor({\n\t line: needle.generatedLine -\n\t (section.generatedOffset.generatedLine - 1),\n\t column: needle.generatedColumn -\n\t (section.generatedOffset.generatedLine === needle.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t bias: aArgs.bias\n\t });\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n\t return this._sections.every(function (s) {\n\t return s.consumer.hasContentsOfAllSources();\n\t });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tIndexedSourceMapConsumer.prototype.sourceContentFor =\n\t function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t var content = section.consumer.sourceContentFor(aSource, true);\n\t if (content) {\n\t return content;\n\t }\n\t }\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source. The line number\n\t * is 1-based.\n\t * - column: The column number in the original source. The column\n\t * number is 0-based.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null. The\n\t * line number is 1-based. \n\t * - column: The column number in the generated source, or null.\n\t * The column number is 0-based.\n\t */\n\tIndexedSourceMapConsumer.prototype.generatedPositionFor =\n\t function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t // Only consider this section if the requested source is in the list of\n\t // sources of the consumer.\n\t if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n\t continue;\n\t }\n\t var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n\t if (generatedPosition) {\n\t var ret = {\n\t line: generatedPosition.line +\n\t (section.generatedOffset.generatedLine - 1),\n\t column: generatedPosition.column +\n\t (section.generatedOffset.generatedLine === generatedPosition.line\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0)\n\t };\n\t return ret;\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null\n\t };\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tIndexedSourceMapConsumer.prototype._parseMappings =\n\t function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t this.__generatedMappings = [];\n\t this.__originalMappings = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t var sectionMappings = section.consumer._generatedMappings;\n\t for (var j = 0; j < sectionMappings.length; j++) {\n\t var mapping = sectionMappings[j];\n\t\n\t var source = section.consumer._sources.at(mapping.source);\n\t source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n\t this._sources.add(source);\n\t source = this._sources.indexOf(source);\n\t\n\t var name = null;\n\t if (mapping.name) {\n\t name = section.consumer._names.at(mapping.name);\n\t this._names.add(name);\n\t name = this._names.indexOf(name);\n\t }\n\t\n\t // The mappings coming from the consumer for the section have\n\t // generated positions relative to the start of the section, so we\n\t // need to offset them to be relative to the start of the concatenated\n\t // generated file.\n\t var adjustedMapping = {\n\t source: source,\n\t generatedLine: mapping.generatedLine +\n\t (section.generatedOffset.generatedLine - 1),\n\t generatedColumn: mapping.generatedColumn +\n\t (section.generatedOffset.generatedLine === mapping.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: name\n\t };\n\t\n\t this.__generatedMappings.push(adjustedMapping);\n\t if (typeof adjustedMapping.originalLine === 'number') {\n\t this.__originalMappings.push(adjustedMapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t quickSort(this.__originalMappings, util.compareByOriginalPositions);\n\t };\n\t\n\texports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\texports.GREATEST_LOWER_BOUND = 1;\n\texports.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Recursive implementation of binary search.\n\t *\n\t * @param aLow Indices here and lower do not contain the needle.\n\t * @param aHigh Indices here and higher do not contain the needle.\n\t * @param aNeedle The element being searched for.\n\t * @param aHaystack The non-empty array being searched.\n\t * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t */\n\tfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n\t // This function terminates when one of the following is true:\n\t //\n\t // 1. We find the exact element we are looking for.\n\t //\n\t // 2. We did not find the exact element, but we can return the index of\n\t // the next-closest element.\n\t //\n\t // 3. We did not find the exact element, and there is no next-closest\n\t // element than the one we are searching for, so we return -1.\n\t var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n\t var cmp = aCompare(aNeedle, aHaystack[mid], true);\n\t if (cmp === 0) {\n\t // Found the element we are looking for.\n\t return mid;\n\t }\n\t else if (cmp > 0) {\n\t // Our needle is greater than aHaystack[mid].\n\t if (aHigh - mid > 1) {\n\t // The element is in the upper half.\n\t return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // The exact needle element was not found in this haystack. Determine if\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return aHigh < aHaystack.length ? aHigh : -1;\n\t } else {\n\t return mid;\n\t }\n\t }\n\t else {\n\t // Our needle is less than aHaystack[mid].\n\t if (mid - aLow > 1) {\n\t // The element is in the lower half.\n\t return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return mid;\n\t } else {\n\t return aLow < 0 ? -1 : aLow;\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * This is an implementation of binary search which will always try and return\n\t * the index of the closest element if there is no exact hit. This is because\n\t * mappings between original and generated line/col pairs are single points,\n\t * and there is an implicit region between each of them, so a miss just means\n\t * that you aren't on the very start of a region.\n\t *\n\t * @param aNeedle The element you are looking for.\n\t * @param aHaystack The array that is being searched.\n\t * @param aCompare A function which takes the needle and an element in the\n\t * array and returns -1, 0, or 1 depending on whether the needle is less\n\t * than, equal to, or greater than the element, respectively.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n\t */\n\texports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n\t if (aHaystack.length === 0) {\n\t return -1;\n\t }\n\t\n\t var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n\t aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n\t if (index < 0) {\n\t return -1;\n\t }\n\t\n\t // We have found either the exact element, or the next-closest element than\n\t // the one we are searching for. However, there may be more than one such\n\t // element. Make sure we always return the smallest of these.\n\t while (index - 1 >= 0) {\n\t if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n\t break;\n\t }\n\t --index;\n\t }\n\t\n\t return index;\n\t};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t// It turns out that some (most?) JavaScript engines don't self-host\n\t// `Array.prototype.sort`. This makes sense because C++ will likely remain\n\t// faster than JS when doing raw CPU-intensive sorting. However, when using a\n\t// custom comparator function, calling back and forth between the VM's C++ and\n\t// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n\t// worse generated code for the comparator function than would be optimal. In\n\t// fact, when sorting with a comparator, these costs outweigh the benefits of\n\t// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n\t// a ~3500ms mean speed-up in `bench/bench.html`.\n\t\n\t/**\n\t * Swap the elements indexed by `x` and `y` in the array `ary`.\n\t *\n\t * @param {Array} ary\n\t * The array.\n\t * @param {Number} x\n\t * The index of the first item.\n\t * @param {Number} y\n\t * The index of the second item.\n\t */\n\tfunction swap(ary, x, y) {\n\t var temp = ary[x];\n\t ary[x] = ary[y];\n\t ary[y] = temp;\n\t}\n\t\n\t/**\n\t * Returns a random integer within the range `low .. high` inclusive.\n\t *\n\t * @param {Number} low\n\t * The lower bound on the range.\n\t * @param {Number} high\n\t * The upper bound on the range.\n\t */\n\tfunction randomIntInRange(low, high) {\n\t return Math.round(low + (Math.random() * (high - low)));\n\t}\n\t\n\t/**\n\t * The Quick Sort algorithm.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t * @param {Number} p\n\t * Start index of the array\n\t * @param {Number} r\n\t * End index of the array\n\t */\n\tfunction doQuickSort(ary, comparator, p, r) {\n\t // If our lower bound is less than our upper bound, we (1) partition the\n\t // array into two pieces and (2) recurse on each half. If it is not, this is\n\t // the empty array and our base case.\n\t\n\t if (p < r) {\n\t // (1) Partitioning.\n\t //\n\t // The partitioning chooses a pivot between `p` and `r` and moves all\n\t // elements that are less than or equal to the pivot to the before it, and\n\t // all the elements that are greater than it after it. The effect is that\n\t // once partition is done, the pivot is in the exact place it will be when\n\t // the array is put in sorted order, and it will not need to be moved\n\t // again. This runs in O(n) time.\n\t\n\t // Always choose a random pivot so that an input array which is reverse\n\t // sorted does not cause O(n^2) running time.\n\t var pivotIndex = randomIntInRange(p, r);\n\t var i = p - 1;\n\t\n\t swap(ary, pivotIndex, r);\n\t var pivot = ary[r];\n\t\n\t // Immediately after `j` is incremented in this loop, the following hold\n\t // true:\n\t //\n\t // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n\t //\n\t // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n\t for (var j = p; j < r; j++) {\n\t if (comparator(ary[j], pivot) <= 0) {\n\t i += 1;\n\t swap(ary, i, j);\n\t }\n\t }\n\t\n\t swap(ary, i + 1, j);\n\t var q = i + 1;\n\t\n\t // (2) Recurse on each half.\n\t\n\t doQuickSort(ary, comparator, p, q - 1);\n\t doQuickSort(ary, comparator, q + 1, r);\n\t }\n\t}\n\t\n\t/**\n\t * Sort the given array in-place with the given comparator function.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t */\n\texports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\n\t};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\tvar util = __webpack_require__(4);\n\t\n\t// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n\t// operating systems these days (capturing the result).\n\tvar REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t// Newline character code for charCodeAt() comparisons\n\tvar NEWLINE_CODE = 10;\n\t\n\t// Private symbol for identifying `SourceNode`s when multiple versions of\n\t// the source-map library are loaded. This MUST NOT CHANGE across\n\t// versions!\n\tvar isSourceNode = \"$$$isSourceNode$$$\";\n\t\n\t/**\n\t * SourceNodes provide a way to abstract over interpolating/concatenating\n\t * snippets of generated JavaScript source code while maintaining the line and\n\t * column information associated with the original source code.\n\t *\n\t * @param aLine The original line number.\n\t * @param aColumn The original column number.\n\t * @param aSource The original source's filename.\n\t * @param aChunks Optional. An array of strings which are snippets of\n\t * generated JS, or other SourceNodes.\n\t * @param aName The original identifier.\n\t */\n\tfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n\t this.children = [];\n\t this.sourceContents = {};\n\t this.line = aLine == null ? null : aLine;\n\t this.column = aColumn == null ? null : aColumn;\n\t this.source = aSource == null ? null : aSource;\n\t this.name = aName == null ? null : aName;\n\t this[isSourceNode] = true;\n\t if (aChunks != null) this.add(aChunks);\n\t}\n\t\n\t/**\n\t * Creates a SourceNode from generated code and a SourceMapConsumer.\n\t *\n\t * @param aGeneratedCode The generated code\n\t * @param aSourceMapConsumer The SourceMap for the generated code\n\t * @param aRelativePath Optional. The path that relative sources in the\n\t * SourceMapConsumer should be relative to.\n\t */\n\tSourceNode.fromStringWithSourceMap =\n\t function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n\t // The SourceNode we want to fill with the generated code\n\t // and the SourceMap\n\t var node = new SourceNode();\n\t\n\t // All even indices of this array are one line of the generated code,\n\t // while all odd indices are the newlines between two adjacent lines\n\t // (since `REGEX_NEWLINE` captures its match).\n\t // Processed fragments are accessed by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var remainingLinesIndex = 0;\n\t var shiftNextLine = function() {\n\t var lineContents = getNextLine();\n\t // The last line of a file might not have a newline.\n\t var newLine = getNextLine() || \"\";\n\t return lineContents + newLine;\n\t\n\t function getNextLine() {\n\t return remainingLinesIndex < remainingLines.length ?\n\t remainingLines[remainingLinesIndex++] : undefined;\n\t }\n\t };\n\t\n\t // We need to remember the position of \"remainingLines\"\n\t var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\t\n\t // The generate SourceNodes we need a code range.\n\t // To extract it current and last mapping is used.\n\t // Here we store the last mapping.\n\t var lastMapping = null;\n\t\n\t aSourceMapConsumer.eachMapping(function (mapping) {\n\t if (lastMapping !== null) {\n\t // We add the code from \"lastMapping\" to \"mapping\":\n\t // First check if there is a new line in between.\n\t if (lastGeneratedLine < mapping.generatedLine) {\n\t // Associate first line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t lastGeneratedLine++;\n\t lastGeneratedColumn = 0;\n\t // The remaining code is added without mapping\n\t } else {\n\t // There is no new line in between.\n\t // Associate the code between \"lastGeneratedColumn\" and\n\t // \"mapping.generatedColumn\" with \"lastMapping\"\n\t var nextLine = remainingLines[remainingLinesIndex] || '';\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t addMappingWithCode(lastMapping, code);\n\t // No more remaining code, continue\n\t lastMapping = mapping;\n\t return;\n\t }\n\t }\n\t // We add the generated code until the first mapping\n\t // to the SourceNode without any mapping.\n\t // Each line is added as separate string.\n\t while (lastGeneratedLine < mapping.generatedLine) {\n\t node.add(shiftNextLine());\n\t lastGeneratedLine++;\n\t }\n\t if (lastGeneratedColumn < mapping.generatedColumn) {\n\t var nextLine = remainingLines[remainingLinesIndex] || '';\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t }\n\t lastMapping = mapping;\n\t }, this);\n\t // We have processed all mappings.\n\t if (remainingLinesIndex < remainingLines.length) {\n\t if (lastMapping) {\n\t // Associate the remaining code in the current line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t }\n\t // and add the remaining lines without any mapping\n\t node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n\t }\n\t\n\t // Copy sourcesContent into SourceNode\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t if (aRelativePath != null) {\n\t sourceFile = util.join(aRelativePath, sourceFile);\n\t }\n\t node.setSourceContent(sourceFile, content);\n\t }\n\t });\n\t\n\t return node;\n\t\n\t function addMappingWithCode(mapping, code) {\n\t if (mapping === null || mapping.source === undefined) {\n\t node.add(code);\n\t } else {\n\t var source = aRelativePath\n\t ? util.join(aRelativePath, mapping.source)\n\t : mapping.source;\n\t node.add(new SourceNode(mapping.originalLine,\n\t mapping.originalColumn,\n\t source,\n\t code,\n\t mapping.name));\n\t }\n\t }\n\t };\n\t\n\t/**\n\t * Add a chunk of generated JS to this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.add = function SourceNode_add(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t aChunk.forEach(function (chunk) {\n\t this.add(chunk);\n\t }, this);\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t if (aChunk) {\n\t this.children.push(aChunk);\n\t }\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Add a chunk of generated JS to the beginning of this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t for (var i = aChunk.length-1; i >= 0; i--) {\n\t this.prepend(aChunk[i]);\n\t }\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t this.children.unshift(aChunk);\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Walk over the tree of JS snippets in this node and its children. The\n\t * walking function is called once for each snippet of JS and is passed that\n\t * snippet and the its original associated source's line/column location.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n\t var chunk;\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t chunk = this.children[i];\n\t if (chunk[isSourceNode]) {\n\t chunk.walk(aFn);\n\t }\n\t else {\n\t if (chunk !== '') {\n\t aFn(chunk, { source: this.source,\n\t line: this.line,\n\t column: this.column,\n\t name: this.name });\n\t }\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n\t * each of `this.children`.\n\t *\n\t * @param aSep The separator.\n\t */\n\tSourceNode.prototype.join = function SourceNode_join(aSep) {\n\t var newChildren;\n\t var i;\n\t var len = this.children.length;\n\t if (len > 0) {\n\t newChildren = [];\n\t for (i = 0; i < len-1; i++) {\n\t newChildren.push(this.children[i]);\n\t newChildren.push(aSep);\n\t }\n\t newChildren.push(this.children[i]);\n\t this.children = newChildren;\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Call String.prototype.replace on the very right-most source snippet. Useful\n\t * for trimming whitespace from the end of a source node, etc.\n\t *\n\t * @param aPattern The pattern to replace.\n\t * @param aReplacement The thing to replace the pattern with.\n\t */\n\tSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n\t var lastChild = this.children[this.children.length - 1];\n\t if (lastChild[isSourceNode]) {\n\t lastChild.replaceRight(aPattern, aReplacement);\n\t }\n\t else if (typeof lastChild === 'string') {\n\t this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n\t }\n\t else {\n\t this.children.push(''.replace(aPattern, aReplacement));\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Set the source content for a source file. This will be added to the SourceMapGenerator\n\t * in the sourcesContent field.\n\t *\n\t * @param aSourceFile The filename of the source file\n\t * @param aSourceContent The content of the source file\n\t */\n\tSourceNode.prototype.setSourceContent =\n\t function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n\t this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n\t };\n\t\n\t/**\n\t * Walk over the tree of SourceNodes. The walking function is called for each\n\t * source file content and is passed the filename and source content.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walkSourceContents =\n\t function SourceNode_walkSourceContents(aFn) {\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t if (this.children[i][isSourceNode]) {\n\t this.children[i].walkSourceContents(aFn);\n\t }\n\t }\n\t\n\t var sources = Object.keys(this.sourceContents);\n\t for (var i = 0, len = sources.length; i < len; i++) {\n\t aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n\t }\n\t };\n\t\n\t/**\n\t * Return the string representation of this source node. Walks over the tree\n\t * and concatenates all the various snippets together to one string.\n\t */\n\tSourceNode.prototype.toString = function SourceNode_toString() {\n\t var str = \"\";\n\t this.walk(function (chunk) {\n\t str += chunk;\n\t });\n\t return str;\n\t};\n\t\n\t/**\n\t * Returns the string representation of this source node along with a source\n\t * map.\n\t */\n\tSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n\t var generated = {\n\t code: \"\",\n\t line: 1,\n\t column: 0\n\t };\n\t var map = new SourceMapGenerator(aArgs);\n\t var sourceMappingActive = false;\n\t var lastOriginalSource = null;\n\t var lastOriginalLine = null;\n\t var lastOriginalColumn = null;\n\t var lastOriginalName = null;\n\t this.walk(function (chunk, original) {\n\t generated.code += chunk;\n\t if (original.source !== null\n\t && original.line !== null\n\t && original.column !== null) {\n\t if(lastOriginalSource !== original.source\n\t || lastOriginalLine !== original.line\n\t || lastOriginalColumn !== original.column\n\t || lastOriginalName !== original.name) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t lastOriginalSource = original.source;\n\t lastOriginalLine = original.line;\n\t lastOriginalColumn = original.column;\n\t lastOriginalName = original.name;\n\t sourceMappingActive = true;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t }\n\t });\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t }\n\t for (var idx = 0, length = chunk.length; idx < length; idx++) {\n\t if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n\t generated.line++;\n\t generated.column = 0;\n\t // Mappings end at eol\n\t if (idx + 1 === length) {\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t } else {\n\t generated.column++;\n\t }\n\t }\n\t });\n\t this.walkSourceContents(function (sourceFile, sourceContent) {\n\t map.setSourceContent(sourceFile, sourceContent);\n\t });\n\t\n\t return { code: generated.code, map: map };\n\t};\n\t\n\texports.SourceNode = SourceNode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// source-map.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 0fd5815da764db5fb9fe","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./source-map.js\n// module id = 0\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var sourceRelative = sourceFile;\n if (sourceRoot !== null) {\n sourceRelative = util.relative(sourceRoot, sourceFile);\n }\n\n if (!generator._sources.has(sourceRelative)) {\n generator._sources.add(sourceRelative);\n }\n\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * 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\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 === null) {\n return 1; // aStr2 !== null\n }\n\n if (aStr2 === null) {\n return -1; // aStr1 !== null\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented\n * in the source maps specification), and then parse the string as\n * JSON.\n */\nfunction parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n}\nexports.parseSourceMapInput = parseSourceMapInput;\n\n/**\n * Compute the URL of a source given the the source root, the source's\n * URL, and the source map's URL.\n */\nfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n sourceURL = sourceURL || '';\n\n if (sourceRoot) {\n // This follows what Chrome does.\n if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n sourceRoot += '/';\n }\n // The spec says:\n // Line 4: An optional source root, useful for relocating source\n // files on a server or removing repeated values in the\n // “sources” entry. This value is prepended to the individual\n // entries in the “source” field.\n sourceURL = sourceRoot + sourceURL;\n }\n\n // Historically, SourceMapConsumer did not take the sourceMapURL as\n // a parameter. This mode is still somewhat supported, which is why\n // this code block is conditional. However, it's preferable to pass\n // the source map URL to SourceMapConsumer, so that this function\n // can implement the source URL resolution algorithm as outlined in\n // the spec. This block is basically the equivalent of:\n // new URL(sourceURL, sourceMapURL).toString()\n // ... except it avoids using URL, which wasn't available in the\n // older releases of node still supported by this library.\n //\n // The spec says:\n // If the sources are not absolute URLs after prepending of the\n // “sourceRoot”, the sources are resolved relative to the\n // SourceMap (like resolving script src in a html document).\n if (sourceMapURL) {\n var parsed = urlParse(sourceMapURL);\n if (!parsed) {\n throw new Error(\"sourceMapURL could not be parsed\");\n }\n if (parsed.path) {\n // Strip the last path component, but keep the \"/\".\n var index = parsed.path.lastIndexOf('/');\n if (index >= 0) {\n parsed.path = parsed.path.substring(0, index + 1);\n }\n }\n sourceURL = join(urlGenerate(parsed), sourceURL);\n }\n\n return normalize(sourceURL);\n}\nexports.computeSourceURL = computeSourceURL;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number is 1-based.\n * - column: Optional. the column number in the original source.\n * The column number is 0-based.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n needle.source = this._findSourceIndex(needle.source);\n if (needle.source < 0) {\n return [];\n }\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The first parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n if (sourceRoot) {\n sourceRoot = util.normalize(sourceRoot);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this._absoluteSources = this._sources.toArray().map(function (s) {\n return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n });\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this._sourceMapURL = aSourceMapURL;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Utility function to find the index of a source. Returns -1 if not\n * found.\n */\nBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n if (this._sources.has(relativeSource)) {\n return this._sources.indexOf(relativeSource);\n }\n\n // Maybe aSource is an absolute URL as returned by |sources|. In\n // this case we can't simply undo the transform.\n var i;\n for (i = 0; i < this._absoluteSources.length; ++i) {\n if (this._absoluteSources[i] == aSource) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @param String aSourceMapURL\n * The URL at which the source map can be found (optional)\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n smc._sourceMapURL = aSourceMapURL;\n smc._absoluteSources = smc._sources.toArray().map(function (s) {\n return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n });\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._absoluteSources.slice();\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n var index = this._findSourceIndex(aSource);\n if (index >= 0) {\n return this.sourcesContent[index];\n }\n\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + relativeSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The first parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based. \n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = null;\n if (mapping.name) {\n name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex] || '';\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex] || '';\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/source-map/lib/array-set.js b/node_modules/source-map/lib/array-set.js deleted file mode 100644 index fbd5c81..0000000 --- a/node_modules/source-map/lib/array-set.js +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = require('./util'); -var has = Object.prototype.hasOwnProperty; -var hasNativeMap = typeof Map !== "undefined"; - -/** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ -function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); -} - -/** - * Static method for creating ArraySet instances from an existing array. - */ -ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; -}; - -/** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ -ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; -}; - -/** - * Add the given string to this set. - * - * @param String aStr - */ -ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } -}; - -/** - * Is the given string a member of this set? - * - * @param String aStr - */ -ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } -}; - -/** - * What is the index of the given string in the array? - * - * @param String aStr - */ -ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); -}; - -/** - * What is the element at the given index? - * - * @param Number aIdx - */ -ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); -}; - -/** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ -ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); -}; - -exports.ArraySet = ArraySet; diff --git a/node_modules/source-map/lib/base64-vlq.js b/node_modules/source-map/lib/base64-vlq.js deleted file mode 100644 index 612b404..0000000 --- a/node_modules/source-map/lib/base64-vlq.js +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. 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 Google Inc. 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 - * OWNER 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. - */ - -var base64 = require('./base64'); - -// A single base 64 digit can contain 6 bits of data. For the base 64 variable -// length quantities we use in the source map spec, the first bit is the sign, -// the next four bits are the actual value, and the 6th bit is the -// continuation bit. The continuation bit tells us whether there are more -// digits in this value following this digit. -// -// Continuation -// | Sign -// | | -// V V -// 101011 - -var VLQ_BASE_SHIFT = 5; - -// binary: 100000 -var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - -// binary: 011111 -var VLQ_BASE_MASK = VLQ_BASE - 1; - -// binary: 100000 -var VLQ_CONTINUATION_BIT = VLQ_BASE; - -/** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ -function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; -} - -/** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ -function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; -} - -/** - * Returns the base 64 VLQ encoded value. - */ -exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; -}; - -/** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ -exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; -}; diff --git a/node_modules/source-map/lib/base64.js b/node_modules/source-map/lib/base64.js deleted file mode 100644 index 8aa86b3..0000000 --- a/node_modules/source-map/lib/base64.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - -/** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ -exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); -}; - -/** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ -exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; -}; diff --git a/node_modules/source-map/lib/binary-search.js b/node_modules/source-map/lib/binary-search.js deleted file mode 100644 index 010ac94..0000000 --- a/node_modules/source-map/lib/binary-search.js +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -exports.GREATEST_LOWER_BOUND = 1; -exports.LEAST_UPPER_BOUND = 2; - -/** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ -function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } -} - -/** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ -exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; -}; diff --git a/node_modules/source-map/lib/mapping-list.js b/node_modules/source-map/lib/mapping-list.js deleted file mode 100644 index 06d1274..0000000 --- a/node_modules/source-map/lib/mapping-list.js +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = require('./util'); - -/** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ -function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; -} - -/** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ -function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; -} - -/** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ -MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - -/** - * Add the given source mapping. - * - * @param Object aMapping - */ -MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } -}; - -/** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ -MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; -}; - -exports.MappingList = MappingList; diff --git a/node_modules/source-map/lib/quick-sort.js b/node_modules/source-map/lib/quick-sort.js deleted file mode 100644 index 6a7caad..0000000 --- a/node_modules/source-map/lib/quick-sort.js +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -// It turns out that some (most?) JavaScript engines don't self-host -// `Array.prototype.sort`. This makes sense because C++ will likely remain -// faster than JS when doing raw CPU-intensive sorting. However, when using a -// custom comparator function, calling back and forth between the VM's C++ and -// JIT'd JS is rather slow *and* loses JIT type information, resulting in -// worse generated code for the comparator function than would be optimal. In -// fact, when sorting with a comparator, these costs outweigh the benefits of -// sorting in C++. By using our own JS-implemented Quick Sort (below), we get -// a ~3500ms mean speed-up in `bench/bench.html`. - -/** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ -function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; -} - -/** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ -function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); -} - -/** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ -function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } -} - -/** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ -exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); -}; diff --git a/node_modules/source-map/lib/source-map-consumer.js b/node_modules/source-map/lib/source-map-consumer.js deleted file mode 100644 index 7b99d1d..0000000 --- a/node_modules/source-map/lib/source-map-consumer.js +++ /dev/null @@ -1,1145 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = require('./util'); -var binarySearch = require('./binary-search'); -var ArraySet = require('./array-set').ArraySet; -var base64VLQ = require('./base64-vlq'); -var quickSort = require('./quick-sort').quickSort; - -function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); -} - -SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); -} - -/** - * The version of the source mapping spec that we are consuming. - */ -SourceMapConsumer.prototype._version = 3; - -// `__generatedMappings` and `__originalMappings` are arrays that hold the -// parsed mapping coordinates from the source map's "mappings" attribute. They -// are lazily instantiated, accessed via the `_generatedMappings` and -// `_originalMappings` getters respectively, and we only parse the mappings -// and create these arrays once queried for a source location. We jump through -// these hoops because there can be many thousands of mappings, and parsing -// them is expensive, so we only want to do it if we must. -// -// Each object in the arrays is of the form: -// -// { -// generatedLine: The line number in the generated code, -// generatedColumn: The column number in the generated code, -// source: The path to the original source file that generated this -// chunk of code, -// originalLine: The line number in the original source that -// corresponds to this chunk of generated code, -// originalColumn: The column number in the original source that -// corresponds to this chunk of generated code, -// name: The name of the original symbol which generated this chunk of -// code. -// } -// -// All properties except for `generatedLine` and `generatedColumn` can be -// `null`. -// -// `_generatedMappings` is ordered by the generated positions. -// -// `_originalMappings` is ordered by the original positions. - -SourceMapConsumer.prototype.__generatedMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } -}); - -SourceMapConsumer.prototype.__originalMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } -}); - -SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - -SourceMapConsumer.GENERATED_ORDER = 1; -SourceMapConsumer.ORIGINAL_ORDER = 2; - -SourceMapConsumer.GREATEST_LOWER_BOUND = 1; -SourceMapConsumer.LEAST_UPPER_BOUND = 2; - -/** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ -SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - -/** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number is 1-based. - * - column: Optional. the column number in the original source. - * The column number is 0-based. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ -SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - needle.source = this._findSourceIndex(needle.source); - if (needle.source < 0) { - return []; - } - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - -exports.SourceMapConsumer = SourceMapConsumer; - -/** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The first parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ -function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - if (sourceRoot) { - sourceRoot = util.normalize(sourceRoot); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; -} - -BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - -/** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ -BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - if (this._sources.has(relativeSource)) { - return this._sources.indexOf(relativeSource); - } - - // Maybe aSource is an absolute URL as returned by |sources|. In - // this case we can't simply undo the transform. - var i; - for (i = 0; i < this._absoluteSources.length; ++i) { - if (this._absoluteSources[i] == aSource) { - return i; - } - } - - return -1; -}; - -/** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @param String aSourceMapURL - * The URL at which the source map can be found (optional) - * @returns BasicSourceMapConsumer - */ -BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - -/** - * The version of the source mapping spec that we are consuming. - */ -BasicSourceMapConsumer.prototype._version = 3; - -/** - * The list of original sources. - */ -Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); - } -}); - -/** - * Provide the JIT with a nice shape / hidden class. - */ -function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; -} - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - -/** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ -BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - -/** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ -BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - -/** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ -BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + relativeSource)) { - return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + relativeSource + '" is not in the SourceMap.'); - } - }; - -/** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ -BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - -exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - -/** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The first parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ -function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) - } - }); -} - -IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - -/** - * The version of the source mapping spec that we are consuming. - */ -IndexedSourceMapConsumer.prototype._version = 3; - -/** - * The list of original sources. - */ -Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } -}); - -/** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ -IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - -/** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ -IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - } - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - -exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; diff --git a/node_modules/source-map/lib/source-map-generator.js b/node_modules/source-map/lib/source-map-generator.js deleted file mode 100644 index 508bcfb..0000000 --- a/node_modules/source-map/lib/source-map-generator.js +++ /dev/null @@ -1,425 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var base64VLQ = require('./base64-vlq'); -var util = require('./util'); -var ArraySet = require('./array-set').ArraySet; -var MappingList = require('./mapping-list').MappingList; - -/** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ -function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; -} - -SourceMapGenerator.prototype._version = 3; - -/** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ -SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - -/** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ -SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - -/** - * Set the source content for a source file. - */ -SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - -/** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ -SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - -/** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ -SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { - throw new Error( - 'original.line and original.column are not numbers -- you probably meant to omit ' + - 'the original mapping entirely and only map the generated position. If so, pass ' + - 'null for the original mapping instead of an object with empty or null values.' - ); - } - - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - -/** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ -SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - }; - -SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - -/** - * Externalize the source map. - */ -SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - -/** - * Render the source map being generated to a string. - */ -SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - -exports.SourceMapGenerator = SourceMapGenerator; diff --git a/node_modules/source-map/lib/source-node.js b/node_modules/source-map/lib/source-node.js deleted file mode 100644 index 8bcdbe3..0000000 --- a/node_modules/source-map/lib/source-node.js +++ /dev/null @@ -1,413 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; -var util = require('./util'); - -// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other -// operating systems these days (capturing the result). -var REGEX_NEWLINE = /(\r?\n)/; - -// Newline character code for charCodeAt() comparisons -var NEWLINE_CODE = 10; - -// Private symbol for identifying `SourceNode`s when multiple versions of -// the source-map library are loaded. This MUST NOT CHANGE across -// versions! -var isSourceNode = "$$$isSourceNode$$$"; - -/** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ -function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); -} - -/** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ -SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[remainingLinesIndex] || ''; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[remainingLinesIndex] || ''; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - -/** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ -SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; -}; - -/** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ -SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; -}; - -/** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ -SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } -}; - -/** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ -SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; -}; - -/** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ -SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; -}; - -/** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ -SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - -/** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ -SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - -/** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ -SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; -}; - -/** - * Returns the string representation of this source node along with a source - * map. - */ -SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; -}; - -exports.SourceNode = SourceNode; diff --git a/node_modules/source-map/lib/util.js b/node_modules/source-map/lib/util.js deleted file mode 100644 index 3ca92e5..0000000 --- a/node_modules/source-map/lib/util.js +++ /dev/null @@ -1,488 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -/** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ -function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } -} -exports.getArg = getArg; - -var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; -var dataUrlRegexp = /^data:.+\,.+$/; - -function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; -} -exports.urlParse = urlParse; - -function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; -} -exports.urlGenerate = urlGenerate; - -/** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ -function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; -} -exports.normalize = normalize; - -/** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ -function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; -} -exports.join = join; - -exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || urlRegexp.test(aPath); -}; - -/** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ -function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); -} -exports.relative = relative; - -var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); -}()); - -function identity (s) { - return s; -} - -/** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ -function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - - return aStr; -} -exports.toSetString = supportsNullProto ? identity : toSetString; - -function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; -} -exports.fromSetString = supportsNullProto ? identity : fromSetString; - -function isProtoString(s) { - if (!s) { - return false; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; -} - -/** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ -function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByOriginalPositions = compareByOriginalPositions; - -/** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ -function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - -function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 === null) { - return 1; // aStr2 !== null - } - - if (aStr2 === null) { - return -1; // aStr1 !== null - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; -} - -/** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ -function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - -/** - * Strip any JSON XSSI avoidance prefix from the string (as documented - * in the source maps specification), and then parse the string as - * JSON. - */ -function parseSourceMapInput(str) { - return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); -} -exports.parseSourceMapInput = parseSourceMapInput; - -/** - * Compute the URL of a source given the the source root, the source's - * URL, and the source map's URL. - */ -function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { - sourceURL = sourceURL || ''; - - if (sourceRoot) { - // This follows what Chrome does. - if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { - sourceRoot += '/'; - } - // The spec says: - // Line 4: An optional source root, useful for relocating source - // files on a server or removing repeated values in the - // “sources” entry. This value is prepended to the individual - // entries in the “source” field. - sourceURL = sourceRoot + sourceURL; - } - - // Historically, SourceMapConsumer did not take the sourceMapURL as - // a parameter. This mode is still somewhat supported, which is why - // this code block is conditional. However, it's preferable to pass - // the source map URL to SourceMapConsumer, so that this function - // can implement the source URL resolution algorithm as outlined in - // the spec. This block is basically the equivalent of: - // new URL(sourceURL, sourceMapURL).toString() - // ... except it avoids using URL, which wasn't available in the - // older releases of node still supported by this library. - // - // The spec says: - // If the sources are not absolute URLs after prepending of the - // “sourceRoot”, the sources are resolved relative to the - // SourceMap (like resolving script src in a html document). - if (sourceMapURL) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var index = parsed.path.lastIndexOf('/'); - if (index >= 0) { - parsed.path = parsed.path.substring(0, index + 1); - } - } - sourceURL = join(urlGenerate(parsed), sourceURL); - } - - return normalize(sourceURL); -} -exports.computeSourceURL = computeSourceURL; diff --git a/node_modules/source-map/package.json b/node_modules/source-map/package.json deleted file mode 100644 index 2466341..0000000 --- a/node_modules/source-map/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "source-map", - "description": "Generates and consumes source maps", - "version": "0.6.1", - "homepage": "https://github.com/mozilla/source-map", - "author": "Nick Fitzgerald ", - "contributors": [ - "Tobias Koppers ", - "Duncan Beevers ", - "Stephen Crane ", - "Ryan Seddon ", - "Miles Elam ", - "Mihai Bazon ", - "Michael Ficarra ", - "Todd Wolfson ", - "Alexander Solovyov ", - "Felix Gnass ", - "Conrad Irwin ", - "usrbincc ", - "David Glasser ", - "Chase Douglas ", - "Evan Wallace ", - "Heather Arthur ", - "Hugh Kennedy ", - "David Glasser ", - "Simon Lydell ", - "Jmeas Smith ", - "Michael Z Goddard ", - "azu ", - "John Gozde ", - "Adam Kirkton ", - "Chris Montgomery ", - "J. Ryan Stinnett ", - "Jack Herrington ", - "Chris Truter ", - "Daniel Espeset ", - "Jamie Wong ", - "Eddy Bruël ", - "Hawken Rives ", - "Gilad Peleg ", - "djchie ", - "Gary Ye ", - "Nicolas Lalevée " - ], - "repository": { - "type": "git", - "url": "http://github.com/mozilla/source-map.git" - }, - "main": "./source-map.js", - "files": [ - "source-map.js", - "source-map.d.ts", - "lib/", - "dist/source-map.debug.js", - "dist/source-map.js", - "dist/source-map.min.js", - "dist/source-map.min.js.map" - ], - "engines": { - "node": ">=0.10.0" - }, - "license": "BSD-3-Clause", - "scripts": { - "test": "npm run build && node test/run-tests.js", - "build": "webpack --color", - "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" - }, - "devDependencies": { - "doctoc": "^0.15.0", - "webpack": "^1.12.0" - }, - "typings": "source-map" -} diff --git a/node_modules/source-map/source-map.d.ts b/node_modules/source-map/source-map.d.ts deleted file mode 100644 index 8f972b0..0000000 --- a/node_modules/source-map/source-map.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -export interface StartOfSourceMap { - file?: string; - sourceRoot?: string; -} - -export interface RawSourceMap extends StartOfSourceMap { - version: string; - sources: string[]; - names: string[]; - sourcesContent?: string[]; - mappings: string; -} - -export interface Position { - line: number; - column: number; -} - -export interface LineRange extends Position { - lastColumn: number; -} - -export interface FindPosition extends Position { - // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND - bias?: number; -} - -export interface SourceFindPosition extends FindPosition { - source: string; -} - -export interface MappedPosition extends Position { - source: string; - name?: string; -} - -export interface MappingItem { - source: string; - generatedLine: number; - generatedColumn: number; - originalLine: number; - originalColumn: number; - name: string; -} - -export class SourceMapConsumer { - static GENERATED_ORDER: number; - static ORIGINAL_ORDER: number; - - static GREATEST_LOWER_BOUND: number; - static LEAST_UPPER_BOUND: number; - - constructor(rawSourceMap: RawSourceMap); - computeColumnSpans(): void; - originalPositionFor(generatedPosition: FindPosition): MappedPosition; - generatedPositionFor(originalPosition: SourceFindPosition): LineRange; - allGeneratedPositionsFor(originalPosition: MappedPosition): Position[]; - hasContentsOfAllSources(): boolean; - sourceContentFor(source: string, returnNullOnMissing?: boolean): string; - eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void; -} - -export interface Mapping { - generated: Position; - original: Position; - source: string; - name?: string; -} - -export class SourceMapGenerator { - constructor(startOfSourceMap?: StartOfSourceMap); - static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator; - addMapping(mapping: Mapping): void; - setSourceContent(sourceFile: string, sourceContent: string): void; - applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void; - toString(): string; -} - -export interface CodeWithSourceMap { - code: string; - map: SourceMapGenerator; -} - -export class SourceNode { - constructor(); - constructor(line: number, column: number, source: string); - constructor(line: number, column: number, source: string, chunk?: string, name?: string); - static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode; - add(chunk: string): void; - prepend(chunk: string): void; - setSourceContent(sourceFile: string, sourceContent: string): void; - walk(fn: (chunk: string, mapping: MappedPosition) => void): void; - walkSourceContents(fn: (file: string, content: string) => void): void; - join(sep: string): SourceNode; - replaceRight(pattern: string, replacement: string): SourceNode; - toString(): string; - toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap; -} diff --git a/node_modules/source-map/source-map.js b/node_modules/source-map/source-map.js deleted file mode 100644 index bc88fe8..0000000 --- a/node_modules/source-map/source-map.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; -exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; -exports.SourceNode = require('./lib/source-node').SourceNode; diff --git a/node_modules/sparkles/LICENSE b/node_modules/sparkles/LICENSE deleted file mode 100644 index 609d227..0000000 --- a/node_modules/sparkles/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2015, 2018-2019, 2021 Blaine Bublitz and Eric Schoffstall - -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/sparkles/README.md b/node_modules/sparkles/README.md deleted file mode 100644 index 95ea085..0000000 --- a/node_modules/sparkles/README.md +++ /dev/null @@ -1,60 +0,0 @@ -

- - - -

- -# sparkles - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Namespaced global event emitter - -## Usage - -Sparkles exports a function that returns a singleton `EventEmitter`. -This EE can be shared across your application, whether or not node loads -multiple copies. - -Note: If you put an event handler in a file in your application, that file must be loaded in via an import somewhere in your application, even if it's not directly being used. Otherwise, it will not be loaded into memory. - -```js -var sparkles = require('sparkles')(); // make sure to call the function - -sparkles.on('my-event', function (evt) { - console.log('my-event handled', evt); -}); - -sparkles.emit('my-event', { my: 'event' }); -``` - -## API - -### sparkles(namespace) - -Returns an EventEmitter that is shared amongst the provided namespace. If no namespace -is provided, returns a default EventEmitter. - -### sparkles.exists(namespace); - -Checks whether a namespace exists and returns true or false. - -## Why the name? - -This is a "global emitter"; shortened: "glitter" but it was already taken; so we got sparkles instead :smile: - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/sparkles.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/sparkles -[npm-image]: https://img.shields.io/npm/v/sparkles.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/sparkles/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/sparkles/dev.yml?branch=master&style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/sparkles -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/sparkles/master.svg?style=flat-square - diff --git a/node_modules/sparkles/index.js b/node_modules/sparkles/index.js deleted file mode 100644 index 8a9c51f..0000000 --- a/node_modules/sparkles/index.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var EventEmitter = require('events').EventEmitter; - -var sparklesNamespace = Symbol.for('sparkles:store'); -var defaultNamespace = Symbol.for('sparkles:namespace'); - -function getStore() { - var store = global[sparklesNamespace]; - - if (!store) { - store = global[sparklesNamespace] = {}; - } - - return store; -} - -function getEmitter(namespace) { - var store = getStore(); - - namespace = namespace || defaultNamespace; - - var ee = store[namespace]; - - if (!ee) { - ee = store[namespace] = new EventEmitter(); - ee.setMaxListeners(0); - ee.remove = function remove() { - ee.removeAllListeners(); - delete store[namespace]; - }; - } - - return ee; -} - -function exists(namespace) { - var store = getStore(); - - return !!store[namespace]; -} - -module.exports = getEmitter; -module.exports.exists = exists; diff --git a/node_modules/sparkles/legacy.js b/node_modules/sparkles/legacy.js deleted file mode 100644 index ba5359a..0000000 --- a/node_modules/sparkles/legacy.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; - -var EventEmitter = require('events').EventEmitter; - -var sparklesNamespace = 'store@sparkles'; -var defaultNamespace = 'default' - -function getStore() { - var store = global[sparklesNamespace]; - - if (!store) { - Object.defineProperty(global, sparklesNamespace, { - value: {}, - enumerable: false, - }); - store = global[sparklesNamespace]; - } - - return store; -} - -function getEmitter(namespace) { - var store = getStore(); - - namespace = namespace || defaultNamespace; - - var ee = store[namespace]; - - if (!ee) { - ee = store[namespace] = new EventEmitter(); - ee.setMaxListeners(0); - ee.remove = function remove() { - ee.removeAllListeners(); - delete store[namespace]; - }; - } - - return ee; -} - -function exists(namespace) { - var store = getStore(); - - return !!store[namespace]; -} - -module.exports = getEmitter; -module.exports.exists = exists; diff --git a/node_modules/sparkles/package.json b/node_modules/sparkles/package.json deleted file mode 100644 index da68add..0000000 --- a/node_modules/sparkles/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "sparkles", - "version": "2.1.0", - "description": "Namespaced global event emitter", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/sparkles", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js", - "legacy.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.3.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "ee", - "emitter", - "events", - "global", - "namespaced" - ] -} diff --git a/node_modules/spdx-exceptions/README.md b/node_modules/spdx-exceptions/README.md deleted file mode 100644 index 6c927ec..0000000 --- a/node_modules/spdx-exceptions/README.md +++ /dev/null @@ -1,36 +0,0 @@ -The package exports an array of strings. Each string is an identifier -for a license exception under the [Software Package Data Exchange -(SPDX)][SPDX] software license metadata standard. - -[SPDX]: https://spdx.org - -## Copyright and Licensing - -### SPDX - -"SPDX" is a federally registered United States trademark of The Linux -Foundation Corporation. - -From version 2.0 of the [SPDX] specification: - -> Copyright © 2010-2015 Linux Foundation and its Contributors. Licensed -> under the Creative Commons Attribution License 3.0 Unported. All other -> rights are expressly reserved. - -The Linux Foundation and the SPDX working groups are good people. Only -they decide what "SPDX" means, as a standard and otherwise. I respect -their work and their rights. You should, too. - -### This Package - -> I created this package by copying exception identifiers out of the -> SPDX specification. That work was mechanical, routine, and required no -> creativity whatsoever. - Kyle Mitchell, package author - -United States users concerned about intellectual property may wish to -discuss the following Supreme Court decisions with their attorneys: - -- _Baker v. Selden_, 101 U.S. 99 (1879) - -- _Feist Publications, Inc., v. Rural Telephone Service Co._, - 499 U.S. 340 (1991) diff --git a/node_modules/spdx-exceptions/deprecated.json b/node_modules/spdx-exceptions/deprecated.json deleted file mode 100644 index cba7e2b..0000000 --- a/node_modules/spdx-exceptions/deprecated.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "Nokia-Qt-exception-1.1" -] diff --git a/node_modules/spdx-exceptions/index.json b/node_modules/spdx-exceptions/index.json deleted file mode 100644 index d9549d3..0000000 --- a/node_modules/spdx-exceptions/index.json +++ /dev/null @@ -1,68 +0,0 @@ -[ - "389-exception", - "Asterisk-exception", - "Autoconf-exception-2.0", - "Autoconf-exception-3.0", - "Autoconf-exception-generic", - "Autoconf-exception-generic-3.0", - "Autoconf-exception-macro", - "Bison-exception-1.24", - "Bison-exception-2.2", - "Bootloader-exception", - "Classpath-exception-2.0", - "CLISP-exception-2.0", - "cryptsetup-OpenSSL-exception", - "DigiRule-FOSS-exception", - "eCos-exception-2.0", - "Fawkes-Runtime-exception", - "FLTK-exception", - "fmt-exception", - "Font-exception-2.0", - "freertos-exception-2.0", - "GCC-exception-2.0", - "GCC-exception-2.0-note", - "GCC-exception-3.1", - "Gmsh-exception", - "GNAT-exception", - "GNOME-examples-exception", - "GNU-compiler-exception", - "gnu-javamail-exception", - "GPL-3.0-interface-exception", - "GPL-3.0-linking-exception", - "GPL-3.0-linking-source-exception", - "GPL-CC-1.0", - "GStreamer-exception-2005", - "GStreamer-exception-2008", - "i2p-gpl-java-exception", - "KiCad-libraries-exception", - "LGPL-3.0-linking-exception", - "libpri-OpenH323-exception", - "Libtool-exception", - "Linux-syscall-note", - "LLGPL", - "LLVM-exception", - "LZMA-exception", - "mif-exception", - "OCaml-LGPL-linking-exception", - "OCCT-exception-1.0", - "OpenJDK-assembly-exception-1.0", - "openvpn-openssl-exception", - "PS-or-PDF-font-exception-20170817", - "QPL-1.0-INRIA-2004-exception", - "Qt-GPL-exception-1.0", - "Qt-LGPL-exception-1.1", - "Qwt-exception-1.0", - "SANE-exception", - "SHL-2.0", - "SHL-2.1", - "stunnel-exception", - "SWI-exception", - "Swift-exception", - "Texinfo-exception", - "u-boot-exception-2.0", - "UBDL-exception", - "Universal-FOSS-exception-1.0", - "vsftpd-openssl-exception", - "WxWindows-exception-3.1", - "x11vnc-openssl-exception" -] diff --git a/node_modules/spdx-exceptions/package.json b/node_modules/spdx-exceptions/package.json deleted file mode 100644 index 2f9a950..0000000 --- a/node_modules/spdx-exceptions/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "spdx-exceptions", - "description": "list of SPDX standard license exceptions", - "version": "2.5.0", - "author": "The Linux Foundation", - "contributors": [ - "Kyle E. Mitchell (https://kemitchell.com/)" - ], - "license": "CC-BY-3.0", - "repository": "kemitchell/spdx-exceptions.json", - "files": [ - "index.json", - "deprecated.json" - ], - "scripts": { - "build": "node build.js", - "latest": "node latest.js" - } -} diff --git a/node_modules/spdx-expression-parse/AUTHORS b/node_modules/spdx-expression-parse/AUTHORS deleted file mode 100644 index 257a76b..0000000 --- a/node_modules/spdx-expression-parse/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -C. Scott Ananian (http://cscott.net) -Kyle E. Mitchell (https://kemitchell.com) -Shinnosuke Watanabe -Antoine Motet diff --git a/node_modules/spdx-expression-parse/LICENSE b/node_modules/spdx-expression-parse/LICENSE deleted file mode 100644 index 831618e..0000000 --- a/node_modules/spdx-expression-parse/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2015 Kyle E. Mitchell & other authors listed in 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/spdx-expression-parse/README.md b/node_modules/spdx-expression-parse/README.md deleted file mode 100644 index 6320485..0000000 --- a/node_modules/spdx-expression-parse/README.md +++ /dev/null @@ -1,105 +0,0 @@ -This package parses [SPDX license expression](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) strings describing license terms, like [package.json license strings](https://docs.npmjs.com/files/package.json#license), into consistently structured ECMAScript objects. The npm command-line interface depends on this package, as do many automatic license-audit tools. - -In a nutshell: - -```javascript -var parse = require('spdx-expression-parse') -var assert = require('assert') - -assert.deepEqual( - // Licensed under the terms of the Two-Clause BSD License. - parse('BSD-2-Clause'), - {license: 'BSD-2-Clause'} -) - -assert.throws(function () { - // An invalid SPDX license expression. - // Should be `Apache-2.0`. - parse('Apache 2') -}) - -assert.deepEqual( - // Dual licensed under either: - // - LGPL 2.1 - // - a combination of Three-Clause BSD and MIT - parse('(LGPL-2.1 OR BSD-3-Clause AND MIT)'), - { - left: {license: 'LGPL-2.1'}, - conjunction: 'or', - right: { - left: {license: 'BSD-3-Clause'}, - conjunction: 'and', - right: {license: 'MIT'} - } - } -) -``` - -The syntax comes from the [Software Package Data eXchange (SPDX)](https://spdx.org/), a standard from the [Linux Foundation](https://www.linuxfoundation.org) for shareable data about software package license terms. SPDX aims to make sharing and auditing license data easy, especially for users of open-source software. - -The bulk of the SPDX standard describes syntax and semantics of XML metadata files. This package implements two lightweight, plain-text components of that larger standard: - -1. The [license list](https://spdx.org/licenses), a mapping from specific string identifiers, like `Apache-2.0`, to standard form license texts and bolt-on license exceptions. The [spdx-license-ids](https://www.npmjs.com/package/spdx-license-ids) and [spdx-exceptions](https://www.npmjs.com/package/spdx-exceptions) packages implement the license list. `spdx-expression-parse` depends on and `require()`s them. - - Any license identifier from the license list is a valid license expression: - - ```javascript - var identifiers = [] - .concat(require('spdx-license-ids')) - .concat(require('spdx-license-ids/deprecated')) - .filter(function (id) { return id[id.length - 1] !== '+' }) - - identifiers.forEach(function (id) { - assert.deepEqual(parse(id), {license: id}) - }) - ``` - - So is any license identifier `WITH` a standardized license exception: - - ```javascript - identifiers.forEach(function (id) { - require('spdx-exceptions').forEach(function (e) { - assert.deepEqual( - parse(id + ' WITH ' + e), - {license: id, exception: e} - ) - }) - }) - ``` - -2. The license expression language, for describing simple and complex license terms, like `MIT` for MIT-licensed and `(GPL-2.0 OR Apache-2.0)` for dual-licensing under GPL 2.0 and Apache 2.0. `spdx-expression-parse` itself implements license expression language, exporting a parser. - - ```javascript - assert.deepEqual( - // Licensed under a combination of: - // - the MIT License AND - // - a combination of: - // - LGPL 2.1 (or a later version) AND - // - Three-Clause BSD - parse('(MIT AND (LGPL-2.1+ AND BSD-3-Clause))'), - { - left: {license: 'MIT'}, - conjunction: 'and', - right: { - left: {license: 'LGPL-2.1', plus: true}, - conjunction: 'and', - right: {license: 'BSD-3-Clause'} - } - } - ) - ``` - -This package differs slightly from the SPDX standard in allowing lower- and mixed-case `AND`, `OR`, and `WITH` operators: - -```javascript -assert.deepEqual( - parse('MIT or BSD-2-Clause'), - { left: { license: 'MIT' }, conjunction: 'or', right: { license: 'BSD-2-Clause' } } -) -assert.deepEqual( - parse('GPL-2.0 with GCC-exception-2.0'), - { license: 'GPL-2.0', exception: 'GCC-exception-2.0' } -) -``` - -The Linux Foundation and its contributors license the SPDX standard under the terms of [the Creative Commons Attribution License 3.0 Unported (SPDX: "CC-BY-3.0")](http://spdx.org/licenses/CC-BY-3.0). "SPDX" is a United States federally registered trademark of the Linux Foundation. The authors of this package license their work under the terms of the MIT License. diff --git a/node_modules/spdx-expression-parse/index.js b/node_modules/spdx-expression-parse/index.js deleted file mode 100644 index 52fab56..0000000 --- a/node_modules/spdx-expression-parse/index.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' - -var scan = require('./scan') -var parse = require('./parse') - -module.exports = function (source) { - return parse(scan(source)) -} diff --git a/node_modules/spdx-expression-parse/package.json b/node_modules/spdx-expression-parse/package.json deleted file mode 100644 index c3a22af..0000000 --- a/node_modules/spdx-expression-parse/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "spdx-expression-parse", - "description": "parse SPDX license expressions", - "version": "4.0.0", - "author": "Kyle E. Mitchell (https://kemitchell.com)", - "files": [ - "AUTHORS", - "index.js", - "parse.js", - "scan.js" - ], - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - }, - "devDependencies": { - "defence-cli": "^3.0.1", - "replace-require-self": "^1.0.0", - "standard": "^14.1.0" - }, - "keywords": [ - "SPDX", - "law", - "legal", - "license", - "metadata", - "package", - "package.json", - "standards" - ], - "license": "MIT", - "repository": "jslicense/spdx-expression-parse.js", - "scripts": { - "lint": "standard", - "test:readme": "defence -i javascript README.md | replace-require-self | node", - "test:suite": "node test.js", - "test": "npm run test:suite && npm run test:readme" - } -} diff --git a/node_modules/spdx-expression-parse/parse.js b/node_modules/spdx-expression-parse/parse.js deleted file mode 100644 index 5a00b45..0000000 --- a/node_modules/spdx-expression-parse/parse.js +++ /dev/null @@ -1,138 +0,0 @@ -'use strict' - -// The ABNF grammar in the spec is totally ambiguous. -// -// This parser follows the operator precedence defined in the -// `Order of Precedence and Parentheses` section. - -module.exports = function (tokens) { - var index = 0 - - function hasMore () { - return index < tokens.length - } - - function token () { - return hasMore() ? tokens[index] : null - } - - function next () { - if (!hasMore()) { - throw new Error() - } - index++ - } - - function parseOperator (operator) { - var t = token() - if (t && t.type === 'OPERATOR' && operator === t.string) { - next() - return t.string - } - } - - function parseWith () { - if (parseOperator('WITH')) { - var t = token() - if (t && t.type === 'EXCEPTION') { - next() - return t.string - } - throw new Error('Expected exception after `WITH`') - } - } - - function parseLicenseRef () { - // TODO: Actually, everything is concatenated into one string - // for backward-compatibility but it could be better to return - // a nice structure. - var begin = index - var string = '' - var t = token() - if (t.type === 'DOCUMENTREF') { - next() - string += 'DocumentRef-' + t.string + ':' - if (!parseOperator(':')) { - throw new Error('Expected `:` after `DocumentRef-...`') - } - } - t = token() - if (t.type === 'LICENSEREF') { - next() - string += 'LicenseRef-' + t.string - return { license: string } - } - index = begin - } - - function parseLicense () { - var t = token() - if (t && t.type === 'LICENSE') { - next() - var node = { license: t.string } - if (parseOperator('+')) { - node.plus = true - } - var exception = parseWith() - if (exception) { - node.exception = exception - } - return node - } - } - - function parseParenthesizedExpression () { - var left = parseOperator('(') - if (!left) { - return - } - - var expr = parseExpression() - - if (!parseOperator(')')) { - throw new Error('Expected `)`') - } - - return expr - } - - function parseAtom () { - return ( - parseParenthesizedExpression() || - parseLicenseRef() || - parseLicense() - ) - } - - function makeBinaryOpParser (operator, nextParser) { - return function parseBinaryOp () { - var left = nextParser() - if (!left) { - return - } - - if (!parseOperator(operator)) { - return left - } - - var right = parseBinaryOp() - if (!right) { - throw new Error('Expected expression') - } - return { - left: left, - conjunction: operator.toLowerCase(), - right: right - } - } - } - - var parseAnd = makeBinaryOpParser('AND', parseAtom) - var parseExpression = makeBinaryOpParser('OR', parseAnd) - - var node = parseExpression() - if (!node || hasMore()) { - throw new Error('Syntax error') - } - return node -} diff --git a/node_modules/spdx-expression-parse/scan.js b/node_modules/spdx-expression-parse/scan.js deleted file mode 100644 index 5285222..0000000 --- a/node_modules/spdx-expression-parse/scan.js +++ /dev/null @@ -1,131 +0,0 @@ -'use strict' - -var licenses = [] - .concat(require('spdx-license-ids')) - .concat(require('spdx-license-ids/deprecated')) -var exceptions = require('spdx-exceptions') - -module.exports = function (source) { - var index = 0 - - function hasMore () { - return index < source.length - } - - // `value` can be a regexp or a string. - // If it is recognized, the matching source string is returned and - // the index is incremented. Otherwise `undefined` is returned. - function read (value) { - if (value instanceof RegExp) { - var chars = source.slice(index) - var match = chars.match(value) - if (match) { - index += match[0].length - return match[0] - } - } else { - if (source.indexOf(value, index) === index) { - index += value.length - return value - } - } - } - - function skipWhitespace () { - read(/[ ]*/) - } - - function operator () { - var string - var possibilities = [/^WITH/i, /^AND/i, /^OR/i, '(', ')', ':', '+'] - for (var i = 0; i < possibilities.length; i++) { - string = read(possibilities[i]) - if (string) { - break - } - } - - if (string === '+' && index > 1 && source[index - 2] === ' ') { - throw new Error('Space before `+`') - } - - return string && { - type: 'OPERATOR', - string: string.toUpperCase() - } - } - - function idstring () { - return read(/[A-Za-z0-9-.]+/) - } - - function expectIdstring () { - var string = idstring() - if (!string) { - throw new Error('Expected idstring at offset ' + index) - } - return string - } - - function documentRef () { - if (read('DocumentRef-')) { - var string = expectIdstring() - return { type: 'DOCUMENTREF', string: string } - } - } - - function licenseRef () { - if (read('LicenseRef-')) { - var string = expectIdstring() - return { type: 'LICENSEREF', string: string } - } - } - - function identifier () { - var begin = index - var string = idstring() - - if (licenses.indexOf(string) !== -1) { - return { - type: 'LICENSE', - string: string - } - } else if (exceptions.indexOf(string) !== -1) { - return { - type: 'EXCEPTION', - string: string - } - } - - index = begin - } - - // Tries to read the next token. Returns `undefined` if no token is - // recognized. - function parseToken () { - // Ordering matters - return ( - operator() || - documentRef() || - licenseRef() || - identifier() - ) - } - - var tokens = [] - while (hasMore()) { - skipWhitespace() - if (!hasMore()) { - break - } - - var token = parseToken() - if (!token) { - throw new Error('Unexpected `' + source[index] + - '` at offset ' + index) - } - - tokens.push(token) - } - return tokens -} diff --git a/node_modules/spdx-license-ids/README.md b/node_modules/spdx-license-ids/README.md deleted file mode 100644 index 500e32d..0000000 --- a/node_modules/spdx-license-ids/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# spdx-license-ids - -[![npm version](https://img.shields.io/npm/v/spdx-license-ids.svg)](https://www.npmjs.com/package/spdx-license-ids) -[![Github Actions](https://action-badges.now.sh/jslicense/spdx-license-ids)](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/jslicense/spdx-license-ids) - -A list of [SPDX license](https://spdx.org/licenses/) identifiers - -## Installation - -[Download JSON directly](https://raw.githubusercontent.com/jslicense/spdx-license-ids/main/index.json), or [use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/): - -``` -npm install spdx-license-ids -``` - -## [Node.js](https://nodejs.org/) API - -### require('spdx-license-ids') - -Type: `string[]` - -All license IDs except for the currently deprecated ones. - -```javascript -const ids = require('spdx-license-ids'); -//=> ['0BSD', 'AAL', 'ADSL', 'AFL-1.1', 'AFL-1.2', 'AFL-2.0', 'AFL-2.1', 'AFL-3.0', 'AGPL-1.0-only', ...] - -ids.includes('BSD-3-Clause'); //=> true -ids.includes('CC-BY-1.0'); //=> true - -ids.includes('GPL-3.0'); //=> false -``` - -### require('spdx-license-ids/deprecated') - -Type: `string[]` - -Deprecated license IDs. - -```javascript -const deprecatedIds = require('spdx-license-ids/deprecated'); -//=> ['AGPL-1.0', 'AGPL-3.0', 'GFDL-1.1', 'GFDL-1.2', 'GFDL-1.3', 'GPL-1.0', 'GPL-2.0', ...] - -deprecatedIds.includes('BSD-3-Clause'); //=> false -deprecatedIds.includes('CC-BY-1.0'); //=> false - -deprecatedIds.includes('GPL-3.0'); //=> true -``` - -## License - -[Creative Commons Zero v1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/deed) diff --git a/node_modules/spdx-license-ids/deprecated.json b/node_modules/spdx-license-ids/deprecated.json deleted file mode 100644 index 4f70a14..0000000 --- a/node_modules/spdx-license-ids/deprecated.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - "AGPL-1.0", - "AGPL-3.0", - "BSD-2-Clause-FreeBSD", - "BSD-2-Clause-NetBSD", - "GFDL-1.1", - "GFDL-1.2", - "GFDL-1.3", - "GPL-1.0", - "GPL-2.0", - "GPL-2.0-with-GCC-exception", - "GPL-2.0-with-autoconf-exception", - "GPL-2.0-with-bison-exception", - "GPL-2.0-with-classpath-exception", - "GPL-2.0-with-font-exception", - "GPL-3.0", - "GPL-3.0-with-GCC-exception", - "GPL-3.0-with-autoconf-exception", - "LGPL-2.0", - "LGPL-2.1", - "LGPL-3.0", - "Net-SNMP", - "Nunit", - "StandardML-NJ", - "bzip2-1.0.5", - "eCos-2.0", - "wxWindows" -] diff --git a/node_modules/spdx-license-ids/index.json b/node_modules/spdx-license-ids/index.json deleted file mode 100644 index f43d501..0000000 --- a/node_modules/spdx-license-ids/index.json +++ /dev/null @@ -1,636 +0,0 @@ -[ - "0BSD", - "3D-Slicer-1.0", - "AAL", - "ADSL", - "AFL-1.1", - "AFL-1.2", - "AFL-2.0", - "AFL-2.1", - "AFL-3.0", - "AGPL-1.0-only", - "AGPL-1.0-or-later", - "AGPL-3.0-only", - "AGPL-3.0-or-later", - "AMD-newlib", - "AMDPLPA", - "AML", - "AML-glslang", - "AMPAS", - "ANTLR-PD", - "ANTLR-PD-fallback", - "APAFML", - "APL-1.0", - "APSL-1.0", - "APSL-1.1", - "APSL-1.2", - "APSL-2.0", - "ASWF-Digital-Assets-1.0", - "ASWF-Digital-Assets-1.1", - "Abstyles", - "AdaCore-doc", - "Adobe-2006", - "Adobe-Display-PostScript", - "Adobe-Glyph", - "Adobe-Utopia", - "Afmparse", - "Aladdin", - "Apache-1.0", - "Apache-1.1", - "Apache-2.0", - "App-s2p", - "Arphic-1999", - "Artistic-1.0", - "Artistic-1.0-Perl", - "Artistic-1.0-cl8", - "Artistic-2.0", - "BSD-1-Clause", - "BSD-2-Clause", - "BSD-2-Clause-Darwin", - "BSD-2-Clause-Patent", - "BSD-2-Clause-Views", - "BSD-2-Clause-first-lines", - "BSD-3-Clause", - "BSD-3-Clause-Attribution", - "BSD-3-Clause-Clear", - "BSD-3-Clause-HP", - "BSD-3-Clause-LBNL", - "BSD-3-Clause-Modification", - "BSD-3-Clause-No-Military-License", - "BSD-3-Clause-No-Nuclear-License", - "BSD-3-Clause-No-Nuclear-License-2014", - "BSD-3-Clause-No-Nuclear-Warranty", - "BSD-3-Clause-Open-MPI", - "BSD-3-Clause-Sun", - "BSD-3-Clause-acpica", - "BSD-3-Clause-flex", - "BSD-4-Clause", - "BSD-4-Clause-Shortened", - "BSD-4-Clause-UC", - "BSD-4.3RENO", - "BSD-4.3TAHOE", - "BSD-Advertising-Acknowledgement", - "BSD-Attribution-HPND-disclaimer", - "BSD-Inferno-Nettverk", - "BSD-Protection", - "BSD-Source-Code", - "BSD-Source-beginning-file", - "BSD-Systemics", - "BSD-Systemics-W3Works", - "BSL-1.0", - "BUSL-1.1", - "Baekmuk", - "Bahyph", - "Barr", - "Beerware", - "BitTorrent-1.0", - "BitTorrent-1.1", - "Bitstream-Charter", - "Bitstream-Vera", - "BlueOak-1.0.0", - "Boehm-GC", - "Borceux", - "Brian-Gladman-2-Clause", - "Brian-Gladman-3-Clause", - "C-UDA-1.0", - "CAL-1.0", - "CAL-1.0-Combined-Work-Exception", - "CATOSL-1.1", - "CC-BY-1.0", - "CC-BY-2.0", - "CC-BY-2.5", - "CC-BY-2.5-AU", - "CC-BY-3.0", - "CC-BY-3.0-AT", - "CC-BY-3.0-AU", - "CC-BY-3.0-DE", - "CC-BY-3.0-IGO", - "CC-BY-3.0-NL", - "CC-BY-3.0-US", - "CC-BY-4.0", - "CC-BY-NC-1.0", - "CC-BY-NC-2.0", - "CC-BY-NC-2.5", - "CC-BY-NC-3.0", - "CC-BY-NC-3.0-DE", - "CC-BY-NC-4.0", - "CC-BY-NC-ND-1.0", - "CC-BY-NC-ND-2.0", - "CC-BY-NC-ND-2.5", - "CC-BY-NC-ND-3.0", - "CC-BY-NC-ND-3.0-DE", - "CC-BY-NC-ND-3.0-IGO", - "CC-BY-NC-ND-4.0", - "CC-BY-NC-SA-1.0", - "CC-BY-NC-SA-2.0", - "CC-BY-NC-SA-2.0-DE", - "CC-BY-NC-SA-2.0-FR", - "CC-BY-NC-SA-2.0-UK", - "CC-BY-NC-SA-2.5", - "CC-BY-NC-SA-3.0", - "CC-BY-NC-SA-3.0-DE", - "CC-BY-NC-SA-3.0-IGO", - "CC-BY-NC-SA-4.0", - "CC-BY-ND-1.0", - "CC-BY-ND-2.0", - "CC-BY-ND-2.5", - "CC-BY-ND-3.0", - "CC-BY-ND-3.0-DE", - "CC-BY-ND-4.0", - "CC-BY-SA-1.0", - "CC-BY-SA-2.0", - "CC-BY-SA-2.0-UK", - "CC-BY-SA-2.1-JP", - "CC-BY-SA-2.5", - "CC-BY-SA-3.0", - "CC-BY-SA-3.0-AT", - "CC-BY-SA-3.0-DE", - "CC-BY-SA-3.0-IGO", - "CC-BY-SA-4.0", - "CC-PDDC", - "CC0-1.0", - "CDDL-1.0", - "CDDL-1.1", - "CDL-1.0", - "CDLA-Permissive-1.0", - "CDLA-Permissive-2.0", - "CDLA-Sharing-1.0", - "CECILL-1.0", - "CECILL-1.1", - "CECILL-2.0", - "CECILL-2.1", - "CECILL-B", - "CECILL-C", - "CERN-OHL-1.1", - "CERN-OHL-1.2", - "CERN-OHL-P-2.0", - "CERN-OHL-S-2.0", - "CERN-OHL-W-2.0", - "CFITSIO", - "CMU-Mach", - "CMU-Mach-nodoc", - "CNRI-Jython", - "CNRI-Python", - "CNRI-Python-GPL-Compatible", - "COIL-1.0", - "CPAL-1.0", - "CPL-1.0", - "CPOL-1.02", - "CUA-OPL-1.0", - "Caldera", - "Caldera-no-preamble", - "Catharon", - "ClArtistic", - "Clips", - "Community-Spec-1.0", - "Condor-1.1", - "Cornell-Lossless-JPEG", - "Cronyx", - "Crossword", - "CrystalStacker", - "Cube", - "D-FSL-1.0", - "DEC-3-Clause", - "DL-DE-BY-2.0", - "DL-DE-ZERO-2.0", - "DOC", - "DRL-1.0", - "DRL-1.1", - "DSDP", - "DocBook-Schema", - "DocBook-XML", - "Dotseqn", - "ECL-1.0", - "ECL-2.0", - "EFL-1.0", - "EFL-2.0", - "EPICS", - "EPL-1.0", - "EPL-2.0", - "EUDatagrid", - "EUPL-1.0", - "EUPL-1.1", - "EUPL-1.2", - "Elastic-2.0", - "Entessa", - "ErlPL-1.1", - "Eurosym", - "FBM", - "FDK-AAC", - "FSFAP", - "FSFAP-no-warranty-disclaimer", - "FSFUL", - "FSFULLR", - "FSFULLRWD", - "FTL", - "Fair", - "Ferguson-Twofish", - "Frameworx-1.0", - "FreeBSD-DOC", - "FreeImage", - "Furuseth", - "GCR-docs", - "GD", - "GFDL-1.1-invariants-only", - "GFDL-1.1-invariants-or-later", - "GFDL-1.1-no-invariants-only", - "GFDL-1.1-no-invariants-or-later", - "GFDL-1.1-only", - "GFDL-1.1-or-later", - "GFDL-1.2-invariants-only", - "GFDL-1.2-invariants-or-later", - "GFDL-1.2-no-invariants-only", - "GFDL-1.2-no-invariants-or-later", - "GFDL-1.2-only", - "GFDL-1.2-or-later", - "GFDL-1.3-invariants-only", - "GFDL-1.3-invariants-or-later", - "GFDL-1.3-no-invariants-only", - "GFDL-1.3-no-invariants-or-later", - "GFDL-1.3-only", - "GFDL-1.3-or-later", - "GL2PS", - "GLWTPL", - "GPL-1.0-only", - "GPL-1.0-or-later", - "GPL-2.0-only", - "GPL-2.0-or-later", - "GPL-3.0-only", - "GPL-3.0-or-later", - "Giftware", - "Glide", - "Glulxe", - "Graphics-Gems", - "Gutmann", - "HIDAPI", - "HP-1986", - "HP-1989", - "HPND", - "HPND-DEC", - "HPND-Fenneberg-Livingston", - "HPND-INRIA-IMAG", - "HPND-Intel", - "HPND-Kevlin-Henney", - "HPND-MIT-disclaimer", - "HPND-Markus-Kuhn", - "HPND-Netrek", - "HPND-Pbmplus", - "HPND-UC", - "HPND-UC-export-US", - "HPND-doc", - "HPND-doc-sell", - "HPND-export-US", - "HPND-export-US-acknowledgement", - "HPND-export-US-modify", - "HPND-export2-US", - "HPND-merchantability-variant", - "HPND-sell-MIT-disclaimer-xserver", - "HPND-sell-regexpr", - "HPND-sell-variant", - "HPND-sell-variant-MIT-disclaimer", - "HPND-sell-variant-MIT-disclaimer-rev", - "HTMLTIDY", - "HaskellReport", - "Hippocratic-2.1", - "IBM-pibs", - "ICU", - "IEC-Code-Components-EULA", - "IJG", - "IJG-short", - "IPA", - "IPL-1.0", - "ISC", - "ISC-Veillard", - "ImageMagick", - "Imlib2", - "Info-ZIP", - "Inner-Net-2.0", - "Intel", - "Intel-ACPI", - "Interbase-1.0", - "JPL-image", - "JPNIC", - "JSON", - "Jam", - "JasPer-2.0", - "Kastrup", - "Kazlib", - "Knuth-CTAN", - "LAL-1.2", - "LAL-1.3", - "LGPL-2.0-only", - "LGPL-2.0-or-later", - "LGPL-2.1-only", - "LGPL-2.1-or-later", - "LGPL-3.0-only", - "LGPL-3.0-or-later", - "LGPLLR", - "LOOP", - "LPD-document", - "LPL-1.0", - "LPL-1.02", - "LPPL-1.0", - "LPPL-1.1", - "LPPL-1.2", - "LPPL-1.3a", - "LPPL-1.3c", - "LZMA-SDK-9.11-to-9.20", - "LZMA-SDK-9.22", - "Latex2e", - "Latex2e-translated-notice", - "Leptonica", - "LiLiQ-P-1.1", - "LiLiQ-R-1.1", - "LiLiQ-Rplus-1.1", - "Libpng", - "Linux-OpenIB", - "Linux-man-pages-1-para", - "Linux-man-pages-copyleft", - "Linux-man-pages-copyleft-2-para", - "Linux-man-pages-copyleft-var", - "Lucida-Bitmap-Fonts", - "MIT", - "MIT-0", - "MIT-CMU", - "MIT-Festival", - "MIT-Khronos-old", - "MIT-Modern-Variant", - "MIT-Wu", - "MIT-advertising", - "MIT-enna", - "MIT-feh", - "MIT-open-group", - "MIT-testregex", - "MITNFA", - "MMIXware", - "MPEG-SSG", - "MPL-1.0", - "MPL-1.1", - "MPL-2.0", - "MPL-2.0-no-copyleft-exception", - "MS-LPL", - "MS-PL", - "MS-RL", - "MTLL", - "Mackerras-3-Clause", - "Mackerras-3-Clause-acknowledgment", - "MakeIndex", - "Martin-Birgmeier", - "McPhee-slideshow", - "Minpack", - "MirOS", - "Motosoto", - "MulanPSL-1.0", - "MulanPSL-2.0", - "Multics", - "Mup", - "NAIST-2003", - "NASA-1.3", - "NBPL-1.0", - "NCBI-PD", - "NCGL-UK-2.0", - "NCL", - "NCSA", - "NGPL", - "NICTA-1.0", - "NIST-PD", - "NIST-PD-fallback", - "NIST-Software", - "NLOD-1.0", - "NLOD-2.0", - "NLPL", - "NOSL", - "NPL-1.0", - "NPL-1.1", - "NPOSL-3.0", - "NRL", - "NTP", - "NTP-0", - "Naumen", - "NetCDF", - "Newsletr", - "Nokia", - "Noweb", - "O-UDA-1.0", - "OAR", - "OCCT-PL", - "OCLC-2.0", - "ODC-By-1.0", - "ODbL-1.0", - "OFFIS", - "OFL-1.0", - "OFL-1.0-RFN", - "OFL-1.0-no-RFN", - "OFL-1.1", - "OFL-1.1-RFN", - "OFL-1.1-no-RFN", - "OGC-1.0", - "OGDL-Taiwan-1.0", - "OGL-Canada-2.0", - "OGL-UK-1.0", - "OGL-UK-2.0", - "OGL-UK-3.0", - "OGTSL", - "OLDAP-1.1", - "OLDAP-1.2", - "OLDAP-1.3", - "OLDAP-1.4", - "OLDAP-2.0", - "OLDAP-2.0.1", - "OLDAP-2.1", - "OLDAP-2.2", - "OLDAP-2.2.1", - "OLDAP-2.2.2", - "OLDAP-2.3", - "OLDAP-2.4", - "OLDAP-2.5", - "OLDAP-2.6", - "OLDAP-2.7", - "OLDAP-2.8", - "OLFL-1.3", - "OML", - "OPL-1.0", - "OPL-UK-3.0", - "OPUBL-1.0", - "OSET-PL-2.1", - "OSL-1.0", - "OSL-1.1", - "OSL-2.0", - "OSL-2.1", - "OSL-3.0", - "OpenPBS-2.3", - "OpenSSL", - "OpenSSL-standalone", - "OpenVision", - "PADL", - "PDDL-1.0", - "PHP-3.0", - "PHP-3.01", - "PPL", - "PSF-2.0", - "Parity-6.0.0", - "Parity-7.0.0", - "Pixar", - "Plexus", - "PolyForm-Noncommercial-1.0.0", - "PolyForm-Small-Business-1.0.0", - "PostgreSQL", - "Python-2.0", - "Python-2.0.1", - "QPL-1.0", - "QPL-1.0-INRIA-2004", - "Qhull", - "RHeCos-1.1", - "RPL-1.1", - "RPL-1.5", - "RPSL-1.0", - "RSA-MD", - "RSCPL", - "Rdisc", - "Ruby", - "Ruby-pty", - "SAX-PD", - "SAX-PD-2.0", - "SCEA", - "SGI-B-1.0", - "SGI-B-1.1", - "SGI-B-2.0", - "SGI-OpenGL", - "SGP4", - "SHL-0.5", - "SHL-0.51", - "SISSL", - "SISSL-1.2", - "SL", - "SMLNJ", - "SMPPL", - "SNIA", - "SPL-1.0", - "SSH-OpenSSH", - "SSH-short", - "SSLeay-standalone", - "SSPL-1.0", - "SWL", - "Saxpath", - "SchemeReport", - "Sendmail", - "Sendmail-8.23", - "SimPL-2.0", - "Sleepycat", - "Soundex", - "Spencer-86", - "Spencer-94", - "Spencer-99", - "SugarCRM-1.1.3", - "Sun-PPP", - "Sun-PPP-2000", - "SunPro", - "Symlinks", - "TAPR-OHL-1.0", - "TCL", - "TCP-wrappers", - "TGPPL-1.0", - "TMate", - "TORQUE-1.1", - "TOSL", - "TPDL", - "TPL-1.0", - "TTWL", - "TTYP0", - "TU-Berlin-1.0", - "TU-Berlin-2.0", - "TermReadKey", - "UCAR", - "UCL-1.0", - "UMich-Merit", - "UPL-1.0", - "URT-RLE", - "Ubuntu-font-1.0", - "Unicode-3.0", - "Unicode-DFS-2015", - "Unicode-DFS-2016", - "Unicode-TOU", - "UnixCrypt", - "Unlicense", - "VOSTROM", - "VSL-1.0", - "Vim", - "W3C", - "W3C-19980720", - "W3C-20150513", - "WTFPL", - "Watcom-1.0", - "Widget-Workshop", - "Wsuipa", - "X11", - "X11-distribute-modifications-variant", - "X11-swapped", - "XFree86-1.1", - "XSkat", - "Xdebug-1.03", - "Xerox", - "Xfig", - "Xnet", - "YPL-1.0", - "YPL-1.1", - "ZPL-1.1", - "ZPL-2.0", - "ZPL-2.1", - "Zed", - "Zeeff", - "Zend-2.0", - "Zimbra-1.3", - "Zimbra-1.4", - "Zlib", - "any-OSI", - "bcrypt-Solar-Designer", - "blessing", - "bzip2-1.0.6", - "check-cvs", - "checkmk", - "copyleft-next-0.3.0", - "copyleft-next-0.3.1", - "curl", - "cve-tou", - "diffmark", - "dtoa", - "dvipdfm", - "eGenix", - "etalab-2.0", - "fwlw", - "gSOAP-1.3b", - "gnuplot", - "gtkbook", - "hdparm", - "iMatix", - "libpng-2.0", - "libselinux-1.0", - "libtiff", - "libutil-David-Nugent", - "lsof", - "magaz", - "mailprio", - "metamail", - "mpi-permissive", - "mpich2", - "mplus", - "pkgconf", - "pnmstitch", - "psfrag", - "psutils", - "python-ldap", - "radvd", - "snprintf", - "softSurfer", - "ssh-keyscan", - "swrule", - "threeparttable", - "ulem", - "w3m", - "xinetd", - "xkeyboard-config-Zinoviev", - "xlock", - "xpp", - "xzoom", - "zlib-acknowledgement" -] diff --git a/node_modules/spdx-license-ids/package.json b/node_modules/spdx-license-ids/package.json deleted file mode 100644 index 7ab34aa..0000000 --- a/node_modules/spdx-license-ids/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "spdx-license-ids", - "version": "3.0.20", - "description": "A list of SPDX license identifiers", - "repository": "jslicense/spdx-license-ids", - "author": "Shinnosuke Watanabe (https://github.com/shinnn)", - "license": "CC0-1.0", - "scripts": { - "build": "node build.js", - "pretest": "eslint .", - "latest": "node latest.js", - "test": "node test.js" - }, - "files": [ - "deprecated.json", - "index.json" - ], - "keywords": [ - "spdx", - "license", - "licenses", - "id", - "identifier", - "identifiers", - "json", - "array", - "oss" - ], - "devDependencies": { - "@shinnn/eslint-config": "^7.0.0", - "eslint": "^8.49.0", - "eslint-formatter-codeframe": "^7.32.1", - "rmfr": "^2.0.0", - "tape": "^5.6.6" - }, - "eslintConfig": { - "extends": "@shinnn" - } -} diff --git a/node_modules/stream-composer/.github/workflows/test-node.yml b/node_modules/stream-composer/.github/workflows/test-node.yml deleted file mode 100644 index 9b94272..0000000 --- a/node_modules/stream-composer/.github/workflows/test-node.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build Status -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - build: - strategy: - matrix: - node-version: [lts/*] - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm test diff --git a/node_modules/stream-composer/LICENSE b/node_modules/stream-composer/LICENSE deleted file mode 100644 index 2b42dab..0000000 --- a/node_modules/stream-composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2023 Mathias Buus - -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/stream-composer/README.md b/node_modules/stream-composer/README.md deleted file mode 100644 index 282cf75..0000000 --- a/node_modules/stream-composer/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# stream-composer - -Modern stream composer - -``` -npm install stream-composer -``` - -Supports composing and pipelining multiple streams into a single [streamx](https://github.com/mafintosh/streamx) stream. - -## Usage - -``` js -const Composer = require('stream-composer') - -// Make a duplex stream out of a read and write stream -const stream = new Composer() - -stream.setReadable(someReadableStream) // set readable side -stream.setWritable(someWritableStream) // set writable side - -// reads, read from the readable stream -stream.on('data', function (data) { - // data is from someReadableStream -}) - -// writes, write to the writable stream -stream.write(data) -``` - -## API - -#### `stream = new Composer([options])` - -Make a new composer. Optionally pass the writable stream and readable stream in the constructor. -Options are forwarded to streamx. - -#### `stream.setReadable(readableStream)` - -Set the readable stream. If you pass `null` the readable stream will be set to an empty stream for you. - -#### `stream.setWritable(writableStream)` - -Set the writable stream. If you pass `null` the writable stream will be set to an empty stream for you. - -#### `stream.setPipeline(...pipelineStreams)` - -Set the stream to a pipeline. Writing to the outer stream writes to the first stream in the pipeline -and reading from the outer stream, reads from the last stream in the pipeline. - -#### `stream = Composer.pipeline(...pipelineStreams)` - -Helper for making a composer stream and setting the pipeline in one go. - -#### `stream = Composer.duplexer(writableStream, readableStream)` - -Helper for making a composer stream and setting the writable and readable stream in one go. - -## License - -MIT diff --git a/node_modules/stream-composer/index.js b/node_modules/stream-composer/index.js deleted file mode 100644 index cab375d..0000000 --- a/node_modules/stream-composer/index.js +++ /dev/null @@ -1,192 +0,0 @@ -const { Duplex, pipeline } = require('streamx') - -module.exports = class Composer extends Duplex { - constructor (opts) { - super(opts) - - this._writable = null - this._readable = null - this._isPipeline = false - this._pipelineMissing = 2 - - this._writeCallback = null - this._finalCallback = null - - this._ondata = this._pushData.bind(this) - this._onend = this._pushEnd.bind(this, null) - this._ondrain = this._continueWrite.bind(this, null) - this._onfinish = this._maybeFinal.bind(this) - this._onerror = this.destroy.bind(this) - this._onclose = this.destroy.bind(this, null) - } - - static pipeline (...streams) { - const c = new Composer() - c.setPipeline(...streams) - return c - } - - static duplexer (ws = null, rs = null) { - const c = new Composer() - c.setWritable(ws) - c.setReadable(rs) - return c - } - - setPipeline (first, ...streams) { - const all = Array.isArray(first) ? first : [first, ...streams] - - this._isPipeline = true - this.setWritable(all[0]) - this.setReadable(all[all.length - 1]) - - pipeline(all, (err) => { - if (err) this.destroy(err) - }) - - return this - } - - setReadable (rs) { - if (this._readable) { - this._readable.removeListener('data', this._ondata) - this._readable.removeListener('end', this._onend) - this._readable.removeListener('error', this._onerror) - this._readable.removeListener('close', this._onclose) - } - - if (rs === null) { - this._readable = null - this.push(null) - this.resume() - return - } - - this._readable = rs - this._readable.on('data', this._ondata) - this._readable.on('end', this._onend) - this._readable.on('error', this._onerror) - this._readable.on('close', this._onclose) - - if (this.destroying && this._readable.destroy) { - this._readable.destroy() - } - - return this - } - - setWritable (ws) { - if (this._writable) { - this._writable.removeListener('drain', this._ondrain) - this._writable.removeListener('finish', this._onfinish) - this._writable.removeListener('error', this._onerror) - this._writable.removeListener('close', this._onclose) - } - - if (ws === null) { - this._writable = null - this._continueWrite(null) - this.end() - return - } - - this._writable = ws - this._writable.on('drain', this._ondrain) - this._writable.on('finish', this._onfinish) - this._writable.on('error', this._onerror) - this._writable.on('close', this._onclose) - - if (this.destroying && this._writable.destroy) { - this._writable.destroy() - } - - return this - } - - _read (cb) { - if (this._readable !== null) { - this._readable.resume() - } - - cb(null) - } - - _pushData (data) { - if (this.push(data) === false && this._readable !== null) { - this._readable.pause() - } - } - - _pushEnd () { - if (this._isPipeline) { - this.on('end', this._decrementPipeline.bind(this)) - } - this.push(null) - if (this._readable !== null) { - this._readable.removeListener('close', this._onclose) - } - } - - _decrementPipeline () { - if (--this._pipelineMissing === 0) this._continueFinal(null) - } - - _maybeFinal () { - if (this._writable !== null) { - this._writable.removeListener('close', this._onclose) - } - - if (this._isPipeline) this._decrementPipeline() - else this._continueFinal(null) - } - - _continueFinal (err) { - if (this._finalCallback === null) return - - const cb = this._finalCallback - this._finalCallback = null - cb(err) - } - - _continueWrite (err) { - if (this._writeCallback === null) return - const cb = this._writeCallback - this._writeCallback = null - cb(err) - } - - _predestroy () { - if (this._writable !== null && this._writable.destroy) this._writable.destroy() - if (this._readable !== null && this._readable.destroy) this._readable.destroy() - this._continueWrite(new Error('Stream destroyed')) - this._continueFinal(new Error('Stream destroyed')) - } - - _writev (datas, cb) { - if (this._writable === null) { - return cb(null) - } - - let flushed = true - - for (const data of datas) { - flushed = this._writable.write(data) - } - - if (!flushed) { - this._writeCallback = cb - return - } - - cb(null) - } - - _final (cb) { - if (this._writable === null) { - return cb(null) - } - - this._finalCallback = cb - this._writable.end() - } -} diff --git a/node_modules/stream-composer/package.json b/node_modules/stream-composer/package.json deleted file mode 100644 index 6b56f9b..0000000 --- a/node_modules/stream-composer/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "stream-composer", - "version": "1.0.2", - "description": "Modern stream composer", - "main": "index.js", - "dependencies": { - "streamx": "^2.13.2" - }, - "devDependencies": { - "brittle": "^3.2.1", - "standard": "^17.0.0" - }, - "scripts": { - "test": "standard && brittle test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/mafintosh/stream-composer.git" - }, - "author": "Mathias Buus (@mafintosh)", - "license": "MIT", - "bugs": { - "url": "https://github.com/mafintosh/stream-composer/issues" - }, - "homepage": "https://github.com/mafintosh/stream-composer" -} diff --git a/node_modules/stream-composer/test.js b/node_modules/stream-composer/test.js deleted file mode 100644 index d222ec4..0000000 --- a/node_modules/stream-composer/test.js +++ /dev/null @@ -1,283 +0,0 @@ -const test = require('brittle') -const { Readable, Writable, Transform } = require('streamx') -const Composer = require('./') - -test('read and write', function (t) { - t.plan(42) - - const c = new Composer() - - let writes = 0 - let reads = 0 - - const r = new Readable() - const w = new Writable({ - write (data, cb) { - t.is(data, 'write-' + (writes++)) - setTimeout(cb, 0) - } - }) - - c.setReadable(r) - c.setWritable(w) - - let flushed = true - for (let i = 0; i < 20; i++) { - flushed = c.write('write-' + i) - } - - t.not(flushed) - - for (let i = 0; i < 20; i++) { - r.push('read-' + i) - } - - t.ok(Readable.isBackpressured(r)) - - c.on('data', function (data) { - t.is(data, 'read-' + (reads++)) - }) -}) - -test('read and write (twice)', function (t) { - t.plan(42) - - const c = new Composer() - - let writes = 0 - let reads = 0 - - const r = new Readable() - const w = new Writable({ - write (data, cb) { - t.is(data, 'write-' + (writes++)) - setTimeout(cb, 0) - } - }) - - c.setReadable(r) - c.setWritable(w) - - c.setReadable(r) - c.setWritable(w) - - let flushed = true - for (let i = 0; i < 20; i++) { - flushed = c.write('write-' + i) - } - - t.not(flushed) - - for (let i = 0; i < 20; i++) { - r.push('read-' + i) - } - - t.ok(Readable.isBackpressured(r)) - - c.on('data', function (data) { - t.is(data, 'read-' + (reads++)) - }) -}) - -test('no write', function (t) { - t.plan(13) - - const c = new Composer() - - let reads = 0 - - const r = new Readable() - - c.setReadable(r) - c.setWritable(null) - - for (let i = 0; i < 10; i++) { - r.push('read-' + i) - } - - r.push(null) - - c.on('data', function (data) { - t.is(data, 'read-' + (reads++)) - }) - - c.on('end', function () { - t.pass('end') - }) - - c.on('finish', function () { - t.pass('finish') - }) - - c.on('close', function () { - t.pass('closed') - }) -}) - -test('no read', function (t) { - t.plan(12) - - const c = new Composer() - - let writes = 0 - - const w = new Writable({ - write (data, cb) { - t.is(data, 'write-' + (writes++)) - setTimeout(cb, 0) - } - }) - - c.setReadable(null) - c.setWritable(w) - - for (let i = 0; i < 10; i++) { - c.write('write-' + i) - } - - c.end() - - c.on('end', function () { - t.pass('ended') - }) - - c.on('close', function () { - t.pass('closed') - }) -}) - -test('pipeline', function (t) { - t.plan(22) - - const c = new Composer() - - c.setPipeline(new Transform(), new Transform()) - - let reads = 0 - - for (let i = 0; i < 20; i++) { - c.write('hello-' + i) - } - - c.on('finish', function () { - t.pass('finish') - }) - - c.end() - - c.on('data', function (data) { - t.is(data, 'hello-' + (reads++)) - }) - - c.on('end', function () { - t.pass('end') - }) -}) - -test('pipeline, static', function (t) { - t.plan(21) - - const c = Composer.pipeline(new Transform(), new Transform(), new Transform(), new Transform()) - - for (let i = 0; i < 20; i++) { - c.write('hello-' + i) - } - - c.end() - - let reads = 0 - c.on('data', function (data) { - t.is(data, 'hello-' + (reads++)) - }) - - c.on('end', function () { - t.pass('ended') - }) -}) - -test('pipeline destroy', function (t) { - t.plan(4) - - const streams = [new Transform(), new Transform(), new Transform(), new Transform()] - const c = Composer.pipeline(streams) - - for (let i = 0; i < 20; i++) { - c.write('hello-' + i) - } - - c.destroy() - - c.on('close', function () { - for (const stream of streams) { - t.ok(stream.destroying) - } - }) -}) - -test('pipeline destroy inner', function (t) { - t.plan(5) - - const streams = [new Transform(), new Transform(), new Transform(), new Transform()] - const c = Composer.pipeline(streams) - - for (let i = 0; i < 20; i++) { - c.write('hello-' + i) - } - - streams[1].destroy() - - c.on('error', function () { - t.pass('has error') - }) - - c.on('close', function () { - for (const stream of streams) { - t.ok(stream.destroying) - } - }) -}) - -test('pipeline w/ core streams', function (t) { - t.plan(23) - - const coreStream = require('stream') - - const c = Composer.pipeline(new Transform({ - transform (obj, cb) { - setImmediate(function () { - cb(null, obj) - }) - } - }), new Transform({ - transform (obj, cb) { - setImmediate(function () { - cb(null, obj) - }) - } - })) - let reads = 0 - - const data = [] - for (let i = 0; i < 20; i++) { - data.push({ msg: 'hello-' + i }) - } - - c.on('finish', function () { - t.absent(pipelineEnded, 'finish') - }) - - c.on('end', function () { - t.absent(pipelineEnded, 'ended') - }) - - let pipelineEnded = false - - coreStream.pipeline([coreStream.Readable.from(data), c], function (err) { - pipelineEnded = true - t.ok(!err, 'pipeline ended') - }) - - c.on('data', function (data) { - t.alike(data, { msg: 'hello-' + reads++ }, 'got data') - }) -}) diff --git a/node_modules/stream-exhaust/README.md b/node_modules/stream-exhaust/README.md deleted file mode 100644 index 1caffb5..0000000 --- a/node_modules/stream-exhaust/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# stream-exhaust - -Ensure that the provided stream is flowing data, even if the stream hasn't been -piped to another stream. - -```javascript -var exhaustively = require('stream-exhaust'); - -exhaustively(fs.createReadStream(__filename)) - .on('close', () => { console.log('all done, despite being streams{1+N}!') }); -``` - -## Prior Art - -This is based on [stream-consume](https://github.com/aroneous/stream-consume) -by [aroneous](https://github.com/aroneous). It is a separate package because it has -different semantics: - -1. It does not call `.resume()` on streams2+ streams. streams2 streams monkeypatch `.pipe` -when entering flowing mode; avoiding `resume()` avoids that fate. -2. It does not examine `._readableState`; instead it checks for the presence of `._read`. - -## API - -### exhaust(Stream s) -> Stream s - -Takes a stream, `s`, and returns it. Ensures that the stream is flowing, either by calling -`.resume()` if the stream is a streams1 stream, or by piping it to a "black hole" stream that -continually asks for more data. - -## License - -MIT diff --git a/node_modules/stream-exhaust/index.js b/node_modules/stream-exhaust/index.js deleted file mode 100644 index 7a1d273..0000000 --- a/node_modules/stream-exhaust/index.js +++ /dev/null @@ -1,34 +0,0 @@ -var Writable = require('stream').Writable; -var inherits = require('util').inherits; - -module.exports = resumer; - -function resumer(stream) { - if (!stream.readable) { - return stream; - } - - if (stream._read) { - stream.pipe(new Sink); - return stream; - } - - if (typeof stream.resume === 'function') { - stream.resume(); - return stream; - } - - return stream; -} - -function Sink() { - Writable.call(this, { - objectMode: true - }); -} - -inherits(Sink, Writable); - -Sink.prototype._write = function(chunk, encoding, cb) { - setImmediate(cb); -}; diff --git a/node_modules/stream-exhaust/package.json b/node_modules/stream-exhaust/package.json deleted file mode 100644 index ed4dcbc..0000000 --- a/node_modules/stream-exhaust/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "stream-exhaust", - "version": "1.0.2", - "description": "Ensure that a stream is flowing data without mutating it", - "main": "index.js", - "scripts": { - "test": "node test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/chrisdickinson/stream-exhaust.git" - }, - "author": "Chris Dickinson ", - "license": "MIT", - "bugs": { - "url": "https://github.com/chrisdickinson/stream-exhaust.git" - }, - "homepage": "https://github.com/chrisdickinson/stream-exhaust.git", - "devDependencies": { - "readable-stream": "^1.0.31", - "tape": "^2.14.0", - "through2": "^0.5.1" - } -} diff --git a/node_modules/stream-exhaust/test.js b/node_modules/stream-exhaust/test.js deleted file mode 100644 index 34530bf..0000000 --- a/node_modules/stream-exhaust/test.js +++ /dev/null @@ -1,209 +0,0 @@ -var test = require('tape'); -var exhaust = require('./index.js'); -var Stream = require('stream'); -var Readable = Stream.Readable; -var Writable = Stream.Writable; -var Duplex = Stream.Duplex; -var through = require('through2'); -var S2Readable = require('readable-stream').Readable; - -test('it should cause a Readable stream to complete if it\'s not piped anywhere', function(assert) { - var rs = new Readable({highWaterMark: 2}); - var a = 0; - var ended = false; - rs._read = function() { - if (a++ < 100) { - rs.push(a + ""); - } else { - ended = true; - rs.push(null); - } - }; - - rs.on("end", function() { - assert.ok(a > 99, 'a should be > 99'); - assert.ok(ended, 'it should end'); - assert.end(); - }); - - exhaust(rs); -}); - -test('should work with Readable streams in objectMode', function(assert) { - var rs = new Readable({highWaterMark: 2, objectMode: true}); - var a = 0; - var ended = false; - rs._read = function() { - if (a++ < 100) { - rs.push(a); - } else { - ended = true; - rs.push(null); - } - }; - - rs.on("end", function() { - assert.ok(a > 99, 'a > 99'); - assert.ok(ended, 'ended is true'); - assert.end(); - }); - - exhaust(rs); -}); - -test('should not interfere with a Readable stream that is piped somewhere', function(assert) { - var rs = new Readable({highWaterMark: 2}); - var a = 0; - var ended = false; - rs._read = function() { - if (a++ < 100) { - rs.push("."); - } else { - ended = true; - rs.push(null); - } - }; - - var sizeRead = 0; - var ws = new Writable({highWaterMark: 2}); - ws._write = function(chunk, enc, next) { - sizeRead += chunk.length; - next(); - } - - ws.on("finish", function() { - assert.ok(a > 99, 'a > 99'); - assert.ok(ended, 'ended is true'); - assert.equal(sizeRead, 100, 'sizeRead === 100'); - assert.end(); - }); - - rs.pipe(ws); - - exhaust(rs); -}); - -test('should not interfere with a Writable stream', function(assert) { - var rs = new Readable({highWaterMark: 2}); - var a = 0; - var ended = false; - rs._read = function() { - if (a++ < 100) { - rs.push("."); - } else { - ended = true; - rs.push(null); - } - }; - - var sizeRead = 0; - var ws = new Writable({highWaterMark: 2}); - ws._write = function(chunk, enc, next) { - sizeRead += chunk.length; - next(); - } - - ws.on("finish", function() { - assert.ok(a > 99, 'a > 99'); - assert.ok(ended, 'ended is true'); - assert.equal(sizeRead, 100, 'sizeRead === 100'); - assert.end(); - }); - - rs.pipe(ws); - - exhaust(ws); -}); - -test('should handle a Transform stream', function(assert) { - var rs = new Readable({highWaterMark: 2}); - var a = 0; - var ended = false; - rs._read = function() { - if (a++ < 100) { - rs.push("."); - } else { - ended = true; - rs.push(null); - } - }; - - var sizeRead = 0; - var flushed = false; - var ts = through({highWaterMark: 2}, function(chunk, enc, cb) { - sizeRead += chunk.length; - this.push(chunk); - cb(); - }, function(cb) { - flushed = true; - cb(); - }); - - ts.on("end", function() { - assert.ok(a > 99, 'a > 99'); - assert.ok(ended, 'ended is true'); - assert.equal(sizeRead, 100, 'sizeRead === 100'); - assert.ok(flushed, 'flushed is true'); - assert.end(); - }); - - rs.pipe(ts); - - exhaust(ts); -}); - -test('should handle a classic stream', function(assert) { - var rs = new Stream(); - var ended = false; - var i; - - rs.on("end", function() { - assert.ok(ended, 'ended is true'); - assert.end(); - }); - - exhaust(rs); - - for (i = 0; i < 100; i++) { - rs.emit("data", i); - } - ended = true; - rs.emit("end"); -}); - -test('should not modify .pipe', function(assert) { - var stream = new S2Readable; - - var pipe = stream.pipe; - - stream._read = function() { - stream.push('ending'); - stream.push(null); - }; - - exhaust(stream); - - assert.equal(stream.pipe, pipe); - assert.end(); -}); - -test('does not error on no resume but readable set to true', function(assert) { - var rs = new Stream(); - rs.readable = true; - - var ended = false; - var i; - - rs.on("end", function() { - assert.ok(ended, 'ended is true'); - assert.end(); - }); - - exhaust(rs); - - for (i = 0; i < 100; i++) { - rs.emit("data", i); - } - ended = true; - rs.emit("end"); -}); diff --git a/node_modules/streamx/LICENSE b/node_modules/streamx/LICENSE deleted file mode 100644 index c728dc7..0000000 --- a/node_modules/streamx/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019 Mathias Buus - -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/streamx/README.md b/node_modules/streamx/README.md deleted file mode 100644 index 29fb19a..0000000 --- a/node_modules/streamx/README.md +++ /dev/null @@ -1,489 +0,0 @@ -# streamx - -An iteration of the Node.js core streams with a series of improvements. - -``` -npm install streamx -``` - -[![Build Status](https://github.com/streamxorg/streamx/workflows/Build%20Status/badge.svg)](https://github.com/streamxorg/streamx/actions?query=workflow%3A%22Build+Status%22) - -## Main improvements from Node.js core stream - -#### Proper lifecycle support. - -Streams have an `_open` function that is called before any read/write operation and a `_destroy` -function that is always run as the last part of the stream. - -This makes it easy to maintain state. - -#### Easy error handling - -Fully integrates a `.destroy()` function. When called the stream will wait for any -pending operation to finish and call the stream destroy logic. - -Close is *always* the last event emitted and `destroy` is always run. - -#### `pipe()` error handles - -`pipe` accepts a callback that is called when the pipeline is fully drained. -It also error handles the streams provided and destroys both streams if either -of them fail. - -#### All streams are both binary and object mode streams - -A `map` function can be provided to map your input data into buffers -or other formats. To indicate how much buffer space each data item takes -an `byteLength` function can be provided as well. - -This removes the need for two modes of streams. - -#### Simplicity - -This is a full rewrite, all contained in one file. - -Lots of stream methods are simplified based on how I and devs I work with actually use streams in the wild. - -#### Backwards compat - -streamx aims to be compatible with Node.js streams whenever it is reasonable to do so. - -This means that streamx streams behave a lot like Node.js streams from the outside but still provides the -improvements above. - -#### Smaller browser footprint - -streamx has a much smaller footprint when compiled for the browser: - -``` -$ for x in stream{,x}; do echo $x: $(browserify -r $x | wc -c) bytes; done -stream: 173844 bytes -streamx: 46943 bytes -``` - -With optimizations turned on, the difference is even more stark: - -``` -$ for x in stream{,x}; do echo $x: $(browserify -r $x -p tinyify | wc -c) bytes; done -stream: 62649 bytes -streamx: 8460 bytes -$ for x in stream{,x}; do echo $x: $(browserify -r $x -p tinyify | gzip | wc -c) "bytes (gzipped)"; done -stream: 18053 bytes (gzipped) -streamx: 2806 bytes (gzipped) -``` - -#### AbortSignal support - -To make it easier to integrate streams in a `async/await` flow, all streams support a `signal` option -that accepts a [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to as an -alternative means to `.destroy` streams. - -## Usage - -``` js -const { Readable } = require('streamx') - -const rs = new Readable({ - read (cb) { - this.push('Cool data') - cb(null) - } -}) - -rs.on('data', data => console.log('data:', data)) -``` - -## API - -This streamx package contains 4 streams similar to Node.js core. - -## Readable Stream - -#### `rs = new stream.Readable([options])` - -Create a new readable stream. - -Options include: - -``` -{ - highWaterMark: 16384, // max buffer size in bytes - map: (data) => data, // optional function to map input data - byteLength: (data) => size, // optional function that calculates the byte size of input data - signal: abortController.signal, // optional AbortSignal that triggers `.destroy` when on `abort` - eagerOpen: false // eagerly open the stream -} -``` - -In addition you can pass the `open`, `read`, and `destroy` functions as shorthands in -the constructor instead of overwrite the methods below. - -The default byteLength function returns the byte length of buffers and `1024` -for any other object. This means the buffer will contain around 16 non buffers -or buffers worth 16kb when full if the defaults are used. - -If you set highWaterMark to `0` then all read ahead buffering on the stream -is disabled and it will only call `_read` when a user reads rather than ahead of time. - -#### `rs._read(cb)` - -This function is called when the stream wants you to push new data. -Overwrite this and add your own read logic. -You should call the callback when you are fully done with the read. - -Can also be set using `options.read` in the constructor. - -Note that this function differs from Node.js streams in that it takes -the "read finished" callback. - -#### `drained = rs.push(data)` - -Push new data to the stream. Returns true if the buffer is not full -and you should push more data if you can. - -If you call `rs.push(null)` you signal to the stream that no more -data will be pushed and that you want to end the stream. - -#### `data = rs.read()` - -Read a piece of data from the stream buffer. If the buffer is currently empty -`null` will be returned and you should wait for `readable` to be emitted before -trying again. If the stream has been ended it will also return `null`. - -Note that this method differs from Node.js streams in that it does not accept -an optional amounts of bytes to consume. - -#### `rs.unshift(data)` - -Add a piece of data to the front of the buffer. Use this if you read too much -data using the `rs.read()` function. - -#### `rs._open(cb)` - -This function is called once before the first read is issued. Use this function -to implement your own open logic. - -Can also be set using `options.open` in the constructor. - -#### `rs._destroy(cb)` - -This function is called just before the stream is fully destroyed. You should -use this to implement whatever teardown logic you need. The final part of the -stream life cycle is always to call destroy itself so this function will always -be called wheather or not the stream ends gracefully or forcefully. - -Can also be set using `options.destroy` in the constructor. - -Note that the `_destroy` might be called without the open function being called -in case no read was ever performed on the stream. - -#### `rs._predestroy()` - -A simple hook that is called as soon as the first `stream.destroy()` call is invoked. - -Use this in case you need to cancel pending reads (if possible) instead of waiting for them to finish. - -Can also be set using `options.predestroy` in the constructor. - -#### `rs.destroy([error])` - -Forcefully destroy the stream. Will call `_destroy` as soon as all pending reads have finished. -Once the stream is fully destroyed `close` will be emitted. - -If you pass an error this error will be emitted just before `close` is, signifying a reason -as to why this stream was destroyed. - -#### `rs.pause()` - -Pauses the stream. You will only need to call this if you want to pause a resumed stream. - -Returns this stream instance. - -#### `rs.resume()` - -Will start reading data from the stream as fast as possible. - -If you do not call this, you need to use the `read()` method to read data or the `pipe()` method to -pipe the stream somewhere else or the `data` handler. - -If none of these option are used the stream will stay paused. - -Returns this stream instance. - -#### `bool = Readable.isPaused(rs)` - -Returns `true` if the stream is paused, else `false`. - -#### `writableStream = rs.pipe(writableStream, [callback])` - -Efficently pipe the readable stream to a writable stream (can be Node.js core stream or a stream from this package). -If you provide a callback the callback is called when the pipeline has fully finished with an optional error in case -it failed. - -To cancel the pipeline destroy either of the streams. - -#### `rs.on('readable')` - -Emitted when data is pushed to the stream if the buffer was previously empty. - -#### `rs.on('data', data)` - -Emitted when data is being read from the stream. If you attach a data handler you are implicitly resuming the stream. - -#### `rs.on('end')` - -Emitted when the readable stream has ended and no data is left in it's buffer. - -#### `rs.on('close')` - -Emitted when the readable stream has fully closed (i.e. it's destroy function has completed) - -#### `rs.on('error', err)` - -Emitted if any of the stream operations fail with an error. `close` is always emitted right after this. - -#### `rs.on('piping', dest)` - -Emitted when the readable stream is pipeing to a destination. - -#### `rs.destroyed` - -Boolean property indicating wheather or not this stream has been destroyed. - -#### `bool = Readable.isBackpressured(rs)` - -Static method to check if a readable stream is currently under backpressure. - -#### `stream = Readable.from(arrayOrBufferOrStringOrAsyncIterator)` - -Static method to turn an array or buffer or string or AsyncIterator into a readable stream. - -## Writable Stream - -#### `ws = new stream.Writable([options])` - -Create a new writable stream. - -Options include: - -``` -{ - highWaterMark: 16384, // max buffer size in bytes - map: (data) => data, // optional function to map input data - byteLength: (data) => size, // optional function that calculates the byte size of input data - signal: abortController.signal // optional AbortSignal that triggers `.destroy` when on `abort` -} -``` - -In addition you can pass the `open`, `write`, `final`, and `destroy` functions as shorthands in -the constructor instead of overwrite the methods below. - -The default byteLength function returns the byte length of buffers and `1024` -for any other object. This means the buffer will contain around 16 non buffers -or buffers worth 16kb when full if the defaults are used. - -#### `ws._open(cb)` - -This function is called once before the first write is issued. Use this function -to implement your own open logic. - -Can also be set using `options.open` in the constructor. - -#### `ws._destroy(cb)` - -This function is called just before the stream is fully destroyed. You should -use this to implement whatever teardown logic you need. The final part of the -stream life cycle is always to call destroy itself so this function will always -be called wheather or not the stream ends gracefully or forcefully. - -Can also be set using `options.destroy` in the constructor. - -Note that the `_destroy` might be called without the open function being called -in case no write was ever performed on the stream. - -#### `ws._predestroy()` - -A simple hook that is called as soon as the first `stream.destroy()` call is invoked. - -Use this in case you need to cancel pending writes (if possible) instead of waiting for them to finish. - -Can also be set using `options.predestroy` in the constructor. - -#### `ws.destroy([error])` - -Forcefully destroy the stream. Will call `_destroy` as soon as all pending reads have finished. -Once the stream is fully destroyed `close` will be emitted. - -If you pass an error this error will be emitted just before `close` is, signifying a reason -as to why this stream was destroyed. - -#### `drained = ws.write(data)` - -Write a piece of data to the stream. Returns `true` if the stream buffer is not full and you -should keep writing to it if you can. If `false` is returned the stream will emit `drain` -once it's buffer is fully drained. - -#### `ws._write(data, callback)` - -This function is called when the stream want to write some data. Use this to implement your own -write logic. When done call the callback and the stream will call it again if more data exists in the buffer. - -Can also be set using `options.write` in the constructor. - -#### `ws._writev(batch, callback)` - -Similar to `_write` but passes an array of all data in the current write buffer instead of the oldest one. -Useful if the destination you are writing the data to supports batching. - -Can also be set using `options.writev` in the constructor. - -#### `ws.end()` - -Gracefully end the writable stream. Call this when you no longer want to write to the stream. - -Once all writes have been fully drained `finish` will be emitted. - -Returns this stream instance. - -#### `ws._final(callback)` - -This function is called just before `finish` is emitted, i.e. when all writes have flushed but `ws.end()` -have been called. Use this to implement any logic that should happen after all writes but before finish. - -Can also be set using `options.final` in the constructor. - -#### `ws.on('finish')` - -Emitted when the stream has been ended and all writes have been drained. - -#### `ws.on('close')` - -Emitted when the readable stream has fully closed (i.e. it's destroy function has completed) - -#### `ws.on('error', err)` - -Emitted if any of the stream operations fail with an error. `close` is always emitted right after this. - -#### `ws.on('pipe', src)` - -Emitted when a readable stream is being piped to the writable one. - -#### `ws.destroyed` - -Boolean property indicating wheather or not this stream has been destroyed. - -#### `bool = Writable.isBackpressured(ws)` - -Static method to check if a writable stream is currently under backpressure. - -#### `bool = await Writable.drained(ws)` - -Static helper to wait for a stream to drain the currently queued writes. -Returns true if they were drained and false otherwise if the stream was destroyed. - -## Duplex Stream - -#### `s = new stream.Duplex([options])` - -A duplex stream is a stream that is both readable and writable. - -Since JS does not support multiple inheritance it inherits directly from Readable -but implements the Writable API as well. - -If you want to provide only a map function for the readable side use `mapReadable` instead. -If you want to provide only a byteLength function for the readable side use `byteLengthReadable` instead. - -Same goes for the writable side but using `mapWritable` and `byteLengthWritable` instead. - -## Transform Stream - -A Transform stream is a duplex stream with an `._transform` template method that allows to -asynchronously map the input to a different output. - -The transform stream overrides the `_write` and `_read` operations of `Readable` and `Writable` but -still allows the setting of these options in the constructor. Usually it is unnecessary to pass -in `read` or `write`/`writev` or to override the corresponding `._read`, `._write` or `._writev` operation. - -#### `ts = new stream.Transform([options])` - -A transform stream is a duplex stream that maps the data written to it and emits that as readable data. - -Has the same options as a duplex stream except you can provide a `transform` function also. - -#### `ts._transform(data, callback)` - -Transform the incoming data. Call `callback(null, mappedData)` or use `ts.push(mappedData)` to -return data to the readable side of the stream. - -Per default the transform function just remits the incoming data making it act as a pass-through stream. - -## Pipeline - -`pipeline` allows to stream form a readable through a set of duplex streams to a writable entry. - -```js -const { pipeline, Readable, Transform, Writable } = require('streamx') -const lastStream = pipeline( - Readable.from([1, 2, 3]), - new Transform({ - transform (from, cb) { - this.push(from.toString()) - cb() - } - }), - new Writable({ - write (data, cb) { - console.log(data) - cb() - } - }) - error => { - // Callback once write has finished - } -) -``` - -#### `lastStream = stream.pipeline(...streams, [done])` - -Pipe all streams together and return the last stream piped to. -When the last stream finishes the pipeline ended succesfully. - -If any of the streams error, whether they are Node.js core streams -or streamx streams, all streams in the pipeline are shutdown. - -Optionally you can pass a done callback to know when the pipeline is done. - -#### `promise = stream.pipelinePromise(...streams)` - -Same as normal pipeline except instead of returning the last stream it returns -a promise representing the done callback. Note you should error handle this -promise if you use this version. - -## Helpers - -#### `bool = isStream(stream)` - -#### `bool = isStreamx(stream)` - -#### `err = getStreamError(stream, [options])` - -Returns `null` if the stream has no errors. - -## Utilities - -Streamx aims to be minimal and stable. It therefore only contains a minimal set of utilities. -To help discover of other modules that help you build streamx apps, we link some useful utilities here - -* [stream-composer](https://github.com/mafintosh/stream-composer) - Compose streams like Node's `stream.compose` and the `duplexify` and `pumpify` modules. -* [teex](https://github.com/mafintosh/teex) - Clone a readable stream into multiple new readable instances. - -## Contributing - -If you want to help contribute to streamx a good way to start is to help writing more test -cases, compatibility tests, documentation, or performance benchmarks. - -If in doubt open an issue :) - -## License - -MIT diff --git a/node_modules/streamx/index.js b/node_modules/streamx/index.js deleted file mode 100644 index d16a099..0000000 --- a/node_modules/streamx/index.js +++ /dev/null @@ -1,1170 +0,0 @@ -const { EventEmitter } = require('events') -const STREAM_DESTROYED = new Error('Stream was destroyed') -const PREMATURE_CLOSE = new Error('Premature close') - -const queueTick = require('queue-tick') -const FIFO = require('fast-fifo') -const TextDecoder = require('text-decoder') - -/* eslint-disable no-multi-spaces */ - -// 29 bits used total (4 from shared, 14 from read, and 11 from write) -const MAX = ((1 << 29) - 1) - -// Shared state -const OPENING = 0b0001 -const PREDESTROYING = 0b0010 -const DESTROYING = 0b0100 -const DESTROYED = 0b1000 - -const NOT_OPENING = MAX ^ OPENING -const NOT_PREDESTROYING = MAX ^ PREDESTROYING - -// Read state (4 bit offset from shared state) -const READ_ACTIVE = 0b00000000000001 << 4 -const READ_UPDATING = 0b00000000000010 << 4 -const READ_PRIMARY = 0b00000000000100 << 4 -const READ_QUEUED = 0b00000000001000 << 4 -const READ_RESUMED = 0b00000000010000 << 4 -const READ_PIPE_DRAINED = 0b00000000100000 << 4 -const READ_ENDING = 0b00000001000000 << 4 -const READ_EMIT_DATA = 0b00000010000000 << 4 -const READ_EMIT_READABLE = 0b00000100000000 << 4 -const READ_EMITTED_READABLE = 0b00001000000000 << 4 -const READ_DONE = 0b00010000000000 << 4 -const READ_NEXT_TICK = 0b00100000000000 << 4 -const READ_NEEDS_PUSH = 0b01000000000000 << 4 -const READ_READ_AHEAD = 0b10000000000000 << 4 - -// Combined read state -const READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED -const READ_ACTIVE_AND_NEEDS_PUSH = READ_ACTIVE | READ_NEEDS_PUSH -const READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE -const READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED -const READ_RESUMED_READ_AHEAD = READ_RESUMED | READ_READ_AHEAD - -const READ_NOT_ACTIVE = MAX ^ READ_ACTIVE -const READ_NON_PRIMARY = MAX ^ READ_PRIMARY -const READ_NON_PRIMARY_AND_PUSHED = MAX ^ (READ_PRIMARY | READ_NEEDS_PUSH) -const READ_PUSHED = MAX ^ READ_NEEDS_PUSH -const READ_PAUSED = MAX ^ READ_RESUMED -const READ_NOT_QUEUED = MAX ^ (READ_QUEUED | READ_EMITTED_READABLE) -const READ_NOT_ENDING = MAX ^ READ_ENDING -const READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING -const READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK -const READ_NOT_UPDATING = MAX ^ READ_UPDATING -const READ_NO_READ_AHEAD = MAX ^ READ_READ_AHEAD -const READ_PAUSED_NO_READ_AHEAD = MAX ^ READ_RESUMED_READ_AHEAD - -// Write state (18 bit offset, 4 bit offset from shared state and 14 from read state) -const WRITE_ACTIVE = 0b00000000001 << 18 -const WRITE_UPDATING = 0b00000000010 << 18 -const WRITE_PRIMARY = 0b00000000100 << 18 -const WRITE_QUEUED = 0b00000001000 << 18 -const WRITE_UNDRAINED = 0b00000010000 << 18 -const WRITE_DONE = 0b00000100000 << 18 -const WRITE_EMIT_DRAIN = 0b00001000000 << 18 -const WRITE_NEXT_TICK = 0b00010000000 << 18 -const WRITE_WRITING = 0b00100000000 << 18 -const WRITE_FINISHING = 0b01000000000 << 18 -const WRITE_CORKED = 0b10000000000 << 18 - -const WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING) -const WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY -const WRITE_NOT_FINISHING = MAX ^ (WRITE_ACTIVE | WRITE_FINISHING) -const WRITE_DRAINED = MAX ^ WRITE_UNDRAINED -const WRITE_NOT_QUEUED = MAX ^ WRITE_QUEUED -const WRITE_NOT_NEXT_TICK = MAX ^ WRITE_NEXT_TICK -const WRITE_NOT_UPDATING = MAX ^ WRITE_UPDATING -const WRITE_NOT_CORKED = MAX ^ WRITE_CORKED - -// Combined shared state -const ACTIVE = READ_ACTIVE | WRITE_ACTIVE -const NOT_ACTIVE = MAX ^ ACTIVE -const DONE = READ_DONE | WRITE_DONE -const DESTROY_STATUS = DESTROYING | DESTROYED | PREDESTROYING -const OPEN_STATUS = DESTROY_STATUS | OPENING -const AUTO_DESTROY = DESTROY_STATUS | DONE -const NON_PRIMARY = WRITE_NON_PRIMARY & READ_NON_PRIMARY -const ACTIVE_OR_TICKING = WRITE_NEXT_TICK | READ_NEXT_TICK -const TICKING = ACTIVE_OR_TICKING & NOT_ACTIVE -const IS_OPENING = OPEN_STATUS | TICKING - -// Combined shared state and read state -const READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE -const READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED -const READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED -const READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE -const SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH | READ_READ_AHEAD -const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE -const READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY - -// Combined write state -const WRITE_PRIMARY_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_DONE -const WRITE_QUEUED_AND_UNDRAINED = WRITE_QUEUED | WRITE_UNDRAINED -const WRITE_QUEUED_AND_ACTIVE = WRITE_QUEUED | WRITE_ACTIVE -const WRITE_DRAIN_STATUS = WRITE_QUEUED | WRITE_UNDRAINED | OPEN_STATUS | WRITE_ACTIVE -const WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED | WRITE_CORKED -const WRITE_PRIMARY_AND_ACTIVE = WRITE_PRIMARY | WRITE_ACTIVE -const WRITE_ACTIVE_AND_WRITING = WRITE_ACTIVE | WRITE_WRITING -const WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED_AND_ACTIVE | WRITE_DONE -const WRITE_BACKPRESSURE_STATUS = WRITE_UNDRAINED | DESTROY_STATUS | WRITE_FINISHING | WRITE_DONE -const WRITE_UPDATE_SYNC_STATUS = WRITE_UPDATING | OPEN_STATUS | WRITE_NEXT_TICK | WRITE_PRIMARY -const WRITE_DROP_DATA = WRITE_FINISHING | WRITE_DONE | DESTROY_STATUS - -const asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator') - -class WritableState { - constructor (stream, { highWaterMark = 16384, map = null, mapWritable, byteLength, byteLengthWritable } = {}) { - this.stream = stream - this.queue = new FIFO() - this.highWaterMark = highWaterMark - this.buffered = 0 - this.error = null - this.pipeline = null - this.drains = null // if we add more seldomly used helpers we might them into a subobject so its a single ptr - this.byteLength = byteLengthWritable || byteLength || defaultByteLength - this.map = mapWritable || map - this.afterWrite = afterWrite.bind(this) - this.afterUpdateNextTick = updateWriteNT.bind(this) - } - - get ended () { - return (this.stream._duplexState & WRITE_DONE) !== 0 - } - - push (data) { - if ((this.stream._duplexState & WRITE_DROP_DATA) !== 0) return false - if (this.map !== null) data = this.map(data) - - this.buffered += this.byteLength(data) - this.queue.push(data) - - if (this.buffered < this.highWaterMark) { - this.stream._duplexState |= WRITE_QUEUED - return true - } - - this.stream._duplexState |= WRITE_QUEUED_AND_UNDRAINED - return false - } - - shift () { - const data = this.queue.shift() - - this.buffered -= this.byteLength(data) - if (this.buffered === 0) this.stream._duplexState &= WRITE_NOT_QUEUED - - return data - } - - end (data) { - if (typeof data === 'function') this.stream.once('finish', data) - else if (data !== undefined && data !== null) this.push(data) - this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY - } - - autoBatch (data, cb) { - const buffer = [] - const stream = this.stream - - buffer.push(data) - while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED_AND_ACTIVE) { - buffer.push(stream._writableState.shift()) - } - - if ((stream._duplexState & OPEN_STATUS) !== 0) return cb(null) - stream._writev(buffer, cb) - } - - update () { - const stream = this.stream - - stream._duplexState |= WRITE_UPDATING - - do { - while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED) { - const data = this.shift() - stream._duplexState |= WRITE_ACTIVE_AND_WRITING - stream._write(data, this.afterWrite) - } - - if ((stream._duplexState & WRITE_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary() - } while (this.continueUpdate() === true) - - stream._duplexState &= WRITE_NOT_UPDATING - } - - updateNonPrimary () { - const stream = this.stream - - if ((stream._duplexState & WRITE_FINISHING_STATUS) === WRITE_FINISHING) { - stream._duplexState = stream._duplexState | WRITE_ACTIVE - stream._final(afterFinal.bind(this)) - return - } - - if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) { - if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) { - stream._duplexState |= ACTIVE - stream._destroy(afterDestroy.bind(this)) - } - return - } - - if ((stream._duplexState & IS_OPENING) === OPENING) { - stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING - stream._open(afterOpen.bind(this)) - } - } - - continueUpdate () { - if ((this.stream._duplexState & WRITE_NEXT_TICK) === 0) return false - this.stream._duplexState &= WRITE_NOT_NEXT_TICK - return true - } - - updateCallback () { - if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) this.update() - else this.updateNextTick() - } - - updateNextTick () { - if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return - this.stream._duplexState |= WRITE_NEXT_TICK - if ((this.stream._duplexState & WRITE_UPDATING) === 0) queueTick(this.afterUpdateNextTick) - } -} - -class ReadableState { - constructor (stream, { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}) { - this.stream = stream - this.queue = new FIFO() - this.highWaterMark = highWaterMark === 0 ? 1 : highWaterMark - this.buffered = 0 - this.readAhead = highWaterMark > 0 - this.error = null - this.pipeline = null - this.byteLength = byteLengthReadable || byteLength || defaultByteLength - this.map = mapReadable || map - this.pipeTo = null - this.afterRead = afterRead.bind(this) - this.afterUpdateNextTick = updateReadNT.bind(this) - } - - get ended () { - return (this.stream._duplexState & READ_DONE) !== 0 - } - - pipe (pipeTo, cb) { - if (this.pipeTo !== null) throw new Error('Can only pipe to one destination') - if (typeof cb !== 'function') cb = null - - this.stream._duplexState |= READ_PIPE_DRAINED - this.pipeTo = pipeTo - this.pipeline = new Pipeline(this.stream, pipeTo, cb) - - if (cb) this.stream.on('error', noop) // We already error handle this so supress crashes - - if (isStreamx(pipeTo)) { - pipeTo._writableState.pipeline = this.pipeline - if (cb) pipeTo.on('error', noop) // We already error handle this so supress crashes - pipeTo.on('finish', this.pipeline.finished.bind(this.pipeline)) // TODO: just call finished from pipeTo itself - } else { - const onerror = this.pipeline.done.bind(this.pipeline, pipeTo) - const onclose = this.pipeline.done.bind(this.pipeline, pipeTo, null) // onclose has a weird bool arg - pipeTo.on('error', onerror) - pipeTo.on('close', onclose) - pipeTo.on('finish', this.pipeline.finished.bind(this.pipeline)) - } - - pipeTo.on('drain', afterDrain.bind(this)) - this.stream.emit('piping', pipeTo) - pipeTo.emit('pipe', this.stream) - } - - push (data) { - const stream = this.stream - - if (data === null) { - this.highWaterMark = 0 - stream._duplexState = (stream._duplexState | READ_ENDING) & READ_NON_PRIMARY_AND_PUSHED - return false - } - - if (this.map !== null) { - data = this.map(data) - if (data === null) { - stream._duplexState &= READ_PUSHED - return this.buffered < this.highWaterMark - } - } - - this.buffered += this.byteLength(data) - this.queue.push(data) - - stream._duplexState = (stream._duplexState | READ_QUEUED) & READ_PUSHED - - return this.buffered < this.highWaterMark - } - - shift () { - const data = this.queue.shift() - - this.buffered -= this.byteLength(data) - if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED - return data - } - - unshift (data) { - const pending = [this.map !== null ? this.map(data) : data] - while (this.buffered > 0) pending.push(this.shift()) - - for (let i = 0; i < pending.length - 1; i++) { - const data = pending[i] - this.buffered += this.byteLength(data) - this.queue.push(data) - } - - this.push(pending[pending.length - 1]) - } - - read () { - const stream = this.stream - - if ((stream._duplexState & READ_STATUS) === READ_QUEUED) { - const data = this.shift() - if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED - if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit('data', data) - return data - } - - if (this.readAhead === false) { - stream._duplexState |= READ_READ_AHEAD - this.updateNextTick() - } - - return null - } - - drain () { - const stream = this.stream - - while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) { - const data = this.shift() - if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED - if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit('data', data) - } - } - - update () { - const stream = this.stream - - stream._duplexState |= READ_UPDATING - - do { - this.drain() - - while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === READ_READ_AHEAD) { - stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH - stream._read(this.afterRead) - this.drain() - } - - if ((stream._duplexState & READ_READABLE_STATUS) === READ_EMIT_READABLE_AND_QUEUED) { - stream._duplexState |= READ_EMITTED_READABLE - stream.emit('readable') - } - - if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary() - } while (this.continueUpdate() === true) - - stream._duplexState &= READ_NOT_UPDATING - } - - updateNonPrimary () { - const stream = this.stream - - if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) { - stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING - stream.emit('end') - if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING - if (this.pipeTo !== null) this.pipeTo.end() - } - - if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) { - if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) { - stream._duplexState |= ACTIVE - stream._destroy(afterDestroy.bind(this)) - } - return - } - - if ((stream._duplexState & IS_OPENING) === OPENING) { - stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING - stream._open(afterOpen.bind(this)) - } - } - - continueUpdate () { - if ((this.stream._duplexState & READ_NEXT_TICK) === 0) return false - this.stream._duplexState &= READ_NOT_NEXT_TICK - return true - } - - updateCallback () { - if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) this.update() - else this.updateNextTick() - } - - updateNextTick () { - if ((this.stream._duplexState & READ_NEXT_TICK) !== 0) return - this.stream._duplexState |= READ_NEXT_TICK - if ((this.stream._duplexState & READ_UPDATING) === 0) queueTick(this.afterUpdateNextTick) - } -} - -class TransformState { - constructor (stream) { - this.data = null - this.afterTransform = afterTransform.bind(stream) - this.afterFinal = null - } -} - -class Pipeline { - constructor (src, dst, cb) { - this.from = src - this.to = dst - this.afterPipe = cb - this.error = null - this.pipeToFinished = false - } - - finished () { - this.pipeToFinished = true - } - - done (stream, err) { - if (err) this.error = err - - if (stream === this.to) { - this.to = null - - if (this.from !== null) { - if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) { - this.from.destroy(this.error || new Error('Writable stream closed prematurely')) - } - return - } - } - - if (stream === this.from) { - this.from = null - - if (this.to !== null) { - if ((stream._duplexState & READ_DONE) === 0) { - this.to.destroy(this.error || new Error('Readable stream closed before ending')) - } - return - } - } - - if (this.afterPipe !== null) this.afterPipe(this.error) - this.to = this.from = this.afterPipe = null - } -} - -function afterDrain () { - this.stream._duplexState |= READ_PIPE_DRAINED - this.updateCallback() -} - -function afterFinal (err) { - const stream = this.stream - if (err) stream.destroy(err) - if ((stream._duplexState & DESTROY_STATUS) === 0) { - stream._duplexState |= WRITE_DONE - stream.emit('finish') - } - if ((stream._duplexState & AUTO_DESTROY) === DONE) { - stream._duplexState |= DESTROYING - } - - stream._duplexState &= WRITE_NOT_FINISHING - - // no need to wait the extra tick here, so we short circuit that - if ((stream._duplexState & WRITE_UPDATING) === 0) this.update() - else this.updateNextTick() -} - -function afterDestroy (err) { - const stream = this.stream - - if (!err && this.error !== STREAM_DESTROYED) err = this.error - if (err) stream.emit('error', err) - stream._duplexState |= DESTROYED - stream.emit('close') - - const rs = stream._readableState - const ws = stream._writableState - - if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err) - - if (ws !== null) { - while (ws.drains !== null && ws.drains.length > 0) ws.drains.shift().resolve(false) - if (ws.pipeline !== null) ws.pipeline.done(stream, err) - } -} - -function afterWrite (err) { - const stream = this.stream - - if (err) stream.destroy(err) - stream._duplexState &= WRITE_NOT_ACTIVE - - if (this.drains !== null) tickDrains(this.drains) - - if ((stream._duplexState & WRITE_DRAIN_STATUS) === WRITE_UNDRAINED) { - stream._duplexState &= WRITE_DRAINED - if ((stream._duplexState & WRITE_EMIT_DRAIN) === WRITE_EMIT_DRAIN) { - stream.emit('drain') - } - } - - this.updateCallback() -} - -function afterRead (err) { - if (err) this.stream.destroy(err) - this.stream._duplexState &= READ_NOT_ACTIVE - if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) this.stream._duplexState &= READ_NO_READ_AHEAD - this.updateCallback() -} - -function updateReadNT () { - if ((this.stream._duplexState & READ_UPDATING) === 0) { - this.stream._duplexState &= READ_NOT_NEXT_TICK - this.update() - } -} - -function updateWriteNT () { - if ((this.stream._duplexState & WRITE_UPDATING) === 0) { - this.stream._duplexState &= WRITE_NOT_NEXT_TICK - this.update() - } -} - -function tickDrains (drains) { - for (let i = 0; i < drains.length; i++) { - // drains.writes are monotonic, so if one is 0 its always the first one - if (--drains[i].writes === 0) { - drains.shift().resolve(true) - i-- - } - } -} - -function afterOpen (err) { - const stream = this.stream - - if (err) stream.destroy(err) - - if ((stream._duplexState & DESTROYING) === 0) { - if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY - if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY - stream.emit('open') - } - - stream._duplexState &= NOT_ACTIVE - - if (stream._writableState !== null) { - stream._writableState.updateCallback() - } - - if (stream._readableState !== null) { - stream._readableState.updateCallback() - } -} - -function afterTransform (err, data) { - if (data !== undefined && data !== null) this.push(data) - this._writableState.afterWrite(err) -} - -function newListener (name) { - if (this._readableState !== null) { - if (name === 'data') { - this._duplexState |= (READ_EMIT_DATA | READ_RESUMED_READ_AHEAD) - this._readableState.updateNextTick() - } - if (name === 'readable') { - this._duplexState |= READ_EMIT_READABLE - this._readableState.updateNextTick() - } - } - - if (this._writableState !== null) { - if (name === 'drain') { - this._duplexState |= WRITE_EMIT_DRAIN - this._writableState.updateNextTick() - } - } -} - -class Stream extends EventEmitter { - constructor (opts) { - super() - - this._duplexState = 0 - this._readableState = null - this._writableState = null - - if (opts) { - if (opts.open) this._open = opts.open - if (opts.destroy) this._destroy = opts.destroy - if (opts.predestroy) this._predestroy = opts.predestroy - if (opts.signal) { - opts.signal.addEventListener('abort', abort.bind(this)) - } - } - - this.on('newListener', newListener) - } - - _open (cb) { - cb(null) - } - - _destroy (cb) { - cb(null) - } - - _predestroy () { - // does nothing - } - - get readable () { - return this._readableState !== null ? true : undefined - } - - get writable () { - return this._writableState !== null ? true : undefined - } - - get destroyed () { - return (this._duplexState & DESTROYED) !== 0 - } - - get destroying () { - return (this._duplexState & DESTROY_STATUS) !== 0 - } - - destroy (err) { - if ((this._duplexState & DESTROY_STATUS) === 0) { - if (!err) err = STREAM_DESTROYED - this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY - - if (this._readableState !== null) { - this._readableState.highWaterMark = 0 - this._readableState.error = err - } - if (this._writableState !== null) { - this._writableState.highWaterMark = 0 - this._writableState.error = err - } - - this._duplexState |= PREDESTROYING - this._predestroy() - this._duplexState &= NOT_PREDESTROYING - - if (this._readableState !== null) this._readableState.updateNextTick() - if (this._writableState !== null) this._writableState.updateNextTick() - } - } -} - -class Readable extends Stream { - constructor (opts) { - super(opts) - - this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD - this._readableState = new ReadableState(this, opts) - - if (opts) { - if (this._readableState.readAhead === false) this._duplexState &= READ_NO_READ_AHEAD - if (opts.read) this._read = opts.read - if (opts.eagerOpen) this._readableState.updateNextTick() - if (opts.encoding) this.setEncoding(opts.encoding) - } - } - - setEncoding (encoding) { - const dec = new TextDecoder(encoding) - const map = this._readableState.map || echo - this._readableState.map = mapOrSkip - return this - - function mapOrSkip (data) { - const next = dec.push(data) - return next === '' && (data.byteLength !== 0 || dec.remaining > 0) ? null : map(next) - } - } - - _read (cb) { - cb(null) - } - - pipe (dest, cb) { - this._readableState.updateNextTick() - this._readableState.pipe(dest, cb) - return dest - } - - read () { - this._readableState.updateNextTick() - return this._readableState.read() - } - - push (data) { - this._readableState.updateNextTick() - return this._readableState.push(data) - } - - unshift (data) { - this._readableState.updateNextTick() - return this._readableState.unshift(data) - } - - resume () { - this._duplexState |= READ_RESUMED_READ_AHEAD - this._readableState.updateNextTick() - return this - } - - pause () { - this._duplexState &= (this._readableState.readAhead === false ? READ_PAUSED_NO_READ_AHEAD : READ_PAUSED) - return this - } - - static _fromAsyncIterator (ite, opts) { - let destroy - - const rs = new Readable({ - ...opts, - read (cb) { - ite.next().then(push).then(cb.bind(null, null)).catch(cb) - }, - predestroy () { - destroy = ite.return() - }, - destroy (cb) { - if (!destroy) return cb(null) - destroy.then(cb.bind(null, null)).catch(cb) - } - }) - - return rs - - function push (data) { - if (data.done) rs.push(null) - else rs.push(data.value) - } - } - - static from (data, opts) { - if (isReadStreamx(data)) return data - if (data[asyncIterator]) return this._fromAsyncIterator(data[asyncIterator](), opts) - if (!Array.isArray(data)) data = data === undefined ? [] : [data] - - let i = 0 - return new Readable({ - ...opts, - read (cb) { - this.push(i === data.length ? null : data[i++]) - cb(null) - } - }) - } - - static isBackpressured (rs) { - return (rs._duplexState & READ_BACKPRESSURE_STATUS) !== 0 || rs._readableState.buffered >= rs._readableState.highWaterMark - } - - static isPaused (rs) { - return (rs._duplexState & READ_RESUMED) === 0 - } - - [asyncIterator] () { - const stream = this - - let error = null - let promiseResolve = null - let promiseReject = null - - this.on('error', (err) => { error = err }) - this.on('readable', onreadable) - this.on('close', onclose) - - return { - [asyncIterator] () { - return this - }, - next () { - return new Promise(function (resolve, reject) { - promiseResolve = resolve - promiseReject = reject - const data = stream.read() - if (data !== null) ondata(data) - else if ((stream._duplexState & DESTROYED) !== 0) ondata(null) - }) - }, - return () { - return destroy(null) - }, - throw (err) { - return destroy(err) - } - } - - function onreadable () { - if (promiseResolve !== null) ondata(stream.read()) - } - - function onclose () { - if (promiseResolve !== null) ondata(null) - } - - function ondata (data) { - if (promiseReject === null) return - if (error) promiseReject(error) - else if (data === null && (stream._duplexState & READ_DONE) === 0) promiseReject(STREAM_DESTROYED) - else promiseResolve({ value: data, done: data === null }) - promiseReject = promiseResolve = null - } - - function destroy (err) { - stream.destroy(err) - return new Promise((resolve, reject) => { - if (stream._duplexState & DESTROYED) return resolve({ value: undefined, done: true }) - stream.once('close', function () { - if (err) reject(err) - else resolve({ value: undefined, done: true }) - }) - }) - } - } -} - -class Writable extends Stream { - constructor (opts) { - super(opts) - - this._duplexState |= OPENING | READ_DONE - this._writableState = new WritableState(this, opts) - - if (opts) { - if (opts.writev) this._writev = opts.writev - if (opts.write) this._write = opts.write - if (opts.final) this._final = opts.final - if (opts.eagerOpen) this._writableState.updateNextTick() - } - } - - cork () { - this._duplexState |= WRITE_CORKED - } - - uncork () { - this._duplexState &= WRITE_NOT_CORKED - this._writableState.updateNextTick() - } - - _writev (batch, cb) { - cb(null) - } - - _write (data, cb) { - this._writableState.autoBatch(data, cb) - } - - _final (cb) { - cb(null) - } - - static isBackpressured (ws) { - return (ws._duplexState & WRITE_BACKPRESSURE_STATUS) !== 0 - } - - static drained (ws) { - if (ws.destroyed) return Promise.resolve(false) - const state = ws._writableState - const pending = (isWritev(ws) ? Math.min(1, state.queue.length) : state.queue.length) - const writes = pending + ((ws._duplexState & WRITE_WRITING) ? 1 : 0) - if (writes === 0) return Promise.resolve(true) - if (state.drains === null) state.drains = [] - return new Promise((resolve) => { - state.drains.push({ writes, resolve }) - }) - } - - write (data) { - this._writableState.updateNextTick() - return this._writableState.push(data) - } - - end (data) { - this._writableState.updateNextTick() - this._writableState.end(data) - return this - } -} - -class Duplex extends Readable { // and Writable - constructor (opts) { - super(opts) - - this._duplexState = OPENING | (this._duplexState & READ_READ_AHEAD) - this._writableState = new WritableState(this, opts) - - if (opts) { - if (opts.writev) this._writev = opts.writev - if (opts.write) this._write = opts.write - if (opts.final) this._final = opts.final - } - } - - cork () { - this._duplexState |= WRITE_CORKED - } - - uncork () { - this._duplexState &= WRITE_NOT_CORKED - this._writableState.updateNextTick() - } - - _writev (batch, cb) { - cb(null) - } - - _write (data, cb) { - this._writableState.autoBatch(data, cb) - } - - _final (cb) { - cb(null) - } - - write (data) { - this._writableState.updateNextTick() - return this._writableState.push(data) - } - - end (data) { - this._writableState.updateNextTick() - this._writableState.end(data) - return this - } -} - -class Transform extends Duplex { - constructor (opts) { - super(opts) - this._transformState = new TransformState(this) - - if (opts) { - if (opts.transform) this._transform = opts.transform - if (opts.flush) this._flush = opts.flush - } - } - - _write (data, cb) { - if (this._readableState.buffered >= this._readableState.highWaterMark) { - this._transformState.data = data - } else { - this._transform(data, this._transformState.afterTransform) - } - } - - _read (cb) { - if (this._transformState.data !== null) { - const data = this._transformState.data - this._transformState.data = null - cb(null) - this._transform(data, this._transformState.afterTransform) - } else { - cb(null) - } - } - - destroy (err) { - super.destroy(err) - if (this._transformState.data !== null) { - this._transformState.data = null - this._transformState.afterTransform() - } - } - - _transform (data, cb) { - cb(null, data) - } - - _flush (cb) { - cb(null) - } - - _final (cb) { - this._transformState.afterFinal = cb - this._flush(transformAfterFlush.bind(this)) - } -} - -class PassThrough extends Transform {} - -function transformAfterFlush (err, data) { - const cb = this._transformState.afterFinal - if (err) return cb(err) - if (data !== null && data !== undefined) this.push(data) - this.push(null) - cb(null) -} - -function pipelinePromise (...streams) { - return new Promise((resolve, reject) => { - return pipeline(...streams, (err) => { - if (err) return reject(err) - resolve() - }) - }) -} - -function pipeline (stream, ...streams) { - const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams] - const done = (all.length && typeof all[all.length - 1] === 'function') ? all.pop() : null - - if (all.length < 2) throw new Error('Pipeline requires at least 2 streams') - - let src = all[0] - let dest = null - let error = null - - for (let i = 1; i < all.length; i++) { - dest = all[i] - - if (isStreamx(src)) { - src.pipe(dest, onerror) - } else { - errorHandle(src, true, i > 1, onerror) - src.pipe(dest) - } - - src = dest - } - - if (done) { - let fin = false - - const autoDestroy = isStreamx(dest) || !!(dest._writableState && dest._writableState.autoDestroy) - - dest.on('error', (err) => { - if (error === null) error = err - }) - - dest.on('finish', () => { - fin = true - if (!autoDestroy) done(error) - }) - - if (autoDestroy) { - dest.on('close', () => done(error || (fin ? null : PREMATURE_CLOSE))) - } - } - - return dest - - function errorHandle (s, rd, wr, onerror) { - s.on('error', onerror) - s.on('close', onclose) - - function onclose () { - if (rd && s._readableState && !s._readableState.ended) return onerror(PREMATURE_CLOSE) - if (wr && s._writableState && !s._writableState.ended) return onerror(PREMATURE_CLOSE) - } - } - - function onerror (err) { - if (!err || error) return - error = err - - for (const s of all) { - s.destroy(err) - } - } -} - -function echo (s) { - return s -} - -function isStream (stream) { - return !!stream._readableState || !!stream._writableState -} - -function isStreamx (stream) { - return typeof stream._duplexState === 'number' && isStream(stream) -} - -function isEnded (stream) { - return !!stream._readableState && stream._readableState.ended -} - -function isFinished (stream) { - return !!stream._writableState && stream._writableState.ended -} - -function getStreamError (stream, opts = {}) { - const err = (stream._readableState && stream._readableState.error) || (stream._writableState && stream._writableState.error) - - // avoid implicit errors by default - return (!opts.all && err === STREAM_DESTROYED) ? null : err -} - -function isReadStreamx (stream) { - return isStreamx(stream) && stream.readable -} - -function isTypedArray (data) { - return typeof data === 'object' && data !== null && typeof data.byteLength === 'number' -} - -function defaultByteLength (data) { - return isTypedArray(data) ? data.byteLength : 1024 -} - -function noop () {} - -function abort () { - this.destroy(new Error('Stream aborted.')) -} - -function isWritev (s) { - return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev -} - -module.exports = { - pipeline, - pipelinePromise, - isStream, - isStreamx, - isEnded, - isFinished, - getStreamError, - Stream, - Writable, - Readable, - Duplex, - Transform, - // Export PassThrough for compatibility with Node.js core's stream module - PassThrough -} diff --git a/node_modules/streamx/package.json b/node_modules/streamx/package.json deleted file mode 100644 index a7312c2..0000000 --- a/node_modules/streamx/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "streamx", - "version": "2.20.2", - "description": "An iteration of the Node.js core streams with a series of improvements", - "main": "index.js", - "dependencies": { - "fast-fifo": "^1.3.2", - "queue-tick": "^1.0.1", - "text-decoder": "^1.1.0" - }, - "devDependencies": { - "b4a": "^1.6.6", - "brittle": "^3.1.1", - "end-of-stream": "^1.4.4", - "standard": "^17.0.0" - }, - "optionalDependencies": { - "bare-events": "^2.2.0" - }, - "files": [ - "index.js" - ], - "imports": { - "events": { - "bare": "bare-events", - "default": "events" - } - }, - "scripts": { - "test": "standard && brittle test/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/mafintosh/streamx.git" - }, - "author": "Mathias Buus (@mafintosh)", - "license": "MIT", - "bugs": { - "url": "https://github.com/mafintosh/streamx/issues" - }, - "homepage": "https://github.com/mafintosh/streamx" -} diff --git a/node_modules/string-width/index.d.ts b/node_modules/string-width/index.d.ts deleted file mode 100644 index 12b5309..0000000 --- a/node_modules/string-width/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -declare const stringWidth: { - /** - Get the visual width of a string - the number of columns required to display it. - - Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - - @example - ``` - import stringWidth = require('string-width'); - - stringWidth('a'); - //=> 1 - - stringWidth('古'); - //=> 2 - - stringWidth('\u001B[1m古\u001B[22m'); - //=> 2 - ``` - */ - (string: string): number; - - // TODO: remove this in the next major version, refactor the whole definition to: - // declare function stringWidth(string: string): number; - // export = stringWidth; - default: typeof stringWidth; -} - -export = stringWidth; diff --git a/node_modules/string-width/index.js b/node_modules/string-width/index.js deleted file mode 100644 index f4d261a..0000000 --- a/node_modules/string-width/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -const stripAnsi = require('strip-ansi'); -const isFullwidthCodePoint = require('is-fullwidth-code-point'); -const emojiRegex = require('emoji-regex'); - -const stringWidth = string => { - if (typeof string !== 'string' || string.length === 0) { - return 0; - } - - string = stripAnsi(string); - - if (string.length === 0) { - return 0; - } - - string = string.replace(emojiRegex(), ' '); - - let width = 0; - - for (let i = 0; i < string.length; i++) { - const code = string.codePointAt(i); - - // Ignore control characters - if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { - continue; - } - - // Ignore combining characters - if (code >= 0x300 && code <= 0x36F) { - continue; - } - - // Surrogates - if (code > 0xFFFF) { - i++; - } - - width += isFullwidthCodePoint(code) ? 2 : 1; - } - - return width; -}; - -module.exports = stringWidth; -// TODO: remove this in the next major version -module.exports.default = stringWidth; diff --git a/node_modules/string-width/license b/node_modules/string-width/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/string-width/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/string-width/package.json b/node_modules/string-width/package.json deleted file mode 100644 index 28ba7b4..0000000 --- a/node_modules/string-width/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "string-width", - "version": "4.2.3", - "description": "Get the visual width of a string - the number of columns required to display it", - "license": "MIT", - "repository": "sindresorhus/string-width", - "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": [ - "string", - "character", - "unicode", - "width", - "visual", - "column", - "columns", - "fullwidth", - "full-width", - "full", - "ansi", - "escape", - "codes", - "cli", - "command-line", - "terminal", - "console", - "cjk", - "chinese", - "japanese", - "korean", - "fixed-width" - ], - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.1", - "xo": "^0.24.0" - } -} diff --git a/node_modules/string-width/readme.md b/node_modules/string-width/readme.md deleted file mode 100644 index bdd3141..0000000 --- a/node_modules/string-width/readme.md +++ /dev/null @@ -1,50 +0,0 @@ -# string-width - -> Get the visual width of a string - the number of columns required to display it - -Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width. - -Useful to be able to measure the actual width of command-line output. - - -## Install - -``` -$ npm install string-width -``` - - -## Usage - -```js -const stringWidth = require('string-width'); - -stringWidth('a'); -//=> 1 - -stringWidth('古'); -//=> 2 - -stringWidth('\u001B[1m古\u001B[22m'); -//=> 2 -``` - - -## Related - -- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module -- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string -- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string - - ---- - -
- - 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/string_decoder/LICENSE b/node_modules/string_decoder/LICENSE deleted file mode 100644 index 778edb2..0000000 --- a/node_modules/string_decoder/LICENSE +++ /dev/null @@ -1,48 +0,0 @@ -Node.js is licensed for use as follows: - -""" -Copyright Node.js contributors. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. -""" - -This license applies to parts of Node.js originating from the -https://github.com/joyent/node repository: - -""" -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -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_decoder/README.md b/node_modules/string_decoder/README.md deleted file mode 100644 index 5fd5831..0000000 --- a/node_modules/string_decoder/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# string_decoder - -***Node-core v8.9.4 string_decoder for userland*** - - -[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/) -[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/) - - -```bash -npm install --save string_decoder -``` - -***Node-core string_decoder for userland*** - -This package is a mirror of the string_decoder implementation in Node-core. - -Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/). - -As of version 1.0.0 **string_decoder** uses semantic versioning. - -## Previous versions - -Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. - -## Update - -The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. - -## Streams Working Group - -`string_decoder` is maintained by the Streams Working Group, which -oversees the development and maintenance of the Streams API within -Node.js. The responsibilities of the Streams Working Group include: - -* Addressing stream issues on the Node.js issue tracker. -* Authoring and editing stream documentation within the Node.js project. -* Reviewing changes to stream subclasses within the Node.js project. -* Redirecting changes to streams from the Node.js project to this - project. -* Assisting in the implementation of stream providers within Node.js. -* Recommending versions of `readable-stream` to be included in Node.js. -* Messaging about the future of streams to give the community advance - notice of changes. - -See [readable-stream](https://github.com/nodejs/readable-stream) for -more details. diff --git a/node_modules/string_decoder/lib/string_decoder.js b/node_modules/string_decoder/lib/string_decoder.js deleted file mode 100644 index 2e89e63..0000000 --- a/node_modules/string_decoder/lib/string_decoder.js +++ /dev/null @@ -1,296 +0,0 @@ -// 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. - -'use strict'; - -/**/ - -var Buffer = require('safe-buffer').Buffer; -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} \ No newline at end of file diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json deleted file mode 100644 index b2bb141..0000000 --- a/node_modules/string_decoder/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "string_decoder", - "version": "1.3.0", - "description": "The string_decoder module from Node core", - "main": "lib/string_decoder.js", - "files": [ - "lib" - ], - "dependencies": { - "safe-buffer": "~5.2.0" - }, - "devDependencies": { - "babel-polyfill": "^6.23.0", - "core-util-is": "^1.0.2", - "inherits": "^2.0.3", - "tap": "~0.4.8" - }, - "scripts": { - "test": "tap test/parallel/*.js && node test/verify-dependencies", - "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/nodejs/string_decoder.git" - }, - "homepage": "https://github.com/nodejs/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT" -} diff --git a/node_modules/strip-ansi/index.d.ts b/node_modules/strip-ansi/index.d.ts deleted file mode 100644 index 907fccc..0000000 --- a/node_modules/strip-ansi/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** -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 deleted file mode 100644 index 9a593df..0000000 --- a/node_modules/strip-ansi/index.js +++ /dev/null @@ -1,4 +0,0 @@ -'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 deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/strip-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/strip-ansi/package.json b/node_modules/strip-ansi/package.json deleted file mode 100644 index 1a41108..0000000 --- a/node_modules/strip-ansi/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "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 deleted file mode 100644 index 7c4b56d..0000000 --- a/node_modules/strip-ansi/readme.md +++ /dev/null @@ -1,46 +0,0 @@ -# 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-json-comments/index.d.ts b/node_modules/strip-json-comments/index.d.ts deleted file mode 100644 index 28ba3c8..0000000 --- a/node_modules/strip-json-comments/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100644 index bb00b38..0000000 --- a/node_modules/strip-json-comments/index.js +++ /dev/null @@ -1,77 +0,0 @@ -'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 deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/strip-json-comments/license +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100644 index ce7875a..0000000 --- a/node_modules/strip-json-comments/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "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 deleted file mode 100644 index cc542e5..0000000 --- a/node_modules/strip-json-comments/readme.md +++ /dev/null @@ -1,78 +0,0 @@ -# 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-color/browser.js b/node_modules/supports-color/browser.js deleted file mode 100644 index 62afa3a..0000000 --- a/node_modules/supports-color/browser.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; -module.exports = { - stdout: false, - stderr: false -}; diff --git a/node_modules/supports-color/index.js b/node_modules/supports-color/index.js deleted file mode 100644 index 6fada39..0000000 --- a/node_modules/supports-color/index.js +++ /dev/null @@ -1,135 +0,0 @@ -'use strict'; -const os = require('os'); -const tty = require('tty'); -const hasFlag = require('has-flag'); - -const {env} = process; - -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false') || - hasFlag('color=never')) { - forceColor = 0; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = 1; -} - -if ('FORCE_COLOR' in env) { - if (env.FORCE_COLOR === 'true') { - forceColor = 1; - } else if (env.FORCE_COLOR === 'false') { - forceColor = 0; - } else { - forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3); - } -} - -function translateLevel(level) { - if (level === 0) { - return false; - } - - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} - -function supportsColor(haveStream, streamIsTTY) { - if (forceColor === 0) { - return 0; - } - - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } - - if (hasFlag('color=256')) { - return 2; - } - - if (haveStream && !streamIsTTY && forceColor === undefined) { - return 0; - } - - const min = forceColor || 0; - - if (env.TERM === 'dumb') { - return min; - } - - if (process.platform === 'win32') { - // Windows 10 build 10586 is the first Windows release that supports 256 colors. - // Windows 10 build 14931 is the first release that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } - - return 1; - } - - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } - - return min; - } - - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - - if (env.COLORTERM === 'truecolor') { - return 3; - } - - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); - - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } - - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } - - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } - - if ('COLORTERM' in env) { - return 1; - } - - return min; -} - -function getSupportLevel(stream) { - const level = supportsColor(stream, stream && stream.isTTY); - return translateLevel(level); -} - -module.exports = { - supportsColor: getSupportLevel, - stdout: translateLevel(supportsColor(true, tty.isatty(1))), - stderr: translateLevel(supportsColor(true, tty.isatty(2))) -}; diff --git a/node_modules/supports-color/license b/node_modules/supports-color/license deleted file mode 100644 index e7af2f7..0000000 --- a/node_modules/supports-color/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/supports-color/package.json b/node_modules/supports-color/package.json deleted file mode 100644 index f7182ed..0000000 --- a/node_modules/supports-color/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "supports-color", - "version": "7.2.0", - "description": "Detect whether a terminal supports color", - "license": "MIT", - "repository": "chalk/supports-color", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava" - }, - "files": [ - "index.js", - "browser.js" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "ansi", - "styles", - "tty", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "support", - "supports", - "capability", - "detect", - "truecolor", - "16m" - ], - "dependencies": { - "has-flag": "^4.0.0" - }, - "devDependencies": { - "ava": "^1.4.1", - "import-fresh": "^3.0.0", - "xo": "^0.24.0" - }, - "browser": "browser.js" -} diff --git a/node_modules/supports-color/readme.md b/node_modules/supports-color/readme.md deleted file mode 100644 index 3654228..0000000 --- a/node_modules/supports-color/readme.md +++ /dev/null @@ -1,76 +0,0 @@ -# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) - -> Detect whether a terminal supports color - - -## Install - -``` -$ npm install supports-color -``` - - -## Usage - -```js -const supportsColor = require('supports-color'); - -if (supportsColor.stdout) { - console.log('Terminal stdout supports color'); -} - -if (supportsColor.stdout.has256) { - console.log('Terminal stdout supports 256 colors'); -} - -if (supportsColor.stderr.has16m) { - console.log('Terminal stderr supports 16 million colors (truecolor)'); -} -``` - - -## API - -Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported. - -The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag: - -- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) -- `.level = 2` and `.has256 = true`: 256 color support -- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) - - -## Info - -It obeys the `--color` and `--no-color` CLI flags. - -For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. - -Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. - - -## Related - -- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right - - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) - - ---- - -
- - 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 deleted file mode 100644 index 346ffec..0000000 --- a/node_modules/supports-preserve-symlinks-flag/.eslintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "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 deleted file mode 100644 index e8d64f3..0000000 --- a/node_modules/supports-preserve-symlinks-flag/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# 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 deleted file mode 100644 index bdd626c..0000000 --- a/node_modules/supports-preserve-symlinks-flag/.nycrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "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 deleted file mode 100644 index 61f607f..0000000 --- a/node_modules/supports-preserve-symlinks-flag/CHANGELOG.md +++ /dev/null @@ -1,22 +0,0 @@ -# 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 deleted file mode 100644 index 2e7b9a3..0000000 --- a/node_modules/supports-preserve-symlinks-flag/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index eb05b12..0000000 --- a/node_modules/supports-preserve-symlinks-flag/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# 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 deleted file mode 100644 index 087be1f..0000000 --- a/node_modules/supports-preserve-symlinks-flag/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -'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 deleted file mode 100644 index 86fd5d3..0000000 --- a/node_modules/supports-preserve-symlinks-flag/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'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 deleted file mode 100644 index 56edadc..0000000 --- a/node_modules/supports-preserve-symlinks-flag/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "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 deleted file mode 100644 index 9938d67..0000000 --- a/node_modules/supports-preserve-symlinks-flag/test/index.js +++ /dev/null @@ -1,29 +0,0 @@ -'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/sver/.travis.yml b/node_modules/sver/.travis.yml deleted file mode 100644 index 2bd0742..0000000 --- a/node_modules/sver/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -git: - depth: 1 -language: node_js -node_js: - - '8' - -before_install: - - npm install -script: - - npm run test diff --git a/node_modules/sver/LICENSE b/node_modules/sver/LICENSE deleted file mode 100644 index 635958e..0000000 --- a/node_modules/sver/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -MIT License ------------ - -Copyright (C) 2017 Guy Bedford - -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/sver/README.md b/node_modules/sver/README.md deleted file mode 100644 index 78af1bf..0000000 --- a/node_modules/sver/README.md +++ /dev/null @@ -1,161 +0,0 @@ -# Sver - -[![Build Status](https://travis-ci.org/guybedford/sver.svg?branch=master)](https://travis-ci.org/guybedford/sver) - -Another Semver utility library. Supports NodeJS 6+ only. No maintenance guarantees. - -This is the semver library used by jspm. - -``` -npm install sver -``` - -```js -const { Semver, SemverRange } = require('sver'); - -// Static usage: -SemverRange.match('^1.2.3', '1.2.4'); // true - -// Class usage: -let range = new SemverRange('^1.2.3'); -let version = new Semver('1.2.4'); -version.matches(range); // true -range.has(version); // true -``` - -### Range support - -Restricts version ranges to the simplified cases: -* `*`: Wildcard range -* `MAJOR`: Match exact major -* `MAJOR.MINOR` Match exact major and minor -* `MAJOR.MINOR.PATCH[-PRE]` Match exact semver -* `~MAJOR.MINOR.PATCH[-PRE]`: Match patch bumps -* `^MAJOR.MINOR.PATCH[-PRE]`: Match minor and patch bumps - -Invalid ranges will fallback to being detected as exact string matches. - -### Prerelease Matching - -By default, as per convention, ranges like `^1.2.3-alpha` only match prerelease ranges on the same patch (`1.2.3-alpha.4`), but -not prerelease ranges from further patches (`1.3.4-alpha`). - -To alter this matching, a third boolean argument can be provided to the match function to support these unstable matches: - -```js -SemverRange.match('^1.2.3', '1.5.6-beta'); // false -SemverRange.match('^1.2.3', '1.5.6-beta', true); // true -``` - -### Best Version Match - -```js -let versions = ['1.2.3', '1.3.4-alpha', '1.3.4-alpha.1', '1.3.4-beta']; -let range = new SemverRange('*'); - -let bestStableMatch = range.bestMatch(versions); -bestStableMatch.toString(); // 1.2.3 - -let bestUnstableMatch = range.bestMatch(versions, true); -bestUnstableMatch.toString(); // 1.3.4-beta -``` - -### Version and Range Sorting - -```js -let versions = ['2.4.5', '2.3.4-alpha', '1.2.3', '2.3.4-alpha.2']; -let ranges = ['^1.2.3', '1.2', '2.3.4']; - -versions.sort(Semver.compare); // [1.2.3, 2.3.4-alpha, 2.3.4-alpha.2, 2.4.5] -ranges.sort(SemverRange.compare) // [1.2, ^1.2.3, 2.3.4] -``` - -### Conversion from Node Semver Ranges - -A utility function is included to convert Node Semver ranges into Semver ranges. - -This requires `semver` to be installed in the application running this process. - -_Note this conversion is lossy by definition._ - -```js -const convertRange = require('sver/convert-range'); - -convertRange('>=2.3.4 <3.0.0').toString(); // ^2.3.4 -convertRange('1 || 2 || 3').toString(); // ^3.0.0 -``` - -### Semver and Semver Range Validation - -When a version string fails semver validation it falls back to being treated as a tag, still as a `Semver` instance. - -For example: - -```js -let version = new Semver('x.y.z'); -version.tag === 'x.y.z'; // true - -version = new Semver('^1.2.3'); -version.major === undefined; // true -version.tag === '^1.2.3'; // true -``` - -For validation, rather use `Semver.isValid` and `SemverRange.isValid`: - -```js -Semver.isValid('x.y.z'); // false -Semver.isValid('^1.2.3'); // false -SemverRange.isValid('^1.2.3'); // true -``` - -## API - -### Semver - -Static methods: - -* `Semver.isValid(version: string): boolean`: Whether the given string is a valid semver. -* `Semver.compare(v1: Semver|string, v2: Semver|string): number`: 1 if v1 > v2, -1 if v1 < v2, 0 if equal. - -For a given Semver instance `version = new Semver('X.Y.Z')`, - -* `version.major`: The major version number. -* `version.minor`: The minor version number. -* `version.patch`: The patch version number. -* `version.pre`: The prerelease identifer, as an array of strings (`.`-separated). -* `version.build`: The build identifier, as a string. -* `version.tag`: If not a valid semver, the full tag string. -* `version.gt(otherVersion: Semver|string): bool`: Whether this version is greater than the other version. -* `version.lt(otherVersion: Semver|string): bool`: Whether this version is less than the other version. -* `version.eq(otherVerion: Semver|string): bool`: Whether this version equals the other version. -* `version.matches(range: SemverRange|string, unstable?: bool): bool`: Whether this version matches the given version range. -* `version.toString(): string`: Convert the version back to a string. - -### SemverRange - -Static methods: - -* `SemverRange.match(range: SemverRange|string, version: Semver|string, unstable = false): bool`: Whether the version matches the range. -* `SemverRange.isValid(range: string): bool`: Whether the given range string is a valid semver range (in this simplified grammar). -* `SemverRange.compare(r1: SemverRange|string, r2: SemverRange|string): number`: 1 if r1 > r2, -1 if r1 < r2, 0 if equal. - -For a given SemverRange instance `range = new SemverRange('^X.Y.Z')`, - -* `range.type: string`: Returns `'wildcard'`, `'major'`, `'stable'` or `'exact'`. -* `range.version: Smever`: Returns the `Semver` instance corresponding to the range. -* `range.isExact: string`: Returns true if the range is an exact version only. -* `range.isStable: string`: Returns true if the range is a stable version range. -* `range.isMajor: string`: Returns true if the range is a major version range. -* `range.isWildcard: string`: Returns true if the range is the wildcard version range. -* `range.gt(otherRange: SemverRange|string): bool`: Whether the range is greater than the other range. -* `range.lt(otherRange: SemverRange|string): bool`: Whether the range is less than the other range. -* `range.eq(otherRange: SemverRange|string): bool`: Whether the range is exactly the same as the other range. -* `range.has(version: Semver|string, unstable = false): bool`: Whether the range includes the given version. -* `range.contains(otherRange: SemverRange|string): bool`: Whether the range fully contains the other range. -* `range.intersect(otherRange: SemverRange|string): SemverRange|undefined`: The intersection range, if any. -* `range.bestMatch(versions: (Semver|string)[], unstable = false): Semver|undefined`: The intersection range, if any. -* `range.toString()`: Convert the range back to a string. - -## License - -MIT diff --git a/node_modules/sver/convert-range.js b/node_modules/sver/convert-range.js deleted file mode 100644 index 3628f19..0000000 --- a/node_modules/sver/convert-range.js +++ /dev/null @@ -1,144 +0,0 @@ -const nodeSemver = require('semver'); -const { Semver, SemverRange } = require('./sver'); - -module.exports = function nodeRangeToSemverRange (range) { - let parsed = nodeSemver.validRange(range); - - // tag version - if (!parsed) - return new SemverRange(range); - - if (parsed === '*') - return new SemverRange(parsed); - - try { - let semverRange = new SemverRange(range); - if (!semverRange.version.tag) - return semverRange; - } - catch (e) { - if (e.code !== 'ENOTSEMVER') - throw e; - } - - let outRange; - for (let union of parsed.split('||')) { - // compute the intersection into a lowest upper bound and a highest lower bound - let upperBound, lowerBound, upperEq, lowerEq; - for (let intersection of union.split(' ')) { - let lt = intersection[0] === '<'; - let gt = intersection[0] === '>'; - if (!lt && !gt) { - upperBound = intersection; - upperEq = true; - break; - } - let eq = intersection[1] === '='; - if (!gt) { - let version = new Semver(intersection.substr(1 + eq)); - if (!upperBound || upperBound.gt(version)) { - upperBound = version; - upperEq = eq; - } - } - else if (!lt) { - let eq = intersection[1] === '='; - let version = new Semver(intersection.substr(1 + eq)); - if (!lowerBound || lowerBound.lt(version)) { - lowerBound = version; - lowerEq = eq; - } - } - } - - // no upper bound -> wildcard - if (!upperBound) { - outRange = new SemverRange('*'); - continue; - } - - // if the lower bound is greater than the upper bound then just return the lower bound exactly - if (lowerBound && upperBound && lowerBound.gt(upperBound)) { - let curRange = new SemverRange(lowerBound.toString()); - // the largest or highest union range wins - if (!outRange || !outRange.contains(curRange) && (curRange.gt(outRange) || curRange.contains(outRange))) - outRange = curRange; - continue; - } - - // determine the largest semver range satisfying the upper bound - let upperRange; - if (upperBound) { - // if the upper bound has an equality then we return it directly - if (upperEq) { - let curRange = new SemverRange(upperBound.toString()); - // the largest or highest union range wins - if (!outRange || !outRange.contains(curRange) && (curRange.gt(outRange) || curRange.contains(outRange))) - outRange = curRange; - continue; - } - - let major = 0, minor = 0, patch = 0, rangeType = ''; - - // if an exact prerelease range, match the lower bound as a range - if (upperBound.pre && lowerBound.major === upperBound.major && lowerBound.minor === upperBound.minor && lowerBound.patch === upperBound.patch) { - outRange = new SemverRange('~' + lowerBound.toString()); - continue; - } - - // <2.0.0 -> ^1.0.0 - else if (upperBound.patch === 0) { - if (upperBound.minor === 0) { - if (upperBound.major > 0) { - major = upperBound.major - 1; - rangeType = '^'; - } - } - // <1.2.0 -> ~1.1.0 - else { - major = upperBound.major; - minor = upperBound.minor - 1; - rangeType = '~'; - } - } - // <1.2.3 -> ~1.2.0 - else { - major = upperBound.major; - minor = upperBound.minor; - patch = 0; - rangeType = '~'; - } - - if (major === 0 && rangeType === '^') - upperRange = new SemverRange('0'); - else - upperRange = new SemverRange(rangeType + major + '.' + minor + '.' + patch); - } - - if (!lowerBound) { - outRange = upperRange; - continue; - } - - // determine the lower range semver range - let lowerRange; - if (!lowerEq) { - if (lowerBound.pre) - lowerRange = new SemverRange('^^' + lowerBound.major + '.' + lowerBound.minor + '.' + lowerBound.patch + '-' + [...lowerBound.pre, 1].join('.')); - else - lowerRange = new SemverRange('^^' + lowerBound.major + '.' + lowerBound.minor + '.' + (lowerBound.patch + 1)); - } - else { - lowerRange = new SemverRange('^^' + lowerBound.toString()); - } - - // we then intersect the upper semver range with the lower semver range - // if the intersection is empty, we return the upper range only - let curRange = upperRange ? lowerRange.intersect(upperRange) || upperRange : lowerRange; - - // the largest or highest union range wins - if (!outRange || !outRange.contains(curRange) && (curRange.gt(outRange) || curRange.contains(outRange))) - outRange = curRange; - } - return outRange; -} diff --git a/node_modules/sver/node_modules/.bin/semver b/node_modules/sver/node_modules/.bin/semver deleted file mode 120000 index 5aaadf4..0000000 --- a/node_modules/sver/node_modules/.bin/semver +++ /dev/null @@ -1 +0,0 @@ -../semver/bin/semver.js \ No newline at end of file diff --git a/node_modules/sver/node_modules/semver/LICENSE b/node_modules/sver/node_modules/semver/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/sver/node_modules/semver/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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/sver/node_modules/semver/README.md b/node_modules/sver/node_modules/semver/README.md deleted file mode 100644 index 2293a14..0000000 --- a/node_modules/sver/node_modules/semver/README.md +++ /dev/null @@ -1,443 +0,0 @@ -semver(1) -- The semantic versioner for npm -=========================================== - -## Install - -```bash -npm install semver -```` - -## Usage - -As a node module: - -```js -const semver = require('semver') - -semver.valid('1.2.3') // '1.2.3' -semver.valid('a.b.c') // null -semver.clean(' =v1.2.3 ') // '1.2.3' -semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true -semver.gt('1.2.3', '9.8.7') // false -semver.lt('1.2.3', '9.8.7') // true -semver.minVersion('>=1.0.0') // '1.0.0' -semver.valid(semver.coerce('v2')) // '2.0.0' -semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' -``` - -As a command-line utility: - -``` -$ semver -h - -A JavaScript implementation of the https://semver.org/ specification -Copyright Isaac Z. Schlueter - -Usage: semver [options] [ [...]] -Prints valid versions sorted by SemVer precedence - -Options: --r --range - Print versions that match the specified range. - --i --increment [] - Increment a version by the specified level. Level can - be one of: major, minor, patch, premajor, preminor, - prepatch, or prerelease. Default level is 'patch'. - Only one version may be specified. - ---preid - Identifier to be used to prefix premajor, preminor, - prepatch or prerelease version increments. - --l --loose - Interpret versions and ranges loosely - --p --include-prerelease - Always include prerelease versions in range matching - --c --coerce - Coerce a string into SemVer if possible - (does not imply --loose) - ---rtl - Coerce version strings right to left - ---ltr - Coerce version strings left to right (default) - -Program exits successfully if any valid version satisfies -all supplied ranges, and prints all satisfying versions. - -If no satisfying versions are found, then exits failure. - -Versions are printed in ascending order, so supplying -multiple versions to the utility will just sort them. -``` - -## Versions - -A "version" is described by the `v2.0.0` specification found at -. - -A leading `"="` or `"v"` character is stripped off and ignored. - -## Ranges - -A `version range` is a set of `comparators` which specify versions -that satisfy the range. - -A `comparator` is composed of an `operator` and a `version`. The set -of primitive `operators` is: - -* `<` Less than -* `<=` Less than or equal to -* `>` Greater than -* `>=` Greater than or equal to -* `=` Equal. If no operator is specified, then equality is assumed, - so this operator is optional, but MAY be included. - -For example, the comparator `>=1.2.7` would match the versions -`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` -or `1.1.0`. - -Comparators can be joined by whitespace to form a `comparator set`, -which is satisfied by the **intersection** of all of the comparators -it includes. - -A range is composed of one or more comparator sets, joined by `||`. A -version matches a range if and only if every comparator in at least -one of the `||`-separated comparator sets is satisfied by the version. - -For example, the range `>=1.2.7 <1.3.0` would match the versions -`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, -or `1.1.0`. - -The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, -`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. - -### Prerelease Tags - -If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then -it will only be allowed to satisfy comparator sets if at least one -comparator with the same `[major, minor, patch]` tuple also has a -prerelease tag. - -For example, the range `>1.2.3-alpha.3` would be allowed to match the -version `1.2.3-alpha.7`, but it would *not* be satisfied by -`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater -than" `1.2.3-alpha.3` according to the SemVer sort rules. The version -range only accepts prerelease tags on the `1.2.3` version. The -version `3.4.5` *would* satisfy the range, because it does not have a -prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. - -The purpose for this behavior is twofold. First, prerelease versions -frequently are updated very quickly, and contain many breaking changes -that are (by the author's design) not yet fit for public consumption. -Therefore, by default, they are excluded from range matching -semantics. - -Second, a user who has opted into using a prerelease version has -clearly indicated the intent to use *that specific* set of -alpha/beta/rc versions. By including a prerelease tag in the range, -the user is indicating that they are aware of the risk. However, it -is still not appropriate to assume that they have opted into taking a -similar risk on the *next* set of prerelease versions. - -Note that this behavior can be suppressed (treating all prerelease -versions as if they were normal versions, for the purpose of range -matching) by setting the `includePrerelease` flag on the options -object to any -[functions](https://github.com/npm/node-semver#functions) that do -range matching. - -#### Prerelease Identifiers - -The method `.inc` takes an additional `identifier` string argument that -will append the value of the string as a prerelease identifier: - -```javascript -semver.inc('1.2.3', 'prerelease', 'beta') -// '1.2.4-beta.0' -``` - -command-line example: - -```bash -$ semver 1.2.3 -i prerelease --preid beta -1.2.4-beta.0 -``` - -Which then can be used to increment further: - -```bash -$ semver 1.2.4-beta.0 -i prerelease -1.2.4-beta.1 -``` - -### Advanced Range Syntax - -Advanced range syntax desugars to primitive comparators in -deterministic ways. - -Advanced ranges may be combined in the same way as primitive -comparators using white space or `||`. - -#### Hyphen Ranges `X.Y.Z - A.B.C` - -Specifies an inclusive set. - -* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` - -If a partial version is provided as the first version in the inclusive -range, then the missing pieces are replaced with zeroes. - -* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` - -If a partial version is provided as the second version in the -inclusive range, then all versions that start with the supplied parts -of the tuple are accepted, but nothing that would be greater than the -provided tuple parts. - -* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0` -* `1.2.3 - 2` := `>=1.2.3 <3.0.0` - -#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` - -Any of `X`, `x`, or `*` may be used to "stand in" for one of the -numeric values in the `[major, minor, patch]` tuple. - -* `*` := `>=0.0.0` (Any version satisfies) -* `1.x` := `>=1.0.0 <2.0.0` (Matching major version) -* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions) - -A partial version range is treated as an X-Range, so the special -character is in fact optional. - -* `""` (empty string) := `*` := `>=0.0.0` -* `1` := `1.x.x` := `>=1.0.0 <2.0.0` -* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0` - -#### Tilde Ranges `~1.2.3` `~1.2` `~1` - -Allows patch-level changes if a minor version is specified on the -comparator. Allows minor-level changes if not. - -* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0` -* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`) -* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`) -* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0` -* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`) -* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`) -* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. - -#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` - -Allows changes that do not modify the left-most non-zero element in the -`[major, minor, patch]` tuple. In other words, this allows patch and -minor updates for versions `1.0.0` and above, patch updates for -versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. - -Many authors treat a `0.x` version as if the `x` were the major -"breaking-change" indicator. - -Caret ranges are ideal when an author may make breaking changes -between `0.2.4` and `0.3.0` releases, which is a common practice. -However, it presumes that there will *not* be breaking changes between -`0.2.4` and `0.2.5`. It allows for changes that are presumed to be -additive (but non-breaking), according to commonly observed practices. - -* `^1.2.3` := `>=1.2.3 <2.0.0` -* `^0.2.3` := `>=0.2.3 <0.3.0` -* `^0.0.3` := `>=0.0.3 <0.0.4` -* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in - the `1.2.3` version will be allowed, if they are greater than or - equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but - `1.2.4-beta.2` would not, because it is a prerelease of a - different `[major, minor, patch]` tuple. -* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the - `0.0.3` version *only* will be allowed, if they are greater than or - equal to `beta`. So, `0.0.3-pr.2` would be allowed. - -When parsing caret ranges, a missing `patch` value desugars to the -number `0`, but will allow flexibility within that value, even if the -major and minor versions are both `0`. - -* `^1.2.x` := `>=1.2.0 <2.0.0` -* `^0.0.x` := `>=0.0.0 <0.1.0` -* `^0.0` := `>=0.0.0 <0.1.0` - -A missing `minor` and `patch` values will desugar to zero, but also -allow flexibility within those values, even if the major version is -zero. - -* `^1.x` := `>=1.0.0 <2.0.0` -* `^0.x` := `>=0.0.0 <1.0.0` - -### Range Grammar - -Putting all this together, here is a Backus-Naur grammar for ranges, -for the benefit of parser authors: - -```bnf -range-set ::= range ( logical-or range ) * -logical-or ::= ( ' ' ) * '||' ( ' ' ) * -range ::= hyphen | simple ( ' ' simple ) * | '' -hyphen ::= partial ' - ' partial -simple ::= primitive | partial | tilde | caret -primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial -partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? -xr ::= 'x' | 'X' | '*' | nr -nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * -tilde ::= '~' partial -caret ::= '^' partial -qualifier ::= ( '-' pre )? ( '+' build )? -pre ::= parts -build ::= parts -parts ::= part ( '.' part ) * -part ::= nr | [-0-9A-Za-z]+ -``` - -## Functions - -All methods and classes take a final `options` object argument. All -options in this object are `false` by default. The options supported -are: - -- `loose` Be more forgiving about not-quite-valid semver strings. - (Any resulting output will always be 100% strict compliant, of - course.) For backwards compatibility reasons, if the `options` - argument is a boolean value instead of an object, it is interpreted - to be the `loose` param. -- `includePrerelease` Set to suppress the [default - behavior](https://github.com/npm/node-semver#prerelease-tags) of - excluding prerelease tagged versions from ranges unless they are - explicitly opted into. - -Strict-mode Comparators and Ranges will be strict about the SemVer -strings that they parse. - -* `valid(v)`: Return the parsed version, or null if it's not valid. -* `inc(v, release)`: Return the version incremented by the release - type (`major`, `premajor`, `minor`, `preminor`, `patch`, - `prepatch`, or `prerelease`), or null if it's not valid - * `premajor` in one call will bump the version up to the next major - version and down to a prerelease of that major version. - `preminor`, and `prepatch` work the same way. - * If called from a non-prerelease version, the `prerelease` will work the - same as `prepatch`. It increments the patch version, then makes a - prerelease. If the input version is already a prerelease it simply - increments it. -* `prerelease(v)`: Returns an array of prerelease components, or null - if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` -* `major(v)`: Return the major version number. -* `minor(v)`: Return the minor version number. -* `patch(v)`: Return the patch version number. -* `intersects(r1, r2, loose)`: Return true if the two supplied ranges - or comparators intersect. -* `parse(v)`: Attempt to parse a string as a semantic version, returning either - a `SemVer` object or `null`. - -### Comparison - -* `gt(v1, v2)`: `v1 > v2` -* `gte(v1, v2)`: `v1 >= v2` -* `lt(v1, v2)`: `v1 < v2` -* `lte(v1, v2)`: `v1 <= v2` -* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, - even if they're not the exact same string. You already know how to - compare strings. -* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. -* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call - the corresponding function above. `"==="` and `"!=="` do simple - string comparison, but are included for completeness. Throws if an - invalid comparison string is provided. -* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions - in descending order when passed to `Array.sort()`. -* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions - are equal. Sorts in ascending order if passed to `Array.sort()`. - `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. -* `diff(v1, v2)`: Returns difference between two versions by the release type - (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), - or null if the versions are the same. - -### Comparators - -* `intersects(comparator)`: Return true if the comparators intersect - -### Ranges - -* `validRange(range)`: Return the valid range or null if it's not valid -* `satisfies(version, range)`: Return true if the version satisfies the - range. -* `maxSatisfying(versions, range)`: Return the highest version in the list - that satisfies the range, or `null` if none of them do. -* `minSatisfying(versions, range)`: Return the lowest version in the list - that satisfies the range, or `null` if none of them do. -* `minVersion(range)`: Return the lowest version that can possibly match - the given range. -* `gtr(version, range)`: Return `true` if version is greater than all the - versions possible in the range. -* `ltr(version, range)`: Return `true` if version is less than all the - versions possible in the range. -* `outside(version, range, hilo)`: Return true if the version is outside - the bounds of the range in either the high or low direction. The - `hilo` argument must be either the string `'>'` or `'<'`. (This is - the function called by `gtr` and `ltr`.) -* `intersects(range)`: Return true if any of the ranges comparators intersect - -Note that, since ranges may be non-contiguous, a version might not be -greater than a range, less than a range, *or* satisfy a range! For -example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` -until `2.0.0`, so the version `1.2.10` would not be greater than the -range (because `2.0.1` satisfies, which is higher), nor less than the -range (since `1.2.8` satisfies, which is lower), and it also does not -satisfy the range. - -If you want to know if a version satisfies or does not satisfy a -range, use the `satisfies(version, range)` function. - -### Coercion - -* `coerce(version, options)`: Coerces a string to semver if possible - -This aims to provide a very forgiving translation of a non-semver string to -semver. It looks for the first digit in a string, and consumes all -remaining characters which satisfy at least a partial semver (e.g., `1`, -`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer -versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All -surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes -`3.4.0`). Only text which lacks digits will fail coercion (`version one` -is not valid). The maximum length for any semver component considered for -coercion is 16 characters; longer components will be ignored -(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any -semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value -components are invalid (`9999999999999999.4.7.4` is likely invalid). - -If the `options.rtl` flag is set, then `coerce` will return the right-most -coercible tuple that does not share an ending index with a longer coercible -tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not -`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of -any other overlapping SemVer tuple. - -### Clean - -* `clean(version)`: Clean a string to be a valid semver if possible - -This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges. - -ex. -* `s.clean(' = v 2.1.5foo')`: `null` -* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` -* `s.clean(' = v 2.1.5-foo')`: `null` -* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` -* `s.clean('=v2.1.5')`: `'2.1.5'` -* `s.clean(' =v2.1.5')`: `2.1.5` -* `s.clean(' 2.1.5 ')`: `'2.1.5'` -* `s.clean('~1.0.0')`: `null` diff --git a/node_modules/sver/node_modules/semver/bin/semver.js b/node_modules/sver/node_modules/semver/bin/semver.js deleted file mode 100755 index 666034a..0000000 --- a/node_modules/sver/node_modules/semver/bin/semver.js +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env node -// Standalone semver comparison program. -// Exits successfully and prints matching version(s) if -// any supplied version is valid and passes all tests. - -var argv = process.argv.slice(2) - -var versions = [] - -var range = [] - -var inc = null - -var version = require('../package.json').version - -var loose = false - -var includePrerelease = false - -var coerce = false - -var rtl = false - -var identifier - -var semver = require('../semver') - -var reverse = false - -var options = {} - -main() - -function main () { - if (!argv.length) return help() - while (argv.length) { - var a = argv.shift() - var indexOfEqualSign = a.indexOf('=') - if (indexOfEqualSign !== -1) { - a = a.slice(0, indexOfEqualSign) - argv.unshift(a.slice(indexOfEqualSign + 1)) - } - switch (a) { - case '-rv': case '-rev': case '--rev': case '--reverse': - reverse = true - break - case '-l': case '--loose': - loose = true - break - case '-p': case '--include-prerelease': - includePrerelease = true - break - case '-v': case '--version': - versions.push(argv.shift()) - break - case '-i': case '--inc': case '--increment': - switch (argv[0]) { - case 'major': case 'minor': case 'patch': case 'prerelease': - case 'premajor': case 'preminor': case 'prepatch': - inc = argv.shift() - break - default: - inc = 'patch' - break - } - break - case '--preid': - identifier = argv.shift() - break - case '-r': case '--range': - range.push(argv.shift()) - break - case '-c': case '--coerce': - coerce = true - break - case '--rtl': - rtl = true - break - case '--ltr': - rtl = false - break - case '-h': case '--help': case '-?': - return help() - default: - versions.push(a) - break - } - } - - var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl } - - versions = versions.map(function (v) { - return coerce ? (semver.coerce(v, options) || { version: v }).version : v - }).filter(function (v) { - return semver.valid(v) - }) - if (!versions.length) return fail() - if (inc && (versions.length !== 1 || range.length)) { return failInc() } - - for (var i = 0, l = range.length; i < l; i++) { - versions = versions.filter(function (v) { - return semver.satisfies(v, range[i], options) - }) - if (!versions.length) return fail() - } - return success(versions) -} - -function failInc () { - console.error('--inc can only be used on a single version with no range') - fail() -} - -function fail () { process.exit(1) } - -function success () { - var compare = reverse ? 'rcompare' : 'compare' - versions.sort(function (a, b) { - return semver[compare](a, b, options) - }).map(function (v) { - return semver.clean(v, options) - }).map(function (v) { - return inc ? semver.inc(v, inc, options, identifier) : v - }).forEach(function (v, i, _) { console.log(v) }) -} - -function help () { - console.log(['SemVer ' + version, - '', - 'A JavaScript implementation of the https://semver.org/ specification', - 'Copyright Isaac Z. Schlueter', - '', - 'Usage: semver [options] [ [...]]', - 'Prints valid versions sorted by SemVer precedence', - '', - 'Options:', - '-r --range ', - ' Print versions that match the specified range.', - '', - '-i --increment []', - ' Increment a version by the specified level. Level can', - ' be one of: major, minor, patch, premajor, preminor,', - " prepatch, or prerelease. Default level is 'patch'.", - ' Only one version may be specified.', - '', - '--preid ', - ' Identifier to be used to prefix premajor, preminor,', - ' prepatch or prerelease version increments.', - '', - '-l --loose', - ' Interpret versions and ranges loosely', - '', - '-p --include-prerelease', - ' Always include prerelease versions in range matching', - '', - '-c --coerce', - ' Coerce a string into SemVer if possible', - ' (does not imply --loose)', - '', - '--rtl', - ' Coerce version strings right to left', - '', - '--ltr', - ' Coerce version strings left to right (default)', - '', - 'Program exits successfully if any valid version satisfies', - 'all supplied ranges, and prints all satisfying versions.', - '', - 'If no satisfying versions are found, then exits failure.', - '', - 'Versions are printed in ascending order, so supplying', - 'multiple versions to the utility will just sort them.' - ].join('\n')) -} diff --git a/node_modules/sver/node_modules/semver/package.json b/node_modules/sver/node_modules/semver/package.json deleted file mode 100644 index 6b970a6..0000000 --- a/node_modules/sver/node_modules/semver/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "semver", - "version": "6.3.1", - "description": "The semantic version parser used by npm.", - "main": "semver.js", - "scripts": { - "test": "tap test/ --100 --timeout=30", - "lint": "echo linting disabled", - "postlint": "template-oss-check", - "template-oss-apply": "template-oss-apply --force", - "lintfix": "npm run lint -- --fix", - "snap": "tap test/ --100 --timeout=30", - "posttest": "npm run lint" - }, - "devDependencies": { - "@npmcli/template-oss": "4.17.0", - "tap": "^12.7.0" - }, - "license": "ISC", - "repository": { - "type": "git", - "url": "https://github.com/npm/node-semver.git" - }, - "bin": { - "semver": "./bin/semver.js" - }, - "files": [ - "bin", - "range.bnf", - "semver.js" - ], - "author": "GitHub Inc.", - "templateOSS": { - "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "content": "./scripts/template-oss", - "version": "4.17.0" - } -} diff --git a/node_modules/sver/node_modules/semver/range.bnf b/node_modules/sver/node_modules/semver/range.bnf deleted file mode 100644 index d4c6ae0..0000000 --- a/node_modules/sver/node_modules/semver/range.bnf +++ /dev/null @@ -1,16 +0,0 @@ -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/sver/node_modules/semver/semver.js b/node_modules/sver/node_modules/semver/semver.js deleted file mode 100644 index 39319c1..0000000 --- a/node_modules/sver/node_modules/semver/semver.js +++ /dev/null @@ -1,1643 +0,0 @@ -exports = module.exports = SemVer - -var debug -/* istanbul ignore next */ -if (typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0) - args.unshift('SEMVER') - console.log.apply(console, args) - } -} else { - debug = function () {} -} - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0' - -var MAX_LENGTH = 256 -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16 - -var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 - -// The actual regexps go on exports.re -var re = exports.re = [] -var safeRe = exports.safeRe = [] -var src = exports.src = [] -var t = exports.tokens = {} -var R = 0 - -function tok (n) { - t[n] = R++ -} - -var LETTERDASHNUMBER = '[a-zA-Z0-9-]' - -// Replace some greedy regex tokens to prevent regex dos issues. These regex are -// used internally via the safeRe object since all inputs in this library get -// normalized first to trim and collapse all extra whitespace. The original -// regexes are exported for userland consumption and lower level usage. A -// future breaking change could export the safer regex only with a note that -// all input should have extra whitespace removed. -var safeRegexReplacements = [ - ['\\s', 1], - ['\\d', MAX_LENGTH], - [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], -] - -function makeSafeRe (value) { - for (var i = 0; i < safeRegexReplacements.length; i++) { - var token = safeRegexReplacements[i][0] - var max = safeRegexReplacements[i][1] - value = value - .split(token + '*').join(token + '{0,' + max + '}') - .split(token + '+').join(token + '{1,' + max + '}') - } - return value -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -tok('NUMERICIDENTIFIER') -src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*' -tok('NUMERICIDENTIFIERLOOSE') -src[t.NUMERICIDENTIFIERLOOSE] = '\\d+' - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -tok('NONNUMERICIDENTIFIER') -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*' - -// ## Main Version -// Three dot-separated numeric identifiers. - -tok('MAINVERSION') -src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIER] + ')' - -tok('MAINVERSIONLOOSE') -src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')' - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -tok('PRERELEASEIDENTIFIER') -src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + - '|' + src[t.NONNUMERICIDENTIFIER] + ')' - -tok('PRERELEASEIDENTIFIERLOOSE') -src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + - '|' + src[t.NONNUMERICIDENTIFIER] + ')' - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -tok('PRERELEASE') -src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + - '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))' - -tok('PRERELEASELOOSE') -src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))' - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -tok('BUILDIDENTIFIER') -src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+' - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -tok('BUILD') -src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + - '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))' - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -tok('FULL') -tok('FULLPLAIN') -src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + - src[t.PRERELEASE] + '?' + - src[t.BUILD] + '?' - -src[t.FULL] = '^' + src[t.FULLPLAIN] + '$' - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -tok('LOOSEPLAIN') -src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + - src[t.PRERELEASELOOSE] + '?' + - src[t.BUILD] + '?' - -tok('LOOSE') -src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$' - -tok('GTLT') -src[t.GTLT] = '((?:<|>)?=?)' - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -tok('XRANGEIDENTIFIERLOOSE') -src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*' -tok('XRANGEIDENTIFIER') -src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*' - -tok('XRANGEPLAIN') -src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + - '(?:' + src[t.PRERELEASE] + ')?' + - src[t.BUILD] + '?' + - ')?)?' - -tok('XRANGEPLAINLOOSE') -src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[t.PRERELEASELOOSE] + ')?' + - src[t.BUILD] + '?' + - ')?)?' - -tok('XRANGE') -src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$' -tok('XRANGELOOSE') -src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$' - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -tok('COERCE') -src[t.COERCE] = '(^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])' -tok('COERCERTL') -re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g') -safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g') - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -tok('LONETILDE') -src[t.LONETILDE] = '(?:~>?)' - -tok('TILDETRIM') -src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+' -re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g') -safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g') -var tildeTrimReplace = '$1~' - -tok('TILDE') -src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$' -tok('TILDELOOSE') -src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$' - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -tok('LONECARET') -src[t.LONECARET] = '(?:\\^)' - -tok('CARETTRIM') -src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+' -re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g') -safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g') -var caretTrimReplace = '$1^' - -tok('CARET') -src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$' -tok('CARETLOOSE') -src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$' - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -tok('COMPARATORLOOSE') -src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$' -tok('COMPARATOR') -src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$' - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -tok('COMPARATORTRIM') -src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + - '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')' - -// this one has to use the /g flag -re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g') -safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g') -var comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -tok('HYPHENRANGE') -src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[t.XRANGEPLAIN] + ')' + - '\\s*$' - -tok('HYPHENRANGELOOSE') -src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[t.XRANGEPLAINLOOSE] + ')' + - '\\s*$' - -// Star ranges basically just allow anything at all. -tok('STAR') -src[t.STAR] = '(<|>)?=?\\s*\\*' - -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]) - if (!re[i]) { - re[i] = new RegExp(src[i]) - - // Replace all greedy whitespace to prevent regex dos issues. These regex are - // used internally via the safeRe object since all inputs in this library get - // normalized first to trim and collapse all extra whitespace. The original - // regexes are exported for userland consumption and lower level usage. A - // future breaking change could export the safer regex only with a note that - // all input should have extra whitespace removed. - safeRe[i] = new RegExp(makeSafeRe(src[i])) - } -} - -exports.parse = parse -function parse (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } -} - -exports.valid = valid -function valid (version, options) { - var v = parse(version, options) - return v ? v.version : null -} - -exports.clean = clean -function clean (version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} - -exports.SemVer = SemVer - -function SemVer (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - - var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]) - - if (!m) { - throw new TypeError('Invalid Version: ' + version) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() -} - -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.') - } - return this.version -} - -SemVer.prototype.toString = function () { - return this.version -} - -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return this.compareMain(other) || this.comparePre(other) -} - -SemVer.prototype.compareMain = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) -} - -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - var i = 0 - do { - var a = this.prerelease[i] - var b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -SemVer.prototype.compareBuild = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - var i = 0 - do { - var a = this.build[i] - var b = other.build[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) -} - -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - var i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break - - default: - throw new Error('invalid increment argument: ' + release) - } - this.format() - this.raw = this.version - return this -} - -exports.inc = inc -function inc (version, release, loose, identifier) { - if (typeof (loose) === 'string') { - identifier = loose - loose = undefined - } - - try { - return new SemVer(version, loose).inc(release, identifier).version - } catch (er) { - return null - } -} - -exports.diff = diff -function diff (version1, version2) { - if (eq(version1, version2)) { - return null - } else { - var v1 = parse(version1) - var v2 = parse(version2) - var prefix = '' - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre' - var defaultResult = 'prerelease' - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} - -exports.compareIdentifiers = compareIdentifiers - -var numeric = /^[0-9]+$/ -function compareIdentifiers (a, b) { - var anum = numeric.test(a) - var bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -exports.rcompareIdentifiers = rcompareIdentifiers -function rcompareIdentifiers (a, b) { - return compareIdentifiers(b, a) -} - -exports.major = major -function major (a, loose) { - return new SemVer(a, loose).major -} - -exports.minor = minor -function minor (a, loose) { - return new SemVer(a, loose).minor -} - -exports.patch = patch -function patch (a, loose) { - return new SemVer(a, loose).patch -} - -exports.compare = compare -function compare (a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)) -} - -exports.compareLoose = compareLoose -function compareLoose (a, b) { - return compare(a, b, true) -} - -exports.compareBuild = compareBuild -function compareBuild (a, b, loose) { - var versionA = new SemVer(a, loose) - var versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) -} - -exports.rcompare = rcompare -function rcompare (a, b, loose) { - return compare(b, a, loose) -} - -exports.sort = sort -function sort (list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(a, b, loose) - }) -} - -exports.rsort = rsort -function rsort (list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(b, a, loose) - }) -} - -exports.gt = gt -function gt (a, b, loose) { - return compare(a, b, loose) > 0 -} - -exports.lt = lt -function lt (a, b, loose) { - return compare(a, b, loose) < 0 -} - -exports.eq = eq -function eq (a, b, loose) { - return compare(a, b, loose) === 0 -} - -exports.neq = neq -function neq (a, b, loose) { - return compare(a, b, loose) !== 0 -} - -exports.gte = gte -function gte (a, b, loose) { - return compare(a, b, loose) >= 0 -} - -exports.lte = lte -function lte (a, b, loose) { - return compare(a, b, loose) <= 0 -} - -exports.cmp = cmp -function cmp (a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b - - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) - - default: - throw new TypeError('Invalid operator: ' + op) - } -} - -exports.Comparator = Comparator -function Comparator (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - if (!(this instanceof Comparator)) { - return new Comparator(comp, options) - } - - comp = comp.trim().split(/\s+/).join(' ') - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) -} - -var ANY = {} -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] - var m = comp.match(r) - - if (!m) { - throw new TypeError('Invalid comparator: ' + comp) - } - - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } -} - -Comparator.prototype.toString = function () { - return this.value -} - -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - return cmp(version, this.operator, this.semver, this.options) -} - -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - var rangeTmp - - if (this.operator === '') { - if (this.value === '') { - return true - } - rangeTmp = new Range(comp.value, options) - return satisfies(this.value, rangeTmp, options) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - rangeTmp = new Range(this.value, options) - return satisfies(comp.semver, rangeTmp, options) - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - var sameSemVer = this.semver.version === comp.semver.version - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')) - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')) - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan -} - -exports.Range = Range -function Range (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - return new Range(range.value, options) - } - - if (!(this instanceof Range)) { - return new Range(range, options) - } - - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease - - // First reduce all whitespace as much as possible so we do not have to rely - // on potentially slow regexes like \s*. This is then stored and used for - // future error messages as well. - this.raw = range - .trim() - .split(/\s+/) - .join(' ') - - // First, split based on boolean or || - this.set = this.raw.split('||').map(function (range) { - return this.parseRange(range.trim()) - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length - }) - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + this.raw) - } - - this.format() -} - -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim() - }).join('||').trim() - return this.range -} - -Range.prototype.toString = function () { - return this.range -} - -Range.prototype.parseRange = function (range) { - var loose = this.options.loose - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, safeRe[t.COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR] - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options) - }, this).join(' ').split(/\s+/) - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe) - }) - } - set = set.map(function (comp) { - return new Comparator(comp, this.options) - }, this) - - return set -} - -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some(function (thisComparators) { - return ( - isSatisfiable(thisComparators, options) && - range.set.some(function (rangeComparators) { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every(function (thisComparator) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) -} - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -function isSatisfiable (comparators, options) { - var result = true - var remainingComparators = comparators.slice() - var testComparator = remainingComparators.pop() - - while (result && remainingComparators.length) { - result = remainingComparators.every(function (otherComparator) { - return testComparator.intersects(otherComparator, options) - }) - - testComparator = remainingComparators.pop() - } - - return result -} - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators -function toComparators (range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value - }).join(' ').trim().split(' ') - }) -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator (comp, options) { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -function isX (id) { - return !id || id.toLowerCase() === 'x' || id === '*' -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options) - }).join(' ') -} - -function replaceTilde (comp, options) { - var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE] - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else if (pr) { - debug('replaceTilde pr', pr) - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets (comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options) - }).join(' ') -} - -function replaceCaret (comp, options) { - debug('caret', comp, options) - var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET] - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr) - var ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0' - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0' - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0' - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + - ' <' + (+M + 1) + '.0.0' - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1) - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0' - } - } else { - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0' - } - } - - debug('caret return', ret) - return ret - }) -} - -function replaceXRanges (comp, options) { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options) - }).join(' ') -} - -function replaceXRange (comp, options) { - comp = comp.trim() - var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE] - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - var xM = isX(M) - var xm = xM || isX(m) - var xp = xm || isX(p) - var anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' - } - - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - ret = gtlt + M + '.' + m + '.' + p + pr - } else if (xm) { - ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr - } else if (xp) { - ret = '>=' + M + '.' + m + '.0' + pr + - ' <' + M + '.' + (+m + 1) + '.0' + pr - } - - debug('xRange return', ret) - - return ret - }) -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars (comp, options) { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(safeRe[t.STAR], '') -} - -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = '>=' + fM + '.0.0' - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0' - } else { - from = '>=' + from - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0' - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0' - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr - } else { - to = '<=' + to - } - - return (from + ' ' + to).trim() -} - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function (version) { - if (!version) { - return false - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } - } - return false -} - -function testSet (set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} - -exports.satisfies = satisfies -function satisfies (version, range, options) { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} - -exports.maxSatisfying = maxSatisfying -function maxSatisfying (versions, range, options) { - var max = null - var maxSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} - -exports.minSatisfying = minSatisfying -function minSatisfying (versions, range, options) { - var min = null - var minSV = null - try { - var rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} - -exports.minVersion = minVersion -function minVersion (range, loose) { - range = new Range(range, loose) - - var minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error('Unexpected operation: ' + comparator.operator) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null -} - -exports.validRange = validRange -function validRange (range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr -function ltr (version, range, options) { - return outside(version, range, '<', options) -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr -function gtr (version, range, options) { - return outside(version, range, '>', options) -} - -exports.outside = outside -function outside (version, range, hilo, options) { - version = new SemVer(version, options) - range = new Range(range, options) - - var gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i] - - var high = null - var low = null - - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} - -exports.prerelease = prerelease -function prerelease (version, options) { - var parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null -} - -exports.intersects = intersects -function intersects (r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -exports.coerce = coerce -function coerce (version, options) { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } - - options = options || {} - - var match = null - if (!options.rtl) { - match = version.match(safeRe[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - var next - while ((next = safeRe[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 - } - safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - safeRe[t.COERCERTL].lastIndex = -1 - } - - if (match === null) { - return null - } - - return parse(match[2] + - '.' + (match[3] || '0') + - '.' + (match[4] || '0'), options) -} diff --git a/node_modules/sver/package.json b/node_modules/sver/package.json deleted file mode 100644 index d3ac122..0000000 --- a/node_modules/sver/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "sver", - "version": "1.8.4", - "description": "Simple Semver and SemverRange classes", - "main": "sver.js", - "scripts": { - "test": "mocha -u tdd -R dot" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/guybedford/sver.git" - }, - "keywords": [ - "semver" - ], - "author": "Guy Bedford", - "license": "MIT", - "bugs": { - "url": "https://github.com/guybedford/sver/issues" - }, - "homepage": "https://github.com/guybedford/sver#readme", - "devDependencies": { - "mocha": "^10.2.0", - "semver": "^6.3.0" - }, - "optionalDependencies": { - "semver": "^6.3.0" - } -} diff --git a/node_modules/sver/sver.js b/node_modules/sver/sver.js deleted file mode 100644 index b8781c1..0000000 --- a/node_modules/sver/sver.js +++ /dev/null @@ -1,392 +0,0 @@ -'use strict'; - -const shortSemverRegEx = /^([~\^])?(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?$/; -const semverRegEx = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(\+[\da-z-]+)?$/i; -exports.semverRegEx = semverRegEx; -exports.shortSemverRegEx = shortSemverRegEx; - -const MAJOR = Symbol('major'); -const MINOR = Symbol('minor'); -const PATCH = Symbol('patch'); -const PRE = Symbol('pre'); -const BUILD = Symbol('build'); -const TAG = Symbol('tag'); - -let numRegEx = /^\d+$/; -class Semver { - constructor (version) { - let semver = version.match(semverRegEx); - if (!semver) { - this[TAG] = version; - return; - } - this[MAJOR] = parseInt(semver[1], 10); - this[MINOR] = parseInt(semver[2], 10); - this[PATCH] = parseInt(semver[3], 10); - this[PRE] = semver[4] && semver[4].split('.'); - this[BUILD] = semver[5]; - } - get major () { - return this[MAJOR]; - } - get minor () { - return this[MINOR]; - } - get patch () { - return this[PATCH]; - } - get pre () { - return this[PRE]; - } - get build () { - return this[BUILD]; - } - get tag () { - return this[TAG]; - } - gt (version) { - return Semver.compare(this, version) === 1; - } - lt (version) { - return Semver.compare(this, version) === -1; - } - eq (version) { - if (!(version instanceof Semver)) - version = new Semver(version); - - if (this[TAG] && version[TAG]) - return this[TAG] === version[TAG]; - if (this[TAG] || version[TAG]) - return false; - if (this[MAJOR] !== version[MAJOR]) - return false; - if (this[MINOR] !== version[MINOR]) - return false; - if (this[PATCH] !== version[PATCH]) - return false; - if (this[PRE] === undefined && version[PRE] === undefined) - return true; - if (this[PRE] === undefined || version[PRE] === undefined) - return false; - if (this[PRE].length !== version[PRE].length) - return false; - for (let i = 0; i < this[PRE].length; i++) { - if (this[PRE][i] !== version[PRE][i]) - return false; - } - return this[BUILD] === version[BUILD]; - } - matches (range, unstable = false) { - if (!(range instanceof SemverRange)) - range = new SemverRange(range); - return range.has(this, unstable); - } - toString () { - if (this[TAG]) - return this[TAG]; - return this[MAJOR] + '.' + this[MINOR] + '.' + this[PATCH] + (this[PRE] ? '-' + this[PRE].join('.') : '') + (this[BUILD] ? this[BUILD] : ''); - } - toJSON() { - return this.toString(); - } - static isValid (version) { - let semver = version.match(semverRegEx); - return semver && semver[2] !== undefined && semver[3] !== undefined; - } - static compare (v1, v2) { - if (!(v1 instanceof Semver)) - v1 = new Semver(v1); - if (!(v2 instanceof Semver)) - v2 = new Semver(v2); - - // not semvers - tags have equal precedence - if (v1[TAG] && v2[TAG]) - return 0; - // semver beats tag version - if (v1[TAG]) - return -1; - if (v2[TAG]) - return 1; - // compare version numbers - if (v1[MAJOR] !== v2[MAJOR]) - return v1[MAJOR] > v2[MAJOR] ? 1 : -1; - if (v1[MINOR] !== v2[MINOR]) - return v1[MINOR] > v2[MINOR] ? 1 : -1; - if (v1[PATCH] !== v2[PATCH]) - return v1[PATCH] > v2[PATCH] ? 1 : -1; - if (!v1[PRE] && !v2[PRE]) - return 0; - if (!v1[PRE]) - return 1; - if (!v2[PRE]) - return -1; - // prerelease comparison - return prereleaseCompare(v1[PRE], v2[PRE]); - } -} -exports.Semver = Semver; - -function prereleaseCompare (v1Pre, v2Pre) { - for (let i = 0, l = Math.min(v1Pre.length, v2Pre.length); i < l; i++) { - if (v1Pre[i] !== v2Pre[i]) { - let isNum1 = v1Pre[i].match(numRegEx); - let isNum2 = v2Pre[i].match(numRegEx); - // numeric has lower precedence - if (isNum1 && !isNum2) - return -1; - if (isNum2 && !isNum1) - return 1; - // compare parts - if (isNum1 && isNum2) - return parseInt(v1Pre[i], 10) > parseInt(v2Pre[i], 10) ? 1 : -1; - else - return v1Pre[i] > v2Pre[i] ? 1 : -1; - } - } - if (v1Pre.length === v2Pre.length) - return 0; - // more pre-release fields win if equal - return v1Pre.length > v2Pre.length ? 1 : -1; - -} - -const WILDCARD_RANGE = 0; -const MAJOR_RANGE = 1; -const STABLE_RANGE = 2; -const EXACT_RANGE = 3; - -const TYPE = Symbol('type'); -const VERSION = Symbol('version'); - -class SemverRange { - constructor (versionRange) { - if (versionRange === '*' || versionRange === '') { - this[TYPE] = WILDCARD_RANGE; - return; - } - let shortSemver = versionRange.match(shortSemverRegEx); - if (shortSemver) { - if (shortSemver[1]) - versionRange = versionRange.substr(1); - if (shortSemver[3] === undefined) { - // ^, ~ mean the same thing for a single major - this[VERSION] = new Semver(versionRange + '.0.0'); - this[TYPE] = MAJOR_RANGE; - } - else { - this[VERSION] = new Semver(versionRange + '.0'); - // ^ only becomes major range for major > 0 - if (shortSemver[1] === '^' && shortSemver[2] !== '0') - this[TYPE] = MAJOR_RANGE; - else - this[TYPE] = STABLE_RANGE; - } - // empty pre array === support prerelease ranges - this[VERSION][PRE] = this[VERSION][PRE] || []; - } - // forces hat on 0.x versions - else if (versionRange.startsWith('^^')) { - this[VERSION] = new Semver(versionRange.substr(2)); - this[TYPE] = MAJOR_RANGE; - } - else if (versionRange[0] === '^') { - this[VERSION] = new Semver(versionRange.substr(1)); - if (this[VERSION][MAJOR] === 0) { - if (this[VERSION][MINOR] === 0) - this[TYPE] = EXACT_RANGE; - else - this[TYPE] = STABLE_RANGE; - } - else { - this[TYPE] = MAJOR_RANGE; - } - } - else if (versionRange[0] === '~') { - this[VERSION] = new Semver(versionRange.substr(1)); - this[TYPE] = STABLE_RANGE; - } - else { - this[VERSION] = new Semver(versionRange); - this[TYPE] = EXACT_RANGE; - } - if (this[VERSION][TAG] && this[TYPE] !== EXACT_RANGE) - this[TYPE] = EXACT_RANGE; - } - get isExact () { - return this[TYPE] === EXACT_RANGE; - } - get isExactSemver () { - return this[TYPE] === EXACT_RANGE && this.version[TAG] === undefined; - } - get isExactTag () { - return this[TYPE] === EXACT_RANGE && this.version[TAG] !== undefined; - } - get isStable () { - return this[TYPE] === STABLE_RANGE; - } - get isMajor () { - return this[TYPE] === MAJOR_RANGE; - } - get isWildcard () { - return this[TYPE] === WILDCARD_RANGE; - } - get type () { - switch (this[TYPE]) { - case WILDCARD_RANGE: - return 'wildcard'; - case MAJOR_RANGE: - return 'major'; - case STABLE_RANGE: - return 'stable'; - case EXACT_RANGE: - return 'exact'; - } - } - get version () { - return this[VERSION]; - } - gt (range) { - return SemverRange.compare(this, range) === 1; - } - lt (range) { - return SemverRange.compare(this, range) === -1; - } - eq (range) { - return SemverRange.compare(this, range) === 0; - } - has (version, unstable = false) { - if (!(version instanceof Semver)) - version = new Semver(version); - if (this[TYPE] === WILDCARD_RANGE) - return unstable || (!version[PRE] && !version[TAG]); - if (this[TYPE] === EXACT_RANGE) - return this[VERSION].eq(version); - if (version[TAG]) - return false; - if (this[VERSION][MAJOR] !== version[MAJOR]) - return false; - if (this[TYPE] === MAJOR_RANGE ? this[VERSION][MINOR] > version[MINOR] : this[VERSION][MINOR] !== version[MINOR]) - return false; - if ((this[TYPE] === MAJOR_RANGE ? this[VERSION][MINOR] === version[MINOR] : true) && this[VERSION][PATCH] > version[PATCH]) - return false; - if (version[PRE] === undefined || version[PRE].length === 0) - return true; - if (this[VERSION][PRE] === undefined || this[VERSION][PRE].length === 0) - return unstable; - if (unstable === false && (this[VERSION][MINOR] !== version[MINOR] || this[VERSION][PATCH] !== version[PATCH])) - return false; - return prereleaseCompare(this[VERSION][PRE], version[PRE]) !== 1; - } - contains (range) { - if (!(range instanceof SemverRange)) - range = new SemverRange(range); - if (this[TYPE] === WILDCARD_RANGE) - return true; - if (range[TYPE] === WILDCARD_RANGE) - return false; - return range[TYPE] >= this[TYPE] && this.has(range[VERSION], true); - } - intersect (range) { - if (!(range instanceof SemverRange)) - range = new SemverRange(range); - - if (this[TYPE] === WILDCARD_RANGE && range[TYPE] === WILDCARD_RANGE) - return this; - if (this[TYPE] === WILDCARD_RANGE) - return range; - if (range[TYPE] === WILDCARD_RANGE) - return this; - - if (this[TYPE] === EXACT_RANGE) - return range.has(this[VERSION], true) ? this : undefined; - if (range[TYPE] === EXACT_RANGE) - return this.has(range[VERSION], true) ? range : undefined; - - let higherRange, lowerRange, polarity; - if (range[VERSION].gt(this[VERSION])) { - higherRange = range; - lowerRange = this; - polarity = true; - } - else { - higherRange = this; - lowerRange = range; - polarity = false; - } - - if (!lowerRange.has(higherRange[VERSION], true)) - return; - - if (lowerRange[TYPE] === MAJOR_RANGE) - return polarity ? range : this; - - let intersection = new SemverRange(higherRange[VERSION].toString()); - intersection[TYPE] = STABLE_RANGE; - return intersection; - } - bestMatch (versions, unstable = false) { - let maxSemver; - versions.forEach(version => { - if (!(version instanceof Semver)) - version = new Semver(version); - if (!this.has(version, unstable)) - return; - if (!maxSemver) - maxSemver = version; - else if (Semver.compare(version, maxSemver) === 1) - maxSemver = version; - }); - return maxSemver; - } - toString () { - let version = this[VERSION]; - switch (this[TYPE]) { - case WILDCARD_RANGE: - return '*'; - case MAJOR_RANGE: - if (version[MAJOR] === 0 && version[MINOR] === 0 && version[PATCH] === 0) - return '0'; - if (version[PRE] && version[PRE].length === 0 && version[PATCH] === 0) - return '^' + version[MAJOR] + '.' + version[MINOR]; - return '^' + version.toString(); - case STABLE_RANGE: - if (version[PRE] && version[PRE].length === 0 && version[PATCH] === 0 || version[MAJOR] === 0 && version[MINOR] === 0) - return version[MAJOR] + '.' + version[MINOR]; - return '~' + version.toString(); - case EXACT_RANGE: - return version.toString(); - } - } - toJSON() { - return this.toString(); - } - static match (range, version, unstable = false) { - if (!(version instanceof Semver)) - version = new Semver(version); - return version.matches(range, unstable); - } - static isValid (range) { - let semverRange = new SemverRange(range); - return semverRange[TYPE] !== EXACT_RANGE || semverRange[VERSION][TAG] === undefined; - } - static compare (r1, r2) { - if (!(r1 instanceof SemverRange)) - r1 = new SemverRange(r1); - if (!(r2 instanceof SemverRange)) - r2 = new SemverRange(r2); - if (r1[TYPE] === WILDCARD_RANGE && r2[TYPE] === WILDCARD_RANGE) - return 0; - if (r1[TYPE] === WILDCARD_RANGE) - return 1; - if (r2[TYPE] === WILDCARD_RANGE) - return -1; - let cmp = Semver.compare(r1[VERSION], r2[VERSION]); - if (cmp !== 0) { - return cmp; - } - if (r1[TYPE] === r2[TYPE]) - return 0; - return r1[TYPE] > r2[TYPE] ? 1 : -1; - } -} -exports.SemverRange = SemverRange; diff --git a/node_modules/synckit/LICENSE b/node_modules/synckit/LICENSE deleted file mode 100644 index b93398b..0000000 --- a/node_modules/synckit/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 UnTS - -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/synckit/README.md b/node_modules/synckit/README.md deleted file mode 100644 index 153ae78..0000000 --- a/node_modules/synckit/README.md +++ /dev/null @@ -1,191 +0,0 @@ -# synckit - -[![GitHub Actions](https://github.com/un-ts/synckit/workflows/CI/badge.svg)](https://github.com/un-ts/synckit/actions/workflows/ci.yml) -[![Codecov](https://img.shields.io/codecov/c/github/un-ts/synckit.svg)](https://codecov.io/gh/un-ts/synckit) -[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fsynckit%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage) -[![npm](https://img.shields.io/npm/v/synckit.svg)](https://www.npmjs.com/package/synckit) -[![GitHub Release](https://img.shields.io/github/release/un-ts/synckit)](https://github.com/un-ts/synckit/releases) - -[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org) -[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com) -[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) -[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) - -Perform async work synchronously in Node.js using `worker_threads` with first-class TypeScript and Yarn P'n'P support. - -## TOC - -- [Usage](#usage) - - [Install](#install) - - [API](#api) - - [Types](#types) - - [Options](#options) - - [Envs](#envs) - - [TypeScript](#typescript) - - [`ts-node`](#ts-node) - - [`esbuild-register`](#esbuild-register) - - [`esbuild-runner`](#esbuild-runner) - - [`swc`](#swc) - - [`tsx`](#tsx) -- [Benchmark](#benchmark) -- [Sponsors](#sponsors) -- [Backers](#backers) -- [Changelog](#changelog) -- [License](#license) - -## Usage - -### Install - -```sh -# yarn -yarn add synckit - -# npm -npm i synckit -``` - -### API - -```js -// runner.js -import { createSyncFn } from 'synckit' - -// the worker path must be absolute -const syncFn = createSyncFn(require.resolve('./worker'), { - tsRunner: 'tsx', // optional, can be `'ts-node' | 'esbuild-register' | 'esbuild-runner' | 'tsx'` -}) - -// do whatever you want, you will get the result synchronously! -const result = syncFn(...args) -``` - -```js -// worker.js -import { runAsWorker } from 'synckit' - -runAsWorker(async (...args) => { - // do expensive work - return result -}) -``` - -You must make sure, the `result` is serializable by [`Structured Clone Algorithm`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) - -### Types - -````ts -export interface GlobalShim { - moduleName: string - /** - * `undefined` means side effect only - */ - globalName?: string - /** - * 1. `undefined` or empty string means `default`, for example: - * ```js - * import globalName from 'module-name' - * ``` - * - * 2. `null` means namespaced, for example: - * ```js - * import * as globalName from 'module-name' - * ``` - * - */ - named?: string | null - /** - * If not `false`, the shim will only be applied when the original `globalName` unavailable, - * for example you may only want polyfill `globalThis.fetch` when it's unavailable natively: - * ```js - * import fetch from 'node-fetch' - * - * if (!globalThis.fetch) { - * globalThis.fetch = fetch - * } - * ``` - */ - conditional?: boolean -} -```` - -### Options - -1. `execArgv` same as env `SYNCKIT_EXEC_ARGV` -2. `globalShims`: Similar like env `SYNCKIT_GLOBAL_SHIMS` but much more flexible which can be a `GlobalShim` `Array`, see `GlobalShim`'s [definition](#types) for more details -3. `timeout` same as env `SYNCKIT_TIMEOUT` -4. `transferList`: Please refer Node.js [`worker_threads`](https://nodejs.org/api/worker_threads.html#:~:text=Default%3A%20true.-,transferList,-%3CObject%5B%5D%3E%20If) documentation -5. `tsRunner` same as env `SYNCKIT_TS_RUNNER` - -### Envs - -1. `SYNCKIT_EXEC_ARGV`: List of node CLI options passed to the worker, split with comma `,`. (default as `[]`), see also [`node` docs](https://nodejs.org/api/worker_threads.html) -2. `SYNCKIT_GLOBAL_SHIMS`: Whether to enable the default `DEFAULT_GLOBAL_SHIMS_PRESET` as `globalShims` -3. `SYNCKIT_TIMEOUT`: `timeout` for performing the async job (no default) -4. `SYNCKIT_TS_RUNNER`: Which TypeScript runner to be used, it could be very useful for development, could be `'ts-node' | 'esbuild-register' | 'esbuild-runner' | 'swc' | 'tsx'`, `'ts-node'` is used by default, make sure you have installed them already - -### TypeScript - -#### `ts-node` - -If you want to use `ts-node` for worker file (a `.ts` file), it is supported out of box! - -If you want to use a custom tsconfig as project instead of default `tsconfig.json`, use `TS_NODE_PROJECT` env. Please view [ts-node](https://github.com/TypeStrong/ts-node#tsconfig) for more details. - -If you want to integrate with [tsconfig-paths](https://www.npmjs.com/package/tsconfig-paths), please view [ts-node](https://github.com/TypeStrong/ts-node#paths-and-baseurl) for more details. - -#### `esbuild-register` - -Please view [`esbuild-register`][] for its document - -#### `esbuild-runner` - -Please view [`esbuild-runner`][] for its document - -#### `swc` - -Please view [`@swc-node/register`][] for its document - -#### `tsx` - -Please view [`tsx`][] for its document - -## Benchmark - -It is about 50x faster than [`sync-threads`](https://github.com/lambci/sync-threads) but 10x slower than native for reading the file content itself 1000 times during runtime, and 40x faster than `sync-threads` but 10x slower than native for total time on my personal MacBook Pro with 64G M1 Max. - -And it's almost 5x faster than [`deasync`](https://github.com/abbr/deasync) but requires no native bindings or `node-gyp`. - -See [benchmark.cjs](./benchmarks/benchmark.cjs.txt) and [benchmark.esm](./benchmarks/benchmark.esm.txt) for more details. - -You can try it with running `yarn benchmark` by yourself. [Here](./benchmarks/benchmark.js) is the benchmark source code. - -## Sponsors - -| 1stG | RxTS | UnTS | -| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) | - -## Backers - -[![Backers](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin) - -| 1stG | RxTS | UnTS | -| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -| [![1stG Open Collective backers and sponsors](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers and sponsors](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers and sponsors](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) | - -## Changelog - -Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md). - -## License - -[MIT][] © [JounQin][]@[1stG.me][] - -[`esbuild-register`]: https://github.com/egoist/esbuild-register -[`esbuild-runner`]: https://github.com/folke/esbuild-runner -[`@swc-node/register`]: https://github.com/swc-project/swc-node/tree/master/packages/register -[`tsx`]: https://github.com/esbuild-kit/tsx -[1stg.me]: https://www.1stg.me -[jounqin]: https://GitHub.com/JounQin -[mit]: http://opensource.org/licenses/MIT diff --git a/node_modules/synckit/lib/index.cjs b/node_modules/synckit/lib/index.cjs deleted file mode 100644 index 6169304..0000000 --- a/node_modules/synckit/lib/index.cjs +++ /dev/null @@ -1,472 +0,0 @@ -'use strict'; - -var node_crypto = require('node:crypto'); -var fs = require('node:fs'); -var module$1 = require('node:module'); -var path = require('node:path'); -var node_url = require('node:url'); -var node_worker_threads = require('node:worker_threads'); -var core = require('@pkgr/core'); - -var __defProp = Object.defineProperty; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __spreadValues = (a, b) => { - for (var prop in b || (b = {})) - if (__hasOwnProp.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b)) { - if (__propIsEnum.call(b, prop)) - __defNormalProp(a, prop, b[prop]); - } - return a; -}; -var __objRest = (source, exclude) => { - var target = {}; - for (var prop in source) - if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) - target[prop] = source[prop]; - if (source != null && __getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(source)) { - if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) - target[prop] = source[prop]; - } - return target; -}; -var __async = (__this, __arguments, generator) => { - return new Promise((resolve, reject) => { - var fulfilled = (value) => { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - }; - var rejected = (value) => { - try { - step(generator.throw(value)); - } catch (e) { - reject(e); - } - }; - var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); - step((generator = generator.apply(__this, __arguments)).next()); - }); -}; -const import_meta = {}; -const INT32_BYTES = 4; -const TsRunner = { - // https://github.com/TypeStrong/ts-node - TsNode: "ts-node", - // https://github.com/egoist/esbuild-register - EsbuildRegister: "esbuild-register", - // https://github.com/folke/esbuild-runner - EsbuildRunner: "esbuild-runner", - // https://github.com/swc-project/swc-node/tree/master/packages/register - SWC: "swc", - // https://github.com/esbuild-kit/tsx - TSX: "tsx" -}; -const { - NODE_OPTIONS, - SYNCKIT_EXEC_ARGV, - SYNCKIT_GLOBAL_SHIMS, - SYNCKIT_TIMEOUT, - SYNCKIT_TS_RUNNER -} = process.env; -const IS_NODE_20 = Number(process.versions.node.split(".")[0]) >= 20; -const DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : void 0; -const DEFAULT_EXEC_ARGV = (SYNCKIT_EXEC_ARGV == null ? void 0 : SYNCKIT_EXEC_ARGV.split(",")) || []; -const DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER; -const DEFAULT_GLOBAL_SHIMS = ["1", "true"].includes( - SYNCKIT_GLOBAL_SHIMS -); -const DEFAULT_GLOBAL_SHIMS_PRESET = [ - { - moduleName: "node-fetch", - globalName: "fetch" - }, - { - moduleName: "node:perf_hooks", - globalName: "performance", - named: "performance" - } -]; -const MTS_SUPPORTED_NODE_VERSION = 16; -let syncFnCache; -function extractProperties(object) { - if (object && typeof object === "object") { - const properties = {}; - for (const key in object) { - properties[key] = object[key]; - } - return properties; - } -} -function createSyncFn(workerPath, timeoutOrOptions) { - syncFnCache != null ? syncFnCache : syncFnCache = /* @__PURE__ */ new Map(); - const cachedSyncFn = syncFnCache.get(workerPath); - if (cachedSyncFn) { - return cachedSyncFn; - } - if (!path.isAbsolute(workerPath)) { - throw new Error("`workerPath` must be absolute"); - } - const syncFn = startWorkerThread( - workerPath, - /* istanbul ignore next */ - typeof timeoutOrOptions === "number" ? { timeout: timeoutOrOptions } : timeoutOrOptions - ); - syncFnCache.set(workerPath, syncFn); - return syncFn; -} -const cjsRequire = typeof require === "undefined" ? module$1.createRequire(import_meta.url) : ( - /* istanbul ignore next */ - require -); -const dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`); -const isFile = (path2) => { - var _a; - try { - return !!((_a = fs.statSync(path2, { throwIfNoEntry: false })) == null ? void 0 : _a.isFile()); - } catch (e) { - return false; - } -}; -const setupTsRunner = (workerPath, { execArgv, tsRunner }) => { - let ext = path.extname(workerPath); - if (!/[/\\]node_modules[/\\]/.test(workerPath) && (!ext || /^\.[cm]?js$/.test(ext))) { - const workPathWithoutExt = ext ? workerPath.slice(0, -ext.length) : workerPath; - let extensions; - switch (ext) { - case ".cjs": { - extensions = [".cts", ".cjs"]; - break; - } - case ".mjs": { - extensions = [".mts", ".mjs"]; - break; - } - default: { - extensions = [".ts", ".js"]; - break; - } - } - const found = core.tryExtensions(workPathWithoutExt, extensions); - let differentExt; - if (found && (!ext || (differentExt = found !== workPathWithoutExt))) { - workerPath = found; - if (differentExt) { - ext = path.extname(workerPath); - } - } - } - const isTs = /\.[cm]?ts$/.test(workerPath); - let jsUseEsm = workerPath.endsWith(".mjs"); - let tsUseEsm = workerPath.endsWith(".mts"); - if (isTs) { - if (!tsUseEsm) { - const pkg = core.findUp(workerPath); - if (pkg) { - tsUseEsm = cjsRequire(pkg).type === "module"; - } - } - if (tsRunner == null && core.isPkgAvailable(TsRunner.TsNode)) { - tsRunner = TsRunner.TsNode; - } - switch (tsRunner) { - case TsRunner.TsNode: { - if (tsUseEsm) { - if (!execArgv.includes("--loader")) { - execArgv = ["--loader", `${TsRunner.TsNode}/esm`, ...execArgv]; - } - } else if (!execArgv.includes("-r")) { - execArgv = ["-r", `${TsRunner.TsNode}/register`, ...execArgv]; - } - break; - } - case TsRunner.EsbuildRegister: { - if (!execArgv.includes("-r")) { - execArgv = ["-r", TsRunner.EsbuildRegister, ...execArgv]; - } - break; - } - case TsRunner.EsbuildRunner: { - if (!execArgv.includes("-r")) { - execArgv = ["-r", `${TsRunner.EsbuildRunner}/register`, ...execArgv]; - } - break; - } - case TsRunner.SWC: { - if (!execArgv.includes("-r")) { - execArgv = ["-r", `@${TsRunner.SWC}-node/register`, ...execArgv]; - } - break; - } - case TsRunner.TSX: { - if (!execArgv.includes("--loader")) { - execArgv = ["--loader", TsRunner.TSX, ...execArgv]; - } - break; - } - default: { - throw new Error(`Unknown ts runner: ${String(tsRunner)}`); - } - } - } else if (!jsUseEsm) { - const pkg = core.findUp(workerPath); - if (pkg) { - jsUseEsm = cjsRequire(pkg).type === "module"; - } - } - let resolvedPnpLoaderPath; - if (process.versions.pnp) { - const nodeOptions = NODE_OPTIONS == null ? void 0 : NODE_OPTIONS.split(/\s+/); - let pnpApiPath; - try { - pnpApiPath = cjsRequire.resolve("pnpapi"); - } catch (e) { - } - if (pnpApiPath && !(nodeOptions == null ? void 0 : nodeOptions.some( - (option, index) => ["-r", "--require"].includes(option) && pnpApiPath === cjsRequire.resolve(nodeOptions[index + 1]) - )) && !execArgv.includes(pnpApiPath)) { - execArgv = ["-r", pnpApiPath, ...execArgv]; - const pnpLoaderPath = path.resolve(pnpApiPath, "../.pnp.loader.mjs"); - if (isFile(pnpLoaderPath)) { - resolvedPnpLoaderPath = node_url.pathToFileURL(pnpLoaderPath).toString(); - if (!IS_NODE_20) { - execArgv = [ - "--experimental-loader", - resolvedPnpLoaderPath, - ...execArgv - ]; - } - } - } - } - return { - ext, - isTs, - jsUseEsm, - tsRunner, - tsUseEsm, - workerPath, - pnpLoaderPath: resolvedPnpLoaderPath, - execArgv - }; -}; -const md5Hash = (text) => node_crypto.createHash("md5").update(text).digest("hex"); -const encodeImportModule = (moduleNameOrGlobalShim, type = "import") => { - const { moduleName, globalName, named, conditional } = typeof moduleNameOrGlobalShim === "string" ? { moduleName: moduleNameOrGlobalShim } : moduleNameOrGlobalShim; - const importStatement = type === "import" ? `import${globalName ? " " + (named === null ? "* as " + globalName : (named == null ? void 0 : named.trim()) ? `{${named}}` : globalName) + " from" : ""} '${path.isAbsolute(moduleName) ? String(node_url.pathToFileURL(moduleName)) : moduleName}'` : `${globalName ? "const " + ((named == null ? void 0 : named.trim()) ? `{${named}}` : globalName) + "=" : ""}require('${moduleName.replace(/\\/g, "\\\\")}')`; - if (!globalName) { - return importStatement; - } - const overrideStatement = `globalThis.${globalName}=${(named == null ? void 0 : named.trim()) ? named : globalName}`; - return importStatement + (conditional === false ? `;${overrideStatement}` : `;if(!globalThis.${globalName})${overrideStatement}`); -}; -const _generateGlobals = (globalShims, type) => globalShims.reduce( - (acc, shim) => `${acc}${acc ? ";" : ""}${encodeImportModule(shim, type)}`, - "" -); -let globalsCache; -let tmpdir; -const _dirname = typeof __dirname === "undefined" ? path.dirname(node_url.fileURLToPath(import_meta.url)) : ( - /* istanbul ignore next */ - __dirname -); -let sharedBuffer; -let sharedBufferView; -const generateGlobals = (workerPath, globalShims, type = "import") => { - globalsCache != null ? globalsCache : globalsCache = /* @__PURE__ */ new Map(); - const cached = globalsCache.get(workerPath); - if (cached) { - const [content2, filepath2] = cached; - if (type === "require" && !filepath2 || type === "import" && filepath2 && isFile(filepath2)) { - return content2; - } - } - const globals = _generateGlobals(globalShims, type); - let content = globals; - let filepath; - if (type === "import") { - if (!tmpdir) { - tmpdir = path.resolve(core.findUp(_dirname), "../node_modules/.synckit"); - } - fs.mkdirSync(tmpdir, { recursive: true }); - filepath = path.resolve(tmpdir, md5Hash(workerPath) + ".mjs"); - content = encodeImportModule(filepath); - fs.writeFileSync(filepath, globals); - } - globalsCache.set(workerPath, [content, filepath]); - return content; -}; -function startWorkerThread(workerPath, { - timeout = DEFAULT_TIMEOUT, - execArgv = DEFAULT_EXEC_ARGV, - tsRunner = DEFAULT_TS_RUNNER, - transferList = [], - globalShims = DEFAULT_GLOBAL_SHIMS -} = {}) { - const { port1: mainPort, port2: workerPort } = new node_worker_threads.MessageChannel(); - const { - isTs, - ext, - jsUseEsm, - tsUseEsm, - tsRunner: finalTsRunner, - workerPath: finalWorkerPath, - pnpLoaderPath, - execArgv: finalExecArgv - } = setupTsRunner(workerPath, { execArgv, tsRunner }); - const workerPathUrl = node_url.pathToFileURL(finalWorkerPath); - if (/\.[cm]ts$/.test(finalWorkerPath)) { - const isTsxSupported = !tsUseEsm || Number.parseFloat(process.versions.node) >= MTS_SUPPORTED_NODE_VERSION; - if (!finalTsRunner) { - throw new Error("No ts runner specified, ts worker path is not supported"); - } else if ([ - // https://github.com/egoist/esbuild-register/issues/79 - TsRunner.EsbuildRegister, - // https://github.com/folke/esbuild-runner/issues/67 - TsRunner.EsbuildRunner, - // https://github.com/swc-project/swc-node/issues/667 - TsRunner.SWC, - .../* istanbul ignore next */ - isTsxSupported ? [] : [TsRunner.TSX] - ].includes(finalTsRunner)) { - throw new Error( - `${finalTsRunner} is not supported for ${ext} files yet` + /* istanbul ignore next */ - (isTsxSupported ? ", you can try [tsx](https://github.com/esbuild-kit/tsx) instead" : "") - ); - } - } - const finalGlobalShims = (globalShims === true ? DEFAULT_GLOBAL_SHIMS_PRESET : Array.isArray(globalShims) ? globalShims : []).filter(({ moduleName }) => core.isPkgAvailable(moduleName)); - sharedBufferView != null ? sharedBufferView : sharedBufferView = new Int32Array( - /* istanbul ignore next */ - sharedBuffer != null ? sharedBuffer : sharedBuffer = new SharedArrayBuffer( - INT32_BYTES - ), - 0, - 1 - ); - const useGlobals = finalGlobalShims.length > 0; - const useEval = isTs ? !tsUseEsm : !jsUseEsm && useGlobals; - const worker = new node_worker_threads.Worker( - jsUseEsm && useGlobals || tsUseEsm && finalTsRunner === TsRunner.TsNode ? dataUrl( - `${generateGlobals( - finalWorkerPath, - finalGlobalShims - )};import '${String(workerPathUrl)}'` - ) : useEval ? `${generateGlobals( - finalWorkerPath, - finalGlobalShims, - "require" - )};${encodeImportModule(finalWorkerPath, "require")}` : workerPathUrl, - { - eval: useEval, - workerData: { sharedBuffer, workerPort, pnpLoaderPath }, - transferList: [workerPort, ...transferList], - execArgv: finalExecArgv - } - ); - let nextID = 0; - const receiveMessageWithId = (port, expectedId, waitingTimeout) => { - const start = Date.now(); - const status = Atomics.wait(sharedBufferView, 0, 0, waitingTimeout); - Atomics.store(sharedBufferView, 0, 0); - if (!["ok", "not-equal"].includes(status)) { - const abortMsg = { - id: expectedId, - cmd: "abort" - }; - port.postMessage(abortMsg); - throw new Error("Internal error: Atomics.wait() failed: " + status); - } - const _a = node_worker_threads.receiveMessageOnPort(mainPort).message, { id } = _a, message = __objRest(_a, ["id"]); - if (id < expectedId) { - const waitingTime = Date.now() - start; - return receiveMessageWithId( - port, - expectedId, - waitingTimeout ? waitingTimeout - waitingTime : void 0 - ); - } - if (expectedId !== id) { - throw new Error( - `Internal error: Expected id ${expectedId} but got id ${id}` - ); - } - return __spreadValues({ id }, message); - }; - const syncFn = (...args) => { - const id = nextID++; - const msg = { id, args }; - worker.postMessage(msg); - const { result, error, properties } = receiveMessageWithId( - mainPort, - id, - timeout - ); - if (error) { - throw Object.assign(error, properties); - } - return result; - }; - worker.unref(); - return syncFn; -} -function runAsWorker(fn) { - if (!node_worker_threads.workerData) { - return; - } - const { workerPort, sharedBuffer: sharedBuffer2, pnpLoaderPath } = node_worker_threads.workerData; - if (pnpLoaderPath && IS_NODE_20) { - module$1.register(pnpLoaderPath); - } - const sharedBufferView2 = new Int32Array(sharedBuffer2, 0, 1); - node_worker_threads.parentPort.on( - "message", - ({ id, args }) => { - (() => __async(this, null, function* () { - let isAborted = false; - const handleAbortMessage = (msg2) => { - if (msg2.id === id && msg2.cmd === "abort") { - isAborted = true; - } - }; - workerPort.on("message", handleAbortMessage); - let msg; - try { - msg = { id, result: yield fn(...args) }; - } catch (error) { - msg = { id, error, properties: extractProperties(error) }; - } - workerPort.off("message", handleAbortMessage); - if (isAborted) { - return; - } - workerPort.postMessage(msg); - Atomics.add(sharedBufferView2, 0, 1); - Atomics.notify(sharedBufferView2, 0); - }))(); - } - ); -} - -exports.DEFAULT_EXEC_ARGV = DEFAULT_EXEC_ARGV; -exports.DEFAULT_GLOBAL_SHIMS = DEFAULT_GLOBAL_SHIMS; -exports.DEFAULT_GLOBAL_SHIMS_PRESET = DEFAULT_GLOBAL_SHIMS_PRESET; -exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; -exports.DEFAULT_TS_RUNNER = DEFAULT_TS_RUNNER; -exports.MTS_SUPPORTED_NODE_VERSION = MTS_SUPPORTED_NODE_VERSION; -exports.TsRunner = TsRunner; -exports._generateGlobals = _generateGlobals; -exports.createSyncFn = createSyncFn; -exports.encodeImportModule = encodeImportModule; -exports.extractProperties = extractProperties; -exports.generateGlobals = generateGlobals; -exports.isFile = isFile; -exports.runAsWorker = runAsWorker; diff --git a/node_modules/synckit/lib/index.d.ts b/node_modules/synckit/lib/index.d.ts deleted file mode 100644 index 25b3a8b..0000000 --- a/node_modules/synckit/lib/index.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/// -import { type TransferListItem } from 'node:worker_threads'; -import type { AnyAsyncFn, GlobalShim, Syncify, ValueOf } from './types.js'; -export * from './types.js'; -export declare const TsRunner: { - readonly TsNode: "ts-node"; - readonly EsbuildRegister: "esbuild-register"; - readonly EsbuildRunner: "esbuild-runner"; - readonly SWC: "swc"; - readonly TSX: "tsx"; -}; -export type TsRunner = ValueOf; -export declare const DEFAULT_TIMEOUT: number | undefined; -export declare const DEFAULT_EXEC_ARGV: string[]; -export declare const DEFAULT_TS_RUNNER: TsRunner | undefined; -export declare const DEFAULT_GLOBAL_SHIMS: boolean; -export declare const DEFAULT_GLOBAL_SHIMS_PRESET: GlobalShim[]; -export declare const MTS_SUPPORTED_NODE_VERSION = 16; -export interface SynckitOptions { - execArgv?: string[]; - globalShims?: GlobalShim[] | boolean; - timeout?: number; - transferList?: TransferListItem[]; - tsRunner?: TsRunner; -} -export declare function extractProperties(object: T): T; -export declare function extractProperties(object?: T): T | undefined; -export declare function createSyncFn, R = unknown>(workerPath: string, timeoutOrOptions?: SynckitOptions | number): Syncify; -export declare const isFile: (path: string) => boolean; -export declare const encodeImportModule: (moduleNameOrGlobalShim: GlobalShim | string, type?: 'import' | 'require') => string; -export declare const generateGlobals: (workerPath: string, globalShims: GlobalShim[], type?: 'import' | 'require') => string; -export declare function runAsWorker = AnyAsyncFn>(fn: T): void; diff --git a/node_modules/synckit/lib/index.js b/node_modules/synckit/lib/index.js deleted file mode 100644 index 2c28246..0000000 --- a/node_modules/synckit/lib/index.js +++ /dev/null @@ -1,380 +0,0 @@ -import { __awaiter, __rest } from "tslib"; -import { createHash } from 'node:crypto'; -import fs from 'node:fs'; -import module from 'node:module'; -import path from 'node:path'; -import { fileURLToPath, pathToFileURL } from 'node:url'; -import { MessageChannel, Worker, parentPort, receiveMessageOnPort, workerData, } from 'node:worker_threads'; -import { findUp, isPkgAvailable, tryExtensions } from '@pkgr/core'; -const INT32_BYTES = 4; -export * from './types.js'; -export const TsRunner = { - TsNode: 'ts-node', - EsbuildRegister: 'esbuild-register', - EsbuildRunner: 'esbuild-runner', - SWC: 'swc', - TSX: 'tsx', -}; -const { NODE_OPTIONS, SYNCKIT_EXEC_ARGV, SYNCKIT_GLOBAL_SHIMS, SYNCKIT_TIMEOUT, SYNCKIT_TS_RUNNER, } = process.env; -const IS_NODE_20 = Number(process.versions.node.split('.')[0]) >= 20; -export const DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : undefined; -export const DEFAULT_EXEC_ARGV = (SYNCKIT_EXEC_ARGV === null || SYNCKIT_EXEC_ARGV === void 0 ? void 0 : SYNCKIT_EXEC_ARGV.split(',')) || []; -export const DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER; -export const DEFAULT_GLOBAL_SHIMS = ['1', 'true'].includes(SYNCKIT_GLOBAL_SHIMS); -export const DEFAULT_GLOBAL_SHIMS_PRESET = [ - { - moduleName: 'node-fetch', - globalName: 'fetch', - }, - { - moduleName: 'node:perf_hooks', - globalName: 'performance', - named: 'performance', - }, -]; -export const MTS_SUPPORTED_NODE_VERSION = 16; -let syncFnCache; -export function extractProperties(object) { - if (object && typeof object === 'object') { - const properties = {}; - for (const key in object) { - properties[key] = object[key]; - } - return properties; - } -} -export function createSyncFn(workerPath, timeoutOrOptions) { - syncFnCache !== null && syncFnCache !== void 0 ? syncFnCache : (syncFnCache = new Map()); - const cachedSyncFn = syncFnCache.get(workerPath); - if (cachedSyncFn) { - return cachedSyncFn; - } - if (!path.isAbsolute(workerPath)) { - throw new Error('`workerPath` must be absolute'); - } - const syncFn = startWorkerThread(workerPath, typeof timeoutOrOptions === 'number' - ? { timeout: timeoutOrOptions } - : timeoutOrOptions); - syncFnCache.set(workerPath, syncFn); - return syncFn; -} -const cjsRequire = typeof require === 'undefined' - ? module.createRequire(import.meta.url) - : require; -const dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`); -export const isFile = (path) => { - var _a; - try { - return !!((_a = fs.statSync(path, { throwIfNoEntry: false })) === null || _a === void 0 ? void 0 : _a.isFile()); - } - catch (_b) { - return false; - } -}; -const setupTsRunner = (workerPath, { execArgv, tsRunner }) => { - let ext = path.extname(workerPath); - if (!/[/\\]node_modules[/\\]/.test(workerPath) && - (!ext || /^\.[cm]?js$/.test(ext))) { - const workPathWithoutExt = ext - ? workerPath.slice(0, -ext.length) - : workerPath; - let extensions; - switch (ext) { - case '.cjs': { - extensions = ['.cts', '.cjs']; - break; - } - case '.mjs': { - extensions = ['.mts', '.mjs']; - break; - } - default: { - extensions = ['.ts', '.js']; - break; - } - } - const found = tryExtensions(workPathWithoutExt, extensions); - let differentExt; - if (found && (!ext || (differentExt = found !== workPathWithoutExt))) { - workerPath = found; - if (differentExt) { - ext = path.extname(workerPath); - } - } - } - const isTs = /\.[cm]?ts$/.test(workerPath); - let jsUseEsm = workerPath.endsWith('.mjs'); - let tsUseEsm = workerPath.endsWith('.mts'); - if (isTs) { - if (!tsUseEsm) { - const pkg = findUp(workerPath); - if (pkg) { - tsUseEsm = - cjsRequire(pkg).type === - 'module'; - } - } - if (tsRunner == null && isPkgAvailable(TsRunner.TsNode)) { - tsRunner = TsRunner.TsNode; - } - switch (tsRunner) { - case TsRunner.TsNode: { - if (tsUseEsm) { - if (!execArgv.includes('--loader')) { - execArgv = ['--loader', `${TsRunner.TsNode}/esm`, ...execArgv]; - } - } - else if (!execArgv.includes('-r')) { - execArgv = ['-r', `${TsRunner.TsNode}/register`, ...execArgv]; - } - break; - } - case TsRunner.EsbuildRegister: { - if (!execArgv.includes('-r')) { - execArgv = ['-r', TsRunner.EsbuildRegister, ...execArgv]; - } - break; - } - case TsRunner.EsbuildRunner: { - if (!execArgv.includes('-r')) { - execArgv = ['-r', `${TsRunner.EsbuildRunner}/register`, ...execArgv]; - } - break; - } - case TsRunner.SWC: { - if (!execArgv.includes('-r')) { - execArgv = ['-r', `@${TsRunner.SWC}-node/register`, ...execArgv]; - } - break; - } - case TsRunner.TSX: { - if (!execArgv.includes('--loader')) { - execArgv = ['--loader', TsRunner.TSX, ...execArgv]; - } - break; - } - default: { - throw new Error(`Unknown ts runner: ${String(tsRunner)}`); - } - } - } - else if (!jsUseEsm) { - const pkg = findUp(workerPath); - if (pkg) { - jsUseEsm = - cjsRequire(pkg).type === 'module'; - } - } - let resolvedPnpLoaderPath; - if (process.versions.pnp) { - const nodeOptions = NODE_OPTIONS === null || NODE_OPTIONS === void 0 ? void 0 : NODE_OPTIONS.split(/\s+/); - let pnpApiPath; - try { - pnpApiPath = cjsRequire.resolve('pnpapi'); - } - catch (_a) { } - if (pnpApiPath && - !(nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.some((option, index) => ['-r', '--require'].includes(option) && - pnpApiPath === cjsRequire.resolve(nodeOptions[index + 1]))) && - !execArgv.includes(pnpApiPath)) { - execArgv = ['-r', pnpApiPath, ...execArgv]; - const pnpLoaderPath = path.resolve(pnpApiPath, '../.pnp.loader.mjs'); - if (isFile(pnpLoaderPath)) { - resolvedPnpLoaderPath = pathToFileURL(pnpLoaderPath).toString(); - if (!IS_NODE_20) { - execArgv = [ - '--experimental-loader', - resolvedPnpLoaderPath, - ...execArgv, - ]; - } - } - } - } - return { - ext, - isTs, - jsUseEsm, - tsRunner, - tsUseEsm, - workerPath, - pnpLoaderPath: resolvedPnpLoaderPath, - execArgv, - }; -}; -const md5Hash = (text) => createHash('md5').update(text).digest('hex'); -export const encodeImportModule = (moduleNameOrGlobalShim, type = 'import') => { - const { moduleName, globalName, named, conditional } = typeof moduleNameOrGlobalShim === 'string' - ? { moduleName: moduleNameOrGlobalShim } - : moduleNameOrGlobalShim; - const importStatement = type === 'import' - ? `import${globalName - ? ' ' + - (named === null - ? '* as ' + globalName - : (named === null || named === void 0 ? void 0 : named.trim()) - ? `{${named}}` - : globalName) + - ' from' - : ''} '${path.isAbsolute(moduleName) - ? String(pathToFileURL(moduleName)) - : moduleName}'` - : `${globalName - ? 'const ' + ((named === null || named === void 0 ? void 0 : named.trim()) ? `{${named}}` : globalName) + '=' - : ''}require('${moduleName - .replace(/\\/g, '\\\\')}')`; - if (!globalName) { - return importStatement; - } - const overrideStatement = `globalThis.${globalName}=${(named === null || named === void 0 ? void 0 : named.trim()) ? named : globalName}`; - return (importStatement + - (conditional === false - ? `;${overrideStatement}` - : `;if(!globalThis.${globalName})${overrideStatement}`)); -}; -export const _generateGlobals = (globalShims, type) => globalShims.reduce((acc, shim) => `${acc}${acc ? ';' : ''}${encodeImportModule(shim, type)}`, ''); -let globalsCache; -let tmpdir; -const _dirname = typeof __dirname === 'undefined' - ? path.dirname(fileURLToPath(import.meta.url)) - : __dirname; -let sharedBuffer; -let sharedBufferView; -export const generateGlobals = (workerPath, globalShims, type = 'import') => { - globalsCache !== null && globalsCache !== void 0 ? globalsCache : (globalsCache = new Map()); - const cached = globalsCache.get(workerPath); - if (cached) { - const [content, filepath] = cached; - if ((type === 'require' && !filepath) || - (type === 'import' && filepath && isFile(filepath))) { - return content; - } - } - const globals = _generateGlobals(globalShims, type); - let content = globals; - let filepath; - if (type === 'import') { - if (!tmpdir) { - tmpdir = path.resolve(findUp(_dirname), '../node_modules/.synckit'); - } - fs.mkdirSync(tmpdir, { recursive: true }); - filepath = path.resolve(tmpdir, md5Hash(workerPath) + '.mjs'); - content = encodeImportModule(filepath); - fs.writeFileSync(filepath, globals); - } - globalsCache.set(workerPath, [content, filepath]); - return content; -}; -function startWorkerThread(workerPath, { timeout = DEFAULT_TIMEOUT, execArgv = DEFAULT_EXEC_ARGV, tsRunner = DEFAULT_TS_RUNNER, transferList = [], globalShims = DEFAULT_GLOBAL_SHIMS, } = {}) { - const { port1: mainPort, port2: workerPort } = new MessageChannel(); - const { isTs, ext, jsUseEsm, tsUseEsm, tsRunner: finalTsRunner, workerPath: finalWorkerPath, pnpLoaderPath, execArgv: finalExecArgv, } = setupTsRunner(workerPath, { execArgv, tsRunner }); - const workerPathUrl = pathToFileURL(finalWorkerPath); - if (/\.[cm]ts$/.test(finalWorkerPath)) { - const isTsxSupported = !tsUseEsm || - Number.parseFloat(process.versions.node) >= MTS_SUPPORTED_NODE_VERSION; - if (!finalTsRunner) { - throw new Error('No ts runner specified, ts worker path is not supported'); - } - else if ([ - TsRunner.EsbuildRegister, - TsRunner.EsbuildRunner, - TsRunner.SWC, - ...(isTsxSupported ? [] : [TsRunner.TSX]), - ].includes(finalTsRunner)) { - throw new Error(`${finalTsRunner} is not supported for ${ext} files yet` + - (isTsxSupported - ? ', you can try [tsx](https://github.com/esbuild-kit/tsx) instead' - : '')); - } - } - const finalGlobalShims = (globalShims === true - ? DEFAULT_GLOBAL_SHIMS_PRESET - : Array.isArray(globalShims) - ? globalShims - : []).filter(({ moduleName }) => isPkgAvailable(moduleName)); - sharedBufferView !== null && sharedBufferView !== void 0 ? sharedBufferView : (sharedBufferView = new Int32Array((sharedBuffer !== null && sharedBuffer !== void 0 ? sharedBuffer : (sharedBuffer = new SharedArrayBuffer(INT32_BYTES))), 0, 1)); - const useGlobals = finalGlobalShims.length > 0; - const useEval = isTs ? !tsUseEsm : !jsUseEsm && useGlobals; - const worker = new Worker((jsUseEsm && useGlobals) || (tsUseEsm && finalTsRunner === TsRunner.TsNode) - ? dataUrl(`${generateGlobals(finalWorkerPath, finalGlobalShims)};import '${String(workerPathUrl)}'`) - : useEval - ? `${generateGlobals(finalWorkerPath, finalGlobalShims, 'require')};${encodeImportModule(finalWorkerPath, 'require')}` - : workerPathUrl, { - eval: useEval, - workerData: { sharedBuffer, workerPort, pnpLoaderPath }, - transferList: [workerPort, ...transferList], - execArgv: finalExecArgv, - }); - let nextID = 0; - const receiveMessageWithId = (port, expectedId, waitingTimeout) => { - const start = Date.now(); - const status = Atomics.wait(sharedBufferView, 0, 0, waitingTimeout); - Atomics.store(sharedBufferView, 0, 0); - if (!['ok', 'not-equal'].includes(status)) { - const abortMsg = { - id: expectedId, - cmd: 'abort', - }; - port.postMessage(abortMsg); - throw new Error('Internal error: Atomics.wait() failed: ' + status); - } - const _a = receiveMessageOnPort(mainPort).message, { id } = _a, message = __rest(_a, ["id"]); - if (id < expectedId) { - const waitingTime = Date.now() - start; - return receiveMessageWithId(port, expectedId, waitingTimeout ? waitingTimeout - waitingTime : undefined); - } - if (expectedId !== id) { - throw new Error(`Internal error: Expected id ${expectedId} but got id ${id}`); - } - return Object.assign({ id }, message); - }; - const syncFn = (...args) => { - const id = nextID++; - const msg = { id, args }; - worker.postMessage(msg); - const { result, error, properties } = receiveMessageWithId(mainPort, id, timeout); - if (error) { - throw Object.assign(error, properties); - } - return result; - }; - worker.unref(); - return syncFn; -} -export function runAsWorker(fn) { - if (!workerData) { - return; - } - const { workerPort, sharedBuffer, pnpLoaderPath } = workerData; - if (pnpLoaderPath && IS_NODE_20) { - module.register(pnpLoaderPath); - } - const sharedBufferView = new Int32Array(sharedBuffer, 0, 1); - parentPort.on('message', ({ id, args }) => { - ; - (() => __awaiter(this, void 0, void 0, function* () { - let isAborted = false; - const handleAbortMessage = (msg) => { - if (msg.id === id && msg.cmd === 'abort') { - isAborted = true; - } - }; - workerPort.on('message', handleAbortMessage); - let msg; - try { - msg = { id, result: yield fn(...args) }; - } - catch (error) { - msg = { id, error, properties: extractProperties(error) }; - } - workerPort.off('message', handleAbortMessage); - if (isAborted) { - return; - } - workerPort.postMessage(msg); - Atomics.add(sharedBufferView, 0, 1); - Atomics.notify(sharedBufferView, 0); - }))(); - }); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/synckit/lib/index.js.map b/node_modules/synckit/lib/index.js.map deleted file mode 100644 index 31f1503..0000000 --- a/node_modules/synckit/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings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CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/synckit/lib/types.d.ts b/node_modules/synckit/lib/types.d.ts deleted file mode 100644 index 7cb6380..0000000 --- a/node_modules/synckit/lib/types.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// -import { MessagePort } from 'node:worker_threads'; -export type AnyFn = (...args: T) => R; -export type AnyPromise = Promise; -export type AnyAsyncFn = AnyFn>; -export type Syncify = T extends (...args: infer Args) => Promise ? (...args: Args) => R : never; -export type PromiseType = T extends Promise ? R : never; -export type ValueOf = T[keyof T]; -export interface MainToWorkerMessage { - id: number; - args: T; -} -export interface MainToWorkerCommandMessage { - id: number; - cmd: string; -} -export interface WorkerData { - sharedBuffer: SharedArrayBuffer; - workerPort: MessagePort; - pnpLoaderPath: string | undefined; -} -export interface DataMessage { - result?: T; - error?: unknown; - properties?: unknown; -} -export interface WorkerToMainMessage extends DataMessage { - id: number; -} -export interface GlobalShim { - moduleName: string; - globalName?: string; - named?: string | null; - conditional?: boolean; -} diff --git a/node_modules/synckit/lib/types.js b/node_modules/synckit/lib/types.js deleted file mode 100644 index 718fd38..0000000 --- a/node_modules/synckit/lib/types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/synckit/lib/types.js.map b/node_modules/synckit/lib/types.js.map deleted file mode 100644 index c768b79..0000000 --- a/node_modules/synckit/lib/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/synckit/package.json b/node_modules/synckit/package.json deleted file mode 100644 index 4dc092f..0000000 --- a/node_modules/synckit/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "synckit", - "version": "0.9.2", - "type": "module", - "description": "Perform async work synchronously in Node.js using `worker_threads` with first-class TypeScript support.", - "repository": "git+https://github.com/un-ts/synckit.git", - "author": "JounQin (https://www.1stG.me) ", - "funding": "https://opencollective.com/unts", - "license": "MIT", - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "main": "./lib/index.cjs", - "module": "./lib/index.js", - "exports": { - "types": "./lib/index.d.ts", - "import": "./lib/index.js", - "require": "./lib/index.cjs" - }, - "types": "./lib/index.d.ts", - "files": [ - "lib", - "!**/*.tsbuildinfo" - ], - "keywords": [ - "deasync", - "make-synchronized", - "make-synchronous", - "sync", - "sync-exec", - "sync-rpc", - "sync-threads", - "synchronize", - "synckit" - ], - "dependencies": { - "@pkgr/core": "^0.1.0", - "tslib": "^2.6.2" - } -} \ No newline at end of file diff --git a/node_modules/teex/LICENSE b/node_modules/teex/LICENSE deleted file mode 100644 index 6d77cd5..0000000 --- a/node_modules/teex/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2020 Mathias Buus - -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/teex/README.md b/node_modules/teex/README.md deleted file mode 100644 index d4fd417..0000000 --- a/node_modules/teex/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# teex - -Turn a readable stream into multiple readable [streamx streams](https://github.com/mafintosh/streamx). - -``` -npm install teex -``` - -## Usage - -``` js -const tee = require('teex') - -// a, b are readable streams that are "clones" -// of someReadableStream. both streams need to -// be flowing, for someReadableStream to flow - -const [a, b] = tee(someReadableStream) -``` - -## API - -#### `const streams = tee(s, [howMany])` - -Split a readable stream into multiple streams. -The `howMany` argument indicates how many streams -to split into and defaults to 2. - -## License - -MIT diff --git a/node_modules/teex/example.js b/node_modules/teex/example.js deleted file mode 100644 index bb62183..0000000 --- a/node_modules/teex/example.js +++ /dev/null @@ -1,16 +0,0 @@ -const tee = require('./') -const { Readable } = require('streamx') - -const s = new Readable() - -for (let i = 0; i < 1000; i++) { - s.push(Buffer.alloc(1024)) -} - -const [a, b] = tee(s) - -a.on('data', console.log) - -setTimeout(function () { - b.read() -}, 1000) diff --git a/node_modules/teex/index.js b/node_modules/teex/index.js deleted file mode 100644 index c606522..0000000 --- a/node_modules/teex/index.js +++ /dev/null @@ -1,52 +0,0 @@ -const { Readable } = require('streamx') - -module.exports = function (s, forks = 2) { - const streams = new Array(forks) - const status = new Array(forks).fill(true) - - let ended = false - - for (let i = 0; i < forks; i++) { - streams[i] = new Readable({ - read (cb) { - const check = !status[i] - status[i] = true - if (check && allReadable()) s.resume() - cb(null) - } - }) - } - - s.on('end', function () { - ended = true - for (const stream of streams) stream.push(null) - }) - - s.on('error', function (err) { - for (const stream of streams) stream.destroy(err) - }) - - s.on('close', function () { - if (ended) return - for (const stream of streams) stream.destroy() - }) - - s.on('data', function (data) { - let needsPause = false - for (let i = 0; i < streams.length; i++) { - if (!(status[i] = streams[i].push(data))) { - needsPause = true - } - } - if (needsPause) s.pause() - }) - - return streams - - function allReadable () { - for (let j = 0; j < status.length; j++) { - if (!status[j]) return false - } - return true - } -} diff --git a/node_modules/teex/package.json b/node_modules/teex/package.json deleted file mode 100644 index 274599b..0000000 --- a/node_modules/teex/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "teex", - "version": "1.0.1", - "description": "Turn a readable stream into multiple readable streamx streams", - "main": "index.js", - "dependencies": { - "streamx": "^2.12.5" - }, - "devDependencies": { - "standard": "^14.3.4", - "tape": "^5.0.1" - }, - "scripts": { - "test": "standard && tape test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/mafintosh/teex.git" - }, - "author": "Mathias Buus (@mafintosh)", - "license": "MIT", - "bugs": { - "url": "https://github.com/mafintosh/teex/issues" - }, - "homepage": "https://github.com/mafintosh/teex" -} diff --git a/node_modules/teex/test.js b/node_modules/teex/test.js deleted file mode 100644 index 74b5c7b..0000000 --- a/node_modules/teex/test.js +++ /dev/null @@ -1,68 +0,0 @@ -const tape = require('tape') -const tee = require('./') -const { Readable } = require('streamx') - -tape('throttled by eachother', function (t) { - const r = new Readable() - - for (let i = 0; i < 1000; i++) { - r.push(Buffer.alloc(1000)) - } - - const [a, b] = tee(r) - - let aTicks = 0 - - a.on('data', function (data) { - aTicks++ - }) - - setTimeout(() => b.read(), 100) - - setTimeout(() => { - t.same(aTicks, 18) - t.end() - }, 200) -}) - -tape('does not premature destroy', function (t) { - const r = new Readable() - - const [a, b] = tee(r) - - r.push('a') - r.push('b') - r.push('c') - r.push(null) - - setTimeout(() => { - const aSeen = [] - const bSeen = [] - - a.on('data', function (data) { - aSeen.push(data) - }) - a.on('end', function () { - aSeen.push(null) - }) - - b.on('data', function (data) { - bSeen.push(data) - }) - b.on('end', function () { - bSeen.push(null) - }) - - let missing = 2 - a.on('close', onclose) - b.on('close', onclose) - - function onclose () { - if (--missing === 0) { - t.same(aSeen, ['a', 'b', 'c', null]) - t.same(bSeen, ['a', 'b', 'c', null]) - t.end() - } - } - }, 200) -}) diff --git a/node_modules/text-decoder/LICENSE b/node_modules/text-decoder/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/node_modules/text-decoder/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/text-decoder/README.md b/node_modules/text-decoder/README.md deleted file mode 100644 index 76f2708..0000000 --- a/node_modules/text-decoder/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# text-decoder - -Streaming text decoder that preserves multibyte Unicode characters. - -``` -npm i text-decoder -``` - -## Usage - -``` js -const TextDecoder = require('text-decoder') - -const td = new TextDecoder() - -td.push(Buffer.of(0xf0, 0x9f, 0x92)) // returns '' -td.push(Buffer.of(0xa9)) // returns '💩' -``` - -## API - -#### `const td = new TextDecoder([encoding])` - -Create a text decoder. `encoding` defaults to `utf8`. - -#### `const string = td.push(data)` - -Push either a `Buffer` or a `string` to the text decoder. Returns the decoded string, buffering any partial data. - -#### `const string = td.end([data])` - -End the decoder, optionally pushing a final piece of data. Returns the decoded string. - -## License - -Apache-2.0 diff --git a/node_modules/text-decoder/index.js b/node_modules/text-decoder/index.js deleted file mode 100644 index 3405f43..0000000 --- a/node_modules/text-decoder/index.js +++ /dev/null @@ -1,64 +0,0 @@ -const PassThroughDecoder = require('./lib/pass-through-decoder') -const UTF8Decoder = require('./lib/utf8-decoder') - -module.exports = class TextDecoder { - constructor (encoding = 'utf8') { - this.encoding = normalizeEncoding(encoding) - - switch (this.encoding) { - case 'utf8': - this.decoder = new UTF8Decoder() - break - case 'utf16le': - case 'base64': - throw new Error('Unsupported encoding: ' + this.encoding) - default: - this.decoder = new PassThroughDecoder(this.encoding) - } - } - - get remaining () { - return this.decoder.remaining - } - - push (data) { - if (typeof data === 'string') return data - return this.decoder.decode(data) - } - - // For Node.js compatibility - write (data) { - return this.push(data) - } - - end (data) { - let result = '' - if (data) result = this.push(data) - result += this.decoder.flush() - return result - } -} - -function normalizeEncoding (encoding) { - encoding = encoding.toLowerCase() - - switch (encoding) { - case 'utf8': - case 'utf-8': - return 'utf8' - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le' - case 'latin1': - case 'binary': - return 'latin1' - case 'base64': - case 'ascii': - case 'hex': - return encoding - default: - throw new Error('Unknown encoding: ' + encoding) - } -}; diff --git a/node_modules/text-decoder/lib/browser-decoder.js b/node_modules/text-decoder/lib/browser-decoder.js deleted file mode 100644 index c1ef0be..0000000 --- a/node_modules/text-decoder/lib/browser-decoder.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = class BrowserDecoder { - constructor (encoding) { - this.decoder = new TextDecoder(encoding === 'utf16le' ? 'utf16-le' : encoding) - } - - get remaining () { - return -1 - } - - decode (data) { - return this.decoder.decode(data, { stream: true }) - } - - flush () { - return this.decoder.decode(new Uint8Array(0)) - } -} diff --git a/node_modules/text-decoder/lib/pass-through-decoder.js b/node_modules/text-decoder/lib/pass-through-decoder.js deleted file mode 100644 index e29a9a4..0000000 --- a/node_modules/text-decoder/lib/pass-through-decoder.js +++ /dev/null @@ -1,17 +0,0 @@ -module.exports = class PassThroughDecoder { - constructor (encoding) { - this.encoding = encoding - } - - get remaining () { - return 0 - } - - decode (tail) { - return tail.toString(this.encoding) - } - - flush () { - return '' - } -} diff --git a/node_modules/text-decoder/lib/utf8-decoder.js b/node_modules/text-decoder/lib/utf8-decoder.js deleted file mode 100644 index ef5d2c8..0000000 --- a/node_modules/text-decoder/lib/utf8-decoder.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * https://encoding.spec.whatwg.org/#utf-8-decoder - */ -module.exports = class UTF8Decoder { - constructor () { - this.codePoint = 0 - this.bytesSeen = 0 - this.bytesNeeded = 0 - this.lowerBoundary = 0x80 - this.upperBoundary = 0xbf - } - - get remaining () { - return this.bytesSeen - } - - decode (data) { - // If we have a fast path, just sniff if the last part is a boundary - if (this.bytesNeeded === 0) { - let isBoundary = true - - for (let i = Math.max(0, data.byteLength - 4), n = data.byteLength; i < n && isBoundary; i++) { - isBoundary = data[i] <= 0x7f - } - - if (isBoundary) return data.toString() - } - - let result = '' - - for (let i = 0, n = data.byteLength; i < n; i++) { - const byte = data[i] - - if (this.bytesNeeded === 0) { - if (byte <= 0x7f) { - result += String.fromCharCode(byte) - } else { - this.bytesSeen = 1 - - if (byte >= 0xc2 && byte <= 0xdf) { - this.bytesNeeded = 2 - this.codePoint = byte & 0x1f - } else if (byte >= 0xe0 && byte <= 0xef) { - if (byte === 0xe0) this.lowerBoundary = 0xa0 - else if (byte === 0xed) this.upperBoundary = 0x9f - this.bytesNeeded = 3 - this.codePoint = byte & 0xf - } else if (byte >= 0xf0 && byte <= 0xf4) { - if (byte === 0xf0) this.lowerBoundary = 0x90 - if (byte === 0xf4) this.upperBoundary = 0x8f - this.bytesNeeded = 4 - this.codePoint = byte & 0x7 - } else { - result += '\ufffd' - } - } - - continue - } - - if (byte < this.lowerBoundary || byte > this.upperBoundary) { - this.codePoint = 0 - this.bytesNeeded = 0 - this.bytesSeen = 0 - this.lowerBoundary = 0x80 - this.upperBoundary = 0xbf - - result += '\ufffd' - - continue - } - - this.lowerBoundary = 0x80 - this.upperBoundary = 0xbf - - this.codePoint = (this.codePoint << 6) | (byte & 0x3f) - this.bytesSeen++ - - if (this.bytesSeen !== this.bytesNeeded) continue - - result += String.fromCodePoint(this.codePoint) - - this.codePoint = 0 - this.bytesNeeded = 0 - this.bytesSeen = 0 - } - - return result - } - - flush () { - const result = this.bytesNeeded > 0 ? '\ufffd' : '' - - this.codePoint = 0 - this.bytesNeeded = 0 - this.bytesSeen = 0 - this.lowerBoundary = 0x80 - this.upperBoundary = 0xbf - - return result - } -} diff --git a/node_modules/text-decoder/package.json b/node_modules/text-decoder/package.json deleted file mode 100644 index c2cd86f..0000000 --- a/node_modules/text-decoder/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "text-decoder", - "version": "1.2.1", - "description": "Streaming text decoder that preserves multibyte Unicode characters", - "main": "index.js", - "files": [ - "index.js", - "lib" - ], - "browser": { - "./lib/pass-through-decoder.js": "./lib/browser-decoder.js", - "./lib/utf8-decoder.js": "./lib/browser-decoder.js" - }, - "scripts": { - "test": "standard && brittle test.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/holepunchto/text-decoder.git" - }, - "author": "Holepunch", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/holepunchto/text-decoder/issues" - }, - "homepage": "https://github.com/holepunchto/text-decoder#readme", - "devDependencies": { - "brittle": "^3.3.2", - "standard": "^17.0.0" - } -} diff --git a/node_modules/through2/LICENSE.md b/node_modules/through2/LICENSE.md deleted file mode 100644 index a2429b6..0000000 --- a/node_modules/through2/LICENSE.md +++ /dev/null @@ -1,9 +0,0 @@ -# The MIT License (MIT) - -**Copyright (c) Rod Vagg (the "Original Author") and additional 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/through2/README.md b/node_modules/through2/README.md deleted file mode 100644 index 1e07799..0000000 --- a/node_modules/through2/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# through2 - -![Build & Test](https://github.com/rvagg/through2/workflows/Build%20&%20Test/badge.svg) - -[![NPM](https://nodei.co/npm/through2.png?downloads&downloadRank)](https://nodei.co/npm/through2/) - -**A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise** - -Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`. - -```js -fs.createReadStream('ex.txt') - .pipe(through2(function (chunk, enc, callback) { - for (let i = 0; i < chunk.length; i++) - if (chunk[i] == 97) - chunk[i] = 122 // swap 'a' for 'z' - - this.push(chunk) - - callback() - })) - .pipe(fs.createWriteStream('out.txt')) - .on('finish', () => doSomethingSpecial()) -``` - -Or object streams: - -```js -const all = [] - -fs.createReadStream('data.csv') - .pipe(csv2()) - .pipe(through2.obj(function (chunk, enc, callback) { - const data = { - name : chunk[0] - , address : chunk[3] - , phone : chunk[10] - } - this.push(data) - - callback() - })) - .on('data', (data) => { - all.push(data) - }) - .on('end', () => { - doSomethingSpecial(all) - }) -``` - -Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`. - -## Do you need this? - -Since Node.js introduced [Simplified Stream Construction](https://nodejs.org/api/stream.html#stream_simplified_construction), many uses of **through2** have become redundant. Consider whether you really need to use **through2** or just want to use the `'readable-stream'` package, or the core `'stream'` package (which is derived from `'readable-stream'`): - -```js -const { Transform } = require('readable-stream') - -const transformer = new Transform({ - transform(chunk, enc, callback) { - // ... - } -}) -``` - -## API - -through2([ options, ] [ transformFunction ] [, flushFunction ]) - -Consult the **[stream.Transform](https://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`). - -### options - -The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`). - -The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call: - -```js -fs.createReadStream('/tmp/important.dat') - .pipe(through2({ objectMode: true, allowHalfOpen: false }, - (chunk, enc, cb) => { - cb(null, 'wut?') // note we can use the second argument on the callback - // to provide data as an alternative to this.push('wut?') - } - )) - .pipe(fs.createWriteStream('/tmp/wut.txt')) -``` - -### transformFunction - -The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk. - -To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on. - -Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error. - -If you **do not provide a `transformFunction`** then you will get a simple pass-through stream. - -### flushFunction - -The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress. - -```js -fs.createReadStream('/tmp/important.dat') - .pipe(through2( - (chunk, enc, cb) => cb(null, chunk), // transform is a noop - function (cb) { // flush function - this.push('tacking on an extra buffer to the end'); - cb(); - } - )) - .pipe(fs.createWriteStream('/tmp/wut.txt')); -``` - -through2.ctor([ options, ] transformFunction[, flushFunction ]) - -Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances. - -```js -const FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) { - if (record.temp != null && record.unit == "F") { - record.temp = ( ( record.temp - 32 ) * 5 ) / 9 - record.unit = "C" - } - this.push(record) - callback() -}) - -// Create instances of FToC like so: -const converter = new FToC() -// Or: -const converter = FToC() -// Or specify/override options when you instantiate, if you prefer: -const converter = FToC({objectMode: true}) -``` - -## License - -**through2** is Copyright © Rod Vagg and additional contributors and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/through2/package.json b/node_modules/through2/package.json deleted file mode 100644 index a5ca532..0000000 --- a/node_modules/through2/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "through2", - "version": "4.0.2", - "description": "A tiny wrapper around Node.js streams.Transform (Streams2/3) to avoid explicit subclassing noise", - "main": "through2.js", - "scripts": { - "test:node": "hundreds mocha test/test.js", - "test:browser": "node -e 'process.exit(process.version.startsWith(\"v8.\") ? 0 : 1)' || polendina --cleanup --runner=mocha test/test.js", - "test": "npm run lint && npm run test:node && npm run test:browser", - "lint": "standard", - "coverage": "c8 --reporter=text --reporter=html mocha test/test.js && npx st -d coverage -p 8888" - }, - "repository": { - "type": "git", - "url": "https://github.com/rvagg/through2.git" - }, - "keywords": [ - "stream", - "streams2", - "through", - "transform" - ], - "author": "Rod Vagg (https://github.com/rvagg)", - "license": "MIT", - "dependencies": { - "readable-stream": "3" - }, - "devDependencies": { - "bl": "^4.0.2", - "buffer": "^5.6.0", - "chai": "^4.2.0", - "hundreds": "~0.0.7", - "mocha": "^7.2.0", - "polendina": "^1.0.0", - "standard": "^14.3.4", - "stream-spigot": "^3.0.6" - } -} diff --git a/node_modules/through2/through2.js b/node_modules/through2/through2.js deleted file mode 100644 index 925da9d..0000000 --- a/node_modules/through2/through2.js +++ /dev/null @@ -1,83 +0,0 @@ -const { Transform } = require('readable-stream') - -function inherits (fn, sup) { - fn.super_ = sup - fn.prototype = Object.create(sup.prototype, { - constructor: { value: fn, enumerable: false, writable: true, configurable: true } - }) -} - -// create a new export function, used by both the main export and -// the .ctor export, contains common logic for dealing with arguments -function through2 (construct) { - return (options, transform, flush) => { - if (typeof options === 'function') { - flush = transform - transform = options - options = {} - } - - if (typeof transform !== 'function') { - // noop - transform = (chunk, enc, cb) => cb(null, chunk) - } - - if (typeof flush !== 'function') { - flush = null - } - - return construct(options, transform, flush) - } -} - -// main export, just make me a transform stream! -const make = through2((options, transform, flush) => { - const t2 = new Transform(options) - - t2._transform = transform - - if (flush) { - t2._flush = flush - } - - return t2 -}) - -// make me a reusable prototype that I can `new`, or implicitly `new` -// with a constructor call -const ctor = through2((options, transform, flush) => { - function Through2 (override) { - if (!(this instanceof Through2)) { - return new Through2(override) - } - - this.options = Object.assign({}, options, override) - - Transform.call(this, this.options) - - this._transform = transform - if (flush) { - this._flush = flush - } - } - - inherits(Through2, Transform) - - return Through2 -}) - -const obj = through2(function (options, transform, flush) { - const t2 = new Transform(Object.assign({ objectMode: true, highWaterMark: 16 }, options)) - - t2._transform = transform - - if (flush) { - t2._flush = flush - } - - return t2 -}) - -module.exports = make -module.exports.ctor = ctor -module.exports.obj = obj diff --git a/node_modules/to-regex-range/LICENSE b/node_modules/to-regex-range/LICENSE deleted file mode 100644 index 7cccaf9..0000000 --- a/node_modules/to-regex-range/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-present, 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/to-regex-range/README.md b/node_modules/to-regex-range/README.md deleted file mode 100644 index 38887da..0000000 --- a/node_modules/to-regex-range/README.md +++ /dev/null @@ -1,305 +0,0 @@ -# to-regex-range [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/to-regex-range.svg?style=flat)](https://www.npmjs.com/package/to-regex-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![NPM total downloads](https://img.shields.io/npm/dt/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![Linux Build Status](https://img.shields.io/travis/micromatch/to-regex-range.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/to-regex-range) - -> Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions. - -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 to-regex-range -``` - -
-What does this do? - -
- -This libary generates the `source` string to be passed to `new RegExp()` for matching a range of numbers. - -**Example** - -```js -const toRegexRange = require('to-regex-range'); -const regex = new RegExp(toRegexRange('15', '95')); -``` - -A string is returned so that you can do whatever you need with it before passing it to `new RegExp()` (like adding `^` or `$` boundaries, defining flags, or combining it another string). - -
- -
- -
-Why use this library? - -
- -### Convenience - -Creating regular expressions for matching numbers gets deceptively complicated pretty fast. - -For example, let's say you need a validation regex for matching part of a user-id, postal code, social security number, tax id, etc: - -* regex for matching `1` => `/1/` (easy enough) -* regex for matching `1` through `5` => `/[1-5]/` (not bad...) -* regex for matching `1` or `5` => `/(1|5)/` (still easy...) -* regex for matching `1` through `50` => `/([1-9]|[1-4][0-9]|50)/` (uh-oh...) -* regex for matching `1` through `55` => `/([1-9]|[1-4][0-9]|5[0-5])/` (no prob, I can do this...) -* regex for matching `1` through `555` => `/([1-9]|[1-9][0-9]|[1-4][0-9]{2}|5[0-4][0-9]|55[0-5])/` (maybe not...) -* regex for matching `0001` through `5555` => `/(0{3}[1-9]|0{2}[1-9][0-9]|0[1-9][0-9]{2}|[1-4][0-9]{3}|5[0-4][0-9]{2}|55[0-4][0-9]|555[0-5])/` (okay, I get the point!) - -The numbers are contrived, but they're also really basic. In the real world you might need to generate a regex on-the-fly for validation. - -**Learn more** - -If you're interested in learning more about [character classes](http://www.regular-expressions.info/charclass.html) and other regex features, I personally have always found [regular-expressions.info](http://www.regular-expressions.info/charclass.html) to be pretty useful. - -### Heavily tested - -As of April 07, 2019, this library runs [>1m test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are correct. - -Tests run in ~280ms on my MacBook Pro, 2.5 GHz Intel Core i7. - -### Optimized - -Generated regular expressions are optimized: - -* duplicate sequences and character classes are reduced using quantifiers -* smart enough to use `?` conditionals when number(s) or range(s) can be positive or negative -* uses fragment caching to avoid processing the same exact string more than once - -
- -
- -## Usage - -Add this library to your javascript application with the following line of code - -```js -const toRegexRange = require('to-regex-range'); -``` - -The main export is a function that takes two integers: the `min` value and `max` value (formatted as strings or numbers). - -```js -const source = toRegexRange('15', '95'); -//=> 1[5-9]|[2-8][0-9]|9[0-5] - -const regex = new RegExp(`^${source}$`); -console.log(regex.test('14')); //=> false -console.log(regex.test('50')); //=> true -console.log(regex.test('94')); //=> true -console.log(regex.test('96')); //=> false -``` - -## Options - -### options.capture - -**Type**: `boolean` - -**Deafault**: `undefined` - -Wrap the returned value in parentheses when there is more than one regex condition. Useful when you're dynamically generating ranges. - -```js -console.log(toRegexRange('-10', '10')); -//=> -[1-9]|-?10|[0-9] - -console.log(toRegexRange('-10', '10', { capture: true })); -//=> (-[1-9]|-?10|[0-9]) -``` - -### options.shorthand - -**Type**: `boolean` - -**Deafault**: `undefined` - -Use the regex shorthand for `[0-9]`: - -```js -console.log(toRegexRange('0', '999999')); -//=> [0-9]|[1-9][0-9]{1,5} - -console.log(toRegexRange('0', '999999', { shorthand: true })); -//=> \d|[1-9]\d{1,5} -``` - -### options.relaxZeros - -**Type**: `boolean` - -**Default**: `true` - -This option relaxes matching for leading zeros when when ranges are zero-padded. - -```js -const source = toRegexRange('-0010', '0010'); -const regex = new RegExp(`^${source}$`); -console.log(regex.test('-10')); //=> true -console.log(regex.test('-010')); //=> true -console.log(regex.test('-0010')); //=> true -console.log(regex.test('10')); //=> true -console.log(regex.test('010')); //=> true -console.log(regex.test('0010')); //=> true -``` - -When `relaxZeros` is false, matching is strict: - -```js -const source = toRegexRange('-0010', '0010', { relaxZeros: false }); -const regex = new RegExp(`^${source}$`); -console.log(regex.test('-10')); //=> false -console.log(regex.test('-010')); //=> false -console.log(regex.test('-0010')); //=> true -console.log(regex.test('10')); //=> false -console.log(regex.test('010')); //=> false -console.log(regex.test('0010')); //=> true -``` - -## Examples - -| **Range** | **Result** | **Compile time** | -| --- | --- | --- | -| `toRegexRange(-10, 10)` | `-[1-9]\|-?10\|[0-9]` | _132μs_ | -| `toRegexRange(-100, -10)` | `-1[0-9]\|-[2-9][0-9]\|-100` | _50μs_ | -| `toRegexRange(-100, 100)` | `-[1-9]\|-?[1-9][0-9]\|-?100\|[0-9]` | _42μs_ | -| `toRegexRange(001, 100)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|100` | _109μs_ | -| `toRegexRange(001, 555)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _51μs_ | -| `toRegexRange(0010, 1000)` | `0{0,2}1[0-9]\|0{0,2}[2-9][0-9]\|0?[1-9][0-9]{2}\|1000` | _31μs_ | -| `toRegexRange(1, 50)` | `[1-9]\|[1-4][0-9]\|50` | _24μs_ | -| `toRegexRange(1, 55)` | `[1-9]\|[1-4][0-9]\|5[0-5]` | _23μs_ | -| `toRegexRange(1, 555)` | `[1-9]\|[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _30μs_ | -| `toRegexRange(1, 5555)` | `[1-9]\|[1-9][0-9]{1,2}\|[1-4][0-9]{3}\|5[0-4][0-9]{2}\|55[0-4][0-9]\|555[0-5]` | _43μs_ | -| `toRegexRange(111, 555)` | `11[1-9]\|1[2-9][0-9]\|[2-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _38μs_ | -| `toRegexRange(29, 51)` | `29\|[34][0-9]\|5[01]` | _24μs_ | -| `toRegexRange(31, 877)` | `3[1-9]\|[4-9][0-9]\|[1-7][0-9]{2}\|8[0-6][0-9]\|87[0-7]` | _32μs_ | -| `toRegexRange(5, 5)` | `5` | _8μs_ | -| `toRegexRange(5, 6)` | `5\|6` | _11μs_ | -| `toRegexRange(1, 2)` | `1\|2` | _6μs_ | -| `toRegexRange(1, 5)` | `[1-5]` | _15μs_ | -| `toRegexRange(1, 10)` | `[1-9]\|10` | _22μs_ | -| `toRegexRange(1, 100)` | `[1-9]\|[1-9][0-9]\|100` | _25μs_ | -| `toRegexRange(1, 1000)` | `[1-9]\|[1-9][0-9]{1,2}\|1000` | _31μs_ | -| `toRegexRange(1, 10000)` | `[1-9]\|[1-9][0-9]{1,3}\|10000` | _34μs_ | -| `toRegexRange(1, 100000)` | `[1-9]\|[1-9][0-9]{1,4}\|100000` | _36μs_ | -| `toRegexRange(1, 1000000)` | `[1-9]\|[1-9][0-9]{1,5}\|1000000` | _42μs_ | -| `toRegexRange(1, 10000000)` | `[1-9]\|[1-9][0-9]{1,6}\|10000000` | _42μs_ | - -## Heads up! - -**Order of arguments** - -When the `min` is larger than the `max`, values will be flipped to create a valid range: - -```js -toRegexRange('51', '29'); -``` - -Is effectively flipped to: - -```js -toRegexRange('29', '51'); -//=> 29|[3-4][0-9]|5[0-1] -``` - -**Steps / increments** - -This library does not support steps (increments). A pr to add support would be welcome. - -## History - -### v2.0.0 - 2017-04-21 - -**New features** - -Adds support for zero-padding! - -### v1.0.0 - -**Optimizations** - -Repeating ranges are now grouped using quantifiers. rocessing time is roughly the same, but the generated regex is much smaller, which should result in faster matching. - -## Attribution - -Inspired by the python library [range-regex](https://github.com/dimka665/range-regex). - -## 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: - -* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by micromatch.") -* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") -* [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/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") -* [repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") -* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 63 | [jonschlinkert](https://github.com/jonschlinkert) | -| 3 | [doowb](https://github.com/doowb) | -| 2 | [realityking](https://github.com/realityking) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)! - - - - - -### 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 April 07, 2019._ \ No newline at end of file diff --git a/node_modules/to-regex-range/index.js b/node_modules/to-regex-range/index.js deleted file mode 100644 index 77fbace..0000000 --- a/node_modules/to-regex-range/index.js +++ /dev/null @@ -1,288 +0,0 @@ -/*! - * to-regex-range - * - * Copyright (c) 2015-present, Jon Schlinkert. - * Released under the MIT License. - */ - -'use strict'; - -const isNumber = require('is-number'); - -const toRegexRange = (min, max, options) => { - if (isNumber(min) === false) { - throw new TypeError('toRegexRange: expected the first argument to be a number'); - } - - if (max === void 0 || min === max) { - return String(min); - } - - if (isNumber(max) === false) { - throw new TypeError('toRegexRange: expected the second argument to be a number.'); - } - - let opts = { relaxZeros: true, ...options }; - if (typeof opts.strictZeros === 'boolean') { - opts.relaxZeros = opts.strictZeros === false; - } - - let relax = String(opts.relaxZeros); - let shorthand = String(opts.shorthand); - let capture = String(opts.capture); - let wrap = String(opts.wrap); - let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; - - if (toRegexRange.cache.hasOwnProperty(cacheKey)) { - return toRegexRange.cache[cacheKey].result; - } - - let a = Math.min(min, max); - let b = Math.max(min, max); - - if (Math.abs(a - b) === 1) { - let result = min + '|' + max; - if (opts.capture) { - return `(${result})`; - } - if (opts.wrap === false) { - return result; - } - return `(?:${result})`; - } - - let isPadded = hasPadding(min) || hasPadding(max); - let state = { min, max, a, b }; - let positives = []; - let negatives = []; - - if (isPadded) { - state.isPadded = isPadded; - state.maxLen = String(state.max).length; - } - - if (a < 0) { - let newMin = b < 0 ? Math.abs(b) : 1; - negatives = splitToPatterns(newMin, Math.abs(a), state, opts); - a = state.a = 0; - } - - if (b >= 0) { - positives = splitToPatterns(a, b, state, opts); - } - - state.negatives = negatives; - state.positives = positives; - state.result = collatePatterns(negatives, positives, opts); - - if (opts.capture === true) { - state.result = `(${state.result})`; - } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { - state.result = `(?:${state.result})`; - } - - toRegexRange.cache[cacheKey] = state; - return state.result; -}; - -function collatePatterns(neg, pos, options) { - let onlyNegative = filterPatterns(neg, pos, '-', false, options) || []; - let onlyPositive = filterPatterns(pos, neg, '', false, options) || []; - let intersected = filterPatterns(neg, pos, '-?', true, options) || []; - let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); - return subpatterns.join('|'); -} - -function splitToRanges(min, max) { - let nines = 1; - let zeros = 1; - - let stop = countNines(min, nines); - let stops = new Set([max]); - - while (min <= stop && stop <= max) { - stops.add(stop); - nines += 1; - stop = countNines(min, nines); - } - - stop = countZeros(max + 1, zeros) - 1; - - while (min < stop && stop <= max) { - stops.add(stop); - zeros += 1; - stop = countZeros(max + 1, zeros) - 1; - } - - stops = [...stops]; - stops.sort(compare); - return stops; -} - -/** - * Convert a range to a regex pattern - * @param {Number} `start` - * @param {Number} `stop` - * @return {String} - */ - -function rangeToPattern(start, stop, options) { - if (start === stop) { - return { pattern: start, count: [], digits: 0 }; - } - - let zipped = zip(start, stop); - let digits = zipped.length; - let pattern = ''; - let count = 0; - - for (let i = 0; i < digits; i++) { - let [startDigit, stopDigit] = zipped[i]; - - if (startDigit === stopDigit) { - pattern += startDigit; - - } else if (startDigit !== '0' || stopDigit !== '9') { - pattern += toCharacterClass(startDigit, stopDigit, options); - - } else { - count++; - } - } - - if (count) { - pattern += options.shorthand === true ? '\\d' : '[0-9]'; - } - - return { pattern, count: [count], digits }; -} - -function splitToPatterns(min, max, tok, options) { - let ranges = splitToRanges(min, max); - let tokens = []; - let start = min; - let prev; - - for (let i = 0; i < ranges.length; i++) { - let max = ranges[i]; - let obj = rangeToPattern(String(start), String(max), options); - let zeros = ''; - - if (!tok.isPadded && prev && prev.pattern === obj.pattern) { - if (prev.count.length > 1) { - prev.count.pop(); - } - - prev.count.push(obj.count[0]); - prev.string = prev.pattern + toQuantifier(prev.count); - start = max + 1; - continue; - } - - if (tok.isPadded) { - zeros = padZeros(max, tok, options); - } - - obj.string = zeros + obj.pattern + toQuantifier(obj.count); - tokens.push(obj); - start = max + 1; - prev = obj; - } - - return tokens; -} - -function filterPatterns(arr, comparison, prefix, intersection, options) { - let result = []; - - for (let ele of arr) { - let { string } = ele; - - // only push if _both_ are negative... - if (!intersection && !contains(comparison, 'string', string)) { - result.push(prefix + string); - } - - // or _both_ are positive - if (intersection && contains(comparison, 'string', string)) { - result.push(prefix + string); - } - } - return result; -} - -/** - * Zip strings - */ - -function zip(a, b) { - let arr = []; - for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); - return arr; -} - -function compare(a, b) { - return a > b ? 1 : b > a ? -1 : 0; -} - -function contains(arr, key, val) { - return arr.some(ele => ele[key] === val); -} - -function countNines(min, len) { - return Number(String(min).slice(0, -len) + '9'.repeat(len)); -} - -function countZeros(integer, zeros) { - return integer - (integer % Math.pow(10, zeros)); -} - -function toQuantifier(digits) { - let [start = 0, stop = ''] = digits; - if (stop || start > 1) { - return `{${start + (stop ? ',' + stop : '')}}`; - } - return ''; -} - -function toCharacterClass(a, b, options) { - return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; -} - -function hasPadding(str) { - return /^-?(0+)\d/.test(str); -} - -function padZeros(value, tok, options) { - if (!tok.isPadded) { - return value; - } - - let diff = Math.abs(tok.maxLen - String(value).length); - let relax = options.relaxZeros !== false; - - switch (diff) { - case 0: - return ''; - case 1: - return relax ? '0?' : '0'; - case 2: - return relax ? '0{0,2}' : '00'; - default: { - return relax ? `0{0,${diff}}` : `0{${diff}}`; - } - } -} - -/** - * Cache - */ - -toRegexRange.cache = {}; -toRegexRange.clearCache = () => (toRegexRange.cache = {}); - -/** - * Expose `toRegexRange` - */ - -module.exports = toRegexRange; diff --git a/node_modules/to-regex-range/package.json b/node_modules/to-regex-range/package.json deleted file mode 100644 index 4ef194f..0000000 --- a/node_modules/to-regex-range/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "to-regex-range", - "description": "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.", - "version": "5.0.1", - "homepage": "https://github.com/micromatch/to-regex-range", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "contributors": [ - "Jon Schlinkert (http://twitter.com/jonschlinkert)", - "Rouven Weßling (www.rouvenwessling.de)" - ], - "repository": "micromatch/to-regex-range", - "bugs": { - "url": "https://github.com/micromatch/to-regex-range/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=8.0" - }, - "scripts": { - "test": "mocha" - }, - "dependencies": { - "is-number": "^7.0.0" - }, - "devDependencies": { - "fill-range": "^6.0.0", - "gulp-format-md": "^2.0.0", - "mocha": "^6.0.2", - "text-table": "^0.2.0", - "time-diff": "^0.3.1" - }, - "keywords": [ - "bash", - "date", - "expand", - "expansion", - "expression", - "glob", - "match", - "match date", - "match number", - "match numbers", - "match year", - "matches", - "matching", - "number", - "numbers", - "numerical", - "range", - "ranges", - "regex", - "regexp", - "regular", - "regular expression", - "sequence" - ], - "verb": { - "layout": "default", - "toc": false, - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "helpers": { - "examples": { - "displayName": "examples" - } - }, - "related": { - "list": [ - "expand-range", - "fill-range", - "micromatch", - "repeat-element", - "repeat-string" - ] - } - } -} diff --git a/node_modules/to-through/LICENSE b/node_modules/to-through/LICENSE deleted file mode 100644 index 0770717..0000000 --- a/node_modules/to-through/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017, 2020-2021 Blaine Bublitz and Eric Schoffstall - -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/to-through/README.md b/node_modules/to-through/README.md deleted file mode 100644 index 1152277..0000000 --- a/node_modules/to-through/README.md +++ /dev/null @@ -1,55 +0,0 @@ -

- - - -

- -# to-through - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Wrap a `Readable` stream in a `Transform` stream. - -## Usage - -```js -var { Readable } = require('streamx'); -var concat = require('concat-stream'); -var toThrough = require('to-through'); - -var readable = Readable.from([' ', 'hello', ' ', 'world']); - -// Can be used as a Readable or Transform -var maybeTransform = toThrough(readable); - -Readable.from(['hi', ' ', 'there', ',']) - .pipe(maybeTransform) - .pipe( - concat(function (result) { - // result === 'hi there, hello world' - }) - ); -``` - -## API - -### `toThrough(readableStream)` - -Takes a `Readable` stream as the only argument and returns a `Transform` stream wrapper. Any data -piped into the `Transform` stream is piped passed along before any data from the wrapped `Readable` is injected into the stream. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/to-through.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/to-through -[npm-image]: https://img.shields.io/npm/v/to-through.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/to-through/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/to-through/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/to-through -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/to-through/master.svg?style=flat-square - diff --git a/node_modules/to-through/index.js b/node_modules/to-through/index.js deleted file mode 100644 index 718f2f6..0000000 --- a/node_modules/to-through/index.js +++ /dev/null @@ -1,134 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; - -// Based on help from @mafintosh via https://gist.github.com/mafintosh/92836a8d03df0ef41356e233e0f06382 - -function toThrough(readable) { - var highWaterMark = readable._readableState.highWaterMark; - - // Streamx uses 16384 as the default highWaterMark for everything and then - // divides it by 1024 for objects - // However, node's objectMode streams the number of objects as highWaterMark, so we need to - // multiply the objectMode highWaterMark by 1024 to make it streamx compatible - if (readable._readableState.objectMode) { - highWaterMark = readable._readableState.highWaterMark * 1024; - } - - var destroyedByError = false; - var readableClosed = false; - var readableEnded = false; - - function flush(cb) { - var self = this; - - // Afer all writes have drained, we change the `_read` implementation - self._read = function (cb) { - readable.resume(); - cb(); - }; - - readable.on('data', onData); - readable.once('error', onError); - readable.once('end', onEnd); - - function cleanup() { - readable.off('data', onData); - readable.off('error', onError); - readable.off('end', onEnd); - } - - function onData(data) { - var drained = self.push(data); - // When the stream is not drained, we pause it because `_read` will be called later - if (!drained) { - readable.pause(); - } - } - - function onError(err) { - cleanup(); - cb(err); - } - - function onEnd() { - cleanup(); - cb(); - } - } - - // Handle the case where a user destroyed the returned stream - function predestroy() { - // Only call destroy on the readable if this `predestroy` wasn't - // caused via the readable having an `error` or `close` event - if (destroyedByError) { - return; - } - if (readableClosed) { - return; - } - readable.destroy(new Error('Wrapper destroyed')); - } - - var wrapper = new Transform({ - highWaterMark: highWaterMark, - flush: flush, - predestroy: predestroy, - }); - - // Forward errors from the underlying stream - readable.once('error', onError); - readable.once('end', onEnd); - readable.once('close', onClose); - - function onError(err) { - destroyedByError = true; - wrapper.destroy(err); - } - - function onEnd() { - readableEnded = true; - } - - function onClose() { - readableClosed = true; - // Only destroy the wrapper if the readable hasn't ended successfully - if (!readableEnded) { - wrapper.destroy(); - } - } - - var shouldFlow = true; - wrapper.once('pipe', onPipe); - wrapper.on('piping', onPiping); - wrapper.on('newListener', onListener); - - function onPiping() { - maybeFlow(); - wrapper.off('piping', onPiping); - wrapper.off('newListener', onListener); - } - - function onListener(event) { - // Once we've seen the data or readable event, check if we need to flow - if (event === 'data' || event === 'readable') { - onPiping(); - } - } - - function onPipe() { - // If the wrapper is piped, disable flow - shouldFlow = false; - } - - function maybeFlow() { - // If we need to flow, end the stream which triggers flush - if (shouldFlow) { - wrapper.end(); - } - } - - return wrapper; -} - -module.exports = toThrough; diff --git a/node_modules/to-through/package.json b/node_modules/to-through/package.json deleted file mode 100644 index bfd99e3..0000000 --- a/node_modules/to-through/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "to-through", - "version": "3.0.0", - "description": "Wrap a Readable stream in a Transform stream.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/to-through", - "license": "MIT", - "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": { - "streamx": "^2.12.5" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.4.2", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "readable-stream": "^3.6.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "transform", - "readable", - "through", - "wrap" - ] -} diff --git a/node_modules/tslib/CopyrightNotice.txt b/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 0e42542..0000000 --- a/node_modules/tslib/CopyrightNotice.txt +++ /dev/null @@ -1,15 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -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/tslib/LICENSE.txt b/node_modules/tslib/LICENSE.txt deleted file mode 100644 index bfe6430..0000000 --- a/node_modules/tslib/LICENSE.txt +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -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. \ No newline at end of file diff --git a/node_modules/tslib/README.md b/node_modules/tslib/README.md deleted file mode 100644 index 290cc61..0000000 --- a/node_modules/tslib/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# tslib - -This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions. - -This library is primarily used by the `--importHelpers` flag in TypeScript. -When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file: - -```ts -var __assign = (this && this.__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; -}; -exports.x = {}; -exports.y = __assign({}, exports.x); - -``` - -will instead be emitted as something like the following: - -```ts -var tslib_1 = require("tslib"); -exports.x = {}; -exports.y = tslib_1.__assign({}, exports.x); -``` - -Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead. -For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`. - -# Installing - -For the latest stable version, run: - -## npm - -```sh -# TypeScript 3.9.2 or later -npm install tslib - -# TypeScript 3.8.4 or earlier -npm install tslib@^1 - -# TypeScript 2.3.2 or earlier -npm install tslib@1.6.1 -``` - -## yarn - -```sh -# TypeScript 3.9.2 or later -yarn add tslib - -# TypeScript 3.8.4 or earlier -yarn add tslib@^1 - -# TypeScript 2.3.2 or earlier -yarn add tslib@1.6.1 -``` - -## bower - -```sh -# TypeScript 3.9.2 or later -bower install tslib - -# TypeScript 3.8.4 or earlier -bower install tslib@^1 - -# TypeScript 2.3.2 or earlier -bower install tslib@1.6.1 -``` - -## JSPM - -```sh -# TypeScript 3.9.2 or later -jspm install tslib - -# TypeScript 3.8.4 or earlier -jspm install tslib@^1 - -# TypeScript 2.3.2 or earlier -jspm install tslib@1.6.1 -``` - -# Usage - -Set the `importHelpers` compiler option on the command line: - -``` -tsc --importHelpers file.ts -``` - -or in your tsconfig.json: - -```json -{ - "compilerOptions": { - "importHelpers": true - } -} -``` - -#### For bower and JSPM users - -You will need to add a `paths` mapping for `tslib`, e.g. For Bower users: - -```json -{ - "compilerOptions": { - "module": "amd", - "importHelpers": true, - "baseUrl": "./", - "paths": { - "tslib" : ["bower_components/tslib/tslib.d.ts"] - } - } -} -``` - -For JSPM users: - -```json -{ - "compilerOptions": { - "module": "system", - "importHelpers": true, - "baseUrl": "./", - "paths": { - "tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"] - } - } -} -``` - -## Deployment - -- Choose your new version number -- Set it in `package.json` and `bower.json` -- Create a tag: `git tag [version]` -- Push the tag: `git push --tags` -- Create a [release in GitHub](https://github.com/microsoft/tslib/releases) -- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow - -Done. - -# Contribute - -There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript. - -* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in. -* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls). -* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript). -* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter. -* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md). - -# Documentation - -* [Quick tutorial](http://www.typescriptlang.org/Tutorial) -* [Programming handbook](http://www.typescriptlang.org/Handbook) -* [Homepage](http://www.typescriptlang.org/) diff --git a/node_modules/tslib/SECURITY.md b/node_modules/tslib/SECURITY.md deleted file mode 100644 index 869fdfe..0000000 --- a/node_modules/tslib/SECURITY.md +++ /dev/null @@ -1,41 +0,0 @@ - - -## Security - -Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). - -If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. - -## Reporting Security Issues - -**Please do not report security vulnerabilities through public GitHub issues.** - -Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). - -If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). - -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). - -Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: - - * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) - * Full paths of source file(s) related to the manifestation of the issue - * The location of the affected source code (tag/branch/commit or direct URL) - * Any special configuration required to reproduce the issue - * Step-by-step instructions to reproduce the issue - * Proof-of-concept or exploit code (if possible) - * Impact of the issue, including how an attacker might exploit the issue - -This information will help us triage your report more quickly. - -If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. - -## Preferred Languages - -We prefer all communications to be in English. - -## Policy - -Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). - - diff --git a/node_modules/tslib/modules/index.d.ts b/node_modules/tslib/modules/index.d.ts deleted file mode 100644 index 3244fab..0000000 --- a/node_modules/tslib/modules/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Note: named reexports are used instead of `export *` because -// TypeScript itself doesn't resolve the `export *` when checking -// if a particular helper exists. -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __exportStar, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __createBinding, - __addDisposableResource, - __disposeResources, - __rewriteRelativeImportExtension, -} from '../tslib.js'; -export * as default from '../tslib.js'; diff --git a/node_modules/tslib/modules/index.js b/node_modules/tslib/modules/index.js deleted file mode 100644 index c91f618..0000000 --- a/node_modules/tslib/modules/index.js +++ /dev/null @@ -1,70 +0,0 @@ -import tslib from '../tslib.js'; -const { - __extends, - __assign, - __rest, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __addDisposableResource, - __disposeResources, - __rewriteRelativeImportExtension, -} = tslib; -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __addDisposableResource, - __disposeResources, - __rewriteRelativeImportExtension, -}; -export default tslib; diff --git a/node_modules/tslib/modules/package.json b/node_modules/tslib/modules/package.json deleted file mode 100644 index aafa0e4..0000000 --- a/node_modules/tslib/modules/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file diff --git a/node_modules/tslib/package.json b/node_modules/tslib/package.json deleted file mode 100644 index 57d0578..0000000 --- a/node_modules/tslib/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "tslib", - "author": "Microsoft Corp.", - "homepage": "https://www.typescriptlang.org/", - "version": "2.8.1", - "license": "0BSD", - "description": "Runtime library for TypeScript helper functions", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/tslib.git" - }, - "main": "tslib.js", - "module": "tslib.es6.js", - "jsnext:main": "tslib.es6.js", - "typings": "tslib.d.ts", - "sideEffects": false, - "exports": { - ".": { - "module": { - "types": "./modules/index.d.ts", - "default": "./tslib.es6.mjs" - }, - "import": { - "node": "./modules/index.js", - "default": { - "types": "./modules/index.d.ts", - "default": "./tslib.es6.mjs" - } - }, - "default": "./tslib.js" - }, - "./*": "./*", - "./": "./" - } -} diff --git a/node_modules/tslib/tslib.d.ts b/node_modules/tslib/tslib.d.ts deleted file mode 100644 index f23df55..0000000 --- a/node_modules/tslib/tslib.d.ts +++ /dev/null @@ -1,460 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -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. -***************************************************************************** */ - -/** - * Used to shim class extends. - * - * @param d The derived class. - * @param b The base class. - */ -export declare function __extends(d: Function, b: Function): void; - -/** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * - * @param t The target object to copy to. - * @param sources One or more source objects from which to copy properties - */ -export declare function __assign(t: any, ...sources: any[]): any; - -/** - * Performs a rest spread on an object. - * - * @param t The source value. - * @param propertyNames The property names excluded from the rest spread. - */ -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; - -/** - * Applies decorators to a target object - * - * @param decorators The set of decorators to apply. - * @param target The target object. - * @param key If specified, the own property to apply the decorators to. - * @param desc The property descriptor, defaults to fetching the descriptor from the target object. - * @experimental - */ -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; - -/** - * Creates an observing function decorator from a parameter decorator. - * - * @param paramIndex The parameter index to apply the decorator to. - * @param decorator The parameter decorator to apply. Note that the return value is ignored. - * @experimental - */ -export declare function __param(paramIndex: number, decorator: Function): Function; - -/** - * Applies decorators to a class or class member, following the native ECMAScript decorator specification. - * @param ctor For non-field class members, the class constructor. Otherwise, `null`. - * @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`. - * @param decorators The decorators to apply - * @param contextIn The `DecoratorContext` to clone for each decorator application. - * @param initializers An array of field initializer mutation functions into which new initializers are written. - * @param extraInitializers An array of extra initializer functions into which new initializers are written. - */ -export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void; - -/** - * Runs field initializers or extra initializers generated by `__esDecorate`. - * @param thisArg The `this` argument to use. - * @param initializers The array of initializers to evaluate. - * @param value The initial value to pass to the initializers. - */ -export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any; - -/** - * Converts a computed property name into a `string` or `symbol` value. - */ -export declare function __propKey(x: any): string | symbol; - -/** - * Assigns the name of a function derived from the left-hand side of an assignment. - * @param f The function to rename. - * @param name The new name for the function. - * @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name. - */ -export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function; - -/** - * Creates a decorator that sets metadata. - * - * @param metadataKey The metadata key - * @param metadataValue The metadata value - * @experimental - */ -export declare function __metadata(metadataKey: any, metadataValue: any): Function; - -/** - * Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`. - * - * @param thisArg The reference to use as the `this` value in the generator function - * @param _arguments The optional arguments array - * @param P The optional promise constructor argument, defaults to the `Promise` property of the global object. - * @param generator The generator function - */ -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; - -/** - * Creates an Iterator object using the body as the implementation. - * - * @param thisArg The reference to use as the `this` value in the function - * @param body The generator state-machine based implementation. - * - * @see [./docs/generator.md] - */ -export declare function __generator(thisArg: any, body: Function): any; - -/** - * Creates bindings for all enumerable properties of `m` on `exports` - * - * @param m The source object - * @param o The `exports` object. - */ -export declare function __exportStar(m: any, o: any): void; - -/** - * Creates a value iterator from an `Iterable` or `ArrayLike` object. - * - * @param o The object. - * @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`. - */ -export declare function __values(o: any): any; - -/** - * Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array. - * - * @param o The object to read from. - * @param n The maximum number of arguments to read, defaults to `Infinity`. - */ -export declare function __read(o: any, n?: number): any[]; - -/** - * Creates an array from iterable spread. - * - * @param args The Iterable objects to spread. - * @deprecated since TypeScript 4.2 - Use `__spreadArray` - */ -export declare function __spread(...args: any[][]): any[]; - -/** - * Creates an array from array spread. - * - * @param args The ArrayLikes to spread into the resulting array. - * @deprecated since TypeScript 4.2 - Use `__spreadArray` - */ -export declare function __spreadArrays(...args: any[][]): any[]; - -/** - * Spreads the `from` array into the `to` array. - * - * @param pack Replace empty elements with `undefined`. - */ -export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[]; - -/** - * Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded, - * and instead should be awaited and the resulting value passed back to the generator. - * - * @param v The value to await. - */ -export declare function __await(v: any): any; - -/** - * Converts a generator function into an async generator function, by using `yield __await` - * in place of normal `await`. - * - * @param thisArg The reference to use as the `this` value in the generator function - * @param _arguments The optional arguments array - * @param generator The generator function - */ -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; - -/** - * Used to wrap a potentially async iterator in such a way so that it wraps the result - * of calling iterator methods of `o` in `__await` instances, and then yields the awaited values. - * - * @param o The potentially async iterator. - * @returns A synchronous iterator yielding `__await` instances on every odd invocation - * and returning the awaited `IteratorResult` passed to `next` every even invocation. - */ -export declare function __asyncDelegator(o: any): any; - -/** - * Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object. - * - * @param o The object. - * @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`. - */ -export declare function __asyncValues(o: any): any; - -/** - * Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays. - * - * @param cooked The cooked possibly-sparse array. - * @param raw The raw string content. - */ -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; - -/** - * Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS. - * - * ```js - * import Default, { Named, Other } from "mod"; - * // or - * import { default as Default, Named, Other } from "mod"; - * ``` - * - * @param mod The CommonJS module exports object. - */ -export declare function __importStar(mod: T): T; - -/** - * Used to shim default imports in ECMAScript Modules transpiled to CommonJS. - * - * ```js - * import Default from "mod"; - * ``` - * - * @param mod The CommonJS module exports object. - */ -export declare function __importDefault(mod: T): T | { default: T }; - -/** - * Emulates reading a private instance field. - * - * @param receiver The instance from which to read the private field. - * @param state A WeakMap containing the private field value for an instance. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * - * @throws {TypeError} If `state` doesn't have an entry for `receiver`. - */ -export declare function __classPrivateFieldGet( - receiver: T, - state: { has(o: T): boolean, get(o: T): V | undefined }, - kind?: "f" -): V; - -/** - * Emulates reading a private static field. - * - * @param receiver The object from which to read the private static field. - * @param state The class constructor containing the definition of the static field. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The descriptor that holds the static field value. - * - * @throws {TypeError} If `receiver` is not `state`. - */ -export declare function __classPrivateFieldGet unknown, V>( - receiver: T, - state: T, - kind: "f", - f: { value: V } -): V; - -/** - * Emulates evaluating a private instance "get" accessor. - * - * @param receiver The instance on which to evaluate the private "get" accessor. - * @param state A WeakSet used to verify an instance supports the private "get" accessor. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The "get" accessor function to evaluate. - * - * @throws {TypeError} If `state` doesn't have an entry for `receiver`. - */ -export declare function __classPrivateFieldGet( - receiver: T, - state: { has(o: T): boolean }, - kind: "a", - f: () => V -): V; - -/** - * Emulates evaluating a private static "get" accessor. - * - * @param receiver The object on which to evaluate the private static "get" accessor. - * @param state The class constructor containing the definition of the static "get" accessor. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The "get" accessor function to evaluate. - * - * @throws {TypeError} If `receiver` is not `state`. - */ -export declare function __classPrivateFieldGet unknown, V>( - receiver: T, - state: T, - kind: "a", - f: () => V -): V; - -/** - * Emulates reading a private instance method. - * - * @param receiver The instance from which to read a private method. - * @param state A WeakSet used to verify an instance supports the private method. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The function to return as the private instance method. - * - * @throws {TypeError} If `state` doesn't have an entry for `receiver`. - */ -export declare function __classPrivateFieldGet unknown>( - receiver: T, - state: { has(o: T): boolean }, - kind: "m", - f: V -): V; - -/** - * Emulates reading a private static method. - * - * @param receiver The object from which to read the private static method. - * @param state The class constructor containing the definition of the static method. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The function to return as the private static method. - * - * @throws {TypeError} If `receiver` is not `state`. - */ -export declare function __classPrivateFieldGet unknown, V extends (...args: any[]) => unknown>( - receiver: T, - state: T, - kind: "m", - f: V -): V; - -/** - * Emulates writing to a private instance field. - * - * @param receiver The instance on which to set a private field value. - * @param state A WeakMap used to store the private field value for an instance. - * @param value The value to store in the private field. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * - * @throws {TypeError} If `state` doesn't have an entry for `receiver`. - */ -export declare function __classPrivateFieldSet( - receiver: T, - state: { has(o: T): boolean, set(o: T, value: V): unknown }, - value: V, - kind?: "f" -): V; - -/** - * Emulates writing to a private static field. - * - * @param receiver The object on which to set the private static field. - * @param state The class constructor containing the definition of the private static field. - * @param value The value to store in the private field. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The descriptor that holds the static field value. - * - * @throws {TypeError} If `receiver` is not `state`. - */ -export declare function __classPrivateFieldSet unknown, V>( - receiver: T, - state: T, - value: V, - kind: "f", - f: { value: V } -): V; - -/** - * Emulates writing to a private instance "set" accessor. - * - * @param receiver The instance on which to evaluate the private instance "set" accessor. - * @param state A WeakSet used to verify an instance supports the private "set" accessor. - * @param value The value to store in the private accessor. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The "set" accessor function to evaluate. - * - * @throws {TypeError} If `state` doesn't have an entry for `receiver`. - */ -export declare function __classPrivateFieldSet( - receiver: T, - state: { has(o: T): boolean }, - value: V, - kind: "a", - f: (v: V) => void -): V; - -/** - * Emulates writing to a private static "set" accessor. - * - * @param receiver The object on which to evaluate the private static "set" accessor. - * @param state The class constructor containing the definition of the static "set" accessor. - * @param value The value to store in the private field. - * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. - * @param f The "set" accessor function to evaluate. - * - * @throws {TypeError} If `receiver` is not `state`. - */ -export declare function __classPrivateFieldSet unknown, V>( - receiver: T, - state: T, - value: V, - kind: "a", - f: (v: V) => void -): V; - -/** - * Checks for the existence of a private field/method/accessor. - * - * @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member. - * @param receiver The object for which to test the presence of the private member. - */ -export declare function __classPrivateFieldIn( - state: (new (...args: any[]) => unknown) | { has(o: any): boolean }, - receiver: unknown, -): boolean; - -/** - * Creates a re-export binding on `object` with key `objectKey` that references `target[key]`. - * - * @param object The local `exports` object. - * @param target The object to re-export from. - * @param key The property key of `target` to re-export. - * @param objectKey The property key to re-export as. Defaults to `key`. - */ -export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; - -/** - * Adds a disposable resource to a resource-tracking environment object. - * @param env A resource-tracking environment object. - * @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`. - * @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added. - * @returns The {@link value} argument. - * - * @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not - * defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method. - */ -export declare function __addDisposableResource(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T; - -/** - * Disposes all resources in a resource-tracking environment object. - * @param env A resource-tracking environment object. - * @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`. - * - * @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the - * error recorded in the resource-tracking environment object. - * @seealso {@link __addDisposableResource} - */ -export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any; - -/** - * Transforms a relative import specifier ending in a non-declaration TypeScript file extension to its JavaScript file extension counterpart. - * @param path The import specifier. - * @param preserveJsx Causes '*.tsx' to transform to '*.jsx' instead of '*.js'. Should be true when `--jsx` is set to `preserve`. - */ -export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean): string; \ No newline at end of file diff --git a/node_modules/tslib/tslib.es6.html b/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41..0000000 --- a/node_modules/tslib/tslib.es6.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/tslib/tslib.es6.js b/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 6c1739b..0000000 --- a/node_modules/tslib/tslib.es6.js +++ /dev/null @@ -1,402 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -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. -***************************************************************************** */ -/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(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); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -}; - -export function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; - -export function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -}; - -export function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); -}; - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -export function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -/** @deprecated */ -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -/** @deprecated */ -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} - -export function __spreadArray(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)); -} - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; - function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } - function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -export function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - -export function __classPrivateFieldIn(state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} - -export function __addDisposableResource(env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; - -} - -var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; - -export function __disposeResources(env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); -} - -export function __rewriteRelativeImportExtension(path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) { - return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); - }); - } - return path; -} - -export default { - __extends: __extends, - __assign: __assign, - __rest: __rest, - __decorate: __decorate, - __param: __param, - __esDecorate: __esDecorate, - __runInitializers: __runInitializers, - __propKey: __propKey, - __setFunctionName: __setFunctionName, - __metadata: __metadata, - __awaiter: __awaiter, - __generator: __generator, - __createBinding: __createBinding, - __exportStar: __exportStar, - __values: __values, - __read: __read, - __spread: __spread, - __spreadArrays: __spreadArrays, - __spreadArray: __spreadArray, - __await: __await, - __asyncGenerator: __asyncGenerator, - __asyncDelegator: __asyncDelegator, - __asyncValues: __asyncValues, - __makeTemplateObject: __makeTemplateObject, - __importStar: __importStar, - __importDefault: __importDefault, - __classPrivateFieldGet: __classPrivateFieldGet, - __classPrivateFieldSet: __classPrivateFieldSet, - __classPrivateFieldIn: __classPrivateFieldIn, - __addDisposableResource: __addDisposableResource, - __disposeResources: __disposeResources, - __rewriteRelativeImportExtension: __rewriteRelativeImportExtension, -}; diff --git a/node_modules/tslib/tslib.es6.mjs b/node_modules/tslib/tslib.es6.mjs deleted file mode 100644 index c17990a..0000000 --- a/node_modules/tslib/tslib.es6.mjs +++ /dev/null @@ -1,401 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -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. -***************************************************************************** */ -/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(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); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -}; - -export function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; -}; - -export function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -}; - -export function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); -}; - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -export function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -/** @deprecated */ -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -/** @deprecated */ -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} - -export function __spreadArray(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)); -} - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; - function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } - function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -export function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - -export function __classPrivateFieldIn(state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} - -export function __addDisposableResource(env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -} - -var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; - -export function __disposeResources(env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); -} - -export function __rewriteRelativeImportExtension(path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) { - return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); - }); - } - return path; -} - -export default { - __extends, - __assign, - __rest, - __decorate, - __param, - __esDecorate, - __runInitializers, - __propKey, - __setFunctionName, - __metadata, - __awaiter, - __generator, - __createBinding, - __exportStar, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, - __classPrivateFieldIn, - __addDisposableResource, - __disposeResources, - __rewriteRelativeImportExtension, -}; diff --git a/node_modules/tslib/tslib.html b/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba5..0000000 --- a/node_modules/tslib/tslib.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/tslib/tslib.js b/node_modules/tslib/tslib.js deleted file mode 100644 index 5e12ace..0000000 --- a/node_modules/tslib/tslib.js +++ /dev/null @@ -1,484 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -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. -***************************************************************************** */ -/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __esDecorate; -var __runInitializers; -var __propKey; -var __setFunctionName; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __classPrivateFieldIn; -var __createBinding; -var __addDisposableResource; -var __disposeResources; -var __rewriteRelativeImportExtension; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __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; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for (var i = decorators.length - 1; i >= 0; i--) { - var context = {}; - for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; - for (var p in contextIn.access) context.access[p] = contextIn.access[p]; - context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; - var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } - else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; - }; - - __runInitializers = function (thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i = 0; i < initializers.length; i++) { - value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - } - return useValue ? value : void 0; - }; - - __propKey = function (x) { - return typeof x === "symbol" ? x : "".concat(x); - }; - - __setFunctionName = function (f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; - - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __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)); - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; - function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } - function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; - }; - - __classPrivateFieldIn = function (state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); - }; - - __addDisposableResource = function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; - }; - - var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; - }; - - __disposeResources = function (env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; - - __rewriteRelativeImportExtension = function (path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) { - return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); - }); - } - return path; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__esDecorate", __esDecorate); - exporter("__runInitializers", __runInitializers); - exporter("__propKey", __propKey); - exporter("__setFunctionName", __setFunctionName); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); - exporter("__classPrivateFieldIn", __classPrivateFieldIn); - exporter("__addDisposableResource", __addDisposableResource); - exporter("__disposeResources", __disposeResources); - exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension); -}); - -0 && (module.exports = { - __extends: __extends, - __assign: __assign, - __rest: __rest, - __decorate: __decorate, - __param: __param, - __esDecorate: __esDecorate, - __runInitializers: __runInitializers, - __propKey: __propKey, - __setFunctionName: __setFunctionName, - __metadata: __metadata, - __awaiter: __awaiter, - __generator: __generator, - __exportStar: __exportStar, - __createBinding: __createBinding, - __values: __values, - __read: __read, - __spread: __spread, - __spreadArrays: __spreadArrays, - __spreadArray: __spreadArray, - __await: __await, - __asyncGenerator: __asyncGenerator, - __asyncDelegator: __asyncDelegator, - __asyncValues: __asyncValues, - __makeTemplateObject: __makeTemplateObject, - __importStar: __importStar, - __importDefault: __importDefault, - __classPrivateFieldGet: __classPrivateFieldGet, - __classPrivateFieldSet: __classPrivateFieldSet, - __classPrivateFieldIn: __classPrivateFieldIn, - __addDisposableResource: __addDisposableResource, - __disposeResources: __disposeResources, - __rewriteRelativeImportExtension: __rewriteRelativeImportExtension, -}); diff --git a/node_modules/type-check/LICENSE b/node_modules/type-check/LICENSE deleted file mode 100644 index 525b118..0000000 --- a/node_modules/type-check/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100644 index b170d67..0000000 --- a/node_modules/type-check/README.md +++ /dev/null @@ -1,210 +0,0 @@ -# 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 deleted file mode 100644 index f78687e..0000000 --- a/node_modules/type-check/lib/check.js +++ /dev/null @@ -1,128 +0,0 @@ -// 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 deleted file mode 100644 index 09db4cb..0000000 --- a/node_modules/type-check/lib/index.js +++ /dev/null @@ -1,16 +0,0 @@ -// 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 deleted file mode 100644 index c360c97..0000000 --- a/node_modules/type-check/lib/parse-type.js +++ /dev/null @@ -1,198 +0,0 @@ -// 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 deleted file mode 100644 index 2a57ea0..0000000 --- a/node_modules/type-check/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "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/unc-path-regex/LICENSE b/node_modules/unc-path-regex/LICENSE deleted file mode 100644 index 65f90ac..0000000 --- a/node_modules/unc-path-regex/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015, 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/unc-path-regex/README.md b/node_modules/unc-path-regex/README.md deleted file mode 100644 index e0eddda..0000000 --- a/node_modules/unc-path-regex/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# unc-path-regex [![NPM version](https://badge.fury.io/js/unc-path-regex.svg)](http://badge.fury.io/js/unc-path-regex) [![Build Status](https://travis-ci.org/jonschlinkert/unc-path-regex.svg)](https://travis-ci.org/jonschlinkert/unc-path-regex) - -> Regular expression for testing if a file path is a windows UNC file path. Can also be used as a component of another regexp via the `.source` property. - -Visit the MSDN reference for [Common Data Types 2.2.57 UNC](https://msdn.microsoft.com/en-us/library/gg465305.aspx) for more information about UNC paths. - -## Install - -Install with [npm](https://www.npmjs.com/) - -```sh -$ npm i unc-path-regex --save -``` - -## Usage - -```js -// unc-path-regex returns a function -var regex = require('unc-path-regex')(); -``` - -**true** - -Returns true for windows UNC paths: - -```js -regex.test('\\/foo/bar'); -regex.test('\\\\foo/bar'); -regex.test('\\\\foo\\admin$'); -regex.test('\\\\foo\\admin$\\system32'); -regex.test('\\\\foo\\temp'); -regex.test('\\\\/foo/bar'); -regex.test('\\\\\\/foo/bar'); -``` - -**false** - -Returns false for non-UNC paths: - -```js -regex.test('/foo/bar'); -regex.test('/'); -regex.test('/foo'); -regex.test('/foo/'); -regex.test('c:'); -regex.test('c:.'); -regex.test('c:./'); -regex.test('c:./file'); -regex.test('c:/'); -regex.test('c:/file'); -``` - -## Related projects - -* [dotfile-regex](https://github.com/regexps/dotfile-regex): Regular expresson for matching dotfiles. -* [dotdir-regex](https://github.com/regexps/dotdir-regex): Regex for matching dot-directories, like `.git/` -* [dirname-regex](https://github.com/regexps/dirname-regex): Regular expression for matching the directory part of a file path. -* [is-unc-path](https://github.com/jonschlinkert/is-unc-path): Returns true if a filepath is a windows UNC file path. -* [is-glob](https://github.com/jonschlinkert/is-glob): Returns `true` if the given string looks like a glob pattern. -* [path-regex](https://github.com/regexps/path-regex): Regular expression for matching the parts of a file path. - -## Running tests - -Install dev dependencies: - -```sh -$ npm i -d && npm test -``` - -## Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/unc-path-regex/issues/new) - -## Author - -**Jon Schlinkert** - -+ [github/jonschlinkert](https://github.com/jonschlinkert) -+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) - -## License - -Copyright © 2015 Jon Schlinkert -Released under the MIT license. - -*** - -_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 07, 2015._ \ No newline at end of file diff --git a/node_modules/unc-path-regex/index.js b/node_modules/unc-path-regex/index.js deleted file mode 100644 index c268404..0000000 --- a/node_modules/unc-path-regex/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = function uncPathRegex() { - return /^[\\\/]{2,}[^\\\/]+[\\\/]+[^\\\/]+/; -}; diff --git a/node_modules/unc-path-regex/package.json b/node_modules/unc-path-regex/package.json deleted file mode 100644 index 3fba9de..0000000 --- a/node_modules/unc-path-regex/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "unc-path-regex", - "description": "Regular expression for testing if a file path is a windows UNC file path. Can also be used as a component of another regexp via the `.source` property.", - "version": "0.1.2", - "homepage": "https://github.com/regexhq/unc-path-regex", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "repository": { - "type" : "git", - "url": "https://github.com/regexhq/unc-path-regex.git" - }, - "bugs": { - "url": "https://github.com/regexhq/unc-path-regex/issues" - }, - "license": "MIT", - "files": [ - "index.js" - ], - "main": "index.js", - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "mocha": "*" - }, - "keywords": [ - "absolute", - "expression", - "file", - "filepath", - "match", - "matching", - "path", - "regex", - "regexp", - "regular", - "unc", - "win", - "windows" - ], - "verb": { - "related": { - "list": [ - "dotfile-regex", - "is-unc-path", - "unc-path-regex", - "dotdir-regex", - "path-regex", - "dirname-regex", - "is-glob" - ] - } - } -} diff --git a/node_modules/undertaker-registry/LICENSE b/node_modules/undertaker-registry/LICENSE deleted file mode 100644 index 811d061..0000000 --- a/node_modules/undertaker-registry/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015, 2017, 2021 Blaine Bublitz and Eric Schoffstall - -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/undertaker-registry/README.md b/node_modules/undertaker-registry/README.md deleted file mode 100644 index 0d3a823..0000000 --- a/node_modules/undertaker-registry/README.md +++ /dev/null @@ -1,217 +0,0 @@ -

- - - -

- -# undertaker-registry - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Default registry in gulp 4. - -## Usage - -```js -var gulp = require('gulp'); -var UndertakerRegistry = require('undertaker-registry'); - -var registry = new UndertakerRegistry(); - -gulp.registry(registry); -``` - -## API - -### new UndertakerRegistry([options]) - -Constructor for the default registry. Inherit from this constructor to build custom registries. - -### init(taker) - -No-op method that receives the undertaker instance. Useful to set pre-defined tasks using the -`undertaker.task(taskName, fn)` method. Custom registries can override this method when inheriting -from this default registry. - -### get(taskName) => Function - -Returns the task with that name or undefined if no task is registered with that name. Useful for custom -task storage. Custom registries can override this method when inheriting from this default registry. - -### set(taskName, fn) => [Function] - -Adds a task to the registry. If `set` modifies a task, it should return the new task so Undertaker can -properly maintain metadata for the task. Useful for adding custom behavior to every task as it is -registered in the system. Custom registries can override this method when inheriting from this default -registry. - -### tasks() => Object - -Returns an object listing all tasks in the registry. Necessary to override if the `get` method is overridden -for custom task storage. Custom registries can override this when when inheriting from this default -registry. - -## Custom Registries - -Custom registries are constructor functions allowing you to pre-define/share tasks -or add custom functionality to your registries. - -A registry's prototype should define: - -- `init(taker)`: receives the undertaker instance to set pre-defined tasks using the `task(taskName, fn)` method. -- `get(taskName)`: returns the task with that name - or `undefined` if no task is registered with that name. -- `set(taskName, fn)`: add task to the registry. If `set` modifies a task, it should return the new task. -- `tasks()`: returns an object listing all tasks in the registry. - -You should not call these functions yourself; leave that to Undertaker, so it can -keep its metadata consistent. - -The easiest way to create a custom registry is to inherit from -[undertaker-registry](https://www.npmjs.com/package/undertaker-registry): - -```javascript -var util = require('util'); - -var DefaultRegistry = require('undertaker-registry'); - -function MyRegistry() { - DefaultRegistry.call(this); -} - -util.inherits(MyRegistry, DefaultRegistry); - -module.exports = MyRegistry; -``` - -### Sharing tasks - -To share common tasks with all your projects, you can expose an `init` method on the registry -prototype and it will receive the Undertaker instance as the only argument. You can then use -`undertaker.task(name, fn)` to register pre-defined tasks. - -For example you might want to share a `clean` task: - -```javascript -var fs = require('fs'); -var util = require('util'); - -var DefaultRegistry = require('undertaker-registry'); -var del = require('del'); - -function CommonRegistry(opts) { - DefaultRegistry.call(this); - - opts = opts || {}; - - this.buildDir = opts.buildDir || './build'; -} - -util.inherits(CommonRegistry, DefaultRegistry); - -CommonRegistry.prototype.init = function (takerInst) { - var buildDir = this.buildDir; - var exists = fs.existsSync(buildDir); - - if (exists) { - throw new Error( - 'Cannot initialize common tasks. ' + buildDir + ' directory exists.' - ); - } - - takerInst.task('clean', function () { - return del([buildDir]); - }); -}; - -module.exports = CommonRegistry; -``` - -Then to use it in a project: - -```javascript -var Undertaker = require('undertaker'); -var CommonRegistry = require('myorg-common-tasks'); - -var taker = new Undertaker(CommonRegistry({ buildDir: '/dist' })); - -taker.task( - 'build', - taker.series('clean', function build(cb) { - // do things - cb(); - }) -); -``` - -### Sharing Functionalities - -By controlling how tasks are added to the registry, you can decorate them. - -For example if you wanted all tasks to share some data, you can use a custom registry -to bind them to that data. Be sure to return the altered task, as per the description -of registry methods above: - -```javascript -var util = require('util'); - -var Undertaker = require('undertaker'); -var DefaultRegistry = require('undertaker-registry'); - -// Some task defined somewhere else -var BuildRegistry = require('./build.js'); -var ServeRegistry = require('./serve.js'); - -function ConfigRegistry(config) { - DefaultRegistry.call(this); - this.config = config; -} - -util.inherits(ConfigRegistry, DefaultRegistry); - -ConfigRegistry.prototype.set = function set(name, fn) { - // The `DefaultRegistry` uses `this._tasks` for storage. - var task = (this._tasks[name] = fn.bind(this.config)); - return task; -}; - -var taker = new Undertaker(); - -taker.registry(new BuildRegistry()); -taker.registry(new ServeRegistry()); - -// `taker.registry` will reset each task in the registry with -// `ConfigRegistry.prototype.set` which will bind them to the config object. -taker.registry( - new ConfigRegistry({ - src: './src', - build: './build', - bindTo: '0.0.0.0:8888', - }) -); - -taker.task( - 'default', - taker.series('clean', 'build', 'serve', function (cb) { - console.log('Server bind to ' + this.bindTo); - console.log('Serving' + this.build); - cb(); - }) -); -``` - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/undertaker-registry.svg?style=flat-square -[npm-url]: https://npmjs.org/package/undertaker-registry -[npm-image]: https://img.shields.io/npm/v/undertaker-registry.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/undertaker-registry/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/undertaker-registry/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/undertaker-registry -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/undertaker-registry/master.svg?style=flat-square - diff --git a/node_modules/undertaker-registry/index.js b/node_modules/undertaker-registry/index.js deleted file mode 100644 index aec5b85..0000000 --- a/node_modules/undertaker-registry/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -function DefaultRegistry() { - if (this instanceof DefaultRegistry === false) { - return new DefaultRegistry(); - } - - this._tasks = {}; -} - -/* eslint no-unused-vars: 0 */ -DefaultRegistry.prototype.init = function init(taker) {}; - -DefaultRegistry.prototype.get = function get(name) { - return this._tasks[name]; -}; - -DefaultRegistry.prototype.set = function set(name, fn) { - return (this._tasks[name] = fn); -}; - -DefaultRegistry.prototype.tasks = function tasks() { - var self = this; - - return Object.keys(this._tasks).reduce(function (tasks, name) { - tasks[name] = self.get(name); - return tasks; - }, {}); -}; - -module.exports = DefaultRegistry; diff --git a/node_modules/undertaker-registry/package.json b/node_modules/undertaker-registry/package.json deleted file mode 100644 index 977aa66..0000000 --- a/node_modules/undertaker-registry/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "undertaker-registry", - "version": "2.0.0", - "description": "Default registry in gulp 4.", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/undertaker-registry", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.3.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "registry", - "tasks", - "undertaker", - "gulp" - ] -} diff --git a/node_modules/undertaker/LICENSE b/node_modules/undertaker/LICENSE deleted file mode 100644 index 4e03626..0000000 --- a/node_modules/undertaker/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014, 2016-2020, 2022 Blaine Bublitz and Eric Schoffstall . - -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/undertaker/README.md b/node_modules/undertaker/README.md deleted file mode 100644 index d263700..0000000 --- a/node_modules/undertaker/README.md +++ /dev/null @@ -1,319 +0,0 @@ -

- - - -

- -# undertaker - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Task registry that allows composition through series/parallel methods. - -## Usage - -```js -var fs = require('fs'); -var Undertaker = require('undertaker'); - -var taker = new Undertaker(); - -taker.task('task1', function(cb){ - // do things - - cb(); // when everything is done -}); - -taker.task('task2', function(){ - return fs.createReadStream('./myFile.js') - .pipe(fs.createWriteStream('./myFile.copy.js')); -}); - -taker.task('task3', function(){ - return new Promise(function(resolve, reject){ - // do things - - resolve(); // when everything is done - }); -}); - -taker.task('combined', taker.series('task1', 'task2')); - -taker.task('all', taker.parallel('combined', 'task3')); -``` - -## API - -__Task functions can be completed in any of the ways supported by -[`async-done`][async-resolution]__ - -### `new Undertaker([registryInstance])` - -The constructor is used to create a new instance of `Undertaker`. Each instance of -`Undertaker` gets its own instance of a registry. By default, the registry is an -instance of [`undertaker-registry`][undertaker-registry] -but it can be an instance of any other registry that follows the [Custom Registries API][custom-registries]. - -To use a custom registry, pass a custom registry instance (`new CustomRegistry([options])`) when -instantiating a new `Undertaker` instance. This will use the custom registry instance for that `Undertaker` instance. - -### `task([taskName,] fn)` - -Both a `getter` and `setter` for tasks. - -If a string (`taskName`) is given as the only argument, it behaves as a `getter` -and returns the wrapped task (not the original function). The wrapped task has a `unwrap` -method that will return the original function. - -If a function (`fn`) and optionally a string (`taskName`) is given, it behaves as -a `setter` and will register the task by the `taskName`. If `taskName` is not -specified, the `name` or `displayName` property of the function is used as the `taskName`. - -Will throw if: - -* As a `getter`: `taskName` is missing or not a string. -* As a `setter`: `taskName` is missing and `fn` is anonymous. -* As a `setter`: `fn` is missing or not a function. - -### `series(taskName || fn...)` - -Takes a variable amount of strings (`taskName`) and/or functions (`fn`) and -returns a function of the composed tasks or functions. Any `taskNames` are -retrieved from the registry using the `get` method. - -When the returned function is executed, the tasks or functions will be executed -in series, each waiting for the prior to finish. If an error occurs, execution -will stop. - -### `parallel(taskName || fn...)` - -Takes a variable amount of strings (`taskName`) and/or functions (`fn`) and -returns a function of the composed tasks or functions. Any `taskNames` are -retrieved from the registry using the `get` method. - -When the returned function is executed, the tasks or functions will be executed -in parallel, all being executed at the same time. If an error occurs, all execution -will complete. - -### `registry([registryInstance])` - -Optionally takes an instantiated registry object. If no arguments are passed, returns -the current registry object. If an instance of a registry (`customRegistry`) is passed -the tasks from the current registry will be transferred to it and the current registry -will be replaced with the new registry. - -The ability to assign new registries will allow you to pre-define/share tasks or add -custom functionality to your registries. See [Custom Registries][custom-registries] -for more information. - -### `tree([options])` - -Optionally takes an `options` object and returns an object representing the -tree of registered tasks. The object returned is [`archy`][archy] -compatible. Also, each node has a `type` property that can be used to determine if the node is a `task` or `function`. - -#### `options` - -##### `options.deep` - -Whether or not the whole tree should be returned. - -Type: `Boolean` - -Default: `false` - -### `lastRun(task, [precision])` - -Takes a string or function (`task`) and returns a timestamp of the last time the task -was run successfully. The time will be the time the task started. - -Returns `undefined` if the task has not been run. - -If a task errors, the result of `lastRun` will be undefined because the task -should probably be re-run from scratch to get into a good state again. - -The timestamp is always given in millisecond but the time resolution can be -rounded using the `precision` parameter. The use case is to be able to compare a build time -to a file time attribute. - -Assuming `undertakerInst.lastRun('someTask')` returns `1426000001111`, -`undertakerInst.lastRun('someTask', 1000)` returns `1426000001000`. - -The default time resolution is `1`. - -## Custom Registries - -Custom registries are constructor functions allowing you to pre-define/share tasks -or add custom functionality to your registries. - -A registry's prototype should define: - -- `init(taker)`: receives the undertaker instance to set pre-defined tasks using the `task(taskName, fn)` method. -- `get(taskName)`: returns the task with that name - or `undefined` if no task is registered with that name. -- `set(taskName, fn)`: add task to the registry. If `set` modifies a task, it should return the new task. -- `tasks()`: returns an object listing all tasks in the registry. - -You should not call these functions yourself; leave that to Undertaker, so it can -keep its metadata consistent. - -The easiest way to create a custom registry is to inherit from [undertaker-registry]: - -```js -var util = require('util'); - -var DefaultRegistry = require('undertaker-registry'); - -function MyRegistry(){ - DefaultRegistry.call(this); -} - -util.inherits(MyRegistry, DefaultRegistry); - -module.exports = MyRegistry; -``` - -### Sharing tasks - -To share common tasks with all your projects, you can expose an `init` method on the registry -prototype and it will receive the `Undertaker` instance as the only argument. You can then use -`undertaker.task(name, fn)` to register pre-defined tasks. - -For example you might want to share a `clean` task: - -```js -var fs = require('fs'); -var util = require('util'); - -var DefaultRegistry = require('undertaker-registry'); -var del = require('del'); - -function CommonRegistry(opts){ - DefaultRegistry.call(this); - - opts = opts || {}; - - this.buildDir = opts.buildDir || './build'; -} - -util.inherits(CommonRegistry, DefaultRegistry); - -CommonRegistry.prototype.init = function(takerInst){ - var buildDir = this.buildDir; - var exists = fs.existsSync(buildDir); - - if(exists){ - throw new Error('Cannot initialize common tasks. ' + buildDir + ' directory exists.'); - } - - takerInst.task('clean', function(){ - return del([buildDir]); - }); -} - -module.exports = CommonRegistry; -``` - -Then to use it in a project: -```js -var Undertaker = require('undertaker'); -var CommonRegistry = require('myorg-common-tasks'); - -var taker = new Undertaker(CommonRegistry({ buildDir: '/dist' })); - -taker.task('build', taker.series('clean', function build(cb) { - // do things - cb(); -})); -``` - -### Sharing Functionalities - -By controlling how tasks are added to the registry, you can decorate them. - -For example if you wanted all tasks to share some data, you can use a custom registry -to bind them to that data. Be sure to return the altered task, as per the description -of registry methods above: - -```js -var util = require('util'); - -var Undertaker = require('undertaker'); -var DefaultRegistry = require('undertaker-registry'); - -// Some task defined somewhere else -var BuildRegistry = require('./build.js'); -var ServeRegistry = require('./serve.js'); - -function ConfigRegistry(config){ - DefaultRegistry.call(this); - this.config = config; -} - -util.inherits(ConfigRegistry, DefaultRegistry); - -ConfigRegistry.prototype.set = function set(name, fn) { - // The `DefaultRegistry` uses `this._tasks` for storage. - var task = this._tasks[name] = fn.bind(this.config); - return task; -}; - -var taker = new Undertaker(); - -taker.registry(new BuildRegistry()); -taker.registry(new ServeRegistry()); - -// `taker.registry` will reset each task in the registry with -// `ConfigRegistry.prototype.set` which will bind them to the config object. -taker.registry(new ConfigRegistry({ - src: './src', - build: './build', - bindTo: '0.0.0.0:8888' -})); - -taker.task('default', taker.series('clean', 'build', 'serve', function(cb) { - console.log('Server bind to ' + this.bindTo); - console.log('Serving' + this.build); - cb(); -})); -``` - -### In the wild - -* [undertaker-registry] - Custom registries probably want to inherit from this. -* [undertaker-forward-reference] - Custom registry supporting forward referenced tasks (similar to gulp 3.x). -* [undertaker-task-metadata] - Proof-of-concept custom registry that attaches metadata to each task. -* [undertaker-common-tasks] - Proof-of-concept custom registry that pre-defines some tasks. -* [alchemist-gulp] - A default set of tasks for building alchemist plugins. -* [gulp-hub] - Custom registry to run tasks in multiple gulpfiles. (In a branch as of this writing) -* [gulp-pipeline] - [RailsRegistry][rails-registry] is an ES2015 class that provides a gulp pipeline replacement for rails applications - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/undertaker.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/undertaker -[npm-image]: https://img.shields.io/npm/v/undertaker.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/undertaker/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/undertaker/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/undertaker -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/undertaker/master.svg?style=flat-square - - - -[async-resolution]: https://github.com/phated/async-done#completion-and-error-resolution -[undertaker-registry]: https://github.com/gulpjs/undertaker-registry -[custom-registries]: #custom-registries -[archy]: https://www.npmjs.org/package/archy -[undertaker-forward-reference]: https://github.com/gulpjs/undertaker-forward-reference -[undertaker-task-metadata]: https://github.com/gulpjs/undertaker-task-metadata -[undertaker-common-tasks]: https://github.com/gulpjs/undertaker-common-tasks -[alchemist-gulp]: https://github.com/webdesserts/alchemist-gulp -[gulp-hub]: https://github.com/frankwallis/gulp-hub/tree/registry-init -[gulp-pipeline]: https://github.com/alienfast/gulp-pipeline -[rails-registry]: https://github.com/alienfast/gulp-pipeline/blob/master/src/registry/railsRegistry.js - diff --git a/node_modules/undertaker/index.js b/node_modules/undertaker/index.js deleted file mode 100644 index 3863fea..0000000 --- a/node_modules/undertaker/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -var inherits = require('util').inherits; -var EventEmitter = require('events').EventEmitter; - -var DefaultRegistry = require('undertaker-registry'); - -var tree = require('./lib/tree'); -var task = require('./lib/task'); -var series = require('./lib/series'); -var lastRun = require('./lib/last-run'); -var parallel = require('./lib/parallel'); -var registry = require('./lib/registry'); -var _getTask = require('./lib/get-task'); -var _setTask = require('./lib/set-task'); - -function Undertaker(customRegistry) { - EventEmitter.call(this); - - this._registry = new DefaultRegistry(); - if (customRegistry) { - this.registry(customRegistry); - } - - this._settle = (process.env.UNDERTAKER_SETTLE === 'true'); -} - -inherits(Undertaker, EventEmitter); - - -Undertaker.prototype.tree = tree; - -Undertaker.prototype.task = task; - -Undertaker.prototype.series = series; - -Undertaker.prototype.lastRun = lastRun; - -Undertaker.prototype.parallel = parallel; - -Undertaker.prototype.registry = registry; - -Undertaker.prototype._getTask = _getTask; - -Undertaker.prototype._setTask = _setTask; - -module.exports = Undertaker; diff --git a/node_modules/undertaker/lib/get-task.js b/node_modules/undertaker/lib/get-task.js deleted file mode 100644 index 14ced1e..0000000 --- a/node_modules/undertaker/lib/get-task.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -function get(name) { - return this._registry.get(name); -} - -module.exports = get; diff --git a/node_modules/undertaker/lib/helpers/buildTree.js b/node_modules/undertaker/lib/helpers/buildTree.js deleted file mode 100644 index 001bac9..0000000 --- a/node_modules/undertaker/lib/helpers/buildTree.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var metadata = require('./metadata'); - -function buildTree(tasks) { - return Object.values(tasks).map(function(task) { - var meta = metadata.get(task); - if (meta) { - return meta.tree; - } - - var name = task.displayName || task.name || ''; - meta = { - name: name, - tree: { - label: name, - type: 'function', - nodes: [], - }, - }; - - metadata.set(task, meta); - return meta.tree; - }); -} - -module.exports = buildTree; diff --git a/node_modules/undertaker/lib/helpers/createExtensions.js b/node_modules/undertaker/lib/helpers/createExtensions.js deleted file mode 100644 index 6dd362f..0000000 --- a/node_modules/undertaker/lib/helpers/createExtensions.js +++ /dev/null @@ -1,73 +0,0 @@ -'use strict'; - -var captureLastRun = require('last-run').capture; -var releaseLastRun = require('last-run').release; - -var metadata = require('./metadata'); - -var uid = 0; - -function Storage(fn) { - var meta = metadata.get(fn); - - this.fn = meta.orig || fn; - this.uid = uid++; - this.name = meta.name; - this.branch = meta.branch || false; - this.captureTime = Date.now(); - this.startHr = []; -} - -Storage.prototype.capture = function() { - captureLastRun(this.fn, this.captureTime); -}; - -Storage.prototype.release = function() { - releaseLastRun(this.fn); -}; - -function createExtensions(ee) { - return { - create: function(fn) { - return new Storage(fn); - }, - before: function(storage) { - storage.startHr = process.hrtime(); - ee.emit('start', { - uid: storage.uid, - name: storage.name, - branch: storage.branch, - time: Date.now(), - }); - }, - after: function(result, storage) { - if (result && result.state === 'error') { - return this.error(result.value, storage); - } - storage.capture(); - ee.emit('stop', { - uid: storage.uid, - name: storage.name, - branch: storage.branch, - duration: process.hrtime(storage.startHr), - time: Date.now(), - }); - }, - error: function(error, storage) { - if (Array.isArray(error)) { - error = error[0]; - } - storage.release(); - ee.emit('error', { - uid: storage.uid, - name: storage.name, - branch: storage.branch, - error: error, - duration: process.hrtime(storage.startHr), - time: Date.now(), - }); - }, - }; -} - -module.exports = createExtensions; diff --git a/node_modules/undertaker/lib/helpers/metadata.js b/node_modules/undertaker/lib/helpers/metadata.js deleted file mode 100644 index b27378e..0000000 --- a/node_modules/undertaker/lib/helpers/metadata.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var metadata = new WeakMap(); - -module.exports = metadata; diff --git a/node_modules/undertaker/lib/helpers/normalizeArgs.js b/node_modules/undertaker/lib/helpers/normalizeArgs.js deleted file mode 100644 index 475ca51..0000000 --- a/node_modules/undertaker/lib/helpers/normalizeArgs.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -var assert = require('assert'); - -var levenshtein = require('fast-levenshtein'); - -function normalizeArgs(registry, args) { - function getFunction(task) { - if (typeof task === 'function') { - return task; - } - - var fn = registry.get(task); - if (!fn) { - var similar = similarTasks(registry, task); - var err; - if (similar.length > 0) { - err = new Error('Task never defined: ' + task + ' - did you mean? ' + similar.join(', ')); - err.task = task; - err.similar = similar; - } else { - err = new Error('Task never defined: ' + task); - err.task = task; - } - throw err; - } - return fn; - } - - var flattenArgs = Array.prototype.concat.apply([], args); - assert(flattenArgs.length, 'One or more tasks should be combined using series or parallel'); - - return flattenArgs.map(getFunction); -} - -function similarTasks(registry, queryTask) { - if (typeof queryTask !== 'string') { - return []; - } - - var tasks = registry.tasks(); - var similarTasks = []; - for (var task in tasks) { - if (Object.prototype.hasOwnProperty.call(tasks, task)) { - var distance = levenshtein.get(task, queryTask); - var allowedDistance = Math.floor(0.4 * task.length) + 1; - if (distance < allowedDistance) { - similarTasks.push(task); - } - } - } - return similarTasks; -} - -module.exports = normalizeArgs; diff --git a/node_modules/undertaker/lib/helpers/validateRegistry.js b/node_modules/undertaker/lib/helpers/validateRegistry.js deleted file mode 100644 index 948e3c3..0000000 --- a/node_modules/undertaker/lib/helpers/validateRegistry.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -var assert = require('assert'); - -function isFunction(fn) { - return typeof fn === 'function'; -} - -function isConstructor(registry) { - if (!(registry && registry.prototype)) { - return false; - } - - var hasProtoGet = isFunction(registry.prototype.get); - var hasProtoSet = isFunction(registry.prototype.set); - var hasProtoInit = isFunction(registry.prototype.init); - var hasProtoTasks = isFunction(registry.prototype.tasks); - - if (hasProtoGet || hasProtoSet || hasProtoInit || hasProtoTasks) { - return true; - } - - return false; -} - -function validateRegistry(registry) { - try { - assert(isFunction(registry.get), 'Custom registry must have `get` function'); - assert(isFunction(registry.set), 'Custom registry must have `set` function'); - assert(isFunction(registry.init), 'Custom registry must have `init` function'); - assert(isFunction(registry.tasks), 'Custom registry must have `tasks` function'); - } catch (err) { - if (isConstructor(registry)) { - assert(false, 'Custom registries must be instantiated, but it looks like you passed a constructor'); - } else { - throw err; - } - } -} - -module.exports = validateRegistry; diff --git a/node_modules/undertaker/lib/last-run.js b/node_modules/undertaker/lib/last-run.js deleted file mode 100644 index db50768..0000000 --- a/node_modules/undertaker/lib/last-run.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var retrieveLastRun = require('last-run'); - -var metadata = require('./helpers/metadata'); - -function lastRun(task, timeResolution) { - var fn = task; - if (typeof task === 'string') { - fn = this._getTask(task); - } - - var meta = metadata.get(fn); - - if (meta) { - fn = meta.orig || fn; - } - - return retrieveLastRun(fn, timeResolution); -} - -module.exports = lastRun; diff --git a/node_modules/undertaker/lib/parallel.js b/node_modules/undertaker/lib/parallel.js deleted file mode 100644 index b19ef38..0000000 --- a/node_modules/undertaker/lib/parallel.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -var bach = require('bach'); - -var metadata = require('./helpers/metadata'); -var buildTree = require('./helpers/buildTree'); -var normalizeArgs = require('./helpers/normalizeArgs'); -var createExtensions = require('./helpers/createExtensions'); - -function parallel() { - var create = this._settle ? bach.settleParallel : bach.parallel; - - var args = normalizeArgs(this._registry, arguments); - var extensions = createExtensions(this); - var fn = create(args, extensions); - var name = ''; - - metadata.set(fn, { - name: name, - branch: true, - tree: { - label: name, - type: 'function', - branch: true, - nodes: buildTree(args), - }, - }); - return fn; -} - -module.exports = parallel; diff --git a/node_modules/undertaker/lib/registry.js b/node_modules/undertaker/lib/registry.js deleted file mode 100644 index 49264fb..0000000 --- a/node_modules/undertaker/lib/registry.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -var validateRegistry = require('./helpers/validateRegistry'); - -function setTasks(registry, nameAndTask) { - var name = nameAndTask[0]; - var task = nameAndTask[1]; - registry.set(name, task); - return registry; -} - -function registry(newRegistry) { - if (!newRegistry) { - return this._registry; - } - - validateRegistry(newRegistry); - - var tasks = this._registry.tasks(); - - this._registry = Object.entries(tasks).reduce(setTasks, newRegistry); - this._registry.init(this); -} - -module.exports = registry; diff --git a/node_modules/undertaker/lib/series.js b/node_modules/undertaker/lib/series.js deleted file mode 100644 index 50f8faa..0000000 --- a/node_modules/undertaker/lib/series.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -var bach = require('bach'); - -var metadata = require('./helpers/metadata'); -var buildTree = require('./helpers/buildTree'); -var normalizeArgs = require('./helpers/normalizeArgs'); -var createExtensions = require('./helpers/createExtensions'); - -function series() { - var create = this._settle ? bach.settleSeries : bach.series; - - var args = normalizeArgs(this._registry, arguments); - var extensions = createExtensions(this); - var fn = create(args, extensions); - var name = ''; - - metadata.set(fn, { - name: name, - branch: true, - tree: { - label: name, - type: 'function', - branch: true, - nodes: buildTree(args), - }, - }); - return fn; -} - -module.exports = series; diff --git a/node_modules/undertaker/lib/set-task.js b/node_modules/undertaker/lib/set-task.js deleted file mode 100644 index b76307d..0000000 --- a/node_modules/undertaker/lib/set-task.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var assert = require('assert'); - -var metadata = require('./helpers/metadata'); - -function set(name, fn) { - assert(name, 'Task name must be specified'); - assert(typeof name === 'string', 'Task name must be a string'); - assert(typeof fn === 'function', 'Task function must be specified'); - - function taskWrapper() { - return fn.apply(this, arguments); - } - - function unwrap() { - return fn; - } - - taskWrapper.unwrap = unwrap; - taskWrapper.displayName = name; - - var meta = metadata.get(fn) || {}; - var nodes = []; - if (meta.branch) { - nodes.push(meta.tree); - } - - var task = this._registry.set(name, taskWrapper) || taskWrapper; - - metadata.set(task, { - name: name, - orig: fn, - tree: { - label: name, - type: 'task', - nodes: nodes, - }, - }); -} - -module.exports = set; diff --git a/node_modules/undertaker/lib/task.js b/node_modules/undertaker/lib/task.js deleted file mode 100644 index 9e5046f..0000000 --- a/node_modules/undertaker/lib/task.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -function task(name, fn) { - if (typeof name === 'function') { - fn = name; - name = fn.displayName || fn.name; - } - - if (!fn) { - return this._getTask(name); - } - - this._setTask(name, fn); -} - -module.exports = task; diff --git a/node_modules/undertaker/lib/tree.js b/node_modules/undertaker/lib/tree.js deleted file mode 100644 index 171a17e..0000000 --- a/node_modules/undertaker/lib/tree.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -var metadata = require('./helpers/metadata'); - -function tree(opts) { - opts = Object.assign({ deep: false }, opts); - - var tasks = this._registry.tasks(); - var nodes = Object.values(tasks).map(function(task) { - var meta = metadata.get(task); - - if (opts.deep) { - return meta.tree; - } - - return meta.tree.label; - }); - - return { - label: 'Tasks', - nodes: nodes, - }; -} - -module.exports = tree; diff --git a/node_modules/undertaker/node_modules/fast-levenshtein/LICENSE.md b/node_modules/undertaker/node_modules/fast-levenshtein/LICENSE.md deleted file mode 100644 index 6212406..0000000 --- a/node_modules/undertaker/node_modules/fast-levenshtein/LICENSE.md +++ /dev/null @@ -1,25 +0,0 @@ -(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/undertaker/node_modules/fast-levenshtein/README.md b/node_modules/undertaker/node_modules/fast-levenshtein/README.md deleted file mode 100644 index 884f17f..0000000 --- a/node_modules/undertaker/node_modules/fast-levenshtein/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# 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) - -A Javascript implementation of the [Levenshtein algorithm](http://en.wikipedia.org/wiki/Levenshtein_distance) with locale-specific collator support. This uses [fastest-levenshtein](https://github.com/ka-weihe/fastest-levenshtein) under the hood. - -## Features - -* Works in node.js and in the browser. -* Locale-sensitive string comparisons if needed. -* Comprehensive test suite. - -## Installation - -```bash -$ npm install fast-levenshtein -``` -**CDN** - -The latest version is now also always available at https://npm-cdn.com/pkg/fast-levenshtein/ - -## 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 - -This uses [fastest-levenshtein](https://github.com/ka-weihe/fastest-levenshtein) under the hood. - -## 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/undertaker/node_modules/fast-levenshtein/levenshtein.js b/node_modules/undertaker/node_modules/fast-levenshtein/levenshtein.js deleted file mode 100644 index 1ec086d..0000000 --- a/node_modules/undertaker/node_modules/fast-levenshtein/levenshtein.js +++ /dev/null @@ -1,107 +0,0 @@ -(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"); - } - - var levenshtein = require('fastest-levenshtein'); - - // 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); - - if (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; - } - return nextCol; - } - return levenshtein.distance(str1, str2); - } - - }; - - // 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/undertaker/node_modules/fast-levenshtein/package.json b/node_modules/undertaker/node_modules/fast-levenshtein/package.json deleted file mode 100644 index e750a2c..0000000 --- a/node_modules/undertaker/node_modules/fast-levenshtein/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "fast-levenshtein", - "version": "3.0.0", - "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", - "dependencies": { - "fastest-levenshtein": "^1.0.7" - } -} diff --git a/node_modules/undertaker/package.json b/node_modules/undertaker/package.json deleted file mode 100644 index 752d1b6..0000000 --- a/node_modules/undertaker/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "undertaker", - "version": "2.0.0", - "description": "Task registry that allows composition through series/parallel methods.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz ", - "Damien Lebrun " - ], - "repository": "gulpjs/undertaker", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js", - "lib" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "bach": "^2.0.1", - "fast-levenshtein": "^3.0.0", - "last-run": "^2.0.0", - "undertaker-registry": "^2.0.0" - }, - "devDependencies": { - "async-once": "^2.0.0", - "del": "^6.1.1", - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.5.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "once": "^1.4.0", - "through2": "^4.0.2", - "undertaker-common-tasks": "^2.0.0", - "undertaker-task-metadata": "^2.0.0", - "vinyl-fs": "^4.0.0" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "registry", - "runner", - "task" - ] -} diff --git a/node_modules/uri-js/LICENSE b/node_modules/uri-js/LICENSE deleted file mode 100755 index 9338bde..0000000 --- a/node_modules/uri-js/LICENSE +++ /dev/null @@ -1,11 +0,0 @@ -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 deleted file mode 100755 index 43e648b..0000000 --- a/node_modules/uri-js/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# 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 deleted file mode 100755 index da51e23..0000000 --- a/node_modules/uri-js/dist/es5/uri.all.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100755 index 0706116..0000000 --- a/node_modules/uri-js/dist/es5/uri.all.js +++ /dev/null @@ -1,1443 +0,0 @@ -/** @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 deleted file mode 100755 index 5b30c4e..0000000 --- a/node_modules/uri-js/dist/es5/uri.all.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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$","IPV6ADDRESS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O,gBAAgBX,aAAtB;YACMC,MAAMD,cAAcC,GAA1B;sBACcW,IAAd,IAAwBC,OAAOT,QAAQS,GAAvC,UAA8CZ,GAA9C;eAEOU,aAAP;;CA1CF,CA8CA;;AD5DA,IAAMH,OAAO,0DAAb;AACA,AAEA;AACA,IAAME,YAAsE;YAClE,UADkE;WAGnE,eAAUV,aAAV,EAAuCI,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 deleted file mode 100755 index da51e23..0000000 --- a/node_modules/uri-js/dist/es5/uri.all.min.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100755 index fcd8458..0000000 --- a/node_modules/uri-js/dist/es5/uri.all.min.js +++ /dev/null @@ -1,3 +0,0 @@ -/** @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 deleted file mode 100755 index f6be760..0000000 --- a/node_modules/uri-js/dist/esnext/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./uri"; diff --git a/node_modules/uri-js/dist/esnext/index.js b/node_modules/uri-js/dist/esnext/index.js deleted file mode 100755 index e3531b5..0000000 --- a/node_modules/uri-js/dist/esnext/index.js +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100755 index 0971f6e..0000000 --- a/node_modules/uri-js/dist/esnext/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100755 index c91cdac..0000000 --- a/node_modules/uri-js/dist/esnext/regexps-iri.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100755 index 34e7de9..0000000 --- a/node_modules/uri-js/dist/esnext/regexps-iri.js +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100755 index 2269c58..0000000 --- a/node_modules/uri-js/dist/esnext/regexps-iri.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100755 index 6096bda..0000000 --- a/node_modules/uri-js/dist/esnext/regexps-uri.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100755 index 1cc659f..0000000 --- a/node_modules/uri-js/dist/esnext/regexps-uri.js +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100755 index cb028b8..0000000 --- a/node_modules/uri-js/dist/esnext/regexps-uri.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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,GAA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EAAG,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,YAAY,EAAE,YAAY,CAAC,EAAE,GAAG,CAAC;QAClE,UAAU,EAAG,IAAI,MAAM,CAAC,YAAY,EAAE,GAAG,CAAC;QAC1C,WAAW,EAAG,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC;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 deleted file mode 100755 index fe5b2f3..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/http.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100755 index 6abf0fe..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/http.js +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100755 index 8211897..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/http.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100755 index fe5b2f3..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/https.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100755 index ec4b6e7..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/https.js +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100755 index 385b8ef..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/https.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100755 index e2aefc2..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/mailto.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100755 index 2553713..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/mailto.js +++ /dev/null @@ -1,148 +0,0 @@ -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 deleted file mode 100755 index 82dba9a..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/mailto.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAa9D,MAAM,CAAC,GAAiB,EAAE,CAAC;AAC3B,MAAM,KAAK,GAAG,IAAI,CAAC;AAEnB,UAAU;AACV,MAAM,YAAY,GAAG,wBAAwB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,2EAA2E,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AACjJ,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAE,kBAAkB;AACnD,MAAM,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,CAAC,CAAE,UAAU;AAE7O,qEAAqE;AACrE,yFAAyF;AACzF,+BAA+B;AAC/B,uGAAuG;AACvG,+GAA+G;AAC/G,kCAAkC;AAClC,+BAA+B;AAC/B,wGAAwG;AACxG,8EAA8E;AAC9E,8FAA8F;AAC9F,mGAAmG;AACnG,MAAM,OAAO,GAAG,uDAAuD,CAAC;AACxE,MAAM,OAAO,GAAG,4DAA4D,CAAC;AAC7E,MAAM,OAAO,GAAG,KAAK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ules/uri-js/dist/esnext/schemes/urn-uuid.d.ts b/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts deleted file mode 100755 index e75f2e7..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/urn-uuid.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index d1fce49..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100755 index 3b7a8b3..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/urn-uuid.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100755 index 7e0c2fb..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/urn.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100755 index 5d3f10a..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/urn.js +++ /dev/null @@ -1,49 +0,0 @@ -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 deleted file mode 100755 index ea43b0b..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/urn.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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,YAAY,GAAG,uBAAuB,CAAC;AAC7C,MAAM,OAAO,GAAG,mEAAmE,CAAC;AACpF,MAAM,IAAI,GAAG,QAAQ,GAAG,YAAY,GAAG,GAAG,GAAG,OAAO,GAAG,KAAK,CAAC;AAC7D,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACxD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AACjE,MAAM,SAAS,GAAG,iBAAiB,CAAC;AACpC,MAAM,YAAY,GAAG,iDAAiD,CAAC;AAEvE,UAAU;AACV,MAAM,OAAO,GAA8C;IAC1D,MAAM,EAAG,KAAK;IAEd,KAAK,EAAG,UAAU,UAAwB,EAAE,OAAkB;QAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QACpE,IAAI,aAAa,GAAG,UAA2B,CAAC;QAEhD,IAAI,OAAO,EAAE;YACZ,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,MAAM,IAAI,KAAK,CAAC;YAC/D,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YACvB,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;YACpD,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;YAEzC,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;YACxB,aAAa,CAAC,GAAG,GAAG,GAAG,CAAC;YACxB,aAAa,CAAC,IAAI,GAAG,SAAS,CAAC;YAE/B,IAAI,aAAa,EAAE;gBAClB,aAAa,GAAG,aAAa,CAAC,KAAK,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 deleted file mode 100755 index 47f4835..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/ws.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100755 index 9277f03..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/ws.js +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100755 index 186818c..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/ws.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ws.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,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3D,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC;SAChC;QAED,qCAAqC;QACrC,IAAI,YAAY,CAAC,YAAY,EAAE;YAC9B,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3D,YAAY,CAAC,IAAI,GAAG,CAAC,IAAI,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 deleted file mode 100755 index fe5b2f3..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/wss.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100755 index d1e22cc..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/wss.js +++ /dev/null @@ -1,9 +0,0 @@ -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 deleted file mode 100755 index e19006d..0000000 --- a/node_modules/uri-js/dist/esnext/schemes/wss.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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 deleted file mode 100755 index da51e23..0000000 --- a/node_modules/uri-js/dist/esnext/uri.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100755 index 659ce26..0000000 --- a/node_modules/uri-js/dist/esnext/uri.js +++ /dev/null @@ -1,480 +0,0 @@ -/** - * 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 deleted file mode 100755 index 2e72ab1..0000000 --- a/node_modules/uri-js/dist/esnext/uri.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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,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,CAAC;AAEF,MAAM,0BAA0B,GAAU,EAAE,OAAmB;IAC9D,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC;AAC1H,CAAC;AAAA,CAAC;AAEF,MAAM,4BAA4B,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 deleted file mode 100755 index 7c12857..0000000 --- a/node_modules/uri-js/dist/esnext/util.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -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 deleted file mode 100755 index 072711e..0000000 --- a/node_modules/uri-js/dist/esnext/util.js +++ /dev/null @@ -1,36 +0,0 @@ -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 deleted file mode 100755 index 05d9df0..0000000 --- a/node_modules/uri-js/dist/esnext/util.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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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-js/package.json b/node_modules/uri-js/package.json deleted file mode 100755 index de95d91..0000000 --- a/node_modules/uri-js/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "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 deleted file mode 100755 index 3c42ded..0000000 --- a/node_modules/uri-js/yarn.lock +++ /dev/null @@ -1,2558 +0,0 @@ -# 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/util-deprecate/History.md b/node_modules/util-deprecate/History.md deleted file mode 100644 index acc8675..0000000 --- a/node_modules/util-deprecate/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -1.0.2 / 2015-10-07 -================== - - * use try/catch when checking `localStorage` (#3, @kumavis) - -1.0.1 / 2014-11-25 -================== - - * browser: use `console.warn()` for deprecation calls - * browser: more jsdocs - -1.0.0 / 2014-04-30 -================== - - * initial commit diff --git a/node_modules/util-deprecate/LICENSE b/node_modules/util-deprecate/LICENSE deleted file mode 100644 index 6a60e8c..0000000 --- a/node_modules/util-deprecate/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -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/util-deprecate/README.md b/node_modules/util-deprecate/README.md deleted file mode 100644 index 75622fa..0000000 --- a/node_modules/util-deprecate/README.md +++ /dev/null @@ -1,53 +0,0 @@ -util-deprecate -============== -### The Node.js `util.deprecate()` function with browser support - -In Node.js, this module simply re-exports the `util.deprecate()` function. - -In the web browser (i.e. via browserify), a browser-specific implementation -of the `util.deprecate()` function is used. - - -## API - -A `deprecate()` function is the only thing exposed by this module. - -``` javascript -// setup: -exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); - - -// users see: -foo(); -// foo() is deprecated, use bar() instead -foo(); -foo(); -``` - - -## License - -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -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/util-deprecate/browser.js b/node_modules/util-deprecate/browser.js deleted file mode 100644 index 549ae2f..0000000 --- a/node_modules/util-deprecate/browser.js +++ /dev/null @@ -1,67 +0,0 @@ - -/** - * Module exports. - */ - -module.exports = deprecate; - -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ - -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -} - -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ - -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} diff --git a/node_modules/util-deprecate/node.js b/node_modules/util-deprecate/node.js deleted file mode 100644 index 5e6fcff..0000000 --- a/node_modules/util-deprecate/node.js +++ /dev/null @@ -1,6 +0,0 @@ - -/** - * For Node.js, simply re-export the core `util.deprecate` function. - */ - -module.exports = require('util').deprecate; diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json deleted file mode 100644 index 2e79f89..0000000 --- a/node_modules/util-deprecate/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "util-deprecate", - "version": "1.0.2", - "description": "The Node.js `util.deprecate()` function with browser support", - "main": "node.js", - "browser": "browser.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/util-deprecate.git" - }, - "keywords": [ - "util", - "deprecate", - "browserify", - "browser", - "node" - ], - "author": "Nathan Rajlich (http://n8.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/util-deprecate/issues" - }, - "homepage": "https://github.com/TooTallNate/util-deprecate" -} diff --git a/node_modules/util/LICENSE b/node_modules/util/LICENSE deleted file mode 100644 index e3d4e69..0000000 --- a/node_modules/util/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -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/util/README.md b/node_modules/util/README.md deleted file mode 100644 index faced97..0000000 --- a/node_modules/util/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# util [![Build Status](https://travis-ci.org/browserify/node-util.png?branch=master)](https://travis-ci.org/browserify/node-util) - -> Node.js's [util][util] module for all engines. - -This implements the Node.js [`util`][util] module for environments that do not have it, like browsers. - -## Install - -You usually do not have to install `util` yourself. If your code runs in Node.js, `util` is built in. If your code runs in the browser, bundlers like [browserify](https://github.com/browserify/browserify) or [webpack](https://github.com/webpack/webpack) (up to version 4 -- [see this documentation](https://webpack.js.org/configuration/resolve/#resolvefallback) for how to include polyfills like `util` in webpack 5+) also include the `util` module. - -But if none of those apply, with npm do: - -```shell -npm install util -``` - -## Usage - -```javascript -var util = require('util') -var EventEmitter = require('events') - -function MyClass() { EventEmitter.call(this) } -util.inherits(MyClass, EventEmitter) -``` - -## Browser Support - -The `util` module uses ES5 features. If you need to support very old browsers like IE8, use a shim like [`es5-shim`](https://www.npmjs.com/package/es5-shim). You need both the shim and the sham versions of `es5-shim`. - -To use `util.promisify` and `util.callbackify`, Promises must already be available. If you need to support browsers like IE11 that do not support Promises, use a shim. [es6-promise](https://github.com/stefanpenner/es6-promise) is a popular one but there are many others available on npm. - -## API - -See the [Node.js util docs][util]. `util` currently supports the Node 8 LTS API. However, some of the methods are outdated. The `inspect` and `format` methods included in this module are a lot more simple and barebones than the ones in Node.js. - -## Contributing - -PRs are very welcome! The main way to contribute to `util` is by porting features, bugfixes and tests from Node.js. Ideally, code contributions to this module are copy-pasted from Node.js and transpiled to ES5, rather than reimplemented from scratch. Matching the Node.js code as closely as possible makes maintenance simpler when new changes land in Node.js. -This module intends to provide exactly the same API as Node.js, so features that are not available in the core `util` module will not be accepted. Feature requests should instead be directed at [nodejs/node](https://github.com/nodejs/node) and will be added to this module once they are implemented in Node.js. - -If there is a difference in behaviour between Node.js's `util` module and this module, please open an issue! - -## License - -[MIT](./LICENSE) - -[util]: https://nodejs.org/docs/latest-v8.x/api/util.html diff --git a/node_modules/util/package.json b/node_modules/util/package.json deleted file mode 100644 index 2099ec0..0000000 --- a/node_modules/util/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "util", - "description": "Node.js's util module for all engines", - "version": "0.12.5", - "author": { - "name": "Joyent", - "url": "http://www.joyent.com" - }, - "browser": { - "./support/isBuffer.js": "./support/isBufferBrowser.js" - }, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - }, - "devDependencies": { - "airtap": "~1.0.0", - "core-js": "^3.6.5", - "is-async-supported": "~1.2.0", - "object.assign": "~4.1.0", - "object.entries": "^1.1.0", - "run-series": "~1.1.4", - "safe-buffer": "^5.1.2", - "tape": "~4.9.0" - }, - "files": [ - "util.js", - "support" - ], - "homepage": "https://github.com/browserify/node-util", - "keywords": [ - "util" - ], - "license": "MIT", - "main": "./util.js", - "repository": { - "type": "git", - "url": "git://github.com/browserify/node-util" - }, - "scripts": { - "test": "node test/node/index.js", - "test:browsers": "airtap test/browser/index.js", - "test:browsers:with-polyfills": "airtap test/browser/with-polyfills.js", - "test:browsers:with-polyfills:local": "npm run test:browsers:with-polyfills -- --local", - "test:browsers:local": "npm run test:browsers -- --local" - } -} diff --git a/node_modules/util/support/isBuffer.js b/node_modules/util/support/isBuffer.js deleted file mode 100644 index ace9ac0..0000000 --- a/node_modules/util/support/isBuffer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function isBuffer(arg) { - return arg instanceof Buffer; -} diff --git a/node_modules/util/support/isBufferBrowser.js b/node_modules/util/support/isBufferBrowser.js deleted file mode 100644 index 0e1bee1..0000000 --- a/node_modules/util/support/isBufferBrowser.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} \ No newline at end of file diff --git a/node_modules/util/support/types.js b/node_modules/util/support/types.js deleted file mode 100644 index 12e9db3..0000000 --- a/node_modules/util/support/types.js +++ /dev/null @@ -1,334 +0,0 @@ -// Currently in sync with Node.js lib/internal/util/types.js -// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 - -'use strict'; - -var isArgumentsObject = require('is-arguments'); -var isGeneratorFunction = require('is-generator-function'); -var whichTypedArray = require('which-typed-array'); -var isTypedArray = require('is-typed-array'); - -function uncurryThis(f) { - return f.call.bind(f); -} - -var BigIntSupported = typeof BigInt !== 'undefined'; -var SymbolSupported = typeof Symbol !== 'undefined'; - -var ObjectToString = uncurryThis(Object.prototype.toString); - -var numberValue = uncurryThis(Number.prototype.valueOf); -var stringValue = uncurryThis(String.prototype.valueOf); -var booleanValue = uncurryThis(Boolean.prototype.valueOf); - -if (BigIntSupported) { - var bigIntValue = uncurryThis(BigInt.prototype.valueOf); -} - -if (SymbolSupported) { - var symbolValue = uncurryThis(Symbol.prototype.valueOf); -} - -function checkBoxedPrimitive(value, prototypeValueOf) { - if (typeof value !== 'object') { - return false; - } - try { - prototypeValueOf(value); - return true; - } catch(e) { - return false; - } -} - -exports.isArgumentsObject = isArgumentsObject; -exports.isGeneratorFunction = isGeneratorFunction; -exports.isTypedArray = isTypedArray; - -// Taken from here and modified for better browser support -// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js -function isPromise(input) { - return ( - ( - typeof Promise !== 'undefined' && - input instanceof Promise - ) || - ( - input !== null && - typeof input === 'object' && - typeof input.then === 'function' && - typeof input.catch === 'function' - ) - ); -} -exports.isPromise = isPromise; - -function isArrayBufferView(value) { - if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { - return ArrayBuffer.isView(value); - } - - return ( - isTypedArray(value) || - isDataView(value) - ); -} -exports.isArrayBufferView = isArrayBufferView; - - -function isUint8Array(value) { - return whichTypedArray(value) === 'Uint8Array'; -} -exports.isUint8Array = isUint8Array; - -function isUint8ClampedArray(value) { - return whichTypedArray(value) === 'Uint8ClampedArray'; -} -exports.isUint8ClampedArray = isUint8ClampedArray; - -function isUint16Array(value) { - return whichTypedArray(value) === 'Uint16Array'; -} -exports.isUint16Array = isUint16Array; - -function isUint32Array(value) { - return whichTypedArray(value) === 'Uint32Array'; -} -exports.isUint32Array = isUint32Array; - -function isInt8Array(value) { - return whichTypedArray(value) === 'Int8Array'; -} -exports.isInt8Array = isInt8Array; - -function isInt16Array(value) { - return whichTypedArray(value) === 'Int16Array'; -} -exports.isInt16Array = isInt16Array; - -function isInt32Array(value) { - return whichTypedArray(value) === 'Int32Array'; -} -exports.isInt32Array = isInt32Array; - -function isFloat32Array(value) { - return whichTypedArray(value) === 'Float32Array'; -} -exports.isFloat32Array = isFloat32Array; - -function isFloat64Array(value) { - return whichTypedArray(value) === 'Float64Array'; -} -exports.isFloat64Array = isFloat64Array; - -function isBigInt64Array(value) { - return whichTypedArray(value) === 'BigInt64Array'; -} -exports.isBigInt64Array = isBigInt64Array; - -function isBigUint64Array(value) { - return whichTypedArray(value) === 'BigUint64Array'; -} -exports.isBigUint64Array = isBigUint64Array; - -function isMapToString(value) { - return ObjectToString(value) === '[object Map]'; -} -isMapToString.working = ( - typeof Map !== 'undefined' && - isMapToString(new Map()) -); - -function isMap(value) { - if (typeof Map === 'undefined') { - return false; - } - - return isMapToString.working - ? isMapToString(value) - : value instanceof Map; -} -exports.isMap = isMap; - -function isSetToString(value) { - return ObjectToString(value) === '[object Set]'; -} -isSetToString.working = ( - typeof Set !== 'undefined' && - isSetToString(new Set()) -); -function isSet(value) { - if (typeof Set === 'undefined') { - return false; - } - - return isSetToString.working - ? isSetToString(value) - : value instanceof Set; -} -exports.isSet = isSet; - -function isWeakMapToString(value) { - return ObjectToString(value) === '[object WeakMap]'; -} -isWeakMapToString.working = ( - typeof WeakMap !== 'undefined' && - isWeakMapToString(new WeakMap()) -); -function isWeakMap(value) { - if (typeof WeakMap === 'undefined') { - return false; - } - - return isWeakMapToString.working - ? isWeakMapToString(value) - : value instanceof WeakMap; -} -exports.isWeakMap = isWeakMap; - -function isWeakSetToString(value) { - return ObjectToString(value) === '[object WeakSet]'; -} -isWeakSetToString.working = ( - typeof WeakSet !== 'undefined' && - isWeakSetToString(new WeakSet()) -); -function isWeakSet(value) { - return isWeakSetToString(value); -} -exports.isWeakSet = isWeakSet; - -function isArrayBufferToString(value) { - return ObjectToString(value) === '[object ArrayBuffer]'; -} -isArrayBufferToString.working = ( - typeof ArrayBuffer !== 'undefined' && - isArrayBufferToString(new ArrayBuffer()) -); -function isArrayBuffer(value) { - if (typeof ArrayBuffer === 'undefined') { - return false; - } - - return isArrayBufferToString.working - ? isArrayBufferToString(value) - : value instanceof ArrayBuffer; -} -exports.isArrayBuffer = isArrayBuffer; - -function isDataViewToString(value) { - return ObjectToString(value) === '[object DataView]'; -} -isDataViewToString.working = ( - typeof ArrayBuffer !== 'undefined' && - typeof DataView !== 'undefined' && - isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) -); -function isDataView(value) { - if (typeof DataView === 'undefined') { - return false; - } - - return isDataViewToString.working - ? isDataViewToString(value) - : value instanceof DataView; -} -exports.isDataView = isDataView; - -// Store a copy of SharedArrayBuffer in case it's deleted elsewhere -var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined; -function isSharedArrayBufferToString(value) { - return ObjectToString(value) === '[object SharedArrayBuffer]'; -} -function isSharedArrayBuffer(value) { - if (typeof SharedArrayBufferCopy === 'undefined') { - return false; - } - - if (typeof isSharedArrayBufferToString.working === 'undefined') { - isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); - } - - return isSharedArrayBufferToString.working - ? isSharedArrayBufferToString(value) - : value instanceof SharedArrayBufferCopy; -} -exports.isSharedArrayBuffer = isSharedArrayBuffer; - -function isAsyncFunction(value) { - return ObjectToString(value) === '[object AsyncFunction]'; -} -exports.isAsyncFunction = isAsyncFunction; - -function isMapIterator(value) { - return ObjectToString(value) === '[object Map Iterator]'; -} -exports.isMapIterator = isMapIterator; - -function isSetIterator(value) { - return ObjectToString(value) === '[object Set Iterator]'; -} -exports.isSetIterator = isSetIterator; - -function isGeneratorObject(value) { - return ObjectToString(value) === '[object Generator]'; -} -exports.isGeneratorObject = isGeneratorObject; - -function isWebAssemblyCompiledModule(value) { - return ObjectToString(value) === '[object WebAssembly.Module]'; -} -exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - -function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); -} -exports.isNumberObject = isNumberObject; - -function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); -} -exports.isStringObject = isStringObject; - -function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); -} -exports.isBooleanObject = isBooleanObject; - -function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); -} -exports.isBigIntObject = isBigIntObject; - -function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); -} -exports.isSymbolObject = isSymbolObject; - -function isBoxedPrimitive(value) { - return ( - isNumberObject(value) || - isStringObject(value) || - isBooleanObject(value) || - isBigIntObject(value) || - isSymbolObject(value) - ); -} -exports.isBoxedPrimitive = isBoxedPrimitive; - -function isAnyArrayBuffer(value) { - return typeof Uint8Array !== 'undefined' && ( - isArrayBuffer(value) || - isSharedArrayBuffer(value) - ); -} -exports.isAnyArrayBuffer = isAnyArrayBuffer; - -['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { - Object.defineProperty(exports, method, { - enumerable: false, - value: function() { - throw new Error(method + ' is not supported in userland'); - } - }); -}); diff --git a/node_modules/util/util.js b/node_modules/util/util.js deleted file mode 100644 index 6db393e..0000000 --- a/node_modules/util/util.js +++ /dev/null @@ -1,715 +0,0 @@ -// 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 getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || - function getOwnPropertyDescriptors(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for (var i = 0; i < keys.length; i++) { - descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - } - return descriptors; - }; - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - if (typeof process !== 'undefined' && process.noDeprecation === true) { - return fn; - } - - // Allow for deprecating things in the process of starting up. - if (typeof process === 'undefined') { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnvRegex = /^$/; - -if (process.env.NODE_DEBUG) { - var debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') - .replace(/\*/g, '.*') - .replace(/,/g, '$|^') - .toUpperCase(); - debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); -} -exports.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').slice(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.slice(1, -1); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -exports.types = require('./support/types'); - -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; -exports.types.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; -exports.types.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; -exports.types.isNativeError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; - -exports.promisify = function promisify(original) { - if (typeof original !== 'function') - throw new TypeError('The "original" argument must be of type Function'); - - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if (typeof fn !== 'function') { - throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - } - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, enumerable: false, writable: false, configurable: true - }); - return fn; - } - - function fn() { - var promiseResolve, promiseReject; - var promise = new Promise(function (resolve, reject) { - promiseResolve = resolve; - promiseReject = reject; - }); - - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - args.push(function (err, value) { - if (err) { - promiseReject(err); - } else { - promiseResolve(value); - } - }); - - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - - return promise; - } - - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - - if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, enumerable: false, writable: false, configurable: true - }); - return Object.defineProperties( - fn, - getOwnPropertyDescriptors(original) - ); -} - -exports.promisify.custom = kCustomPromisifiedSymbol - -function callbackifyOnRejected(reason, cb) { - // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). - // Because `null` is a special error value in callbacks which means "no error - // occurred", we error-wrap so the callback consumer can distinguish between - // "the promise rejected with null" or "the promise fulfilled with undefined". - if (!reason) { - var newReason = new Error('Promise was rejected with a falsy value'); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); -} - -function callbackify(original) { - if (typeof original !== 'function') { - throw new TypeError('The "original" argument must be of type Function'); - } - - // We DO NOT return the promise as it gives the user a false sense that - // the promise is actually somehow related to the callback's execution - // and that the callback throwing will reject the promise. - function callbackified() { - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push(arguments[i]); - } - - var maybeCb = args.pop(); - if (typeof maybeCb !== 'function') { - throw new TypeError('The last argument must be of type Function'); - } - var self = this; - var cb = function() { - return maybeCb.apply(self, arguments); - }; - // In true node style we process the callback on `nextTick` with all the - // implications (stack, `uncaughtException`, `async_hooks`) - original.apply(this, args) - .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) }, - function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); - } - - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, - getOwnPropertyDescriptors(original)); - return callbackified; -} -exports.callbackify = callbackify; diff --git a/node_modules/v8flags/LICENSE b/node_modules/v8flags/LICENSE deleted file mode 100644 index 924a628..0000000 --- a/node_modules/v8flags/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018, 2021 Tyler Kellen , Blaine Bublitz , and Eric Schoffstall - -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/v8flags/README.md b/node_modules/v8flags/README.md deleted file mode 100644 index c716536..0000000 --- a/node_modules/v8flags/README.md +++ /dev/null @@ -1,61 +0,0 @@ -

- - - -

- -# v8flags - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Get available v8 and Node.js flags. - -## Usage - -```js -const v8flags = require('v8flags'); - -v8flags(function (err, results) { - console.log(results); - // [ '--use_strict', - // '--es5_readonly', - // '--es52_globals', - // '--harmony_typeof', - // '--harmony_scoping', - // '--harmony_modules', - // '--harmony_proxies', - // '--harmony_collections', - // '--harmony', - // ... -}); -``` - -## API - -### `v8flags(cb)` - -Finds the available flags and calls the passed callback with any errors and an array of flag results. - -### `v8flags.configfile` - -The name of the cache file for flags. - -### `v8flags.configPath` - -The filepath location of the `configfile` above. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/v8flags.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/v8flags -[npm-image]: https://img.shields.io/npm/v/v8flags.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/v8flags/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/v8flags/dev.yml?branch=master&style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/v8flags -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/v8flags/master.svg?style=flat-square - diff --git a/node_modules/v8flags/config-path.js b/node_modules/v8flags/config-path.js deleted file mode 100644 index 96bfab8..0000000 --- a/node_modules/v8flags/config-path.js +++ /dev/null @@ -1,37 +0,0 @@ -var os = require('os'); -var path = require('path'); -var userHome = os.homedir(); - -var env = process.env; -var name = 'js-v8flags'; - -function macos() { - var library = path.join(userHome, 'Library'); - return path.join(library, 'Caches', name); -} - -function windows() { - var appData = env.LOCALAPPDATA || path.join(userHome, 'AppData', 'Local'); - return path.join(appData, name); -} - -// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html -function linux() { - return path.join(env.XDG_CACHE_HOME || path.join(userHome, '.cache'), name); -} - -module.exports = function (platform) { - if (!userHome) { - return os.tmpdir(); - } - - if (platform === 'darwin') { - return macos(); - } - - if (platform === 'win32') { - return windows(); - } - - return linux(); -}; diff --git a/node_modules/v8flags/index.js b/node_modules/v8flags/index.js deleted file mode 100644 index 42bca0c..0000000 --- a/node_modules/v8flags/index.js +++ /dev/null @@ -1,162 +0,0 @@ -// this entire module is depressing. i should have spent my time learning -// how to patch v8 so that these options would just be available on the -// process object. - -var os = require('os'); -var fs = require('fs'); -var path = require('path'); -var crypto = require('crypto'); -var execFile = require('child_process').execFile; -var configPath = require('./config-path.js')(process.platform); -var env = process.env; -var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME || ''; -var exclusions = ['--help', '--completion-bash']; - -// This number must be incremented whenever the generated cache file changes. -var CACHE_VERSION = 3; - -var configfile = - '.v8flags-' + - CACHE_VERSION + - '-' + - process.versions.v8 + - '.' + - crypto.createHash('sha256').update(user).digest('hex') + - '.json'; - -var failureMessage = [ - 'Unable to cache a config file for v8flags to your home directory', - 'or a temporary folder. To fix this problem, please correct your', - 'environment by setting HOME=/path/to/home or TEMP=/path/to/temp.', - 'NOTE: the user running this must be able to access provided path.', - 'If all else fails, please open an issue here:', - 'http://github.com/gulpjs/v8flags', -].join('\n'); - -function fail(err) { - err.message += '\n\n' + failureMessage; - return err; -} - -function openConfig(cb) { - fs.mkdir(configPath, function () { - tryOpenConfig(path.join(configPath, configfile), function (err, fd) { - if (err) { - return tryOpenConfig(path.join(os.tmpdir(), configfile), cb); - } - return cb(null, fd); - }); - }); -} - -function tryOpenConfig(configpath, cb) { - try { - // if the config file is valid, it should be json and therefore - // node should be able to require it directly. if this doesn't - // throw, we're done! - var content = require(configpath); - process.nextTick(function () { - cb(null, content); - }); - } catch (e) { - // if requiring the config file failed, maybe it doesn't exist, or - // perhaps it has become corrupted. instead of calling back with the - // content of the file, call back with a file descriptor that we can - // write the cached data to - fs.open(configpath, 'w+', function (err, fd) { - if (err) { - return cb(err); - } - return cb(null, fd); - }); - } -} - -function normalizeFlagName(flag) { - return flag.trim(); -} - -// i can't wait for the day this whole module is obsolete because these -// options are available on the process object. this executes node with -// `--v8-options` and parses the result, returning an array of command -// line flags. -function getFlags(cb) { - var flags = Array.from(process.allowedNodeEnvironmentFlags); - - execFile(process.execPath, ['--v8-options'], function (execErr, result) { - if (execErr) { - cb(execErr); - return; - } - - var index = result.indexOf('\nOptions:'); - if (index >= 0) { - result = result.slice(index); - var regexp = /^\s\s--[\w-]+/gm; - var matchedFlags = result.match(regexp); - if (matchedFlags) { - flags = flags.concat( - matchedFlags.map(normalizeFlagName).filter(function (name) { - return exclusions.indexOf(name) === -1; - }) - ); - } - } - - cb(null, flags); - }); -} - -// write some json to a file descriptor. if this fails, call back -// with both the error and the data that was meant to be written. -function writeConfig(fd, flags, cb) { - var json = JSON.stringify(flags); - var buf = Buffer.from(json); - return fs.write(fd, buf, 0, buf.length, 0, function (writeErr) { - fs.close(fd, function (closeErr) { - var err = writeErr || closeErr; - if (err) { - return cb(fail(err), flags); - } - return cb(null, flags); - }); - }); -} - -module.exports = function (cb) { - // bail early if this is not node - var isElectron = process.versions && process.versions.electron; - if (isElectron) { - return process.nextTick(function () { - cb(null, []); - }); - } - - // attempt to open/read cache file - openConfig(function (openErr, result) { - if (!openErr && typeof result !== 'number') { - return cb(null, result); - } - // if the result is not an array, we need to go fetch - // the flags by invoking node with `--v8-options` - getFlags(function (flagsErr, flags) { - // if there was an error fetching the flags, bail immediately - if (flagsErr) { - return cb(flagsErr); - } - // if there was a problem opening the config file for writing - // throw an error but include the flags anyway so that users - // can continue to execute (at the expense of having to fetch - // flags on every run until they fix the underyling problem). - if (openErr) { - return cb(fail(openErr), flags); - } - // write the config file to disk so subsequent runs can read - // flags out of a cache file. - return writeConfig(result, flags, cb); - }); - }); -}; - -module.exports.configfile = configfile; -module.exports.configPath = configPath; diff --git a/node_modules/v8flags/package.json b/node_modules/v8flags/package.json deleted file mode 100644 index 514ae56..0000000 --- a/node_modules/v8flags/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "v8flags", - "version": "4.0.1", - "description": "Get available v8 and Node.js flags.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Tyler Kellen ", - "Blaine Bublitz ", - "Nicolò Ribaudo ", - "Selwyn ", - "Leo Zhang " - ], - "repository": "gulpjs/v8flags", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "files": [ - "index.js", - "config-path.js", - "LICENSE" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": {}, - "devDependencies": { - "async": "^3.2.2", - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.3.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "proxyquire": "^2.1.3" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "v8 flags", - "harmony flags" - ] -} diff --git a/node_modules/value-or-function/LICENSE b/node_modules/value-or-function/LICENSE deleted file mode 100644 index eb8faf7..0000000 --- a/node_modules/value-or-function/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2017, 2021 Blaine Bublitz and Eric Schoffstall - -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/value-or-function/README.md b/node_modules/value-or-function/README.md deleted file mode 100644 index 43b1267..0000000 --- a/node_modules/value-or-function/README.md +++ /dev/null @@ -1,139 +0,0 @@ -

- - - -

- -# value-or-function - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Normalize a value or function, applying extra args to the function - -## Example - -```js -var normalize = require('value-or-function'); - -// Values matching type are returned -var isEnabled = normalize('boolean', true); -// isEnabled === true - -// Values not matching type return undefined -var isEnabled = normalize('boolean', 1); -// isEnabled === undefined - -// Functions are called -var isEnabled = normalize('boolean', function () { - return false; -}); -// isEnabled === false - -// Extra arguments are applied to function -var count = normalize( - 'number', - function (a, b) { - return a + b; - }, - 1, - 2 -); -// count === 3 - -// Supply the function with context -var context = { c: 3 }; -var count = normalize.call( - context, - 'number', - function (a, b) { - return a + b + this.c; - }, - 1, - 2 -); -// count === 6 - -// Values one of multiple types are returned -var isEnabled = normalize(['string', 'boolean'], true); -// isEnabled === true - -// Provide a function as first argument to do custom coercion -var now = new Date(); -var enabledSince = normalize(function (value) { - if (value.constructor === Date) { - return value; - } -}, now); -// enabledSince === now - -// Convenience methods are available for the built-in types -var result = normalize.object({}); -var result = normalize.number(1); -var result = normalize.string(''); -var result = normalize.symbol(Symbol()); -var result = normalize.boolean(true); -var result = normalize.function(function () {}); -var result = normalize.date(new Date()); -``` - -## API - -### `normalize(coercer, value[, ...appliedArguments])` - -Takes a coercer function `coercer` to transform `value` to the desired type. -Also optionally takes any extra arguments to apply to `value` if `value` is a function. - -If the return value of `coercer(value)` is not `null` or `undefined`, that value is returned. -Otherwise, if `value` is a function, that function is called with any extra arguments -supplied to `normalize`, and its return value is passed through the coercer. - -If `coercer` is a string, it must be one of the built-in types (see below) -and the appropriate default coercer is invoked, optionally first reducing `value` -to a primitive type with `.valueOf()` if it is an Object. - -If `coercer` is an array, each element is tried until one returns something other -than `null` or `undefined`, or it results in `undefined` if all of the elements yield `null` or `undefined`. - -#### `normalize.object(value[, ...appliedArguments])` - -Convenience method for `normalize('object', ...)`. - -#### `normalize.number(value[, ...appliedArguments])` - -Convenience method for `normalize('number', ...)`. - -#### `normalize.string(value[, ...appliedArguments])` - -Convenience method for `normalize('string', ...)`. - -#### `normalize.symbol(value[, ...appliedArguments])` - -Convenience method for `normalize('symbol', ...)`. - -#### `normalize.boolean(value[, ...appliedArguments])` - -Convenience method for `normalize('boolean', ...)`. - -#### `normalize.function(value[, ...appliedArguments])` - -Convenience method for `normalize('function', ...)`. - -#### `normalize.date(value[, ...appliedArguments])` - -Convenience method for `normalize('date', ...)`. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/value-or-function.svg?style=flat-square -[npm-url]: https://npmjs.org/package/value-or-function -[npm-image]: https://img.shields.io/npm/v/value-or-function.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/value-or-function/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/value-or-function/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/value-or-function -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/value-or-function/master.svg?style=flat-square - diff --git a/node_modules/value-or-function/index.js b/node_modules/value-or-function/index.js deleted file mode 100644 index 3c1724b..0000000 --- a/node_modules/value-or-function/index.js +++ /dev/null @@ -1,113 +0,0 @@ -'use strict'; - -// Built-in types -var types = [ - 'object', - 'number', - 'string', - 'symbol', - 'boolean', - 'date', - 'function', // Weird to expose this -]; - -function normalize(coercer, value) { - var coercers = coercer; - if (!Array.isArray(coercers)) { - coercers = [coercer]; - } - - var ctx = this; - var args = slice(arguments, 2); - - // Try in order until one returns a non-undefined value - var result; - coercers.some(function (coercer) { - var val = value; - if (typeof value === 'function' && coercer !== 'function') { - val = value.apply(ctx, args); - } - - result = coerce(ctx, coercer, val); - return result !== undefined; - }); - - return result; -} - -function coerce(ctx, coercer, value) { - // Handle built-in types - if (typeof coercer === 'string') { - if (coerce[coercer]) { - return coerce[coercer].call(ctx, value); - } - return typeOf(coercer, value); - } - - // Handle custom coercer - if (typeof coercer === 'function') { - return coercer.call(ctx, value); - } - - throw new Error('Invalid coercer. Can only be a string or function.'); -} - -coerce.string = function (value) { - if ( - value != null && - typeof value === 'object' && - typeof value.toString === 'function' - ) { - value = value.toString(); - } - return typeOf('string', primitive(value)); -}; - -coerce.number = function (value) { - return typeOf('number', primitive(value)); -}; - -coerce.boolean = function (value) { - return typeOf('boolean', primitive(value)); -}; - -coerce.date = function (value) { - value = primitive(value); - if (typeof value === 'number' && !isNaN(value) && isFinite(value)) { - return new Date(value); - } -}; - -function typeOf(type, value) { - if (typeof value === type) { - return value; - } -} - -function primitive(value) { - if ( - value != null && - typeof value === 'object' && - typeof value.valueOf === 'function' - ) { - value = value.valueOf(); - } - return value; -} - -function slice(value, from) { - return Array.prototype.slice.call(value, from); -} - -// Add methods for each type -types.forEach(function (type) { - // Make it an array for easier concat - var typeArg = [type]; - - normalize[type] = function () { - var args = slice(arguments); - return normalize.apply(this, typeArg.concat(args)); - }; -}); - -module.exports = normalize; diff --git a/node_modules/value-or-function/package.json b/node_modules/value-or-function/package.json deleted file mode 100644 index 57a0ca3..0000000 --- a/node_modules/value-or-function/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "value-or-function", - "version": "4.0.0", - "description": "Normalize a value or function, applying extra args to the function", - "author": "Gulp Team (http://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz ", - "Hugo Wood " - ], - "repository": "gulpjs/value-or-function", - "license": "MIT", - "engines": { - "node": ">= 10.13.0" - }, - "main": "index.js", - "files": [ - "index.js" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.4.2", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "sinon": "^12.0.1" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "options", - "normalize", - "value", - "function" - ] -} diff --git a/node_modules/vinyl-contents/LICENSE b/node_modules/vinyl-contents/LICENSE deleted file mode 100644 index 9cf0f73..0000000 --- a/node_modules/vinyl-contents/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2019, 2022 Blaine Bublitz and Eric Schoffstall - -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/vinyl-contents/README.md b/node_modules/vinyl-contents/README.md deleted file mode 100644 index 807332c..0000000 --- a/node_modules/vinyl-contents/README.md +++ /dev/null @@ -1,73 +0,0 @@ -

- - - -

- -# vinyl-contents - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Utility to read the contents of a vinyl file. - -## Usage - -```js -/* - WARNING: This is a very naive plugin implementation - It is only meant for demonstation purposes. - For a more complete implementation, see: https://github.com/gulp-community/gulp-pug -*/ -var { Transform } = require('streamx'); -var pug = require('pug'); -var vinylContents = require('vinyl-contents'); - -function gulpPug(options) { - return new Transform({ - transform: function (file, cb) { - vinylContents(file, function (err, contents) { - if (err) { - return cb(err); - } - - if (!contents) { - return cb(); - } - - file.contents = pug.compile(contents.toString(), options)(); - cb(null, file); - }); - }, - }); -} -``` - -## API - -### `vinylContents(file, callback)` - -**Warning:** Only use this if interacting with a library that can **only** receive strings or buffers. This loads all streaming contents into memory which can cause unexpected results for your end-users. - -Takes a Vinyl file and an error-first callback. Calls the callback with an error if one occur (or if the first argument is not a Vinyl file), or the file contents if no error occurs. - -If the Vinyl contents are: - -- A Buffer, will be returned directly. -- A Stream, will be buffered into a BufferList and returned. -- Empty, will be undefined. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/vinyl-contents.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/vinyl-contents -[npm-image]: https://img.shields.io/npm/v/vinyl-contents.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/vinyl-contents/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/vinyl-contents/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl-contents -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/vinyl-contents/master.svg?style=flat-square - diff --git a/node_modules/vinyl-contents/index.js b/node_modules/vinyl-contents/index.js deleted file mode 100644 index deab58e..0000000 --- a/node_modules/vinyl-contents/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -var Vinyl = require('vinyl'); -var bl = require('bl'); - -function vinylContents(file, cb) { - if (!Vinyl.isVinyl(file)) { - cb(new Error('Must be a Vinyl object')); - return; - } - - if (file.isBuffer()) { - cb(null, file.contents); - return; - } - - if (file.isStream()) { - var bufferList = bl(function (err, data) { - if (err) { - cb(err); - return; - } - - cb(null, data); - }); - file.contents.pipe(bufferList); - return; - } - - cb(); -} - -module.exports = vinylContents; diff --git a/node_modules/vinyl-contents/package.json b/node_modules/vinyl-contents/package.json deleted file mode 100644 index ff8bfcb..0000000 --- a/node_modules/vinyl-contents/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "vinyl-contents", - "version": "2.0.0", - "description": "Utility to read the contents of a vinyl file.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Blaine Bublitz " - ], - "repository": "gulpjs/vinyl-contents", - "license": "MIT", - "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": { - "bl": "^5.0.0", - "vinyl": "^3.0.0" - }, - "devDependencies": { - "eslint": "^7.0.0", - "eslint-config-gulp": "^5.0.0", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.0.0", - "mocha": "^8.0.0", - "nyc": "^15.0.0", - "readable-stream": "^3.6.0", - "streamx": "^2.12.5" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [] -} diff --git a/node_modules/vinyl-fs/LICENSE b/node_modules/vinyl-fs/LICENSE deleted file mode 100644 index 1a7d8f2..0000000 --- a/node_modules/vinyl-fs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013-2020, 2023 Blaine Bublitz and Eric Schoffstall - -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/vinyl-fs/README.md b/node_modules/vinyl-fs/README.md deleted file mode 100644 index df45435..0000000 --- a/node_modules/vinyl-fs/README.md +++ /dev/null @@ -1,366 +0,0 @@ -

- - - -

- -# vinyl-fs - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -[Vinyl][vinyl] adapter for the file system. - -## What is Vinyl? - -[Vinyl][vinyl] is a very simple metadata object that describes a file. When you think of a file, two attributes come to mind: `path` and `contents`. These are the main attributes on a [Vinyl][vinyl] object. A file does not necessarily represent something on your computer’s file system. You have files on S3, FTP, Dropbox, Box, CloudThingly.io and other services. [Vinyl][vinyl] can be used to describe files from all of these sources. - -## What is a Vinyl Adapter? - -While Vinyl provides a clean way to describe a file, we now need a way to access these files. Each file source needs what we call a "Vinyl adapter". A Vinyl adapter simply exposes a `src(globs)` and a `dest(folder)` method. Each return a stream. The `src` stream produces Vinyl objects, and the `dest` stream consumes Vinyl objects. Vinyl adapters can expose extra methods that might be specific to their input/output medium, such as the `symlink` method `vinyl-fs` provides. - -## Usage - -```javascript -var map = require('map-stream'); -var vfs = require('vinyl-fs'); - -var log = function (file, cb) { - console.log(file.path); - cb(null, file); -}; - -vfs - .src(['./js/**/*.js', '!./js/vendor/*.js']) - .pipe(map(log)) - .pipe(vfs.dest('./output')); -``` - -## API - -### `src(globs[, options])` - -Takes a glob string or an array of glob strings as the first argument and an options object as the second. -Returns a stream of [vinyl] `File` objects. - -**Note: UTF-8 BOM will be removed from all UTF-8 files read with `.src` unless disabled in the options.** - -#### Globs - -Globs are executed in order, so negations should follow positive globs. - -For example: - -```js -fs.src(['!b*', '*']); -``` - -would not exclude any files, but the following would exclude all files starting with "b": - -```js -fs.src(['*', '!b*']); -``` - -#### Options - -- Values passed to the options must be of the expected type, otherwise they will be ignored. -- All options can be passed a function instead of a value. The function will be called with the [vinyl] `File` object as its only argument and must return a value of the expected type for that option. - -##### `options.buffer` - -Whether or not you want to buffer the file contents into memory. Setting to `false` will make `file.contents` a paused Stream. - -Type: `Boolean` - -Default: `true` - -##### `options.read` - -Whether or not you want the file to be read at all. Useful for stuff like removing files. Setting to `false` will make `file.contents = null` and will disable writing the file to disk via `.dest()`. - -Type: `Boolean` - -Default: `true` - -##### `options.since` - -Only streams files that have been modified since the time specified. - -Type: `Date` or `Number` - -Default: `undefined` - -##### `options.removeBOM` - -Causes the BOM to be removed on UTF-8 encoded files. Set to `false` if you need the BOM for some reason. - -Type: `Boolean` - -Default: `true` - -##### `options.encoding` - -Optionally transcode from the given encoding. The default is `'utf8'`. We use -[iconv-lite], please refer to its Wiki for a list of supported encodings. You -can set this to `false` to avoid any transcoding, and effectively just pass -around raw binary data. - -Type: `String` or `Boolean` - -Default: `'utf8'` - -##### `options.sourcemaps` - -Enables sourcemap support on files passed through the stream. Will load inline sourcemaps and resolve sourcemap links from files. - -Type: `Boolean` - -Default: `false` - -##### `options.resolveSymlinks` - -Whether or not to recursively resolve symlinks to their targets. Set to `false` to preserve them as symlinks and make `file.symlink` equal the original symlink's target path. - -Type: `Boolean` - -Default: `true` - -##### `options.dot` - -Whether or not you want globs to match on dot files (e.g. `.gitignore`). - -**Note: This option is not resolved from a function because it is passed verbatim to anymatch.** - -Type: `Boolean` - -Default: `false` - -##### other - -Any glob-related options are documented in [glob-stream] and [anymatch] and are forwarded verbatim. - -### `dest(folder[, options])` - -Takes a folder path string or a function as the first argument and an options object as the second. If given a function, it will be called with each [vinyl] `File` object and must return a folder path. -Returns a stream that accepts [vinyl] `File` objects, writes them to disk at the folder/cwd specified, and passes them downstream so you can keep piping these around. - -Once the file is written to disk, an attempt is made to determine if the `stat.mode`, `stat.mtime` and `stat.atime` of the [vinyl] `File` object differ from the file on the filesystem. -If they differ and the running process owns the file, the corresponding filesystem metadata is updated. -If they don't differ or the process doesn't own the file, the attempt is skipped silently. -**This functionality is disabled on Windows operating systems or any other OS that doesn't support `process.getuid` or `process.geteuid` in node. This is due to Windows having very unexpected results through usage of `fs.fchmod` and `fs.futimes`.** - -**Note: The `fs.futimes()` method internally converts `stat.mtime` and `stat.atime` timestamps to seconds; this division by `1000` may cause some loss of precision in 32-bit Node.js.** - -If the file has a `symlink` attribute specifying a target path, then a symlink will be created. - -**Note: The file will be modified after being written to this stream.** - -- `cwd`, `base`, and `path` will be overwritten to match the folder. -- `stat` will be updated to match the file on the filesystem. -- `contents` will have it's position reset to the beginning if it is a stream. - -#### Options - -- Values passed to the options must be of the expected type, otherwise they will be ignored. -- All options can be passed a function instead of a value. The function will be called with the [vinyl] `File` object as its only argument and must return a value of the expected type for that option. - -##### `options.cwd` - -The working directory the folder is relative to. - -Type: `String` - -Default: `process.cwd()` - -##### `options.mode` - -The mode the files should be created with. This option is only resolved if the [vinyl] `File` is not symbolic. - -Type: `Number` - -Default: The `mode` of the input file (`file.stat.mode`) if any, or the process mode if the input file has no `mode` property. - -##### `options.dirMode` - -The mode directories should be created with. - -Type: `Number` - -Default: The process `mode`. - -##### `options.overwrite` - -Whether or not existing files with the same path should be overwritten. - -Type: `Boolean` - -Default: `true` (always overwrite existing files) - -##### `options.append` - -Whether or not new data should be appended after existing file contents (if any). - -Type: `Boolean` - -Default: `false` (always replace existing contents, if any) - -##### `options.encoding` - -Optionally transcode to the given encoding. The default is `'utf8'`. We use -[iconv-lite], please refer to its Wiki for a list of supported encodings. You -can set this to `false` to avoid any transcoding, and effectively just pass -around raw binary data. - -Type: `String` or `Boolean` - -Default: `'utf8'`. - -##### `options.sourcemaps` - -Enables sourcemap support on files passed through the stream. Will write inline soucemaps if specified as `true`. -Specifying a `String` path will write external sourcemaps at the given path. - -Examples: - -```js -// Write as inline comments -vfs.dest('./', { sourcemaps: true }); - -// Write as files in the same folder -vfs.dest('./', { sourcemaps: '.' }); -``` - -Type: `Boolean` or `String` - -Default: `undefined` (do not write sourcemaps) - -##### `options.relativeSymlinks` - -When creating a symlink, whether or not the created symlink should be relative. If `false`, the symlink will be absolute. - -**Note: This option will be ignored if a `junction` is being created, as they must be absolute.** - -Type: `Boolean` - -Default: `false` - -##### `options.useJunctions` - -When creating a symlink, whether or not a directory symlink should be created as a `junction`. -This option is only relevant on Windows and ignored elsewhere. Please refer to the [Symbolic Links on Windows][symbolic-caveats] section below. - -Type: `Boolean` - -Default: `true` - -### `symlink(folder[, options])` - -Takes a folder path string or a function as the first argument and an options object as the second. If given a function, it will be called with each [vinyl] `File` object and must return a folder path. -Returns a stream that accepts [vinyl] `File` objects, creates a symbolic link (i.e. symlink) at the folder/cwd specified, and passes them downstream so you can keep piping these around. - -**Note: The file will be modified after being written to this stream.** - -- `cwd`, `base`, and `path` will be overwritten to match the folder. -- `stat` will be updated to match the symlink on the filesystem. -- `contents` will be set to `null`. -- `symlink` will be added or replaced to be the original path. - -**Note: On Windows, directory links are created using Junctions by default. Use the `useJunctions` option to disable this behavior.** - -#### Options - -- Values passed to the options must be of the expected type, otherwise they will be ignored. -- All options can be passed a function instead of a value. The function will be called with the [vinyl] `File` object as its only argument and must return a value of the expected type for that option. - -##### `options.cwd` - -The working directory the folder is relative to. - -Type: `String` - -Default: `process.cwd()` - -##### `options.dirMode` - -The mode directories should be created with. - -Type: `Number` - -Default: The process mode. - -##### `options.overwrite` - -Whether or not existing files with the same path should be overwritten. - -Type: `Boolean` - -Default: `true` (always overwrite existing files) - -##### `options.relativeSymlinks` - -Whether or not the created symlinks should be relative. If `false`, the symlink will be absolute. - -**Note: This option will be ignored if a `junction` is being created, as they must be absolute.** - -Type: `Boolean` - -Default: `false` - -##### `options.useJunctions` - -When creating a symlink, whether or not a directory symlink should be created as a `junction`. -This option is only relevant on Windows and ignored elsewhere. Please refer to the [Symbolic Links on Windows][symbolic-caveats] section below. - -Type: `Boolean` - -Default: `true` - -#### Symbolic Links on Windows - -When creating symbolic links on Windows, we pass a `type` argument to Node's -`fs` module which specifies the kind of target we link to (one of `'file'`, -`'dir'` or `'junction'`). Specifically, this will be `'file'` when the target -is a regular file, `'junction'` if the target is a directory, or `'dir'` if -the target is a directory and the user overrides the `useJunctions` option -default. - -However, if the user tries to make a "dangling" link (pointing to a non-existent -target) we won't be able to determine automatically which type we should use. -In these cases, `vinyl-fs` will behave slightly differently depending on -whether the dangling link is being created via `symlink()` or via `dest()`. - -For dangling links created via `symlink()`, the incoming vinyl represents the -target and so we will look to its stats to guess the desired type. In -particular, if `isDirectory()` returns false then we'll create a `'file'` type -link, otherwise we will create a `'junction'` or a `'dir'` type link depending -on the value of the `useJunctions` option. - -For dangling links created via `dest()`, the incoming vinyl represents the link - -typically read off disk via `src()` with the `resolveSymlinks` option set to -false. In this case, we won't be able to make any reasonable guess as to the -type of link and we default to using `'file'`, which may cause unexpected behavior -if you are creating a "dangling" link to a directory. It is advised to avoid this -scenario. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/vinyl-fs.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/vinyl-fs -[npm-image]: https://img.shields.io/npm/v/vinyl-fs.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/vinyl-fs/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/vinyl-fs/dev.yml??branch=master&style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl-fs -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/vinyl-fs.svg?style=flat-square - - - -[symbolic-caveats]: #symbolic-links-on-windows -[glob-stream]: https://github.com/gulpjs/glob-stream -[anymatch]: https://github.com/micromatch/anymatch -[vinyl]: https://github.com/gulpjs/vinyl -[iconv-lite]: https://github.com/ashtuchkin/iconv-lite - diff --git a/node_modules/vinyl-fs/index.js b/node_modules/vinyl-fs/index.js deleted file mode 100644 index acdeac2..0000000 --- a/node_modules/vinyl-fs/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -module.exports = { - src: require('./lib/src'), - dest: require('./lib/dest'), - symlink: require('./lib/symlink'), -}; diff --git a/node_modules/vinyl-fs/lib/codecs.js b/node_modules/vinyl-fs/lib/codecs.js deleted file mode 100644 index e333d46..0000000 --- a/node_modules/vinyl-fs/lib/codecs.js +++ /dev/null @@ -1,107 +0,0 @@ -'use strict'; - -/* eslint-disable new-cap */ - -var iconv = require('iconv-lite'); -// TODO: Reaching into iconv-lite is fragile -var StripBOM = require('iconv-lite/lib/bom-handling').StripBOM; -var Transform = require('streamx').Transform; - -var DEFAULT_ENCODING = require('./constants').DEFAULT_ENCODING; - -function Codec(codec, encoding) { - this.codec = codec; - this.enc = codec.enc || encoding; - this.bomAware = codec.bomAware || false; -} - -function getEncoder(codec) { - return new codec.encoder(null, codec); -} - -Codec.prototype.encode = function (str) { - var encoder = getEncoder(this.codec); - var buf = encoder.write(str); - var end = encoder.end(); - return end && end.length > 0 ? Buffer.concat(buf, end) : buf; -}; - -Codec.prototype.encodeStream = function () { - var encoder = getEncoder(this.codec); - return new Transform({ - transform: function (str, cb) { - var buf = encoder.write(str); - if (buf && buf.length) { - this.push(buf); - } - cb(); - }, - flush: function (cb) { - var buf = encoder.end(); - if (buf && buf.length) { - this.push(buf); - } - cb(); - }, - }); -}; - -function getDecoder(codec) { - return new codec.decoder(null, codec); -} - -Codec.prototype.decode = function (buf, options) { - var decoder = getDecoder(this.codec); - if (options && options.removeBOM) { - decoder = new StripBOM(decoder); - } - var str = decoder.write(buf); - var end = decoder.end(); - return end ? str + end : str; -}; - -Codec.prototype.decodeStream = function (options) { - var decoder = getDecoder(this.codec); - if (options && options.removeBOM) { - decoder = new StripBOM(decoder); - } - return new Transform({ - transform: function (buf, cb) { - var str = decoder.write(buf); - if (str && str.length) { - this.push(str); - } - cb(); - }, - flush: function (cb) { - var str = decoder.end(); - if (str && str.length) { - this.push(str); - } - cb(); - }, - }); -}; - -var cache = {}; - -function getCodec(encoding) { - var codec = cache[encoding]; - if (!!codec || !encoding || Object.hasOwnProperty.call(cache, encoding)) { - return codec; - } - - try { - codec = new Codec(iconv.getCodec(encoding), encoding); - } catch (err) { - // Unsupported codec - } - - cache[encoding] = codec; - return codec; -} - -// Pre-load default encoding -getCodec(DEFAULT_ENCODING); - -module.exports = getCodec; diff --git a/node_modules/vinyl-fs/lib/constants.js b/node_modules/vinyl-fs/lib/constants.js deleted file mode 100644 index db60b77..0000000 --- a/node_modules/vinyl-fs/lib/constants.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -module.exports = { - MASK_MODE: parseInt('7777', 8), - DEFAULT_FILE_MODE: parseInt('0666', 8), - DEFAULT_ENCODING: 'utf8', -}; diff --git a/node_modules/vinyl-fs/lib/dest/index.js b/node_modules/vinyl-fs/lib/dest/index.js deleted file mode 100644 index 519b76b..0000000 --- a/node_modules/vinyl-fs/lib/dest/index.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -var lead = require('lead'); -var composer = require('stream-composer'); -var mkdirpStream = require('fs-mkdirp-stream'); -var createResolver = require('resolve-options'); - -var config = require('./options'); -var prepare = require('./prepare'); -var sourcemap = require('./sourcemap'); -var writeContents = require('./write-contents'); - -var folderConfig = { - outFolder: { - type: 'string', - }, -}; - -function dest(outFolder, opt) { - if (!outFolder) { - throw new Error( - 'Invalid dest() folder argument.' + - ' Please specify a non-empty string or a function.' - ); - } - - var optResolver = createResolver(config, opt); - var folderResolver = createResolver(folderConfig, { outFolder: outFolder }); - - function dirpath(file, callback) { - var dirMode = optResolver.resolve('dirMode', file); - - callback(null, file.dirname, dirMode); - } - - var saveStream = composer.pipeline( - prepare(folderResolver, optResolver), - sourcemap(optResolver), - mkdirpStream(dirpath), - writeContents(optResolver) - ); - - // Sink the output stream to start flowing - return lead(saveStream); -} - -module.exports = dest; diff --git a/node_modules/vinyl-fs/lib/dest/options.js b/node_modules/vinyl-fs/lib/dest/options.js deleted file mode 100644 index 47c0c51..0000000 --- a/node_modules/vinyl-fs/lib/dest/options.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; - -var DEFAULT_ENCODING = require('../constants').DEFAULT_ENCODING; - -var config = { - cwd: { - type: 'string', - default: process.cwd, - }, - mode: { - type: 'number', - default: function (file) { - return file.stat ? file.stat.mode : null; - }, - }, - dirMode: { - type: 'number', - }, - overwrite: { - type: 'boolean', - default: true, - }, - append: { - type: 'boolean', - default: false, - }, - encoding: { - type: ['string', 'boolean'], - default: DEFAULT_ENCODING, - }, - sourcemaps: { - type: ['string', 'boolean'], - default: false, - }, - // Symlink options - relativeSymlinks: { - type: 'boolean', - default: false, - }, - // This option is ignored on non-Windows platforms - useJunctions: { - type: 'boolean', - default: true, - }, -}; - -module.exports = config; diff --git a/node_modules/vinyl-fs/lib/dest/prepare.js b/node_modules/vinyl-fs/lib/dest/prepare.js deleted file mode 100644 index 08d5c1f..0000000 --- a/node_modules/vinyl-fs/lib/dest/prepare.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -var path = require('path'); - -var fs = require('graceful-fs'); -var Vinyl = require('vinyl'); -var Transform = require('streamx').Transform; - -function prepareWrite(folderResolver, optResolver) { - if (!folderResolver) { - throw new Error('Invalid output folder'); - } - - function normalize(file, cb) { - if (!Vinyl.isVinyl(file)) { - return cb(new Error('Received a non-Vinyl object in `dest()`')); - } - - // TODO: Remove this after people upgrade vinyl/transition from gulp-util - if (typeof file.isSymbolic !== 'function') { - file = new Vinyl(file); - } - - var outFolderPath = folderResolver.resolve('outFolder', file); - if (!outFolderPath) { - return cb(new Error('Invalid output folder')); - } - var cwd = path.resolve(optResolver.resolve('cwd', file)); - var basePath = path.resolve(cwd, outFolderPath); - var writePath = path.resolve(basePath, file.relative); - - // Wire up new properties - file.cwd = cwd; - file.base = basePath; - file.path = writePath; - if (!file.isSymbolic()) { - var mode = optResolver.resolve('mode', file); - file.stat = file.stat || new fs.Stats(); - file.stat.mode = mode; - } - - cb(null, file); - } - - return new Transform({ - transform: normalize, - }); -} - -module.exports = prepareWrite; diff --git a/node_modules/vinyl-fs/lib/dest/sourcemap.js b/node_modules/vinyl-fs/lib/dest/sourcemap.js deleted file mode 100644 index 7f64835..0000000 --- a/node_modules/vinyl-fs/lib/dest/sourcemap.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; -var sourcemap = require('vinyl-sourcemap'); - -function sourcemapStream(optResolver) { - function saveSourcemap(file, callback) { - var self = this; - - var srcMap = optResolver.resolve('sourcemaps', file); - - if (!srcMap) { - return callback(null, file); - } - - var srcMapLocation = typeof srcMap === 'string' ? srcMap : undefined; - - sourcemap.write(file, srcMapLocation, onWrite); - - function onWrite(sourcemapErr, updatedFile, sourcemapFile) { - if (sourcemapErr) { - return callback(sourcemapErr); - } - - self.push(updatedFile); - if (sourcemapFile) { - self.push(sourcemapFile); - } - - callback(); - } - } - - return new Transform({ - transform: saveSourcemap, - }); -} - -module.exports = sourcemapStream; diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/index.js b/node_modules/vinyl-fs/lib/dest/write-contents/index.js deleted file mode 100644 index 5d55819..0000000 --- a/node_modules/vinyl-fs/lib/dest/write-contents/index.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; - -var writeDir = require('./write-dir'); -var writeStream = require('./write-stream'); -var writeBuffer = require('./write-buffer'); -var writeSymbolicLink = require('./write-symbolic-link'); - -var fo = require('../../file-operations'); - -function writeContents(optResolver) { - function writeFile(file, callback) { - // Write it as a symlink - if (file.isSymbolic()) { - return writeSymbolicLink(file, optResolver, onWritten); - } - - // If directory then mkdirp it - if (file.isDirectory()) { - return writeDir(file, optResolver, onWritten); - } - - // Stream it to disk yo - if (file.isStream()) { - return writeStream(file, optResolver, onWritten); - } - - // Write it like normal - if (file.isBuffer()) { - return writeBuffer(file, optResolver, onWritten); - } - - // If no contents then do nothing - if (file.isNull()) { - return onWritten(); - } - - // This is invoked by the various writeXxx modules when they've finished - // writing the contents. - function onWritten(writeErr) { - var flags = fo.getFlags({ - overwrite: optResolver.resolve('overwrite', file), - append: optResolver.resolve('append', file), - }); - if (fo.isFatalOverwriteError(writeErr, flags)) { - return callback(writeErr); - } - - callback(null, file); - } - } - - return new Transform({ - transform: writeFile, - }); -} - -module.exports = writeContents; diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js deleted file mode 100644 index 242fe2f..0000000 --- a/node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -var fo = require('../../file-operations'); -var getCodec = require('../../codecs'); -var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING; - -function writeBuffer(file, optResolver, onWritten) { - var flags = fo.getFlags({ - overwrite: optResolver.resolve('overwrite', file), - append: optResolver.resolve('append', file), - }); - - var encoding = optResolver.resolve('encoding', file); - var codec = getCodec(encoding); - if (encoding && !codec) { - return onWritten(new Error('Unsupported encoding: ' + encoding)); - } - - var opt = { - mode: file.stat.mode, - flags: flags, - }; - - var contents = file.contents; - - if (encoding && codec.enc !== DEFAULT_ENCODING) { - contents = getCodec(DEFAULT_ENCODING).decode(contents); - contents = codec.encode(contents); - } - - fo.writeFile(file.path, contents, opt, onWriteFile); - - function onWriteFile(writeErr, fd) { - if (writeErr) { - return fo.closeFd(writeErr, fd, onWritten); - } - - fo.updateMetadata(fd, file, onUpdate); - - function onUpdate(updateErr) { - fo.closeFd(updateErr, fd, onWritten); - } - } -} - -module.exports = writeBuffer; diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js deleted file mode 100644 index 8b632e1..0000000 --- a/node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); - -var mkdirp = require('fs-mkdirp-stream/mkdirp'); - -var fo = require('../../file-operations'); - -function writeDir(file, optResolver, onWritten) { - mkdirp(file.path, file.stat.mode, onMkdirp); - - function onMkdirp(mkdirpErr) { - if (mkdirpErr) { - return onWritten(mkdirpErr); - } - - fs.open(file.path, 'r', onOpen); - } - - function onOpen(openErr, fd) { - // If we don't have access, just move along - if (isInaccessible(openErr)) { - return fo.closeFd(null, fd, onWritten); - } - - if (openErr) { - return fo.closeFd(openErr, fd, onWritten); - } - - fo.updateMetadata(fd, file, onUpdate); - - function onUpdate(updateErr) { - fo.closeFd(updateErr, fd, onWritten); - } - } -} - -function isInaccessible(err) { - if (!err) { - return false; - } - - if (err.code === 'EACCES') { - return true; - } - - return false; -} - -module.exports = writeDir; diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js deleted file mode 100644 index 84e0358..0000000 --- a/node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -var pipeline = require('streamx').pipeline; - -var fo = require('../../file-operations'); -var getCodec = require('../../codecs'); -var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING; -var readStream = require('../../src/read-contents/read-stream'); - -function writeStream(file, optResolver, onWritten) { - var flags = fo.getFlags({ - overwrite: optResolver.resolve('overwrite', file), - append: optResolver.resolve('append', file), - }); - - var encoding = optResolver.resolve('encoding', file); - var codec = getCodec(encoding); - if (encoding && !codec) { - return onWritten(new Error('Unsupported encoding: ' + encoding)); - } - - var opt = { - mode: file.stat.mode, - // TODO: need to test this - flags: flags, - }; - - // TODO: is this the best API? - var outStream = fo.createWriteStream(file.path, opt, onFlush); - - // TODO: should this use a clone? - var streams = [file.contents]; - - if (encoding && encoding.enc !== DEFAULT_ENCODING) { - streams.push(getCodec(DEFAULT_ENCODING).decodeStream()); - streams.push(codec.encodeStream()); - } - - streams.push(outStream); - - pipeline(streams, onWritten); - - // Cleanup - function onFlush(fd, callback) { - // TODO: this is doing sync stuff & the callback seems unnecessary - readStream(file, { resolve: resolve }, complete); - - function resolve(key) { - if (key === 'encoding') { - return encoding; - } - if (key === 'removeBOM') { - return false; - } - throw new Error("Eek! stub resolver doesn't have " + key); - } - - function complete() { - if (typeof fd !== 'number') { - return callback(); - } - - fo.updateMetadata(fd, file, callback); - } - } -} - -module.exports = writeStream; diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js deleted file mode 100644 index e1dc42d..0000000 --- a/node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -var os = require('os'); -var path = require('path'); - -var fo = require('../../file-operations'); - -var isWindows = os.platform() === 'win32'; - -function writeSymbolicLink(file, optResolver, onWritten) { - if (!file.symlink) { - return onWritten(new Error('Missing symlink property on symbolic vinyl')); - } - - var isRelative = optResolver.resolve('relativeSymlinks', file); - var flags = fo.getFlags({ - overwrite: optResolver.resolve('overwrite', file), - append: optResolver.resolve('append', file), - }); - - if (!isWindows) { - // On non-Windows, just use 'file' - return createLinkWithType('file'); - } - - fo.reflectStat(file.symlink, file, onReflect); - - function onReflect(statErr) { - if (statErr && statErr.code !== 'ENOENT') { - return onWritten(statErr); - } - - // This option provides a way to create a Junction instead of a - // Directory symlink on Windows. This comes with the following caveats: - // * NTFS Junctions cannot be relative. - // * NTFS Junctions MUST be directories. - // * NTFS Junctions must be on the same file system. - // * Most products CANNOT detect a directory is a Junction: - // This has the side effect of possibly having a whole directory - // deleted when a product is deleting the Junction directory. - // For example, JetBrains product lines will delete the entire contents - // of the TARGET directory because the product does not realize it's - // a symlink as the JVM and Node return false for isSymlink. - - // This function is Windows only, so we don't need to check again - var useJunctions = optResolver.resolve('useJunctions', file); - - var dirType = useJunctions ? 'junction' : 'dir'; - // Dangling links are always 'file' - var type = !statErr && file.isDirectory() ? dirType : 'file'; - - createLinkWithType(type); - } - - function createLinkWithType(type) { - // This is done after prepare() to use the adjusted file.base property - if (isRelative && type !== 'junction') { - file.symlink = path.relative(file.base, file.symlink); - } - - var opts = { - flags: flags, - type: type, - }; - fo.symlink(file.symlink, file.path, opts, onSymlink); - - function onSymlink(symlinkErr) { - if (symlinkErr) { - return onWritten(symlinkErr); - } - - fo.reflectLinkStat(file.path, file, onWritten); - } - } -} - -module.exports = writeSymbolicLink; diff --git a/node_modules/vinyl-fs/lib/file-operations.js b/node_modules/vinyl-fs/lib/file-operations.js deleted file mode 100644 index e7c88c5..0000000 --- a/node_modules/vinyl-fs/lib/file-operations.js +++ /dev/null @@ -1,459 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); -var date = require('value-or-function').date; -var Writable = require('streamx').Writable; - -var constants = require('./constants'); - -var APPEND_MODE_REGEXP = /a/; - -function closeFd(propagatedErr, fd, callback) { - if (typeof fd !== 'number') { - return callback(propagatedErr); - } - - fs.close(fd, onClosed); - - function onClosed(closeErr) { - if (propagatedErr || closeErr) { - return callback(propagatedErr || closeErr); - } - - callback(); - } -} - -function isValidUnixId(id) { - if (typeof id !== 'number') { - return false; - } - - if (id < 0) { - return false; - } - - return true; -} - -function getFlags(options) { - var flags = !options.append ? 'w' : 'a'; - if (!options.overwrite) { - flags += 'x'; - } - return flags; -} - -function isFatalOverwriteError(err, flags) { - if (!err) { - return false; - } - - if (err.code === 'EEXIST' && flags[1] === 'x') { - // Handle scenario for file overwrite failures. - return false; - } - - // Otherwise, this is a fatal error - return true; -} - -function isFatalUnlinkError(err) { - if (!err || err.code === 'ENOENT') { - return false; - } - - return true; -} - -function getModeDiff(fsMode, vinylMode) { - var modeDiff = 0; - - if (typeof vinylMode === 'number') { - modeDiff = (vinylMode ^ fsMode) & constants.MASK_MODE; - } - - return modeDiff; -} - -function getTimesDiff(fsStat, vinylStat) { - var mtime = date(vinylStat.mtime) || 0; - if (!mtime) { - return; - } - - var atime = date(vinylStat.atime) || 0; - if (+mtime === +fsStat.mtime && +atime === +fsStat.atime) { - return; - } - - if (!atime) { - atime = date(fsStat.atime) || undefined; - } - - var timesDiff = { - mtime: vinylStat.mtime, - atime: atime, - }; - - return timesDiff; -} - -function getOwnerDiff(fsStat, vinylStat) { - if (!isValidUnixId(vinylStat.uid) && !isValidUnixId(vinylStat.gid)) { - return; - } - - if ( - (!isValidUnixId(fsStat.uid) && !isValidUnixId(vinylStat.uid)) || - (!isValidUnixId(fsStat.gid) && !isValidUnixId(vinylStat.gid)) - ) { - return; - } - - var uid = fsStat.uid; // Default to current uid. - if (isValidUnixId(vinylStat.uid)) { - uid = vinylStat.uid; - } - - var gid = fsStat.gid; // Default to current gid. - if (isValidUnixId(vinylStat.gid)) { - gid = vinylStat.gid; - } - - if (uid === fsStat.uid && gid === fsStat.gid) { - return; - } - - var ownerDiff = { - uid: uid, - gid: gid, - }; - - return ownerDiff; -} - -function isOwner(fsStat) { - var hasGetuid = typeof process.getuid === 'function'; - var hasGeteuid = typeof process.geteuid === 'function'; - - // If we don't have either, assume we don't have permissions. - // This should only happen on Windows. - // Windows basically noops fchmod and errors on futimes called on directories. - if (!hasGeteuid && !hasGetuid) { - return false; - } - - var uid; - if (hasGeteuid) { - uid = process.geteuid(); - } else { - uid = process.getuid(); - } - - if (fsStat.uid !== uid && uid !== 0) { - return false; - } - - return true; -} - -// Node 10 on Windows fails with EPERM if you stat a symlink to a directory so we recursively readlink before we reflect stats -// TODO: Remove this indirection when we drop Node 10 support -function findSymlinkHardpath(path, callback) { - fs.readlink(path, onReadlink); - - function onReadlink(readlinkErr, resolvedPath) { - if (readlinkErr) { - return callback(readlinkErr); - } - - fs.lstat(resolvedPath, onLstat); - - function onLstat(lstatErr, stat) { - if (lstatErr) { - return callback(lstatErr); - } - - if (stat.isSymbolicLink()) { - return findSymlinkHardpath(resolvedPath, callback); - } - - callback(null, resolvedPath); - } - } -} - -function reflectStat(path, file, callback) { - // Set file.stat to the reflect current state on disk - fs.stat(path, onStat); - - function onStat(statErr, stat) { - if (statErr) { - return callback(statErr); - } - - file.stat = stat; - callback(); - } -} - -function reflectLinkStat(path, file, callback) { - // Set file.stat to the reflect current state on disk - fs.lstat(path, onLstat); - - function onLstat(lstatErr, stat) { - if (lstatErr) { - return callback(lstatErr); - } - - file.stat = stat; - callback(); - } -} - -function updateMetadata(fd, file, callback) { - fs.fstat(fd, onStat); - - function onStat(statErr, stat) { - if (statErr) { - return callback(statErr); - } - - // Check if mode needs to be updated - var modeDiff = getModeDiff(stat.mode, file.stat.mode); - - // Check if atime/mtime need to be updated - var timesDiff = getTimesDiff(stat, file.stat); - - // Check if uid/gid need to be updated - var ownerDiff = getOwnerDiff(stat, file.stat); - - // Set file.stat to the reflect current state on disk - Object.assign(file.stat, stat); - - // Nothing to do - if (!modeDiff && !timesDiff && !ownerDiff) { - return callback(); - } - - // Check access, `futimes`, `fchmod` & `fchown` only work if we own - // the file, or if we are effectively root (`fchown` only when root). - if (!isOwner(stat)) { - return callback(); - } - - if (modeDiff) { - return mode(); - } - if (timesDiff) { - return times(); - } - owner(); - - function mode() { - var mode = stat.mode ^ modeDiff; - - fs.fchmod(fd, mode, onFchmod); - - function onFchmod(fchmodErr) { - if (!fchmodErr) { - file.stat.mode = mode; - } - if (timesDiff) { - return times(fchmodErr); - } - if (ownerDiff) { - return owner(fchmodErr); - } - callback(fchmodErr); - } - } - - function times(propagatedErr) { - fs.futimes(fd, timesDiff.atime, timesDiff.mtime, onFutimes); - - function onFutimes(futimesErr) { - if (!futimesErr) { - file.stat.atime = timesDiff.atime; - file.stat.mtime = timesDiff.mtime; - } - // If a filesystem doesn't implement futimes, we don't callback with the error. - // Instead we update the stats to match filesystem and clear the error. - if (futimesErr && futimesErr.code === 'ENOSYS') { - file.stat.atime = stat.atime; - file.stat.mtime = stat.mtime; - futimesErr = null; - } - if (ownerDiff) { - return owner(propagatedErr || futimesErr); - } - callback(propagatedErr || futimesErr); - } - } - - function owner(propagatedErr) { - fs.fchown(fd, ownerDiff.uid, ownerDiff.gid, onFchown); - - function onFchown(fchownErr) { - if (!fchownErr) { - file.stat.uid = ownerDiff.uid; - file.stat.gid = ownerDiff.gid; - } - callback(propagatedErr || fchownErr); - } - } - } -} - -function symlink(srcPath, destPath, opts, callback) { - // Because fs.symlink does not allow atomic overwrite option with flags, we - // delete and recreate if the link already exists and overwrite is true. - if (opts.flags === 'w') { - // TODO What happens when we call unlink with windows junctions? - fs.unlink(destPath, onUnlink); - } else { - fs.symlink(srcPath, destPath, opts.type, onSymlink); - } - - function onUnlink(unlinkErr) { - if (isFatalUnlinkError(unlinkErr)) { - return callback(unlinkErr); - } - fs.symlink(srcPath, destPath, opts.type, onSymlink); - } - - function onSymlink(symlinkErr) { - if (isFatalOverwriteError(symlinkErr, opts.flags)) { - return callback(symlinkErr); - } - callback(); - } -} - -/* - Custom writeFile implementation because we need access to the - file descriptor after the write is complete. - Most of the implementation taken from node core. - */ -function writeFile(filepath, data, options, callback) { - if (typeof options === 'function') { - callback = options; - options = {}; - } - - if (!Buffer.isBuffer(data)) { - return callback(new TypeError('Data must be a Buffer')); - } - - if (!options) { - options = {}; - } - - // Default the same as node - var mode = options.mode || constants.DEFAULT_FILE_MODE; - var flags = options.flags || 'w'; - var position = APPEND_MODE_REGEXP.test(flags) ? null : 0; - - fs.open(filepath, flags, mode, onOpen); - - function onOpen(openErr, fd) { - if (openErr) { - return onComplete(openErr); - } - - fs.write(fd, data, 0, data.length, position, onComplete); - - function onComplete(writeErr) { - callback(writeErr, fd); - } - } -} - -function noopFlush(fd, cb) { - cb(); -} - -function createWriteStream(path, options, flush) { - if (typeof options === 'function') { - flush = options; - options = null; - } - - options = options || {}; - flush = flush || noopFlush; - - var mode = options.mode || constants.DEFAULT_FILE_MODE; - var flags = options.flags || 'w'; - - var fd = null; - - return new Writable({ - mapWritable: function (data) { - if (typeof data === 'string') { - return Buffer.from(data); - } else { - return data; - } - }, - open: function (cb) { - fs.open(path, flags, mode, onOpen); - - function onOpen(openErr, openedFd) { - if (openErr) { - cb(openErr); - return; - } - - fd = openedFd; - cb(); - } - }, - destroy: function (cb) { - if (fd) { - fs.close(fd, onClose); - } else { - onClose(); - } - - function onClose(closeErr) { - fd = null; - cb(closeErr); - } - }, - write: function (data, cb) { - fs.write(fd, data, 0, data.length, null, onWrite); - - function onWrite(writeErr) { - if (writeErr) { - cb(writeErr); - return; - } - - cb(); - } - }, - final: function (cb) { - flush(fd, cb); - }, - }); -} - -module.exports = { - closeFd: closeFd, - isValidUnixId: isValidUnixId, - getFlags: getFlags, - isFatalOverwriteError: isFatalOverwriteError, - isFatalUnlinkError: isFatalUnlinkError, - getModeDiff: getModeDiff, - getTimesDiff: getTimesDiff, - getOwnerDiff: getOwnerDiff, - isOwner: isOwner, - findSymlinkHardpath: findSymlinkHardpath, - reflectStat: reflectStat, - reflectLinkStat: reflectLinkStat, - updateMetadata: updateMetadata, - symlink: symlink, - writeFile: writeFile, - createWriteStream: createWriteStream, -}; diff --git a/node_modules/vinyl-fs/lib/src/index.js b/node_modules/vinyl-fs/lib/src/index.js deleted file mode 100644 index 278f3f7..0000000 --- a/node_modules/vinyl-fs/lib/src/index.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -var gs = require('glob-stream'); -var pipeline = require('streamx').pipeline; -var toThrough = require('to-through'); -var isValidGlob = require('is-valid-glob'); -var normalizePath = require('normalize-path'); -var createResolver = require('resolve-options'); - -var config = require('./options'); -var prepare = require('./prepare'); -var wrapVinyl = require('./wrap-vinyl'); -var sourcemap = require('./sourcemap'); -var readContents = require('./read-contents'); -var resolveSymlinks = require('./resolve-symlinks'); - -function normalize(glob) { - return normalizePath(glob, false); -} - -function src(glob, opt) { - var optResolver = createResolver(config, opt); - - if (!isValidGlob(glob)) { - throw new Error('Invalid glob argument: ' + glob); - } - - if (!Array.isArray(glob)) { - glob = [glob]; - } - - glob = glob.map(normalize); - - var outputStream = pipeline( - gs(glob, opt), - wrapVinyl(optResolver), - resolveSymlinks(optResolver), - prepare(optResolver), - readContents(optResolver), - sourcemap(optResolver) - ); - - return toThrough(outputStream); -} - -module.exports = src; diff --git a/node_modules/vinyl-fs/lib/src/options.js b/node_modules/vinyl-fs/lib/src/options.js deleted file mode 100644 index e6b090c..0000000 --- a/node_modules/vinyl-fs/lib/src/options.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var DEFAULT_ENCODING = require('../constants').DEFAULT_ENCODING; - -var config = { - buffer: { - type: 'boolean', - default: true, - }, - read: { - type: 'boolean', - default: true, - }, - since: { - type: 'date', - }, - removeBOM: { - type: 'boolean', - default: true, - }, - encoding: { - type: ['string', 'boolean'], - default: DEFAULT_ENCODING, - }, - sourcemaps: { - type: 'boolean', - default: false, - }, - resolveSymlinks: { - type: 'boolean', - default: true, - }, -}; - -module.exports = config; diff --git a/node_modules/vinyl-fs/lib/src/prepare.js b/node_modules/vinyl-fs/lib/src/prepare.js deleted file mode 100644 index 715cb1e..0000000 --- a/node_modules/vinyl-fs/lib/src/prepare.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; - -function prepareRead(optResolver) { - function normalize(file, callback) { - var since = optResolver.resolve('since', file); - - if (file.stat) { - // Skip this file if since option is set and current file is too old - if (Math.max(file.stat.mtime, file.stat.ctime) <= since) { - return callback(); - } - } - - return callback(null, file); - } - - return new Transform({ - transform: normalize, - }); -} - -module.exports = prepareRead; diff --git a/node_modules/vinyl-fs/lib/src/read-contents/index.js b/node_modules/vinyl-fs/lib/src/read-contents/index.js deleted file mode 100644 index b6f1b47..0000000 --- a/node_modules/vinyl-fs/lib/src/read-contents/index.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; - -var readDir = require('./read-dir'); -var readStream = require('./read-stream'); -var readBuffer = require('./read-buffer'); -var readSymbolicLink = require('./read-symbolic-link'); - -function readContents(optResolver) { - function readFile(file, callback) { - // Skip reading contents if read option says so - var read = optResolver.resolve('read', file); - if (!read) { - return callback(null, file); - } - - // Don't fail to read a directory - if (file.isDirectory()) { - return readDir(file, optResolver, onRead); - } - - // Process symbolic links included with `resolveSymlinks` option - if (file.stat && file.stat.isSymbolicLink()) { - return readSymbolicLink(file, optResolver, onRead); - } - - // Read and pass full contents - var buffer = optResolver.resolve('buffer', file); - if (buffer) { - return readBuffer(file, optResolver, onRead); - } - - // Don't buffer anything - just pass streams - return readStream(file, optResolver, onRead); - - // This is invoked by the various readXxx modules when they've finished - // reading the contents. - function onRead(readErr) { - if (readErr) { - return callback(readErr); - } - callback(null, file); - } - } - - return new Transform({ - transform: readFile, - }); -} - -module.exports = readContents; diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js b/node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js deleted file mode 100644 index 28f9863..0000000 --- a/node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); - -var getCodec = require('../../codecs'); -var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING; - -function bufferFile(file, optResolver, onRead) { - var encoding = optResolver.resolve('encoding', file); - var codec = getCodec(encoding); - if (encoding && !codec) { - return onRead(new Error('Unsupported encoding: ' + encoding)); - } - - fs.readFile(file.path, onReadFile); - - function onReadFile(readErr, contents) { - if (readErr) { - return onRead(readErr); - } - - if (encoding) { - var removeBOM = codec.bomAware && optResolver.resolve('removeBOM', file); - - if (removeBOM || codec.enc !== DEFAULT_ENCODING) { - contents = codec.decode(contents, { removeBOM: removeBOM }); - contents = getCodec(DEFAULT_ENCODING).encode(contents); - } - } - - file.contents = contents; - - onRead(); - } -} - -module.exports = bufferFile; diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-dir.js b/node_modules/vinyl-fs/lib/src/read-contents/read-dir.js deleted file mode 100644 index be7262b..0000000 --- a/node_modules/vinyl-fs/lib/src/read-contents/read-dir.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -function readDir(file, optResolver, onRead) { - // Do nothing for now - onRead(); -} - -module.exports = readDir; diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-stream.js b/node_modules/vinyl-fs/lib/src/read-contents/read-stream.js deleted file mode 100644 index 7a35492..0000000 --- a/node_modules/vinyl-fs/lib/src/read-contents/read-stream.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); -var Composer = require('stream-composer'); - -var getCodec = require('../../codecs'); -var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING; - -function streamFile(file, optResolver, onRead) { - var encoding = optResolver.resolve('encoding', file); - var codec = getCodec(encoding); - if (encoding && !codec) { - return onRead(new Error('Unsupported encoding: ' + encoding)); - } - - var filePath = file.path; - - file.contents = new Composer({ - open: function (cb) { - var contents = fs.createReadStream(filePath); - var streams = [contents]; - - if (encoding) { - var removeBOM = - codec.bomAware && optResolver.resolve('removeBOM', file); - - if (removeBOM || codec.enc !== DEFAULT_ENCODING) { - streams.push(codec.decodeStream({ removeBOM: removeBOM })); - streams.push(getCodec(DEFAULT_ENCODING).encodeStream()); - } - } - - if (streams.length > 1) { - this.setPipeline(streams); - } else { - this.setReadable(contents); - } - - cb(); - }, - }); - - onRead(); -} - -module.exports = streamFile; diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js b/node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js deleted file mode 100644 index 47e24cd..0000000 --- a/node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); - -function readLink(file, optResolver, onRead) { - fs.readlink(file.path, onReadlink); - - function onReadlink(readErr, target) { - if (readErr) { - return onRead(readErr); - } - - // Store the link target path - file.symlink = target; - - onRead(); - } -} - -module.exports = readLink; diff --git a/node_modules/vinyl-fs/lib/src/resolve-symlinks.js b/node_modules/vinyl-fs/lib/src/resolve-symlinks.js deleted file mode 100644 index 628a001..0000000 --- a/node_modules/vinyl-fs/lib/src/resolve-symlinks.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; -var fo = require('../file-operations'); - -function resolveSymlinks(optResolver) { - // A stat property is exposed on file objects as a (wanted) side effect - function resolveFile(file, callback) { - fo.reflectLinkStat(file.path, file, onReflect); - - function onReflect(statErr) { - if (statErr) { - return callback(statErr); - } - - if (!file.stat.isSymbolicLink()) { - return callback(null, file); - } - - var resolveSymlinks = optResolver.resolve('resolveSymlinks', file); - - if (!resolveSymlinks) { - return callback(null, file); - } - - fo.findSymlinkHardpath(file.path, onSymlinkHardpath); - } - - function onSymlinkHardpath(readlinkErr, path) { - if (readlinkErr) { - return callback(readlinkErr); - } - - // Get target's stats - fo.reflectStat(path, file, onReflect); - } - } - - return new Transform({ - transform: resolveFile, - }); -} - -module.exports = resolveSymlinks; diff --git a/node_modules/vinyl-fs/lib/src/sourcemap.js b/node_modules/vinyl-fs/lib/src/sourcemap.js deleted file mode 100644 index 42893ab..0000000 --- a/node_modules/vinyl-fs/lib/src/sourcemap.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -var Transform = require('streamx').Transform; -var sourcemap = require('vinyl-sourcemap'); - -function sourcemapStream(optResolver) { - function addSourcemap(file, callback) { - var srcMap = optResolver.resolve('sourcemaps', file); - - if (!srcMap) { - return callback(null, file); - } - - sourcemap.add(file, onAdd); - - function onAdd(sourcemapErr, updatedFile) { - if (sourcemapErr) { - return callback(sourcemapErr); - } - - callback(null, updatedFile); - } - } - - return new Transform({ - transform: addSourcemap, - }); -} - -module.exports = sourcemapStream; diff --git a/node_modules/vinyl-fs/lib/src/wrap-vinyl.js b/node_modules/vinyl-fs/lib/src/wrap-vinyl.js deleted file mode 100644 index 00dffef..0000000 --- a/node_modules/vinyl-fs/lib/src/wrap-vinyl.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var File = require('vinyl'); -var Transform = require('streamx').Transform; - -function wrapVinyl() { - function wrapFile(globFile, callback) { - var file = new File(globFile); - - callback(null, file); - } - - return new Transform({ - transform: wrapFile, - }); -} - -module.exports = wrapVinyl; diff --git a/node_modules/vinyl-fs/lib/symlink/index.js b/node_modules/vinyl-fs/lib/symlink/index.js deleted file mode 100644 index 1ff977c..0000000 --- a/node_modules/vinyl-fs/lib/symlink/index.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -var lead = require('lead'); -var composer = require('stream-composer'); -var mkdirpStream = require('fs-mkdirp-stream'); -var createResolver = require('resolve-options'); - -var config = require('./options'); -var prepare = require('./prepare'); -var linkFile = require('./link-file'); - -var folderConfig = { - outFolder: { - type: 'string', - }, -}; - -function symlink(outFolder, opt) { - if (!outFolder) { - throw new Error( - 'Invalid symlink() folder argument.' + - ' Please specify a non-empty string or a function.' - ); - } - - var optResolver = createResolver(config, opt); - var folderResolver = createResolver(folderConfig, { outFolder: outFolder }); - - function dirpath(file, callback) { - var dirMode = optResolver.resolve('dirMode', file); - - callback(null, file.dirname, dirMode); - } - - var stream = composer.pipeline( - prepare(folderResolver, optResolver), - mkdirpStream(dirpath), - linkFile(optResolver) - ); - - // Sink the stream to start flowing - return lead(stream); -} - -module.exports = symlink; diff --git a/node_modules/vinyl-fs/lib/symlink/link-file.js b/node_modules/vinyl-fs/lib/symlink/link-file.js deleted file mode 100644 index fe2543a..0000000 --- a/node_modules/vinyl-fs/lib/symlink/link-file.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -var os = require('os'); -var path = require('path'); - -var Transform = require('streamx').Transform; - -var fo = require('../file-operations'); - -var isWindows = os.platform() === 'win32'; - -function linkStream(optResolver) { - function linkFile(file, callback) { - var isRelative = optResolver.resolve('relativeSymlinks', file); - var flags = fo.getFlags({ - overwrite: optResolver.resolve('overwrite', file), - append: false, - }); - - if (!isWindows) { - // On non-Windows, just use 'file' - return createLinkWithType('file'); - } - - fo.reflectStat(file.symlink, file, onReflectTarget); - - function onReflectTarget(statErr) { - if (statErr && statErr.code !== 'ENOENT') { - return callback(statErr); - } - // If target doesn't exist, the vinyl will still carry the target stats. - // Let's use those to determine which kind of dangling link to create. - - // This option provides a way to create a Junction instead of a - // Directory symlink on Windows. This comes with the following caveats: - // * NTFS Junctions cannot be relative. - // * NTFS Junctions MUST be directories. - // * NTFS Junctions must be on the same file system. - // * Most products CANNOT detect a directory is a Junction: - // This has the side effect of possibly having a whole directory - // deleted when a product is deleting the Junction directory. - // For example, JetBrains product lines will delete the entire contents - // of the TARGET directory because the product does not realize it's - // a symlink as the JVM and Node return false for isSymlink. - - // This function is Windows only, so we don't need to check again - var useJunctions = optResolver.resolve('useJunctions', file); - - var dirType = useJunctions ? 'junction' : 'dir'; - var type = !statErr && file.isDirectory() ? dirType : 'file'; - - createLinkWithType(type); - } - - function createLinkWithType(type) { - // This is done after prepare() to use the adjusted file.base property - if (isRelative && type !== 'junction') { - file.symlink = path.relative(file.base, file.symlink); - } - - var opts = { - flags: flags, - type: type, - }; - fo.symlink(file.symlink, file.path, opts, onSymlink); - } - - function onSymlink(symlinkErr) { - if (symlinkErr) { - return callback(symlinkErr); - } - - fo.reflectLinkStat(file.path, file, onReflectLink); - } - - function onReflectLink(reflectErr) { - if (reflectErr) { - return callback(reflectErr); - } - - callback(null, file); - } - } - - return new Transform({ - transform: linkFile, - }); -} - -module.exports = linkStream; diff --git a/node_modules/vinyl-fs/lib/symlink/options.js b/node_modules/vinyl-fs/lib/symlink/options.js deleted file mode 100644 index fd9e1c7..0000000 --- a/node_modules/vinyl-fs/lib/symlink/options.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -var config = { - cwd: { - type: 'string', - default: process.cwd, - }, - dirMode: { - type: 'number', - }, - overwrite: { - type: 'boolean', - default: true, - }, - relativeSymlinks: { - type: 'boolean', - default: false, - }, - // This option is ignored on non-Windows platforms - useJunctions: { - type: 'boolean', - default: true, - }, -}; - -module.exports = config; diff --git a/node_modules/vinyl-fs/lib/symlink/prepare.js b/node_modules/vinyl-fs/lib/symlink/prepare.js deleted file mode 100644 index 28aff37..0000000 --- a/node_modules/vinyl-fs/lib/symlink/prepare.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -var path = require('path'); - -var fs = require('graceful-fs'); -var Vinyl = require('vinyl'); -var Transform = require('streamx').Transform; - -function prepareSymlink(folderResolver, optResolver) { - if (!folderResolver) { - throw new Error('Invalid output folder'); - } - - function normalize(file, cb) { - if (!Vinyl.isVinyl(file)) { - return cb(new Error('Received a non-Vinyl object in `symlink()`')); - } - - // TODO: Remove this after people upgrade vinyl/transition from gulp-util - if (typeof file.isSymbolic !== 'function') { - file = new Vinyl(file); - } - - var cwd = path.resolve(optResolver.resolve('cwd', file)); - - var outFolderPath = folderResolver.resolve('outFolder', file); - if (!outFolderPath) { - return cb(new Error('Invalid output folder')); - } - var basePath = path.resolve(cwd, outFolderPath); - var writePath = path.resolve(basePath, file.relative); - - // Wire up new properties - // Note: keep the target stats for now, we may need them in link-file - file.stat = file.stat || new fs.Stats(); - file.cwd = cwd; - file.base = basePath; - // This is the path we are linking *TO* - // Use `file.symlink` if it was set in the pipeline - file.symlink = file.symlink || file.path; - file.path = writePath; - // We have to set contents to null for a link - // Otherwise `isSymbolic()` returns false - file.contents = null; - - cb(null, file); - } - - return new Transform({ - transform: normalize, - }); -} - -module.exports = prepareSymlink; diff --git a/node_modules/vinyl-fs/package.json b/node_modules/vinyl-fs/package.json deleted file mode 100644 index 31b8313..0000000 --- a/node_modules/vinyl-fs/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "vinyl-fs", - "version": "4.0.0", - "description": "Vinyl adapter for the file system.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Eric Schoffstall ", - "Blaine Bublitz " - ], - "repository": "gulpjs/vinyl-fs", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js", - "lib" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "fs-mkdirp-stream": "^2.0.1", - "glob-stream": "^8.0.0", - "graceful-fs": "^4.2.11", - "iconv-lite": "^0.6.3", - "is-valid-glob": "^1.0.0", - "lead": "^4.0.0", - "normalize-path": "3.0.0", - "resolve-options": "^2.0.0", - "stream-composer": "^1.0.2", - "streamx": "^2.14.0", - "to-through": "^3.0.0", - "value-or-function": "^4.0.0", - "vinyl": "^3.0.0", - "vinyl-sourcemap": "^2.0.0" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "expect": "^27.5.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "readable-stream": "3.6.0", - "rimraf": "^3.0.2", - "sinon": "^15.0.2" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "gulp", - "vinyl-adapter", - "vinyl", - "file", - "file system", - "fs", - "streams" - ] -} diff --git a/node_modules/vinyl-sourcemap/LICENSE b/node_modules/vinyl-sourcemap/LICENSE deleted file mode 100644 index 872f822..0000000 --- a/node_modules/vinyl-sourcemap/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017, 2022 Blaine Bublitz and Eric Schoffstall (Based on code from gulp-sourcemaps - ISC License - Copyright (c) 2014, Florian Reiterer) - -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/vinyl-sourcemap/README.md b/node_modules/vinyl-sourcemap/README.md deleted file mode 100644 index b79336c..0000000 --- a/node_modules/vinyl-sourcemap/README.md +++ /dev/null @@ -1,77 +0,0 @@ -

- - - -

- -# vinyl-sourcemap - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Add/write sourcemaps to/from Vinyl files. - -## Usage - -```js -sourcemap.add(file, function (err, updatedFile) { - // updatedFile will have a .sourceMap property -}); - -// The 2nd argument can be given as a path string -sourcemap.write(file, './maps', function (err, updatedFile, sourcemapFile) { - // sourcemapFile will be a Vinyl file to be written to some location - // updatedFile will have the .contents property updated with a sourceMappingURL that resolves to sourcemapFile -}); - -// If not defined, the sourcemap is inlined -sourcemap.write(file, function (err, updatedFile, sourcemapFile) { - // sourcemapFile is undefined - // updatedFile will have the .contents property updated with a sourceMappingURL that is an inlined sourcemap -}); -``` - -## API - -### `sourcemap.add(file, callback)` - -Takes a [Vinyl][vinyl] `file` object and a `callback` function. It attempts to parse an inline sourcemap or load an external sourcemap for the file. If a valid sourcemap is found, the `sources` & `sourcesContent` properties are resolved to actual files (if possible) and a fully resolved sourcemap is attached as `file.sourceMap`. If a sourcemap is not found, a stub sourcemap is generated for the file and attached as `file.sourceMap`. - -Once all resolution is complete, the `callback(err, updatedFile)` is called with the `updatedFile`. If an error occurs, it will be passed as `err` and `updatedFile` will be undefined. **Note:** The original file is mutated but `updatedFile` is passed to the callback as a convenience. - -If the `file` is not a Vinyl object or the contents are streaming, an Error will be passed to the `callback`. - -If the `file` has a `.sourceMap` property or the contents are null, the `callback` will be called immediately without mutation to the file. - -All filesystem operations are optional & non-fatal so any errors will not be bubbled to the `callback`. - -### `sourcemap.write(file, [outputPath,] callback)` - -Takes a [Vinyl][vinyl] `file` object, (optionally) an `outputPath` string and a `callback` function. - -If `outputPath` is not passed, an inline sourcemap will be generated from the `file.sourceMap` property and appended to the `file.contents`. Once the inline sourcemap is appended, the `callback(err, updatedFile)` is called with the `updatedFile`. If an error occurs, it will be passed as `err` and `updatedFile` will be undefined. **Note:** The original file is mutated but `updatedFile` is passed to the callback as a convenience. - -If `outputPath` is passed, a new Vinyl file will be generated using `file.cwd` and `file.base` from the original file, the path to the external sourcemap, and the `file.sourceMap` (as contents). The external location will be appended to the `file.contents` of the original file. Once the new file is created and location appended, the `callback(err, updatedFile, sourcemapFile)` is called with the `updatedFile` and the `sourcemapFile`. If an error occurs, it will be passed as `err` and `updatedFile`/`sourcemapFile` will be undefined. **Note:** The original file is mutated but `updatedFile` is passed to the callback as a convenience. - -If the `file` is not a Vinyl object or the contents are streaming, an Error will be passed to the `callback`. - -If the `file` doesn't have a `.sourceMap` property or the contents are null, the `callback` will be called immediately without mutation to the file. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/vinyl-sourcemap.svg?style=flat-square -[npm-url]: https://npmjs.com/package/vinyl-sourcemap -[npm-image]: https://img.shields.io/npm/v/vinyl-sourcemap.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/vinyl-sourcemap/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/vinyl-sourcemap/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl-sourcemap -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/vinyl-sourcemap/master.svg?style=flat-square - - - -[vinyl]: https://github.com/gulpjs/vinyl - diff --git a/node_modules/vinyl-sourcemap/index.js b/node_modules/vinyl-sourcemap/index.js deleted file mode 100644 index a7111ea..0000000 --- a/node_modules/vinyl-sourcemap/index.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -var File = require('vinyl'); -var vinylContents = require('vinyl-contents'); - -var helpers = require('./lib/helpers'); - -var PLUGIN_NAME = 'vinyl-sourcemap'; - -function add(file, callback) { - // Bail early an error if the file argument is not a Vinyl file - if (!File.isVinyl(file)) { - return callback(new Error(PLUGIN_NAME + '-add: Not a vinyl file')); - } - - // Bail early successfully if file is null or already has a sourcemap - if (file.isNull() || file.sourceMap) { - return callback(null, file); - } - - vinylContents(file, onContents); - - function onContents(err, contents) { - if (err) { - return callback(err); - } - - var state = { - path: '', // Root path for the sources in the map - map: null, - content: contents.toString(), - // TODO: handle this? - preExistingComment: null, - }; - - helpers.addSourceMaps(file, state, callback); - } -} - -function write(file, destPath, callback) { - // Check if options or a callback are passed as second argument - if (typeof destPath === 'function') { - callback = destPath; - destPath = undefined; - } - - // Bail early with an error if the file argument is not a Vinyl file - if (!File.isVinyl(file)) { - return callback(new Error(PLUGIN_NAME + '-write: Not a vinyl file')); - } - - // Bail early successfully if file is null or doesn't have sourcemap - if (file.isNull() || !file.sourceMap) { - return callback(null, file); - } - - helpers.writeSourceMaps(file, destPath, callback); -} - -module.exports = { - add: add, - write: write, -}; diff --git a/node_modules/vinyl-sourcemap/lib/helpers.js b/node_modules/vinyl-sourcemap/lib/helpers.js deleted file mode 100644 index 15cdf9d..0000000 --- a/node_modules/vinyl-sourcemap/lib/helpers.js +++ /dev/null @@ -1,349 +0,0 @@ -'use strict'; - -var path = require('path'); -var os = require('os'); -var TextDecoder = require('util').TextDecoder; - -var fs = require('graceful-fs'); -var Readable = require('streamx').Readable; -var Transform = require('streamx').Transform; -var nal = require('now-and-later'); -var File = require('vinyl'); -var convert = require('convert-source-map'); - -var urlRegex = /^(https?|webpack(-[^:]+)?):\/\//; - -var bufCR = Buffer.from('\r'); -var bufCRLF = Buffer.from('\r\n'); -var bufLF = Buffer.from('\n'); -var bufEOL = Buffer.from(os.EOL); - -var decoder = new TextDecoder('utf-8', { ignoreBOM: false }); - -function isRemoteSource(source) { - return source.match(urlRegex); -} - -function parse(data) { - try { - return JSON.parse(decoder.decode(data)); - } catch (err) { - // TODO: should this log a debug? - } -} - -function loadSourceMap(file, state, callback) { - // Try to read inline source map - state.map = convert.fromSource(state.content); - - if (state.map) { - state.map = state.map.toObject(); - // Sources in map are relative to the source file - state.path = file.dirname; - state.content = convert.removeComments(state.content); - // Remove source map comment from source - if (file.isStream()) { - file.contents = Readable.from(state.content); - } else { - file.contents = Buffer.from(state.content, 'utf8'); - } - return callback(); - } - - // Look for source map comment referencing a source map file - var mapComment = convert.mapFileCommentRegex.exec(state.content); - - var mapFile; - if (mapComment) { - mapFile = path.resolve(file.dirname, mapComment[1] || mapComment[2]); - state.content = convert.removeMapFileComments(state.content); - // Remove source map comment from source - if (file.isStream()) { - file.contents = Readable.from(state.content); - } else { - file.contents = Buffer.from(state.content, 'utf8'); - } - } else { - // If no comment try map file with same name as source file - mapFile = file.path + '.map'; - } - - // Sources in external map are relative to map file - state.path = path.dirname(mapFile); - - fs.readFile(mapFile, onRead); - - function onRead(err, data) { - if (err) { - return callback(); - } - state.map = parse(data); - callback(); - } -} - -// Fix source paths and sourceContent for imported source map -function fixImportedSourceMap(file, state, callback) { - if (!state.map) { - return callback(); - } - - state.map.sourcesContent = state.map.sourcesContent || []; - - nal.map(state.map.sources, normalizeSourcesAndContent, callback); - - function assignSourcesContent(sourceContent, idx) { - state.map.sourcesContent[idx] = sourceContent; - } - - function normalizeSourcesAndContent(sourcePath, idx, cb) { - var sourceRoot = state.map.sourceRoot || ''; - var sourceContent = state.map.sourcesContent[idx] || null; - - if (isRemoteSource(sourcePath)) { - assignSourcesContent(sourceContent, idx); - return cb(); - } - - if (state.map.sourcesContent[idx]) { - return cb(); - } - - if (sourceRoot && isRemoteSource(sourceRoot)) { - assignSourcesContent(sourceContent, idx); - return cb(); - } - - var basePath = path.resolve(file.base, sourceRoot); - var absPath = path.resolve(state.path, sourceRoot, sourcePath); - var relPath = path.relative(basePath, absPath); - var unixRelPath = normalizeRelpath(relPath); - - state.map.sources[idx] = unixRelPath; - - if (absPath !== file.path) { - // Load content from file async - return fs.readFile(absPath, onRead); - } - - // If current file: use content - assignSourcesContent(state.content, idx); - cb(); - - function onRead(err, data) { - if (err) { - assignSourcesContent(null, idx); - return cb(); - } - assignSourcesContent(decoder.decode(data), idx); - cb(); - } - } -} - -function mapsLoaded(file, state, callback) { - if (!state.map) { - state.map = { - version: 3, - names: [], - mappings: '', - sources: [normalizeRelpath(file.relative)], - sourcesContent: [state.content], - }; - } - - state.map.file = normalizeRelpath(file.relative); - file.sourceMap = state.map; - - callback(); -} - -function addSourceMaps(file, state, callback) { - var tasks = [loadSourceMap, fixImportedSourceMap, mapsLoaded]; - - function apply(fn, key, cb) { - fn(file, state, cb); - } - - nal.mapSeries(tasks, apply, done); - - function done() { - callback(null, file); - } -} - -/* Write Helpers */ -function createSourceMapFile(opts) { - return new File({ - cwd: opts.cwd, - base: opts.base, - path: opts.path, - contents: Buffer.from(JSON.stringify(opts.content)), - stat: { - isFile: function () { - return true; - }, - isDirectory: function () { - return false; - }, - isBlockDevice: function () { - return false; - }, - isCharacterDevice: function () { - return false; - }, - isSymbolicLink: function () { - return false; - }, - isFIFO: function () { - return false; - }, - isSocket: function () { - return false; - }, - }, - }); -} - -var needsMultiline = ['.css']; - -function getCommentOptions(extname) { - var opts = { - multiline: needsMultiline.indexOf(extname) !== -1, - }; - - return opts; -} - -function writeSourceMaps(file, destPath, callback) { - var sourceMapFile; - var commentOpts = getCommentOptions(file.extname); - - var comment; - if (destPath == null) { - // Encode source map into comment - comment = convert.fromObject(file.sourceMap).toComment(commentOpts); - } else { - var mapFile = path.join(destPath, file.relative) + '.map'; - var sourceMapPath = path.join(file.base, mapFile); - - // Create new sourcemap File - sourceMapFile = createSourceMapFile({ - cwd: file.cwd, - base: file.base, - path: sourceMapPath, - content: file.sourceMap, - }); - - var sourcemapLocation = path.relative(file.dirname, sourceMapPath); - - sourcemapLocation = normalizeRelpath(sourcemapLocation); - - comment = convert.generateMapFileComment(sourcemapLocation, commentOpts); - } - - // Append source map comment - file = append(file, Buffer.from(comment)); - - callback(null, file, sourceMapFile); -} - -function append(file, comment) { - if (file.isBuffer()) { - file.contents = appendBuffer(file.contents, comment); - } - - if (file.isStream()) { - file.contents = file.contents.pipe(appendStream(comment)); - } - - return file; -} - -function appendBuffer(buf1, buf2) { - var eol; - if (buf1.slice(-2).equals(bufCRLF)) { - eol = bufCRLF; - } else if (buf1.slice(-1).equals(bufLF)) { - eol = bufLF; - } else if (buf1.slice(-1).equals(bufCR)) { - eol = bufCR; - } else { - eol = bufEOL; - } - return Buffer.concat([buf1, buf2, eol]); -} - -// Implementation heavily inspired by https://github.com/maxogden/eol-stream -function appendStream(comment) { - var crAtEnd = false; - var eol = bufEOL; - - return new Transform({ - transform: detect, - flush: flush, - }); - - function detect(chunk, callback) { - var isString = typeof chunk === 'string'; - - var cr = isString ? bufCR.toString() : bufCR[0]; - var lf = isString ? bufLF.toString() : bufLF[0]; - - if (crAtEnd) { - if (chunk[0] === lf) { - eol = bufCRLF; - } else { - eol = bufCR; - } - // Reset the flag because we search for the _last_ line ending - crAtEnd = false; - return callback(null, chunk); - } - - var i = 0; - while (i < chunk.length) { - if (chunk[i] === cr) { - if (i === chunk.length - 1) { - // Need to read the next chunk to see if it is a CRLF - crAtEnd = true; - i += 1; - } else if (chunk[i + 1] === lf) { - eol = bufCRLF; - // We skip two because we saw the CRLF - i += 2; - } else { - eol = bufCR; - i += 1; - } - continue; - } - - if (chunk[i] === lf) { - eol = bufLF; - } - - i += 1; - } - - callback(null, chunk); - } - - function flush(cb) { - this.push(comment); - this.push(eol); - - cb(); - } -} - -function normalizeRelpath(fp) { - // Since we only ever operate on relative paths, - // this utility shouldn't need to handle path roots - return path.posix.normalize(fp.replace(/\\/g, '/')); -} - -module.exports = { - addSourceMaps: addSourceMaps, - writeSourceMaps: writeSourceMaps, -}; diff --git a/node_modules/vinyl-sourcemap/package.json b/node_modules/vinyl-sourcemap/package.json deleted file mode 100644 index 835a919..0000000 --- a/node_modules/vinyl-sourcemap/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "vinyl-sourcemap", - "version": "2.0.0", - "description": "Add/write sourcemaps to/from Vinyl files.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Robin Venneman", - "Blaine Bublitz " - ], - "repository": "gulpjs/vinyl-sourcemap", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js", - "lib/" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "convert-source-map": "^2.0.0", - "graceful-fs": "^4.2.10", - "now-and-later": "^3.0.0", - "streamx": "^2.12.5", - "vinyl": "^3.0.0", - "vinyl-contents": "^2.0.0" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.5.1", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "readable-stream": "^3.6.0" - }, - "nyc": { - "extension": [ - ".js" - ], - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "vinyl", - "sourcemap", - "gulp" - ] -} diff --git a/node_modules/vinyl-sourcemaps-apply/.jshintrc b/node_modules/vinyl-sourcemaps-apply/.jshintrc deleted file mode 100644 index 36a93d9..0000000 --- a/node_modules/vinyl-sourcemaps-apply/.jshintrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "node": true, - "strict": true -} \ No newline at end of file diff --git a/node_modules/vinyl-sourcemaps-apply/.npmignore b/node_modules/vinyl-sourcemaps-apply/.npmignore deleted file mode 100644 index 91dfed8..0000000 --- a/node_modules/vinyl-sourcemaps-apply/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -node_modules \ No newline at end of file diff --git a/node_modules/vinyl-sourcemaps-apply/README.md b/node_modules/vinyl-sourcemaps-apply/README.md deleted file mode 100644 index b1d2c48..0000000 --- a/node_modules/vinyl-sourcemaps-apply/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# vinyl-sourcemaps-apply - -Apply a source map to a vinyl file, merging it with preexisting source maps. - -## Usage: - -```javascript -var applySourceMap = require('vinyl-sourcemaps-apply'); -applySourceMap(vinylFile, sourceMap); -``` - -### Example (Gulp plugin): - -```javascript -var through = require('through2'); -var applySourceMap = require('vinyl-sourcemaps-apply'); -var myTransform = require('myTransform'); - -module.exports = function(options) { - - function transform(file, encoding, callback) { - // generate source maps if plugin source-map present - if (file.sourceMap) { - options.makeSourceMaps = true; - } - - // do normal plugin logic - var result = myTransform(file.contents, options); - file.contents = new Buffer(result.code); - - // apply source map to the chain - if (file.sourceMap) { - applySourceMap(file, result.map); - } - - this.push(file); - callback(); - } - - return through.obj(transform); -}; -``` \ No newline at end of file diff --git a/node_modules/vinyl-sourcemaps-apply/index.js b/node_modules/vinyl-sourcemaps-apply/index.js deleted file mode 100644 index c966b80..0000000 --- a/node_modules/vinyl-sourcemaps-apply/index.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; -var SourceMapGenerator = require('source-map').SourceMapGenerator; -var SourceMapConsumer = require('source-map').SourceMapConsumer; - -module.exports = function applySourceMap(file, sourceMap) { - if (typeof sourceMap === 'string' || sourceMap instanceof String) { - sourceMap = JSON.parse(sourceMap); - } - - if (file.sourceMap && (typeof file.sourceMap === 'string' || file.sourceMap instanceof String)) { - file.sourceMap = JSON.parse(file.sourceMap); - } - - // check source map properties - assertProperty(sourceMap, "file"); - assertProperty(sourceMap, "mappings"); - assertProperty(sourceMap, "sources"); - - // fix paths if Windows style paths - sourceMap.file = sourceMap.file.replace(/\\/g, '/'); - sourceMap.sources = sourceMap.sources.map(function(filePath) { - return filePath.replace(/\\/g, '/'); - }); - - if (file.sourceMap && file.sourceMap.mappings !== '') { - var generator = SourceMapGenerator.fromSourceMap(new SourceMapConsumer(sourceMap)); - generator.applySourceMap(new SourceMapConsumer(file.sourceMap)); - file.sourceMap = JSON.parse(generator.toString()); - } else { - file.sourceMap = sourceMap; - } -}; - -function assertProperty(sourceMap, propertyName) { - if (!sourceMap.hasOwnProperty(propertyName)) { - var e = new Error('Source map to be applied is missing the \"' + propertyName + '\" property'); - throw e; - } -} diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/CHANGELOG.md b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/CHANGELOG.md deleted file mode 100644 index 3a8c066..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/CHANGELOG.md +++ /dev/null @@ -1,301 +0,0 @@ -# Change Log - -## 0.5.6 - -* Fix for regression when people were using numbers as names in source maps. See - #236. - -## 0.5.5 - -* Fix "regression" of unsupported, implementation behavior that half the world - happens to have come to depend on. See #235. - -* Fix regression involving function hoisting in SpiderMonkey. See #233. - -## 0.5.4 - -* Large performance improvements to source-map serialization. See #228 and #229. - -## 0.5.3 - -* Do not include unnecessary distribution files. See - commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86. - -## 0.5.2 - -* Include browser distributions of the library in package.json's `files`. See - issue #212. - -## 0.5.1 - -* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See - ff05274becc9e6e1295ed60f3ea090d31d843379. - -## 0.5.0 - -* Node 0.8 is no longer supported. - -* Use webpack instead of dryice for bundling. - -* Big speedups serializing source maps. See pull request #203. - -* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that - explicitly start with the source root. See issue #199. - -## 0.4.4 - -* Fix an issue where using a `SourceMapGenerator` after having created a - `SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See - issue #191. - -* Fix an issue with where `SourceMapGenerator` would mistakenly consider - different mappings as duplicates of each other and avoid generating them. See - issue #192. - -## 0.4.3 - -* A very large number of performance improvements, particularly when parsing - source maps. Collectively about 75% of time shaved off of the source map - parsing benchmark! - -* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy - searching in the presence of a column option. See issue #177. - -* Fix a bug with joining a source and its source root when the source is above - the root. See issue #182. - -* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to - determine when all sources' contents are inlined into the source map. See - issue #190. - -## 0.4.2 - -* Add an `.npmignore` file so that the benchmarks aren't pulled down by - dependent projects. Issue #169. - -* Add an optional `column` argument to - `SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines - with no mappings. Issues #172 and #173. - -## 0.4.1 - -* Fix accidentally defining a global variable. #170. - -## 0.4.0 - -* The default direction for fuzzy searching was changed back to its original - direction. See #164. - -* There is now a `bias` option you can supply to `SourceMapConsumer` to control - the fuzzy searching direction. See #167. - -* About an 8% speed up in parsing source maps. See #159. - -* Added a benchmark for parsing and generating source maps. - -## 0.3.0 - -* Change the default direction that searching for positions fuzzes when there is - not an exact match. See #154. - -* Support for environments using json2.js for JSON serialization. See #156. - -## 0.2.0 - -* Support for consuming "indexed" source maps which do not have any remote - sections. See pull request #127. This introduces a minor backwards - incompatibility if you are monkey patching `SourceMapConsumer.prototype` - methods. - -## 0.1.43 - -* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue - #148 for some discussion and issues #150, #151, and #152 for implementations. - -## 0.1.42 - -* Fix an issue where `SourceNode`s from different versions of the source-map - library couldn't be used in conjunction with each other. See issue #142. - -## 0.1.41 - -* Fix a bug with getting the source content of relative sources with a "./" - prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768). - -* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the - column span of each mapping. - -* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find - all generated positions associated with a given original source and line. - -## 0.1.40 - -* Performance improvements for parsing source maps in SourceMapConsumer. - -## 0.1.39 - -* Fix a bug where setting a source's contents to null before any source content - had been set before threw a TypeError. See issue #131. - -## 0.1.38 - -* Fix a bug where finding relative paths from an empty path were creating - absolute paths. See issue #129. - -## 0.1.37 - -* Fix a bug where if the source root was an empty string, relative source paths - would turn into absolute source paths. Issue #124. - -## 0.1.36 - -* Allow the `names` mapping property to be an empty string. Issue #121. - -## 0.1.35 - -* A third optional parameter was added to `SourceNode.fromStringWithSourceMap` - to specify a path that relative sources in the second parameter should be - relative to. Issue #105. - -* If no file property is given to a `SourceMapGenerator`, then the resulting - source map will no longer have a `null` file property. The property will - simply not exist. Issue #104. - -* Fixed a bug where consecutive newlines were ignored in `SourceNode`s. - Issue #116. - -## 0.1.34 - -* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103. - -* Fix bug involving source contents and the - `SourceMapGenerator.prototype.applySourceMap`. Issue #100. - -## 0.1.33 - -* Fix some edge cases surrounding path joining and URL resolution. - -* Add a third parameter for relative path to - `SourceMapGenerator.prototype.applySourceMap`. - -* Fix issues with mappings and EOLs. - -## 0.1.32 - -* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns - (issue 92). - -* Fixed test runner to actually report number of failed tests as its process - exit code. - -* Fixed a typo when reporting bad mappings (issue 87). - -## 0.1.31 - -* Delay parsing the mappings in SourceMapConsumer until queried for a source - location. - -* Support Sass source maps (which at the time of writing deviate from the spec - in small ways) in SourceMapConsumer. - -## 0.1.30 - -* Do not join source root with a source, when the source is a data URI. - -* Extend the test runner to allow running single specific test files at a time. - -* Performance improvements in `SourceNode.prototype.walk` and - `SourceMapConsumer.prototype.eachMapping`. - -* Source map browser builds will now work inside Workers. - -* Better error messages when attempting to add an invalid mapping to a - `SourceMapGenerator`. - -## 0.1.29 - -* Allow duplicate entries in the `names` and `sources` arrays of source maps - (usually from TypeScript) we are parsing. Fixes github issue 72. - -## 0.1.28 - -* Skip duplicate mappings when creating source maps from SourceNode; github - issue 75. - -## 0.1.27 - -* Don't throw an error when the `file` property is missing in SourceMapConsumer, - we don't use it anyway. - -## 0.1.26 - -* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70. - -## 0.1.25 - -* Make compatible with browserify - -## 0.1.24 - -* Fix issue with absolute paths and `file://` URIs. See - https://bugzilla.mozilla.org/show_bug.cgi?id=885597 - -## 0.1.23 - -* Fix issue with absolute paths and sourcesContent, github issue 64. - -## 0.1.22 - -* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21. - -## 0.1.21 - -* Fixed handling of sources that start with a slash so that they are relative to - the source root's host. - -## 0.1.20 - -* Fixed github issue #43: absolute URLs aren't joined with the source root - anymore. - -## 0.1.19 - -* Using Travis CI to run tests. - -## 0.1.18 - -* Fixed a bug in the handling of sourceRoot. - -## 0.1.17 - -* Added SourceNode.fromStringWithSourceMap. - -## 0.1.16 - -* Added missing documentation. - -* Fixed the generating of empty mappings in SourceNode. - -## 0.1.15 - -* Added SourceMapGenerator.applySourceMap. - -## 0.1.14 - -* The sourceRoot is now handled consistently. - -## 0.1.13 - -* Added SourceMapGenerator.fromSourceMap. - -## 0.1.12 - -* SourceNode now generates empty mappings too. - -## 0.1.11 - -* Added name support to SourceNode. - -## 0.1.10 - -* Added sourcesContent support to the customer and generator. diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/LICENSE b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/LICENSE deleted file mode 100644 index ed1b7cf..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ - -Copyright (c) 2009-2011, Mozilla Foundation 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. - -* Neither the names of the Mozilla Foundation nor the names of project - 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/vinyl-sourcemaps-apply/node_modules/source-map/README.md b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/README.md deleted file mode 100644 index 3281339..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/README.md +++ /dev/null @@ -1,729 +0,0 @@ -# Source Map - -[![Build Status](https://travis-ci.org/mozilla/source-map.png?branch=master)](https://travis-ci.org/mozilla/source-map) - -[![NPM](https://nodei.co/npm/source-map.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map) - -This is a library to generate and consume the source map format -[described here][format]. - -[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit - -## Use with Node - - $ npm install source-map - -## Use on the Web - - - --------------------------------------------------------------------------------- - - - - - -## Table of Contents - -- [Examples](#examples) - - [Consuming a source map](#consuming-a-source-map) - - [Generating a source map](#generating-a-source-map) - - [With SourceNode (high level API)](#with-sourcenode-high-level-api) - - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) -- [API](#api) - - [SourceMapConsumer](#sourcemapconsumer) - - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) - - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) - - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) - - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) - - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) - - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) - - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) - - [SourceMapGenerator](#sourcemapgenerator) - - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) - - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) - - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) - - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) - - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) - - [SourceNode](#sourcenode) - - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) - - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) - - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) - - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) - - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) - - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) - - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) - - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) - - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) - - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) - - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) - - - -## Examples - -### Consuming a source map - -```js -var rawSourceMap = { - version: 3, - file: 'min.js', - names: ['bar', 'baz', 'n'], - sources: ['one.js', 'two.js'], - sourceRoot: 'http://example.com/www/js/', - mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' -}; - -var smc = new SourceMapConsumer(rawSourceMap); - -console.log(smc.sources); -// [ 'http://example.com/www/js/one.js', -// 'http://example.com/www/js/two.js' ] - -console.log(smc.originalPositionFor({ - line: 2, - column: 28 -})); -// { source: 'http://example.com/www/js/two.js', -// line: 2, -// column: 10, -// name: 'n' } - -console.log(smc.generatedPositionFor({ - source: 'http://example.com/www/js/two.js', - line: 2, - column: 10 -})); -// { line: 2, column: 28 } - -smc.eachMapping(function (m) { - // ... -}); -``` - -### Generating a source map - -In depth guide: -[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) - -#### With SourceNode (high level API) - -```js -function compile(ast) { - switch (ast.type) { - case 'BinaryExpression': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - [compile(ast.left), " + ", compile(ast.right)] - ); - case 'Literal': - return new SourceNode( - ast.location.line, - ast.location.column, - ast.location.source, - String(ast.value) - ); - // ... - default: - throw new Error("Bad AST"); - } -} - -var ast = parse("40 + 2", "add.js"); -console.log(compile(ast).toStringWithSourceMap({ - file: 'add.js' -})); -// { code: '40 + 2', -// map: [object SourceMapGenerator] } -``` - -#### With SourceMapGenerator (low level API) - -```js -var map = new SourceMapGenerator({ - file: "source-mapped.js" -}); - -map.addMapping({ - generated: { - line: 10, - column: 35 - }, - source: "foo.js", - original: { - line: 33, - column: 2 - }, - name: "christopher" -}); - -console.log(map.toString()); -// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' -``` - -## API - -Get a reference to the module: - -```js -// Node.js -var sourceMap = require('source-map'); - -// Browser builds -var sourceMap = window.sourceMap; - -// Inside Firefox -const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); -``` - -### SourceMapConsumer - -A SourceMapConsumer instance represents a parsed source map which we can query -for information about the original file positions by giving it a file position -in the generated source. - -#### new SourceMapConsumer(rawSourceMap) - -The only parameter is the raw source map (either as a string which can be -`JSON.parse`'d, or an object). According to the spec, source maps have the -following attributes: - -* `version`: Which version of the source map spec this map is following. - -* `sources`: An array of URLs to the original source files. - -* `names`: An array of identifiers which can be referenced by individual - mappings. - -* `sourceRoot`: Optional. The URL root from which all sources are relative. - -* `sourcesContent`: Optional. An array of contents of the original source files. - -* `mappings`: A string of base64 VLQs which contain the actual mappings. - -* `file`: Optional. The generated filename this source map is associated with. - -```js -var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); -``` - -#### SourceMapConsumer.prototype.computeColumnSpans() - -Compute the last column for each generated mapping. The last column is -inclusive. - -```js -// Before: -consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] - -consumer.computeColumnSpans(); - -// After: -consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1, -// lastColumn: 9 }, -// { line: 2, -// column: 10, -// lastColumn: 19 }, -// { line: 2, -// column: 20, -// lastColumn: Infinity } ] - -``` - -#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) - -Returns the original source, line, and column information for the generated -source's line and column positions provided. The only argument is an object with -the following properties: - -* `line`: The line number in the generated source. - -* `column`: The column number in the generated source. - -* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or - `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest - element that is smaller than or greater than the one we are searching for, - respectively, if the exact element cannot be found. Defaults to - `SourceMapConsumer.GREATEST_LOWER_BOUND`. - -and an object is returned with the following properties: - -* `source`: The original source file, or null if this information is not - available. - -* `line`: The line number in the original source, or null if this information is - not available. - -* `column`: The column number in the original source, or null if this - information is not available. - -* `name`: The original identifier, or null if this information is not available. - -```js -consumer.originalPositionFor({ line: 2, column: 10 }) -// { source: 'foo.coffee', -// line: 2, -// column: 2, -// name: null } - -consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) -// { source: null, -// line: null, -// column: null, -// name: null } -``` - -#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) - -Returns the generated line and column information for the original source, -line, and column positions provided. The only argument is an object with -the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. - -* `column`: The column number in the original source. - -and an object is returned with the following properties: - -* `line`: The line number in the generated source, or null. - -* `column`: The column number in the generated source, or null. - -```js -consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) -// { line: 1, -// column: 56 } -``` - -#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) - -Returns all generated line and column information for the original source, line, -and column provided. If no column is provided, returns all mappings -corresponding to a either the line we are searching for or the next closest line -that has any mappings. Otherwise, returns all mappings corresponding to the -given line and either the column we are searching for or the next closest column -that has any offsets. - -The only argument is an object with the following properties: - -* `source`: The filename of the original source. - -* `line`: The line number in the original source. - -* `column`: Optional. The column number in the original source. - -and an array of objects is returned, each with the following properties: - -* `line`: The line number in the generated source, or null. - -* `column`: The column number in the generated source, or null. - -```js -consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) -// [ { line: 2, -// column: 1 }, -// { line: 2, -// column: 10 }, -// { line: 2, -// column: 20 } ] -``` - -#### SourceMapConsumer.prototype.hasContentsOfAllSources() - -Return true if we have the embedded source content for every source listed in -the source map, false otherwise. - -In other words, if this method returns `true`, then -`consumer.sourceContentFor(s)` will succeed for every source `s` in -`consumer.sources`. - -```js -// ... -if (consumer.hasContentsOfAllSources()) { - consumerReadyCallback(consumer); -} else { - fetchSources(consumer, consumerReadyCallback); -} -// ... -``` - -#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) - -Returns the original source content for the source provided. The only -argument is the URL of the original source file. - -If the source content for the given source is not found, then an error is -thrown. Optionally, pass `true` as the second param to have `null` returned -instead. - -```js -consumer.sources -// [ "my-cool-lib.clj" ] - -consumer.sourceContentFor("my-cool-lib.clj") -// "..." - -consumer.sourceContentFor("this is not in the source map"); -// Error: "this is not in the source map" is not in the source map - -consumer.sourceContentFor("this is not in the source map", true); -// null -``` - -#### SourceMapConsumer.prototype.eachMapping(callback, context, order) - -Iterate over each mapping between an original source/line/column and a -generated line/column in this source map. - -* `callback`: The function that is called with each mapping. Mappings have the - form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, - name }` - -* `context`: Optional. If specified, this object will be the value of `this` - every time that `callback` is called. - -* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or - `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over - the mappings sorted by the generated file's line/column order or the - original's source/line/column order, respectively. Defaults to - `SourceMapConsumer.GENERATED_ORDER`. - -```js -consumer.eachMapping(function (m) { console.log(m); }) -// ... -// { source: 'illmatic.js', -// generatedLine: 1, -// generatedColumn: 0, -// originalLine: 1, -// originalColumn: 0, -// name: null } -// { source: 'illmatic.js', -// generatedLine: 2, -// generatedColumn: 0, -// originalLine: 2, -// originalColumn: 0, -// name: null } -// ... -``` -### SourceMapGenerator - -An instance of the SourceMapGenerator represents a source map which is being -built incrementally. - -#### new SourceMapGenerator([startOfSourceMap]) - -You may pass an object with the following properties: - -* `file`: The filename of the generated source that this source map is - associated with. - -* `sourceRoot`: A root for all relative URLs in this source map. - -* `skipValidation`: Optional. When `true`, disables validation of mappings as - they are added. This can improve performance but should be used with - discretion, as a last resort. Even then, one should avoid using this flag when - running tests, if possible. - -```js -var generator = new sourceMap.SourceMapGenerator({ - file: "my-generated-javascript-file.js", - sourceRoot: "http://example.com/app/js/" -}); -``` - -#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) - -Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. - -* `sourceMapConsumer` The SourceMap. - -```js -var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); -``` - -#### SourceMapGenerator.prototype.addMapping(mapping) - -Add a single mapping from original source line and column to the generated -source's line and column for this source map being created. The mapping object -should have the following properties: - -* `generated`: An object with the generated line and column positions. - -* `original`: An object with the original line and column positions. - -* `source`: The original source file (relative to the sourceRoot). - -* `name`: An optional original token name for this mapping. - -```js -generator.addMapping({ - source: "module-one.scm", - original: { line: 128, column: 0 }, - generated: { line: 3, column: 456 } -}) -``` - -#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for an original source file. - -* `sourceFile` the URL of the original source file. - -* `sourceContent` the content of the source file. - -```js -generator.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) - -Applies a SourceMap for a source file to the SourceMap. -Each mapping to the supplied source file is rewritten using the -supplied SourceMap. Note: The resolution for the resulting mappings -is the minimum of this map and the supplied map. - -* `sourceMapConsumer`: The SourceMap to be applied. - -* `sourceFile`: Optional. The filename of the source file. - If omitted, sourceMapConsumer.file will be used, if it exists. - Otherwise an error will be thrown. - -* `sourceMapPath`: Optional. The dirname of the path to the SourceMap - to be applied. If relative, it is relative to the SourceMap. - - This parameter is needed when the two SourceMaps aren't in the same - directory, and the SourceMap to be applied contains relative source - paths. If so, those relative source paths need to be rewritten - relative to the SourceMap. - - If omitted, it is assumed that both SourceMaps are in the same directory, - thus not needing any rewriting. (Supplying `'.'` has the same effect.) - -#### SourceMapGenerator.prototype.toString() - -Renders the source map being generated to a string. - -```js -generator.toString() -// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' -``` - -### SourceNode - -SourceNodes provide a way to abstract over interpolating and/or concatenating -snippets of generated JavaScript source code, while maintaining the line and -column information associated between those snippets and the original source -code. This is useful as the final intermediate representation a compiler might -use before outputting the generated JS and source map. - -#### new SourceNode([line, column, source[, chunk[, name]]]) - -* `line`: The original line number associated with this source node, or null if - it isn't associated with an original line. - -* `column`: The original column number associated with this source node, or null - if it isn't associated with an original column. - -* `source`: The original source's filename; null if no filename is provided. - -* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see - below. - -* `name`: Optional. The original identifier. - -```js -var node = new SourceNode(1, 2, "a.cpp", [ - new SourceNode(3, 4, "b.cpp", "extern int status;\n"), - new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), - new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), -]); -``` - -#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) - -Creates a SourceNode from generated code and a SourceMapConsumer. - -* `code`: The generated code - -* `sourceMapConsumer` The SourceMap for the generated code - -* `relativePath` The optional path that relative sources in `sourceMapConsumer` - should be relative to. - -```js -var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); -var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), - consumer); -``` - -#### SourceNode.prototype.add(chunk) - -Add a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.add(" + "); -node.add(otherNode); -node.add([leftHandOperandNode, " + ", rightHandOperandNode]); -``` - -#### SourceNode.prototype.prepend(chunk) - -Prepend a chunk of generated JS to this source node. - -* `chunk`: A string snippet of generated JS code, another instance of - `SourceNode`, or an array where each member is one of those things. - -```js -node.prepend("/** Build Id: f783haef86324gf **/\n\n"); -``` - -#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) - -Set the source content for a source file. This will be added to the -`SourceMap` in the `sourcesContent` field. - -* `sourceFile`: The filename of the source file - -* `sourceContent`: The content of the source file - -```js -node.setSourceContent("module-one.scm", - fs.readFileSync("path/to/module-one.scm")) -``` - -#### SourceNode.prototype.walk(fn) - -Walk over the tree of JS snippets in this node and its children. The walking -function is called once for each snippet of JS and is passed that snippet and -the its original associated source's line/column location. - -* `fn`: The traversal function. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.walk(function (code, loc) { console.log("WALK:", code, loc); }) -// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } -// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } -// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } -// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } -``` - -#### SourceNode.prototype.walkSourceContents(fn) - -Walk over the tree of SourceNodes. The walking function is called for each -source file content and is passed the filename and source content. - -* `fn`: The traversal function. - -```js -var a = new SourceNode(1, 2, "a.js", "generated from a"); -a.setSourceContent("a.js", "original a"); -var b = new SourceNode(1, 2, "b.js", "generated from b"); -b.setSourceContent("b.js", "original b"); -var c = new SourceNode(1, 2, "c.js", "generated from c"); -c.setSourceContent("c.js", "original c"); - -var node = new SourceNode(null, null, null, [a, b, c]); -node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) -// WALK: a.js : original a -// WALK: b.js : original b -// WALK: c.js : original c -``` - -#### SourceNode.prototype.join(sep) - -Like `Array.prototype.join` except for SourceNodes. Inserts the separator -between each of this source node's children. - -* `sep`: The separator. - -```js -var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); -var operand = new SourceNode(3, 4, "a.rs", "="); -var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); - -var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); -var joinedNode = node.join(" "); -``` - -#### SourceNode.prototype.replaceRight(pattern, replacement) - -Call `String.prototype.replace` on the very right-most source snippet. Useful -for trimming white space from the end of a source node, etc. - -* `pattern`: The pattern to replace. - -* `replacement`: The thing to replace the pattern with. - -```js -// Trim trailing white space. -node.replaceRight(/\s*$/, ""); -``` - -#### SourceNode.prototype.toString() - -Return the string representation of this source node. Walks over the tree and -concatenates all the various snippets together to one string. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toString() -// 'unodostresquatro' -``` - -#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) - -Returns the string representation of this tree of source nodes, plus a -SourceMapGenerator which contains all the mappings between the generated and -original sources. - -The arguments are the same as those to `new SourceMapGenerator`. - -```js -var node = new SourceNode(1, 2, "a.js", [ - new SourceNode(3, 4, "b.js", "uno"), - "dos", - [ - "tres", - new SourceNode(5, 6, "c.js", "quatro") - ] -]); - -node.toStringWithSourceMap({ file: "my-output-file.js" }) -// { code: 'unodostresquatro', -// map: [object SourceMapGenerator] } -``` diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.debug.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.debug.js deleted file mode 100644 index b5ab638..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.debug.js +++ /dev/null @@ -1,3091 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ - exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { - throw new Error( - 'original.line and original.column are not numbers -- you probably meant to omit ' + - 'the original mapping entirely and only map the generated position. If so, pass ' + - 'null for the original mapping instead of an object with empty or null values.' - ); - } - - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. 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 Google Inc. 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 - * OWNER 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. - */ - - var base64 = __webpack_require__(3); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); - }()); - - function identity (s) { - return s; - } - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - - return aStr; - } - exports.toSetString = supportsNullProto ? identity : toSetString; - - function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; - } - exports.fromSetString = supportsNullProto ? identity : fromSetString; - - function isProtoString(s) { - if (!s) { - return false; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; - } - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[remainingLinesIndex]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[remainingLinesIndex]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCBlNDczOGZjNzJhN2IyMzAzOTg4OSIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC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pbmFsQ29sdW1uXG4gICAgICAgIH0pO1xuICAgICAgICBpZiAob3JpZ2luYWwuc291cmNlICE9IG51bGwpIHtcbiAgICAgICAgICAvLyBDb3B5IG1hcHBpbmdcbiAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IG9yaWdpbmFsLnNvdXJjZTtcbiAgICAgICAgICBpZiAoYVNvdXJjZU1hcFBhdGggIT0gbnVsbCkge1xuICAgICAgICAgICAgbWFwcGluZy5zb3VyY2UgPSB1dGlsLmpvaW4oYVNvdXJjZU1hcFBhdGgsIG1hcHBpbmcuc291cmNlKVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbWFwcGluZy5zb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsTGluZSA9IG9yaWdpbmFsLmxpbmU7XG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgICAgICBpZiAob3JpZ2luYWwubmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLm5hbWUgPSBvcmlnaW5hbC5uYW1lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICB2YXIgc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICBpZiAoc291cmNlICE9IG51bGwgJiYgIW5ld1NvdXJjZXMuaGFzKHNvdXJjZSkpIHtcbiAgICAgICAgbmV3U291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgIH1cblxuICAgICAgdmFyIG5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICBpZiAobmFtZSAhPSBudWxsICYmICFuZXdOYW1lcy5oYXMobmFtZSkpIHtcbiAgICAgICAgbmV3TmFtZXMuYWRkKG5h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mU6IGxpbmUsXG4gICAgICBvcmlnaW5hbENvbHVtbjogdXRpbC5nZXRBcmcoYUFyZ3MsICdjb2x1bW4nLCAwKVxuICAgIH07XG5cbiAgICBpZiAodGhpcy5zb3VyY2VSb290ICE9IG51bGwpIHtcbiAgICAgIG5lZWRsZS5zb3VyY2UgPSB1dGlsLnJlbGF0aXZlKHRoaXMuc291cmNlUm9vdCwgbmVlZGxlLnNvdXJjZSk7XG4gICAgfVxuICAgIGlmICghdGhpcy5fc291cmNlcy5oYXMobmVlZGxlLnNvdXJjZSkpIHtcbiAgICAgIHJldHVybiBbXTtcbiAgICB9XG4gICAgbmVlZGxlLnNvdXJjZSA9IHRoaXMuX3NvdXJjZXMuaW5kZXhPZihuZWVkbGUuc291cmNlKTtcblxuICAgIHZhciBtYXBwaW5ncyA9IFtdO1xuXG4gICAgdmFyIGluZGV4ID0gdGhpcy5fZmluZE1hcHBpbmcobmVlZGxlLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuX29yaWdpbmFsTWFwcGluZ3MsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXCJvcmlnaW5hbExpbmVcIixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIm9yaWdpbmFsQ29sdW1uXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXRpbC5jb21wYXJlQnlPcmlnaW5hbFBvc2l0aW9ucyxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiaW5hcnlTZWFyY2guTEVBU1RfVVBQRVJfQk9VTkQpO1xuICAgIGlmIChpbmRleCA+PSAwKSB7XG4gICAgICB2YXIgbWFwcGluZyA9IHRoaXMuX29yaWdpbmFsTWFwcGluZ3NbaW5kZXhdO1xuXG4gICAgICBpZiAoYUFyZ3MuY29sdW1uID09PSB1bmRlZmluZWQpIHtcbiAgICAgICAgdmFyIG9yaWdpbmFsTGluZSA9IG1hcHBpbmcub3JpZ2luY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c2VnbWVudCA9IFtdO1xuICAgICAgICAgIHdoaWxlIChpbmRleCA8IGVuZCkge1xuICAgICAgICAgICAgYmFzZTY0VkxRLmRlY29kZShhU3RyLCBpbmRleCwgdGVtcCk7XG4gICAgICAgICAgICB2YWx1ZSA9IHRlbXAudmFsdWU7XG4gICAgICAgICAgICBpbmRleCA9IHRlbXAucmVzdDtcbiAgICAgICAgICAgIHNlZ21lbnQucHVzaCh2YWx1ZSk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAyKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlLCBidXQgbm8gbGluZSBhbmQgY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHNlZ21lbnQubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ZvdW5kIGEgc291cmNlIGFuZCBsaW5lLCBidXQgbm8gY29sdW1uJyk7XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgY2FjaGVkU2VnbWVudHNbc3RyXSA9IHNlZ21lbnQ7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBHZW5lcmF0ZWQgY29sdW1uLlxuICAgICAgICBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbiA9IHByZXZpb3VzR2VuZXJhdGVkQ29sdW1uICsgc2VnbWVudFswXTtcbiAgICAgICAgcHJldmlvdXNHZW5lcmF0ZWRDb2x1bW4gPSBtYXBwaW5nLmdlbmVyYXRlZENvbHVtbjtcblxuICAgICAgICBpZiAoc2VnbWVudC5sZW5ndGggPiAxKSB7XG4gICAgICAgICAgLy8gT3JpZ2luYWwgc291cmNlLlxuICAgICAgICAgIG1hcHBpbmcuc291cmNlID0gcHJldmlvdXNTb3VyY2UgKyBzZWdtZW50WzFdO1xuICAgICAgICAgIHByZXZpb3VzU291cmNlICs9IHNlZ21lbnRbMV07XG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c291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBzb3VyY2UgPSB1dGlsLmpvaW4odGhpcy5zb3VyY2VSb290LCBzb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICB2YXIgbmFtZSA9IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICduYW1lJywgbnVsbCk7XG4gICAgICAgIGlmIChuYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgbmFtZSA9IHRoaXMuX25hbWVzLmF0KG5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgbGluZTogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsQ29sdW1uJywgbnVsbCksXG4gICAgICAgICAgbmFtZTogbmFtZVxuICAgICAgICB9O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBzb3VyY2U6IG51bGwsXG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgbmFtZTogbnVsbFxuICAgIH07XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuaGFzQ29udGVudHNPZkFsbFNvdXJjZXMgPVxuICBmdW5jdGlvbiBCYXNpY1NvdXJjZU1hcENvbnN1bWVyX2hhc0NvbnRlbnRzT2ZBbGxTb3VyY2VzKCkge1xuICAgIGlmICghdGhpcy5zb3VyY2VzQ29udGVudCkge1xuICAgICAgcmV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C5saW5lLFxuICAgICAgICAgIGNvbHVtbjogZ2VuZXJhdGVkLmNvbHVtblxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIGxhc3RPcmlnaW5hbFNvdXJjZSA9IG51bGw7XG4gICAgICBzb3VyY2VNYXBwaW5nQWN0aXZlID0gZmFsc2U7XG4gICAgfVxuICAgIGZvciAodmFyIGlkeCA9IDAsIGxlbmd0aCA9IGNodW5rLmxlbmd0aDsgaWR4IDwgbGVuZ3RoOyBpZHgrKykge1xuICAgICAgaWYgKGNodW5rLmNoYXJDb2RlQXQoaWR4KSA9PT0gTkVXTElORV9DT0RFKSB7XG4gICAgICAgIGdlbmVyYXRlZC5saW5lKys7XG4gICAgICAgIGdlbmVyYXRlZC5jb2x1bW4gPSAwO1xuICAgICAgICAvLyBNYXBwaW5ncyBlbmQgYXQgZW9sXG4gICAgICAgIGlmIChpZHggKyAxID09PSBsZW5ndGgpIHtcbiAgICAgICAgICBsYXN0T3JpZ2luYWxTb3VyY2UgPSBudWxsO1xuICAgICAgICAgIHNvdXJjZU1hcHBpbmdBY3RpdmUgPSBmYWxzZTtcbiAgICAgICAgfSBlbHNlIGlmIChzb3VyY2VNYXBwaW5nQWN0aXZlKSB7XG4gICAgICAgICAgbWFwLmFkZE1hcHBpbmcoe1xuICAgICAgICAgICAgc291cmNlOiBvcmlnaW5hbC5zb3VyY2UsXG4gICAgICAgICAgICBvcmlnaW5hbDoge1xuICAgICAgICAgICAgICBsaW5lOiBvcmlnaW5hbC5saW5lLFxuICAgICAgICAgICAgICBjb2x1bW46IG9yaWdpbmFsLmNvbHVtblxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGdlbmVyYXRlZDoge1xuICAgICAgICAgICAgICBsaW5lOiBnZW5lcmF0ZWQubGluZSxcbiAgICAgICAgICAgICAgY29sdW1uOiBnZW5lcmF0ZWQuY29sdW1uXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgbmFtZTogb3JpZ2luYWwubmFtZVxuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBnZW5lcmF0ZWQuY29sdW1uKys7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbiAgdGhpcy53YWxrU291cmNlQ29udGVudHMoZnVuY3Rpb24gKHNvdXJjZUZpbGUsIHNvdXJjZUNvbnRlbnQpIHtcbiAgICBtYXAuc2V0U291cmNlQ29udGVudChzb3VyY2VGaWxlLCBzb3VyY2VDb250ZW50KTtcbiAgfSk7XG5cbiAgcmV0dXJuIHsgY29kZTogZ2VuZXJhdGVkLmNvZGUsIG1hcDogbWFwIH07XG59O1xuXG5leHBvcnRzLlNvdXJjZU5vZGUgPSBTb3VyY2VOb2RlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9saWIvc291cmNlLW5vZGUuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJzb3VyY2VSb290IjoiIn0= \ No newline at end of file diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.js deleted file mode 100644 index 4e630e2..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.js +++ /dev/null @@ -1,3090 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ - exports.SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).MappingList; - - /** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ - function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - - /** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - - /** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - - /** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { - throw new Error( - 'original.line and original.column are not numbers -- you probably meant to omit ' + - 'the original mapping entirely and only map the generated position. If so, pass ' + - 'null for the original mapping instead of an object with empty or null values.' - ); - } - - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - - /** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - - /** - * Render the source map being generated to a string. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. 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 Google Inc. 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 - * OWNER 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. - */ - - var base64 = __webpack_require__(3); - - // A single base 64 digit can contain 6 bits of data. For the base 64 variable - // length quantities we use in the source map spec, the first bit is the sign, - // the next four bits are the actual value, and the 6th bit is the - // continuation bit. The continuation bit tells us whether there are more - // digits in this value following this digit. - // - // Continuation - // | Sign - // | | - // V V - // 101011 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var VLQ_CONTINUATION_BIT = VLQ_BASE; - - /** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ - function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; - } - - /** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - - /** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ - exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - /** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ - function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; - } - exports.urlParse = urlParse; - - function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; - } - exports.urlGenerate = urlGenerate; - - /** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; - } - exports.normalize = normalize; - - /** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ - function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; - } - exports.join = join; - - exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); - }; - - /** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ - function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); - } - exports.relative = relative; - - var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); - }()); - - function identity (s) { - return s; - } - - /** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ - function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - - return aStr; - } - exports.toSetString = supportsNullProto ? identity : toSetString; - - function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; - } - exports.fromSetString = supportsNullProto ? identity : fromSetString; - - function isProtoString(s) { - if (!s) { - return false; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; - } - - /** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ - function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByOriginalPositions = compareByOriginalPositions; - - /** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ - function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; - } - exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - - function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; - } - - /** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ - function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); - } - exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; - }; - - /** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); - }; - - /** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; - } - - /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; - } - - /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } - }; - - /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__generatedMappings` and `__originalMappings` are arrays that hold the - // parsed mapping coordinates from the source map's "mappings" attribute. They - // are lazily instantiated, accessed via the `_generatedMappings` and - // `_originalMappings` getters respectively, and we only parse the mappings - // and create these arrays once queried for a source location. We jump through - // these hoops because there can be many thousands of mappings, and parsing - // them is expensive, so we only want to do it if we must. - // - // Each object in the arrays is of the form: - // - // { - // generatedLine: The line number in the generated code, - // generatedColumn: The column number in the generated code, - // source: The path to the original source file that generated this - // chunk of code, - // originalLine: The line number in the original source that - // corresponds to this chunk of generated code, - // originalColumn: The column number in the original source that - // corresponds to this chunk of generated code, - // name: The name of the original symbol which generated this chunk of - // code. - // } - // - // All properties except for `generatedLine` and `generatedColumn` can be - // `null`. - // - // `_generatedMappings` is ordered by the generated positions. - // - // `_originalMappings` is ordered by the original positions. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - - /** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - exports.SourceMapConsumer = SourceMapConsumer; - - /** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ - function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; - } - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - - /** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ - function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } - }); - - /** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - - /** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - - /** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - - /** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - - /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - exports.GREATEST_LOWER_BOUND = 1; - exports.LEAST_UPPER_BOUND = 2; - - /** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ - function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } - } - - /** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ - exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- Mode: js; js-indent-level: 2; -*- */ - /* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var NEWLINE_CODE = 10; - - // Private symbol for identifying `SourceNode`s when multiple versions of - // the source-map library are loaded. This MUST NOT CHANGE across - // versions! - var isSourceNode = "$$$isSourceNode$$$"; - - /** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ - function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); - } - - /** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[remainingLinesIndex]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[remainingLinesIndex]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - - /** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; - }; - - /** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } - }; - - /** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; - }; - - /** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; - }; - - /** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ - SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - - /** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - - /** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; \ No newline at end of file diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.min.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.min.js deleted file mode 100644 index f2a46bd..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/dist/source-map.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.sourceMap=n():e.sourceMap=n()}(this,function(){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){n.SourceMapGenerator=r(1).SourceMapGenerator,n.SourceMapConsumer=r(7).SourceMapConsumer,n.SourceNode=r(10).SourceNode},function(e,n,r){function t(e){e||(e={}),this._file=i.getArg(e,"file",null),this._sourceRoot=i.getArg(e,"sourceRoot",null),this._skipValidation=i.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new a,this._sourcesContents=null}var o=r(2),i=r(4),s=r(5).ArraySet,a=r(6).MappingList;t.prototype._version=3,t.fromSourceMap=function(e){var n=e.sourceRoot,r=new t({file:e.file,sourceRoot:n});return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(t.source=e.source,null!=n&&(t.source=i.relative(n,t.source)),t.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(t.name=e.name)),r.addMapping(t)}),e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&r.setSourceContent(n,t)}),r},t.prototype.addMapping=function(e){var n=i.getArg(e,"generated"),r=i.getArg(e,"original",null),t=i.getArg(e,"source",null),o=i.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,t,o),null!=t&&(t=String(t),this._sources.has(t)||this._sources.add(t)),null!=o&&(o=String(o),this._names.has(o)||this._names.add(o)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:t,name:o})},t.prototype.setSourceContent=function(e,n){var r=e;null!=this._sourceRoot&&(r=i.relative(this._sourceRoot,r)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[i.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[i.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},t.prototype.applySourceMap=function(e,n,r){var t=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');t=e.file}var o=this._sourceRoot;null!=o&&(t=i.relative(o,t));var a=new s,u=new s;this._mappings.unsortedForEach(function(n){if(n.source===t&&null!=n.originalLine){var s=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=s.source&&(n.source=s.source,null!=r&&(n.source=i.join(r,n.source)),null!=o&&(n.source=i.relative(o,n.source)),n.originalLine=s.line,n.originalColumn=s.column,null!=s.name&&(n.name=s.name))}var l=n.source;null==l||a.has(l)||a.add(l);var c=n.name;null==c||u.has(c)||u.add(c)},this),this._sources=a,this._names=u,e.sources.forEach(function(n){var t=e.sourceContentFor(n);null!=t&&(null!=r&&(n=i.join(r,n)),null!=o&&(n=i.relative(o,n)),this.setSourceContent(n,t))},this)},t.prototype._validateMapping=function(e,n,r,t){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||n||r||t)&&!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:t}))},t.prototype._serializeMappings=function(){for(var e,n,r,t,s=0,a=1,u=0,l=0,c=0,g=0,p="",h=this._mappings.toArray(),f=0,d=h.length;f0){if(!i.compareByGeneratedPositionsInflated(n,h[f-1]))continue;e+=","}e+=o.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(t=this._sources.indexOf(n.source),e+=o.encode(t-g),g=t,e+=o.encode(n.originalLine-1-l),l=n.originalLine-1,e+=o.encode(n.originalColumn-u),u=n.originalColumn,null!=n.name&&(r=this._names.indexOf(n.name),e+=o.encode(r-c),c=r)),p+=e}return p},t.prototype._generateSourcesContent=function(e,n){return e.map(function(e){if(!this._sourcesContents)return null;null!=n&&(e=i.relative(n,e));var r=i.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},t.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},t.prototype.toString=function(){return JSON.stringify(this.toJSON())},n.SourceMapGenerator=t},function(e,n,r){function t(e){return e<0?(-e<<1)+1:(e<<1)+0}function o(e){var n=1===(1&e),r=e>>1;return n?-r:r}var i=r(3),s=5,a=1<>>=s,o>0&&(n|=l),r+=i.encode(n);while(o>0);return r},n.decode=function(e,n,r){var t,a,c=e.length,g=0,p=0;do{if(n>=c)throw new Error("Expected more digits in base 64 VLQ value.");if(a=i.decode(e.charCodeAt(n++)),a===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));t=!!(a&l),a&=u,g+=a<=0;c--)s=u[c],"."===s?u.splice(c,1):".."===s?l++:l>0&&(""===s?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return r=u.join("/"),""===r&&(r=a?"/":"."),i?(i.path=r,o(i)):r}function s(e,n){""===e&&(e="."),""===n&&(n=".");var r=t(n),s=t(e);if(s&&(e=s.path||"/"),r&&!r.scheme)return s&&(r.scheme=s.scheme),o(r);if(r||n.match(_))return n;if(s&&!s.host&&!s.path)return s.host=n,o(s);var a="/"===n.charAt(0)?n:i(e.replace(/\/+$/,"")+"/"+n);return s?(s.path=a,o(s)):a}function a(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==n.indexOf(e+"/");){var t=e.lastIndexOf("/");if(t<0)return n;if(e=e.slice(0,t),e.match(/^([^\/]+:\/)?\/*$/))return n;++r}return Array(r+1).join("../")+n.substr(e.length+1)}function u(e){return e}function l(e){return g(e)?"$"+e:e}function c(e){return g(e)?e.slice(1):e}function g(e){if(!e)return!1;var n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(var r=n-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(e,n,r){var t=e.source-n.source;return 0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t||r?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=e.generatedLine-n.generatedLine,0!==t?t:e.name-n.name))))}function h(e,n,r){var t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t||r?t:(t=e.source-n.source,0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:e.name-n.name))))}function f(e,n){return e===n?0:e>n?1:-1}function d(e,n){var r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=f(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:f(e.name,n.name)))))}n.getArg=r;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,_=/^data:.+\,.+$/;n.urlParse=t,n.urlGenerate=o,n.normalize=i,n.join=s,n.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},n.relative=a;var v=function(){var e=Object.create(null);return!("__proto__"in e)}();n.toSetString=v?u:l,n.fromSetString=v?u:c,n.compareByOriginalPositions=p,n.compareByGeneratedPositionsDeflated=h,n.compareByGeneratedPositionsInflated=d},function(e,n,r){function t(){this._array=[],this._set=s?new Map:Object.create(null)}var o=r(4),i=Object.prototype.hasOwnProperty,s="undefined"!=typeof Map;t.fromArray=function(e,n){for(var r=new t,o=0,i=e.length;o=0)return n}else{var r=o.toSetString(e);if(i.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},t.prototype.at=function(e){if(e>=0&&er||t==r&&s>=o||i.compareByGeneratedPositionsInflated(e,n)<=0}function o(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var i=r(4);o.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)},o.prototype.add=function(e){t(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},o.prototype.toArray=function(){return this._sorted||(this._array.sort(i.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},n.MappingList=o},function(e,n,r){function t(e){var n=e;return"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=n.sections?new s(n):new o(n)}function o(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=a.getArg(n,"version"),t=a.getArg(n,"sources"),o=a.getArg(n,"names",[]),i=a.getArg(n,"sourceRoot",null),s=a.getArg(n,"sourcesContent",null),u=a.getArg(n,"mappings"),c=a.getArg(n,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);t=t.map(String).map(a.normalize).map(function(e){return i&&a.isAbsolute(i)&&a.isAbsolute(e)?a.relative(i,e):e}),this._names=l.fromArray(o.map(String),!0),this._sources=l.fromArray(t,!0),this.sourceRoot=i,this.sourcesContent=s,this._mappings=u,this.file=c}function i(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e){var n=e;"string"==typeof e&&(n=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=a.getArg(n,"version"),o=a.getArg(n,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new l,this._names=new l;var i={line:-1,column:0};this._sections=o.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var n=a.getArg(e,"offset"),r=a.getArg(n,"line"),o=a.getArg(n,"column");if(r=0){var i=this._originalMappings[o];if(void 0===e.column)for(var s=i.originalLine;i&&i.originalLine===s;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o];else for(var l=i.originalColumn;i&&i.originalLine===n&&i.originalColumn==l;)t.push({line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++o]}return t},n.SourceMapConsumer=t,o.prototype=Object.create(t.prototype),o.prototype.consumer=t,o.fromSourceMap=function(e){var n=Object.create(o.prototype),r=n._names=l.fromArray(e._names.toArray(),!0),t=n._sources=l.fromArray(e._sources.toArray(),!0);n.sourceRoot=e._sourceRoot,n.sourcesContent=e._generateSourcesContent(n._sources.toArray(),n.sourceRoot),n.file=e._file;for(var s=e._mappings.toArray().slice(),u=n.__generatedMappings=[],c=n.__originalMappings=[],p=0,h=s.length;p1&&(r.source=d+o[1],d+=o[1],r.originalLine=h+o[2],h=r.originalLine,r.originalLine+=1,r.originalColumn=f+o[3],f=r.originalColumn,o.length>4&&(r.name=m+o[4],m+=o[4])),S.push(r),"number"==typeof r.originalLine&&A.push(r)}g(S,a.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,g(A,a.compareByOriginalPositions),this.__originalMappings=A},o.prototype._findMapping=function(e,n,r,t,o,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[t]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[t]);return u.search(e,n,o,i)},o.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=a.getArg(o,"source",null);null!==i&&(i=this._sources.at(i),null!=this.sourceRoot&&(i=a.join(this.sourceRoot,i)));var s=a.getArg(o,"name",null);return null!==s&&(s=this._names.at(s)),{source:i,line:a.getArg(o,"originalLine",null),column:a.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},o.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}))},o.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=a.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=a.urlParse(this.sourceRoot))){var t=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')},o.prototype.generatedPositionFor=function(e){var n=a.getArg(e,"source");if(null!=this.sourceRoot&&(n=a.relative(this.sourceRoot,n)),!this._sources.has(n))return{line:null,column:null,lastColumn:null};n=this._sources.indexOf(n);var r={source:n,originalLine:a.getArg(e,"line"),originalColumn:a.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",a.compareByOriginalPositions,a.getArg(e,"bias",t.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:a.getArg(i,"generatedLine",null),column:a.getArg(i,"generatedColumn",null),lastColumn:a.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},n.BasicSourceMapConsumer=o,s.prototype=Object.create(t.prototype),s.prototype.constructor=t,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],n=0;n0?t-u>1?r(u,t,o,i,s,a):a==n.LEAST_UPPER_BOUND?t1?r(e,u,o,i,s,a):a==n.LEAST_UPPER_BOUND?u:e<0?-1:e}n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,o,i){if(0===t.length)return-1;var s=r(-1,t.length,e,t,o,i||n.GREATEST_LOWER_BOUND);if(s<0)return-1;for(;s-1>=0&&0===o(t[s],t[s-1],!0);)--s;return s}},function(e,n){function r(e,n,r){var t=e[n];e[n]=e[r],e[r]=t}function t(e,n){return Math.round(e+Math.random()*(n-e))}function o(e,n,i,s){if(i=0;n--)this.prepend(e[n]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},t.prototype.walk=function(e){for(var n,r=0,t=this.children.length;r0){for(n=[],r=0;r 0 && aGenerated.column >= 0\n\t && !aOriginal && !aSource && !aName) {\n\t // Case 1.\n\t return;\n\t }\n\t else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n\t && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n\t && aGenerated.line > 0 && aGenerated.column >= 0\n\t && aOriginal.line > 0 && aOriginal.column >= 0\n\t && aSource) {\n\t // Cases 2 and 3.\n\t return;\n\t }\n\t else {\n\t throw new Error('Invalid mapping: ' + JSON.stringify({\n\t generated: aGenerated,\n\t source: aSource,\n\t original: aOriginal,\n\t name: aName\n\t }));\n\t }\n\t };\n\t\n\t/**\n\t * Serialize the accumulated mappings in to the stream of base 64 VLQs\n\t * specified by the source map format.\n\t */\n\tSourceMapGenerator.prototype._serializeMappings =\n\t function SourceMapGenerator_serializeMappings() {\n\t var previousGeneratedColumn = 0;\n\t var previousGeneratedLine = 1;\n\t var previousOriginalColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousName = 0;\n\t var previousSource = 0;\n\t var result = '';\n\t var next;\n\t var mapping;\n\t var nameIdx;\n\t var sourceIdx;\n\t\n\t var mappings = this._mappings.toArray();\n\t for (var i = 0, len = mappings.length; i < len; i++) {\n\t mapping = mappings[i];\n\t next = ''\n\t\n\t if (mapping.generatedLine !== previousGeneratedLine) {\n\t previousGeneratedColumn = 0;\n\t while (mapping.generatedLine !== previousGeneratedLine) {\n\t next += ';';\n\t previousGeneratedLine++;\n\t }\n\t }\n\t else {\n\t if (i > 0) {\n\t if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n\t continue;\n\t }\n\t next += ',';\n\t }\n\t }\n\t\n\t next += base64VLQ.encode(mapping.generatedColumn\n\t - previousGeneratedColumn);\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (mapping.source != null) {\n\t sourceIdx = this._sources.indexOf(mapping.source);\n\t next += base64VLQ.encode(sourceIdx - previousSource);\n\t previousSource = sourceIdx;\n\t\n\t // lines are stored 0-based in SourceMap spec version 3\n\t next += base64VLQ.encode(mapping.originalLine - 1\n\t - previousOriginalLine);\n\t previousOriginalLine = mapping.originalLine - 1;\n\t\n\t next += base64VLQ.encode(mapping.originalColumn\n\t - previousOriginalColumn);\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (mapping.name != null) {\n\t nameIdx = this._names.indexOf(mapping.name);\n\t next += base64VLQ.encode(nameIdx - previousName);\n\t previousName = nameIdx;\n\t }\n\t }\n\t\n\t result += next;\n\t }\n\t\n\t return result;\n\t };\n\t\n\tSourceMapGenerator.prototype._generateSourcesContent =\n\t function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n\t return aSources.map(function (source) {\n\t if (!this._sourcesContents) {\n\t return null;\n\t }\n\t if (aSourceRoot != null) {\n\t source = util.relative(aSourceRoot, source);\n\t }\n\t var key = util.toSetString(source);\n\t return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n\t ? this._sourcesContents[key]\n\t : null;\n\t }, this);\n\t };\n\t\n\t/**\n\t * Externalize the source map.\n\t */\n\tSourceMapGenerator.prototype.toJSON =\n\t function SourceMapGenerator_toJSON() {\n\t var map = {\n\t version: this._version,\n\t sources: this._sources.toArray(),\n\t names: this._names.toArray(),\n\t mappings: this._serializeMappings()\n\t };\n\t if (this._file != null) {\n\t map.file = this._file;\n\t }\n\t if (this._sourceRoot != null) {\n\t map.sourceRoot = this._sourceRoot;\n\t }\n\t if (this._sourcesContents) {\n\t map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n\t }\n\t\n\t return map;\n\t };\n\t\n\t/**\n\t * Render the source map being generated to a string.\n\t */\n\tSourceMapGenerator.prototype.toString =\n\t function SourceMapGenerator_toString() {\n\t return JSON.stringify(this.toJSON());\n\t };\n\t\n\texports.SourceMapGenerator = SourceMapGenerator;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t *\n\t * Based on the Base 64 VLQ implementation in Closure Compiler:\n\t * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n\t *\n\t * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n\t * Redistribution and use in source and binary forms, with or without\n\t * modification, are permitted provided that the following conditions are\n\t * met:\n\t *\n\t * * Redistributions of source code must retain the above copyright\n\t * notice, this list of conditions and the following disclaimer.\n\t * * Redistributions in binary form must reproduce the above\n\t * copyright notice, this list of conditions and the following\n\t * disclaimer in the documentation and/or other materials provided\n\t * with the distribution.\n\t * * Neither the name of Google Inc. nor the names of its\n\t * contributors may be used to endorse or promote products derived\n\t * from this software without specific prior written permission.\n\t *\n\t * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\t * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n\t * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n\t * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n\t * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n\t * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\t * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n\t * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n\t * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t */\n\t\n\tvar base64 = __webpack_require__(3);\n\t\n\t// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n\t// length quantities we use in the source map spec, the first bit is the sign,\n\t// the next four bits are the actual value, and the 6th bit is the\n\t// continuation bit. The continuation bit tells us whether there are more\n\t// digits in this value following this digit.\n\t//\n\t// Continuation\n\t// | Sign\n\t// | |\n\t// V V\n\t// 101011\n\t\n\tvar VLQ_BASE_SHIFT = 5;\n\t\n\t// binary: 100000\n\tvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\t\n\t// binary: 011111\n\tvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\t\n\t// binary: 100000\n\tvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\t\n\t/**\n\t * Converts from a two-complement value to a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n\t * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n\t */\n\tfunction toVLQSigned(aValue) {\n\t return aValue < 0\n\t ? ((-aValue) << 1) + 1\n\t : (aValue << 1) + 0;\n\t}\n\t\n\t/**\n\t * Converts to a two-complement value from a value where the sign bit is\n\t * placed in the least significant bit. For example, as decimals:\n\t * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n\t * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n\t */\n\tfunction fromVLQSigned(aValue) {\n\t var isNegative = (aValue & 1) === 1;\n\t var shifted = aValue >> 1;\n\t return isNegative\n\t ? -shifted\n\t : shifted;\n\t}\n\t\n\t/**\n\t * Returns the base 64 VLQ encoded value.\n\t */\n\texports.encode = function base64VLQ_encode(aValue) {\n\t var encoded = \"\";\n\t var digit;\n\t\n\t var vlq = toVLQSigned(aValue);\n\t\n\t do {\n\t digit = vlq & VLQ_BASE_MASK;\n\t vlq >>>= VLQ_BASE_SHIFT;\n\t if (vlq > 0) {\n\t // There are still more digits in this value, so we must make sure the\n\t // continuation bit is marked.\n\t digit |= VLQ_CONTINUATION_BIT;\n\t }\n\t encoded += base64.encode(digit);\n\t } while (vlq > 0);\n\t\n\t return encoded;\n\t};\n\t\n\t/**\n\t * Decodes the next base 64 VLQ value from the given string and returns the\n\t * value and the rest of the string via the out parameter.\n\t */\n\texports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n\t var strLen = aStr.length;\n\t var result = 0;\n\t var shift = 0;\n\t var continuation, digit;\n\t\n\t do {\n\t if (aIndex >= strLen) {\n\t throw new Error(\"Expected more digits in base 64 VLQ value.\");\n\t }\n\t\n\t digit = base64.decode(aStr.charCodeAt(aIndex++));\n\t if (digit === -1) {\n\t throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n\t }\n\t\n\t continuation = !!(digit & VLQ_CONTINUATION_BIT);\n\t digit &= VLQ_BASE_MASK;\n\t result = result + (digit << shift);\n\t shift += VLQ_BASE_SHIFT;\n\t } while (continuation);\n\t\n\t aOutParam.value = fromVLQSigned(result);\n\t aOutParam.rest = aIndex;\n\t};\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\t\n\t/**\n\t * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n\t */\n\texports.encode = function (number) {\n\t if (0 <= number && number < intToCharMap.length) {\n\t return intToCharMap[number];\n\t }\n\t throw new TypeError(\"Must be between 0 and 63: \" + number);\n\t};\n\t\n\t/**\n\t * Decode a single base 64 character code digit to an integer. Returns -1 on\n\t * failure.\n\t */\n\texports.decode = function (charCode) {\n\t var bigA = 65; // 'A'\n\t var bigZ = 90; // 'Z'\n\t\n\t var littleA = 97; // 'a'\n\t var littleZ = 122; // 'z'\n\t\n\t var zero = 48; // '0'\n\t var nine = 57; // '9'\n\t\n\t var plus = 43; // '+'\n\t var slash = 47; // '/'\n\t\n\t var littleOffset = 26;\n\t var numberOffset = 52;\n\t\n\t // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n\t if (bigA <= charCode && charCode <= bigZ) {\n\t return (charCode - bigA);\n\t }\n\t\n\t // 26 - 51: abcdefghijklmnopqrstuvwxyz\n\t if (littleA <= charCode && charCode <= littleZ) {\n\t return (charCode - littleA + littleOffset);\n\t }\n\t\n\t // 52 - 61: 0123456789\n\t if (zero <= charCode && charCode <= nine) {\n\t return (charCode - zero + numberOffset);\n\t }\n\t\n\t // 62: +\n\t if (charCode == plus) {\n\t return 62;\n\t }\n\t\n\t // 63: /\n\t if (charCode == slash) {\n\t return 63;\n\t }\n\t\n\t // Invalid base64 digit.\n\t return -1;\n\t};\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t/**\n\t * This is a helper function for getting values from parameter/options\n\t * objects.\n\t *\n\t * @param args The object we are extracting values from\n\t * @param name The name of the property we are getting.\n\t * @param defaultValue An optional value to return if the property is missing\n\t * from the object. If this is not specified and the property is missing, an\n\t * error will be thrown.\n\t */\n\tfunction getArg(aArgs, aName, aDefaultValue) {\n\t if (aName in aArgs) {\n\t return aArgs[aName];\n\t } else if (arguments.length === 3) {\n\t return aDefaultValue;\n\t } else {\n\t throw new Error('\"' + aName + '\" is a required argument.');\n\t }\n\t}\n\texports.getArg = getArg;\n\t\n\tvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\n\tvar dataUrlRegexp = /^data:.+\\,.+$/;\n\t\n\tfunction urlParse(aUrl) {\n\t var match = aUrl.match(urlRegexp);\n\t if (!match) {\n\t return null;\n\t }\n\t return {\n\t scheme: match[1],\n\t auth: match[2],\n\t host: match[3],\n\t port: match[4],\n\t path: match[5]\n\t };\n\t}\n\texports.urlParse = urlParse;\n\t\n\tfunction urlGenerate(aParsedUrl) {\n\t var url = '';\n\t if (aParsedUrl.scheme) {\n\t url += aParsedUrl.scheme + ':';\n\t }\n\t url += '//';\n\t if (aParsedUrl.auth) {\n\t url += aParsedUrl.auth + '@';\n\t }\n\t if (aParsedUrl.host) {\n\t url += aParsedUrl.host;\n\t }\n\t if (aParsedUrl.port) {\n\t url += \":\" + aParsedUrl.port\n\t }\n\t if (aParsedUrl.path) {\n\t url += aParsedUrl.path;\n\t }\n\t return url;\n\t}\n\texports.urlGenerate = urlGenerate;\n\t\n\t/**\n\t * Normalizes a path, or the path portion of a URL:\n\t *\n\t * - Replaces consecutive slashes with one slash.\n\t * - Removes unnecessary '.' parts.\n\t * - Removes unnecessary '/..' parts.\n\t *\n\t * Based on code in the Node.js 'path' core module.\n\t *\n\t * @param aPath The path or url to normalize.\n\t */\n\tfunction normalize(aPath) {\n\t var path = aPath;\n\t var url = urlParse(aPath);\n\t if (url) {\n\t if (!url.path) {\n\t return aPath;\n\t }\n\t path = url.path;\n\t }\n\t var isAbsolute = exports.isAbsolute(path);\n\t\n\t var parts = path.split(/\\/+/);\n\t for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n\t part = parts[i];\n\t if (part === '.') {\n\t parts.splice(i, 1);\n\t } else if (part === '..') {\n\t up++;\n\t } else if (up > 0) {\n\t if (part === '') {\n\t // The first part is blank if the path is absolute. Trying to go\n\t // above the root is a no-op. Therefore we can remove all '..' parts\n\t // directly after the root.\n\t parts.splice(i + 1, up);\n\t up = 0;\n\t } else {\n\t parts.splice(i, 2);\n\t up--;\n\t }\n\t }\n\t }\n\t path = parts.join('/');\n\t\n\t if (path === '') {\n\t path = isAbsolute ? '/' : '.';\n\t }\n\t\n\t if (url) {\n\t url.path = path;\n\t return urlGenerate(url);\n\t }\n\t return path;\n\t}\n\texports.normalize = normalize;\n\t\n\t/**\n\t * Joins two paths/URLs.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be joined with the root.\n\t *\n\t * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n\t * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n\t * first.\n\t * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n\t * is updated with the result and aRoot is returned. Otherwise the result\n\t * is returned.\n\t * - If aPath is absolute, the result is aPath.\n\t * - Otherwise the two paths are joined with a slash.\n\t * - Joining for example 'http://' and 'www.example.com' is also supported.\n\t */\n\tfunction join(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t if (aPath === \"\") {\n\t aPath = \".\";\n\t }\n\t var aPathUrl = urlParse(aPath);\n\t var aRootUrl = urlParse(aRoot);\n\t if (aRootUrl) {\n\t aRoot = aRootUrl.path || '/';\n\t }\n\t\n\t // `join(foo, '//www.example.org')`\n\t if (aPathUrl && !aPathUrl.scheme) {\n\t if (aRootUrl) {\n\t aPathUrl.scheme = aRootUrl.scheme;\n\t }\n\t return urlGenerate(aPathUrl);\n\t }\n\t\n\t if (aPathUrl || aPath.match(dataUrlRegexp)) {\n\t return aPath;\n\t }\n\t\n\t // `join('http://', 'www.example.com')`\n\t if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n\t aRootUrl.host = aPath;\n\t return urlGenerate(aRootUrl);\n\t }\n\t\n\t var joined = aPath.charAt(0) === '/'\n\t ? aPath\n\t : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\t\n\t if (aRootUrl) {\n\t aRootUrl.path = joined;\n\t return urlGenerate(aRootUrl);\n\t }\n\t return joined;\n\t}\n\texports.join = join;\n\t\n\texports.isAbsolute = function (aPath) {\n\t return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n\t};\n\t\n\t/**\n\t * Make a path relative to a URL or another path.\n\t *\n\t * @param aRoot The root path or URL.\n\t * @param aPath The path or URL to be made relative to aRoot.\n\t */\n\tfunction relative(aRoot, aPath) {\n\t if (aRoot === \"\") {\n\t aRoot = \".\";\n\t }\n\t\n\t aRoot = aRoot.replace(/\\/$/, '');\n\t\n\t // It is possible for the path to be above the root. In this case, simply\n\t // checking whether the root is a prefix of the path won't work. Instead, we\n\t // need to remove components from the root one by one, until either we find\n\t // a prefix that fits, or we run out of components to remove.\n\t var level = 0;\n\t while (aPath.indexOf(aRoot + '/') !== 0) {\n\t var index = aRoot.lastIndexOf(\"/\");\n\t if (index < 0) {\n\t return aPath;\n\t }\n\t\n\t // If the only part of the root that is left is the scheme (i.e. http://,\n\t // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n\t // have exhausted all components, so the path is not relative to the root.\n\t aRoot = aRoot.slice(0, index);\n\t if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n\t return aPath;\n\t }\n\t\n\t ++level;\n\t }\n\t\n\t // Make sure we add a \"../\" for each component we removed from the root.\n\t return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n\t}\n\texports.relative = relative;\n\t\n\tvar supportsNullProto = (function () {\n\t var obj = Object.create(null);\n\t return !('__proto__' in obj);\n\t}());\n\t\n\tfunction identity (s) {\n\t return s;\n\t}\n\t\n\t/**\n\t * Because behavior goes wacky when you set `__proto__` on objects, we\n\t * have to prefix all the strings in our set with an arbitrary character.\n\t *\n\t * See https://github.com/mozilla/source-map/pull/31 and\n\t * https://github.com/mozilla/source-map/issues/30\n\t *\n\t * @param String aStr\n\t */\n\tfunction toSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return '$' + aStr;\n\t }\n\t\n\t return aStr;\n\t}\n\texports.toSetString = supportsNullProto ? identity : toSetString;\n\t\n\tfunction fromSetString(aStr) {\n\t if (isProtoString(aStr)) {\n\t return aStr.slice(1);\n\t }\n\t\n\t return aStr;\n\t}\n\texports.fromSetString = supportsNullProto ? identity : fromSetString;\n\t\n\tfunction isProtoString(s) {\n\t if (!s) {\n\t return false;\n\t }\n\t\n\t var length = s.length;\n\t\n\t if (length < 9 /* \"__proto__\".length */) {\n\t return false;\n\t }\n\t\n\t if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n\t s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n\t s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n\t s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n\t s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n\t s.charCodeAt(length - 9) !== 95 /* '_' */) {\n\t return false;\n\t }\n\t\n\t for (var i = length - 10; i >= 0; i--) {\n\t if (s.charCodeAt(i) !== 36 /* '$' */) {\n\t return false;\n\t }\n\t }\n\t\n\t return true;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings where the original positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same original source/line/column, but different generated\n\t * line and column the same. Useful when searching for a mapping with a\n\t * stubbed out mapping.\n\t */\n\tfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n\t var cmp = mappingA.source - mappingB.source;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0 || onlyCompareOriginal) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return mappingA.name - mappingB.name;\n\t}\n\texports.compareByOriginalPositions = compareByOriginalPositions;\n\t\n\t/**\n\t * Comparator between two mappings with deflated source and name indices where\n\t * the generated positions are compared.\n\t *\n\t * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n\t * mappings with the same generated line and column, but different\n\t * source/name/original line and column the same. Useful when searching for a\n\t * mapping with a stubbed out mapping.\n\t */\n\tfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0 || onlyCompareGenerated) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.source - mappingB.source;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return mappingA.name - mappingB.name;\n\t}\n\texports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\t\n\tfunction strcmp(aStr1, aStr2) {\n\t if (aStr1 === aStr2) {\n\t return 0;\n\t }\n\t\n\t if (aStr1 > aStr2) {\n\t return 1;\n\t }\n\t\n\t return -1;\n\t}\n\t\n\t/**\n\t * Comparator between two mappings with inflated source and name strings where\n\t * the generated positions are compared.\n\t */\n\tfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n\t var cmp = mappingA.generatedLine - mappingB.generatedLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = strcmp(mappingA.source, mappingB.source);\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalLine - mappingB.originalLine;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t cmp = mappingA.originalColumn - mappingB.originalColumn;\n\t if (cmp !== 0) {\n\t return cmp;\n\t }\n\t\n\t return strcmp(mappingA.name, mappingB.name);\n\t}\n\texports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar hasNativeMap = typeof Map !== \"undefined\";\n\t\n\t/**\n\t * A data structure which is a combination of an array and a set. Adding a new\n\t * member is O(1), testing for membership is O(1), and finding the index of an\n\t * element is O(1). Removing elements from the set is not supported. Only\n\t * strings are supported for membership.\n\t */\n\tfunction ArraySet() {\n\t this._array = [];\n\t this._set = hasNativeMap ? new Map() : Object.create(null);\n\t}\n\t\n\t/**\n\t * Static method for creating ArraySet instances from an existing array.\n\t */\n\tArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n\t var set = new ArraySet();\n\t for (var i = 0, len = aArray.length; i < len; i++) {\n\t set.add(aArray[i], aAllowDuplicates);\n\t }\n\t return set;\n\t};\n\t\n\t/**\n\t * Return how many unique items are in this ArraySet. If duplicates have been\n\t * added, than those do not count towards the size.\n\t *\n\t * @returns Number\n\t */\n\tArraySet.prototype.size = function ArraySet_size() {\n\t return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n\t};\n\t\n\t/**\n\t * Add the given string to this set.\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n\t var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n\t var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n\t var idx = this._array.length;\n\t if (!isDuplicate || aAllowDuplicates) {\n\t this._array.push(aStr);\n\t }\n\t if (!isDuplicate) {\n\t if (hasNativeMap) {\n\t this._set.set(aStr, idx);\n\t } else {\n\t this._set[sStr] = idx;\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Is the given string a member of this set?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.has = function ArraySet_has(aStr) {\n\t if (hasNativeMap) {\n\t return this._set.has(aStr);\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t return has.call(this._set, sStr);\n\t }\n\t};\n\t\n\t/**\n\t * What is the index of the given string in the array?\n\t *\n\t * @param String aStr\n\t */\n\tArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n\t if (hasNativeMap) {\n\t var idx = this._set.get(aStr);\n\t if (idx >= 0) {\n\t return idx;\n\t }\n\t } else {\n\t var sStr = util.toSetString(aStr);\n\t if (has.call(this._set, sStr)) {\n\t return this._set[sStr];\n\t }\n\t }\n\t\n\t throw new Error('\"' + aStr + '\" is not in the set.');\n\t};\n\t\n\t/**\n\t * What is the element at the given index?\n\t *\n\t * @param Number aIdx\n\t */\n\tArraySet.prototype.at = function ArraySet_at(aIdx) {\n\t if (aIdx >= 0 && aIdx < this._array.length) {\n\t return this._array[aIdx];\n\t }\n\t throw new Error('No element indexed by ' + aIdx);\n\t};\n\t\n\t/**\n\t * Returns the array representation of this set (which has the proper indices\n\t * indicated by indexOf). Note that this is a copy of the internal array used\n\t * for storing the members so that no one can mess with internal state.\n\t */\n\tArraySet.prototype.toArray = function ArraySet_toArray() {\n\t return this._array.slice();\n\t};\n\t\n\texports.ArraySet = ArraySet;\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2014 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\t\n\t/**\n\t * Determine whether mappingB is after mappingA with respect to generated\n\t * position.\n\t */\n\tfunction generatedPositionAfter(mappingA, mappingB) {\n\t // Optimized for most common case\n\t var lineA = mappingA.generatedLine;\n\t var lineB = mappingB.generatedLine;\n\t var columnA = mappingA.generatedColumn;\n\t var columnB = mappingB.generatedColumn;\n\t return lineB > lineA || lineB == lineA && columnB >= columnA ||\n\t util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n\t}\n\t\n\t/**\n\t * A data structure to provide a sorted view of accumulated mappings in a\n\t * performance conscious manner. It trades a neglibable overhead in general\n\t * case for a large speedup in case of mappings being added in order.\n\t */\n\tfunction MappingList() {\n\t this._array = [];\n\t this._sorted = true;\n\t // Serves as infimum\n\t this._last = {generatedLine: -1, generatedColumn: 0};\n\t}\n\t\n\t/**\n\t * Iterate through internal items. This method takes the same arguments that\n\t * `Array.prototype.forEach` takes.\n\t *\n\t * NOTE: The order of the mappings is NOT guaranteed.\n\t */\n\tMappingList.prototype.unsortedForEach =\n\t function MappingList_forEach(aCallback, aThisArg) {\n\t this._array.forEach(aCallback, aThisArg);\n\t };\n\t\n\t/**\n\t * Add the given source mapping.\n\t *\n\t * @param Object aMapping\n\t */\n\tMappingList.prototype.add = function MappingList_add(aMapping) {\n\t if (generatedPositionAfter(this._last, aMapping)) {\n\t this._last = aMapping;\n\t this._array.push(aMapping);\n\t } else {\n\t this._sorted = false;\n\t this._array.push(aMapping);\n\t }\n\t};\n\t\n\t/**\n\t * Returns the flat, sorted array of mappings. The mappings are sorted by\n\t * generated position.\n\t *\n\t * WARNING: This method returns internal data without copying, for\n\t * performance. The return value must NOT be mutated, and should be treated as\n\t * an immutable borrow. If you want to take ownership, you must make your own\n\t * copy.\n\t */\n\tMappingList.prototype.toArray = function MappingList_toArray() {\n\t if (!this._sorted) {\n\t this._array.sort(util.compareByGeneratedPositionsInflated);\n\t this._sorted = true;\n\t }\n\t return this._array;\n\t};\n\t\n\texports.MappingList = MappingList;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar util = __webpack_require__(4);\n\tvar binarySearch = __webpack_require__(8);\n\tvar ArraySet = __webpack_require__(5).ArraySet;\n\tvar base64VLQ = __webpack_require__(2);\n\tvar quickSort = __webpack_require__(9).quickSort;\n\t\n\tfunction SourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t return sourceMap.sections != null\n\t ? new IndexedSourceMapConsumer(sourceMap)\n\t : new BasicSourceMapConsumer(sourceMap);\n\t}\n\t\n\tSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n\t return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n\t}\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tSourceMapConsumer.prototype._version = 3;\n\t\n\t// `__generatedMappings` and `__originalMappings` are arrays that hold the\n\t// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n\t// are lazily instantiated, accessed via the `_generatedMappings` and\n\t// `_originalMappings` getters respectively, and we only parse the mappings\n\t// and create these arrays once queried for a source location. We jump through\n\t// these hoops because there can be many thousands of mappings, and parsing\n\t// them is expensive, so we only want to do it if we must.\n\t//\n\t// Each object in the arrays is of the form:\n\t//\n\t// {\n\t// generatedLine: The line number in the generated code,\n\t// generatedColumn: The column number in the generated code,\n\t// source: The path to the original source file that generated this\n\t// chunk of code,\n\t// originalLine: The line number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// originalColumn: The column number in the original source that\n\t// corresponds to this chunk of generated code,\n\t// name: The name of the original symbol which generated this chunk of\n\t// code.\n\t// }\n\t//\n\t// All properties except for `generatedLine` and `generatedColumn` can be\n\t// `null`.\n\t//\n\t// `_generatedMappings` is ordered by the generated positions.\n\t//\n\t// `_originalMappings` is ordered by the original positions.\n\t\n\tSourceMapConsumer.prototype.__generatedMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n\t get: function () {\n\t if (!this.__generatedMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__generatedMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype.__originalMappings = null;\n\tObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n\t get: function () {\n\t if (!this.__originalMappings) {\n\t this._parseMappings(this._mappings, this.sourceRoot);\n\t }\n\t\n\t return this.__originalMappings;\n\t }\n\t});\n\t\n\tSourceMapConsumer.prototype._charIsMappingSeparator =\n\t function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n\t var c = aStr.charAt(index);\n\t return c === \";\" || c === \",\";\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t throw new Error(\"Subclasses must implement _parseMappings\");\n\t };\n\t\n\tSourceMapConsumer.GENERATED_ORDER = 1;\n\tSourceMapConsumer.ORIGINAL_ORDER = 2;\n\t\n\tSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\n\tSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Iterate over each mapping between an original source/line/column and a\n\t * generated line/column in this source map.\n\t *\n\t * @param Function aCallback\n\t * The function that is called with each mapping.\n\t * @param Object aContext\n\t * Optional. If specified, this object will be the value of `this` every\n\t * time that `aCallback` is called.\n\t * @param aOrder\n\t * Either `SourceMapConsumer.GENERATED_ORDER` or\n\t * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n\t * iterate over the mappings sorted by the generated file's line/column\n\t * order or the original's source/line/column order, respectively. Defaults to\n\t * `SourceMapConsumer.GENERATED_ORDER`.\n\t */\n\tSourceMapConsumer.prototype.eachMapping =\n\t function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n\t var context = aContext || null;\n\t var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\t\n\t var mappings;\n\t switch (order) {\n\t case SourceMapConsumer.GENERATED_ORDER:\n\t mappings = this._generatedMappings;\n\t break;\n\t case SourceMapConsumer.ORIGINAL_ORDER:\n\t mappings = this._originalMappings;\n\t break;\n\t default:\n\t throw new Error(\"Unknown order of iteration.\");\n\t }\n\t\n\t var sourceRoot = this.sourceRoot;\n\t mappings.map(function (mapping) {\n\t var source = mapping.source === null ? null : this._sources.at(mapping.source);\n\t if (source != null && sourceRoot != null) {\n\t source = util.join(sourceRoot, source);\n\t }\n\t return {\n\t source: source,\n\t generatedLine: mapping.generatedLine,\n\t generatedColumn: mapping.generatedColumn,\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: mapping.name === null ? null : this._names.at(mapping.name)\n\t };\n\t }, this).forEach(aCallback, context);\n\t };\n\t\n\t/**\n\t * Returns all generated line and column information for the original source,\n\t * line, and column provided. If no column is provided, returns all mappings\n\t * corresponding to a either the line we are searching for or the next\n\t * closest line that has any mappings. Otherwise, returns all mappings\n\t * corresponding to the given line and either the column we are searching for\n\t * or the next closest column that has any offsets.\n\t *\n\t * The only argument is an object with the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: Optional. the column number in the original source.\n\t *\n\t * and an array of objects is returned, each with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\tSourceMapConsumer.prototype.allGeneratedPositionsFor =\n\t function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n\t var line = util.getArg(aArgs, 'line');\n\t\n\t // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n\t // returns the index of the closest mapping less than the needle. By\n\t // setting needle.originalColumn to 0, we thus find the last mapping for\n\t // the given line, provided such a mapping exists.\n\t var needle = {\n\t source: util.getArg(aArgs, 'source'),\n\t originalLine: line,\n\t originalColumn: util.getArg(aArgs, 'column', 0)\n\t };\n\t\n\t if (this.sourceRoot != null) {\n\t needle.source = util.relative(this.sourceRoot, needle.source);\n\t }\n\t if (!this._sources.has(needle.source)) {\n\t return [];\n\t }\n\t needle.source = this._sources.indexOf(needle.source);\n\t\n\t var mappings = [];\n\t\n\t var index = this._findMapping(needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t binarySearch.LEAST_UPPER_BOUND);\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (aArgs.column === undefined) {\n\t var originalLine = mapping.originalLine;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we found. Since\n\t // mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we found.\n\t while (mapping && mapping.originalLine === originalLine) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t } else {\n\t var originalColumn = mapping.originalColumn;\n\t\n\t // Iterate until either we run out of mappings, or we run into\n\t // a mapping for a different line than the one we were searching for.\n\t // Since mappings are sorted, this is guaranteed to find all mappings for\n\t // the line we are searching for.\n\t while (mapping &&\n\t mapping.originalLine === line &&\n\t mapping.originalColumn == originalColumn) {\n\t mappings.push({\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t });\n\t\n\t mapping = this._originalMappings[++index];\n\t }\n\t }\n\t }\n\t\n\t return mappings;\n\t };\n\t\n\texports.SourceMapConsumer = SourceMapConsumer;\n\t\n\t/**\n\t * A BasicSourceMapConsumer instance represents a parsed source map which we can\n\t * query for information about the original file positions by giving it a file\n\t * position in the generated source.\n\t *\n\t * The only parameter is the raw source map (either as a JSON string, or\n\t * already parsed to an object). According to the spec, source maps have the\n\t * following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - sources: An array of URLs to the original source files.\n\t * - names: An array of identifiers which can be referrenced by individual mappings.\n\t * - sourceRoot: Optional. The URL root from which all sources are relative.\n\t * - sourcesContent: Optional. An array of contents of the original source files.\n\t * - mappings: A string of base64 VLQs which contain the actual mappings.\n\t * - file: Optional. The generated file this source map is associated with.\n\t *\n\t * Here is an example source map, taken from the source map spec[0]:\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"out.js\",\n\t * sourceRoot : \"\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AA,AB;;ABCDE;\"\n\t * }\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n\t */\n\tfunction BasicSourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sources = util.getArg(sourceMap, 'sources');\n\t // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n\t // requires the array) to play nice here.\n\t var names = util.getArg(sourceMap, 'names', []);\n\t var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n\t var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n\t var mappings = util.getArg(sourceMap, 'mappings');\n\t var file = util.getArg(sourceMap, 'file', null);\n\t\n\t // Once again, Sass deviates from the spec and supplies the version as a\n\t // string rather than a number, so we use loose equality checking here.\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t sources = sources\n\t .map(String)\n\t // Some source maps produce relative source paths like \"./foo.js\" instead of\n\t // \"foo.js\". Normalize these first so that future comparisons will succeed.\n\t // See bugzil.la/1090768.\n\t .map(util.normalize)\n\t // Always ensure that absolute sources are internally stored relative to\n\t // the source root, if the source root is absolute. Not doing this would\n\t // be particularly problematic when the source root is a prefix of the\n\t // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n\t .map(function (source) {\n\t return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n\t ? util.relative(sourceRoot, source)\n\t : source;\n\t });\n\t\n\t // Pass `true` below to allow duplicate names and sources. While source maps\n\t // are intended to be compressed and deduplicated, the TypeScript compiler\n\t // sometimes generates source maps with duplicates in them. See Github issue\n\t // #72 and bugzil.la/889492.\n\t this._names = ArraySet.fromArray(names.map(String), true);\n\t this._sources = ArraySet.fromArray(sources, true);\n\t\n\t this.sourceRoot = sourceRoot;\n\t this.sourcesContent = sourcesContent;\n\t this._mappings = mappings;\n\t this.file = file;\n\t}\n\t\n\tBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\t\n\t/**\n\t * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n\t *\n\t * @param SourceMapGenerator aSourceMap\n\t * The source map that will be consumed.\n\t * @returns BasicSourceMapConsumer\n\t */\n\tBasicSourceMapConsumer.fromSourceMap =\n\t function SourceMapConsumer_fromSourceMap(aSourceMap) {\n\t var smc = Object.create(BasicSourceMapConsumer.prototype);\n\t\n\t var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n\t var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n\t smc.sourceRoot = aSourceMap._sourceRoot;\n\t smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n\t smc.sourceRoot);\n\t smc.file = aSourceMap._file;\n\t\n\t // Because we are modifying the entries (by converting string sources and\n\t // names to indices into the sources and names ArraySets), we have to make\n\t // a copy of the entry or else bad things happen. Shared mutable state\n\t // strikes again! See github issue #191.\n\t\n\t var generatedMappings = aSourceMap._mappings.toArray().slice();\n\t var destGeneratedMappings = smc.__generatedMappings = [];\n\t var destOriginalMappings = smc.__originalMappings = [];\n\t\n\t for (var i = 0, length = generatedMappings.length; i < length; i++) {\n\t var srcMapping = generatedMappings[i];\n\t var destMapping = new Mapping;\n\t destMapping.generatedLine = srcMapping.generatedLine;\n\t destMapping.generatedColumn = srcMapping.generatedColumn;\n\t\n\t if (srcMapping.source) {\n\t destMapping.source = sources.indexOf(srcMapping.source);\n\t destMapping.originalLine = srcMapping.originalLine;\n\t destMapping.originalColumn = srcMapping.originalColumn;\n\t\n\t if (srcMapping.name) {\n\t destMapping.name = names.indexOf(srcMapping.name);\n\t }\n\t\n\t destOriginalMappings.push(destMapping);\n\t }\n\t\n\t destGeneratedMappings.push(destMapping);\n\t }\n\t\n\t quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\t\n\t return smc;\n\t };\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tBasicSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t return this._sources.toArray().map(function (s) {\n\t return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n\t }, this);\n\t }\n\t});\n\t\n\t/**\n\t * Provide the JIT with a nice shape / hidden class.\n\t */\n\tfunction Mapping() {\n\t this.generatedLine = 0;\n\t this.generatedColumn = 0;\n\t this.source = null;\n\t this.originalLine = null;\n\t this.originalColumn = null;\n\t this.name = null;\n\t}\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tBasicSourceMapConsumer.prototype._parseMappings =\n\t function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t var generatedLine = 1;\n\t var previousGeneratedColumn = 0;\n\t var previousOriginalLine = 0;\n\t var previousOriginalColumn = 0;\n\t var previousSource = 0;\n\t var previousName = 0;\n\t var length = aStr.length;\n\t var index = 0;\n\t var cachedSegments = {};\n\t var temp = {};\n\t var originalMappings = [];\n\t var generatedMappings = [];\n\t var mapping, str, segment, end, value;\n\t\n\t while (index < length) {\n\t if (aStr.charAt(index) === ';') {\n\t generatedLine++;\n\t index++;\n\t previousGeneratedColumn = 0;\n\t }\n\t else if (aStr.charAt(index) === ',') {\n\t index++;\n\t }\n\t else {\n\t mapping = new Mapping();\n\t mapping.generatedLine = generatedLine;\n\t\n\t // Because each offset is encoded relative to the previous one,\n\t // many segments often have the same encoding. We can exploit this\n\t // fact by caching the parsed variable length fields of each segment,\n\t // allowing us to avoid a second parse if we encounter the same\n\t // segment again.\n\t for (end = index; end < length; end++) {\n\t if (this._charIsMappingSeparator(aStr, end)) {\n\t break;\n\t }\n\t }\n\t str = aStr.slice(index, end);\n\t\n\t segment = cachedSegments[str];\n\t if (segment) {\n\t index += str.length;\n\t } else {\n\t segment = [];\n\t while (index < end) {\n\t base64VLQ.decode(aStr, index, temp);\n\t value = temp.value;\n\t index = temp.rest;\n\t segment.push(value);\n\t }\n\t\n\t if (segment.length === 2) {\n\t throw new Error('Found a source, but no line and column');\n\t }\n\t\n\t if (segment.length === 3) {\n\t throw new Error('Found a source and line, but no column');\n\t }\n\t\n\t cachedSegments[str] = segment;\n\t }\n\t\n\t // Generated column.\n\t mapping.generatedColumn = previousGeneratedColumn + segment[0];\n\t previousGeneratedColumn = mapping.generatedColumn;\n\t\n\t if (segment.length > 1) {\n\t // Original source.\n\t mapping.source = previousSource + segment[1];\n\t previousSource += segment[1];\n\t\n\t // Original line.\n\t mapping.originalLine = previousOriginalLine + segment[2];\n\t previousOriginalLine = mapping.originalLine;\n\t // Lines are stored 0-based\n\t mapping.originalLine += 1;\n\t\n\t // Original column.\n\t mapping.originalColumn = previousOriginalColumn + segment[3];\n\t previousOriginalColumn = mapping.originalColumn;\n\t\n\t if (segment.length > 4) {\n\t // Original name.\n\t mapping.name = previousName + segment[4];\n\t previousName += segment[4];\n\t }\n\t }\n\t\n\t generatedMappings.push(mapping);\n\t if (typeof mapping.originalLine === 'number') {\n\t originalMappings.push(mapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t this.__generatedMappings = generatedMappings;\n\t\n\t quickSort(originalMappings, util.compareByOriginalPositions);\n\t this.__originalMappings = originalMappings;\n\t };\n\t\n\t/**\n\t * Find the mapping that best matches the hypothetical \"needle\" mapping that\n\t * we are searching for in the given \"haystack\" of mappings.\n\t */\n\tBasicSourceMapConsumer.prototype._findMapping =\n\t function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n\t aColumnName, aComparator, aBias) {\n\t // To return the position we are searching for, we must first find the\n\t // mapping for the given position and then return the opposite position it\n\t // points to. Because the mappings are sorted, we can use binary search to\n\t // find the best mapping.\n\t\n\t if (aNeedle[aLineName] <= 0) {\n\t throw new TypeError('Line must be greater than or equal to 1, got '\n\t + aNeedle[aLineName]);\n\t }\n\t if (aNeedle[aColumnName] < 0) {\n\t throw new TypeError('Column must be greater than or equal to 0, got '\n\t + aNeedle[aColumnName]);\n\t }\n\t\n\t return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n\t };\n\t\n\t/**\n\t * Compute the last column for each generated mapping. The last column is\n\t * inclusive.\n\t */\n\tBasicSourceMapConsumer.prototype.computeColumnSpans =\n\t function SourceMapConsumer_computeColumnSpans() {\n\t for (var index = 0; index < this._generatedMappings.length; ++index) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t // Mappings do not contain a field for the last generated columnt. We\n\t // can come up with an optimistic estimate, however, by assuming that\n\t // mappings are contiguous (i.e. given two consecutive mappings, the\n\t // first mapping ends where the second one starts).\n\t if (index + 1 < this._generatedMappings.length) {\n\t var nextMapping = this._generatedMappings[index + 1];\n\t\n\t if (mapping.generatedLine === nextMapping.generatedLine) {\n\t mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n\t continue;\n\t }\n\t }\n\t\n\t // The last mapping for each line spans the entire line.\n\t mapping.lastGeneratedColumn = Infinity;\n\t }\n\t };\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source.\n\t * - column: The column number in the generated source.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null.\n\t * - column: The column number in the original source, or null.\n\t * - name: The original identifier, or null.\n\t */\n\tBasicSourceMapConsumer.prototype.originalPositionFor =\n\t function SourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._generatedMappings,\n\t \"generatedLine\",\n\t \"generatedColumn\",\n\t util.compareByGeneratedPositionsDeflated,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._generatedMappings[index];\n\t\n\t if (mapping.generatedLine === needle.generatedLine) {\n\t var source = util.getArg(mapping, 'source', null);\n\t if (source !== null) {\n\t source = this._sources.at(source);\n\t if (this.sourceRoot != null) {\n\t source = util.join(this.sourceRoot, source);\n\t }\n\t }\n\t var name = util.getArg(mapping, 'name', null);\n\t if (name !== null) {\n\t name = this._names.at(name);\n\t }\n\t return {\n\t source: source,\n\t line: util.getArg(mapping, 'originalLine', null),\n\t column: util.getArg(mapping, 'originalColumn', null),\n\t name: name\n\t };\n\t }\n\t }\n\t\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function BasicSourceMapConsumer_hasContentsOfAllSources() {\n\t if (!this.sourcesContent) {\n\t return false;\n\t }\n\t return this.sourcesContent.length >= this._sources.size() &&\n\t !this.sourcesContent.some(function (sc) { return sc == null; });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tBasicSourceMapConsumer.prototype.sourceContentFor =\n\t function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t if (!this.sourcesContent) {\n\t return null;\n\t }\n\t\n\t if (this.sourceRoot != null) {\n\t aSource = util.relative(this.sourceRoot, aSource);\n\t }\n\t\n\t if (this._sources.has(aSource)) {\n\t return this.sourcesContent[this._sources.indexOf(aSource)];\n\t }\n\t\n\t var url;\n\t if (this.sourceRoot != null\n\t && (url = util.urlParse(this.sourceRoot))) {\n\t // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n\t // many users. We can help them out when they expect file:// URIs to\n\t // behave like it would if they were running a local HTTP server. See\n\t // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n\t var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n\t if (url.scheme == \"file\"\n\t && this._sources.has(fileUriAbsPath)) {\n\t return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n\t }\n\t\n\t if ((!url.path || url.path == \"/\")\n\t && this._sources.has(\"/\" + aSource)) {\n\t return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n\t }\n\t }\n\t\n\t // This function is used recursively from\n\t // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n\t // don't want to throw if we can't find the source - we just want to\n\t // return null, so we provide a flag to exit gracefully.\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: The column number in the original source.\n\t * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n\t * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\tBasicSourceMapConsumer.prototype.generatedPositionFor =\n\t function SourceMapConsumer_generatedPositionFor(aArgs) {\n\t var source = util.getArg(aArgs, 'source');\n\t if (this.sourceRoot != null) {\n\t source = util.relative(this.sourceRoot, source);\n\t }\n\t if (!this._sources.has(source)) {\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t }\n\t source = this._sources.indexOf(source);\n\t\n\t var needle = {\n\t source: source,\n\t originalLine: util.getArg(aArgs, 'line'),\n\t originalColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t var index = this._findMapping(\n\t needle,\n\t this._originalMappings,\n\t \"originalLine\",\n\t \"originalColumn\",\n\t util.compareByOriginalPositions,\n\t util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n\t );\n\t\n\t if (index >= 0) {\n\t var mapping = this._originalMappings[index];\n\t\n\t if (mapping.source === needle.source) {\n\t return {\n\t line: util.getArg(mapping, 'generatedLine', null),\n\t column: util.getArg(mapping, 'generatedColumn', null),\n\t lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n\t };\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null,\n\t lastColumn: null\n\t };\n\t };\n\t\n\texports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\t\n\t/**\n\t * An IndexedSourceMapConsumer instance represents a parsed source map which\n\t * we can query for information. It differs from BasicSourceMapConsumer in\n\t * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n\t * input.\n\t *\n\t * The only parameter is a raw source map (either as a JSON string, or already\n\t * parsed to an object). According to the spec for indexed source maps, they\n\t * have the following attributes:\n\t *\n\t * - version: Which version of the source map spec this map is following.\n\t * - file: Optional. The generated file this source map is associated with.\n\t * - sections: A list of section definitions.\n\t *\n\t * Each value under the \"sections\" field has two fields:\n\t * - offset: The offset into the original specified at which this section\n\t * begins to apply, defined as an object with a \"line\" and \"column\"\n\t * field.\n\t * - map: A source map definition. This source map could also be indexed,\n\t * but doesn't have to be.\n\t *\n\t * Instead of the \"map\" field, it's also possible to have a \"url\" field\n\t * specifying a URL to retrieve a source map from, but that's currently\n\t * unsupported.\n\t *\n\t * Here's an example source map, taken from the source map spec[0], but\n\t * modified to omit a section which uses the \"url\" field.\n\t *\n\t * {\n\t * version : 3,\n\t * file: \"app.js\",\n\t * sections: [{\n\t * offset: {line:100, column:10},\n\t * map: {\n\t * version : 3,\n\t * file: \"section.js\",\n\t * sources: [\"foo.js\", \"bar.js\"],\n\t * names: [\"src\", \"maps\", \"are\", \"fun\"],\n\t * mappings: \"AAAA,E;;ABCDE;\"\n\t * }\n\t * }],\n\t * }\n\t *\n\t * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n\t */\n\tfunction IndexedSourceMapConsumer(aSourceMap) {\n\t var sourceMap = aSourceMap;\n\t if (typeof aSourceMap === 'string') {\n\t sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n\t }\n\t\n\t var version = util.getArg(sourceMap, 'version');\n\t var sections = util.getArg(sourceMap, 'sections');\n\t\n\t if (version != this._version) {\n\t throw new Error('Unsupported version: ' + version);\n\t }\n\t\n\t this._sources = new ArraySet();\n\t this._names = new ArraySet();\n\t\n\t var lastOffset = {\n\t line: -1,\n\t column: 0\n\t };\n\t this._sections = sections.map(function (s) {\n\t if (s.url) {\n\t // The url field will require support for asynchronicity.\n\t // See https://github.com/mozilla/source-map/issues/16\n\t throw new Error('Support for url field in sections not implemented.');\n\t }\n\t var offset = util.getArg(s, 'offset');\n\t var offsetLine = util.getArg(offset, 'line');\n\t var offsetColumn = util.getArg(offset, 'column');\n\t\n\t if (offsetLine < lastOffset.line ||\n\t (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n\t throw new Error('Section offsets must be ordered and non-overlapping.');\n\t }\n\t lastOffset = offset;\n\t\n\t return {\n\t generatedOffset: {\n\t // The offset fields are 0-based, but we use 1-based indices when\n\t // encoding/decoding from VLQ.\n\t generatedLine: offsetLine + 1,\n\t generatedColumn: offsetColumn + 1\n\t },\n\t consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n\t }\n\t });\n\t}\n\t\n\tIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\n\tIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\t\n\t/**\n\t * The version of the source mapping spec that we are consuming.\n\t */\n\tIndexedSourceMapConsumer.prototype._version = 3;\n\t\n\t/**\n\t * The list of original sources.\n\t */\n\tObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n\t get: function () {\n\t var sources = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n\t sources.push(this._sections[i].consumer.sources[j]);\n\t }\n\t }\n\t return sources;\n\t }\n\t});\n\t\n\t/**\n\t * Returns the original source, line, and column information for the generated\n\t * source's line and column positions provided. The only argument is an object\n\t * with the following properties:\n\t *\n\t * - line: The line number in the generated source.\n\t * - column: The column number in the generated source.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - source: The original source file, or null.\n\t * - line: The line number in the original source, or null.\n\t * - column: The column number in the original source, or null.\n\t * - name: The original identifier, or null.\n\t */\n\tIndexedSourceMapConsumer.prototype.originalPositionFor =\n\t function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n\t var needle = {\n\t generatedLine: util.getArg(aArgs, 'line'),\n\t generatedColumn: util.getArg(aArgs, 'column')\n\t };\n\t\n\t // Find the section containing the generated position we're trying to map\n\t // to an original position.\n\t var sectionIndex = binarySearch.search(needle, this._sections,\n\t function(needle, section) {\n\t var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n\t if (cmp) {\n\t return cmp;\n\t }\n\t\n\t return (needle.generatedColumn -\n\t section.generatedOffset.generatedColumn);\n\t });\n\t var section = this._sections[sectionIndex];\n\t\n\t if (!section) {\n\t return {\n\t source: null,\n\t line: null,\n\t column: null,\n\t name: null\n\t };\n\t }\n\t\n\t return section.consumer.originalPositionFor({\n\t line: needle.generatedLine -\n\t (section.generatedOffset.generatedLine - 1),\n\t column: needle.generatedColumn -\n\t (section.generatedOffset.generatedLine === needle.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t bias: aArgs.bias\n\t });\n\t };\n\t\n\t/**\n\t * Return true if we have the source content for every source in the source\n\t * map, false otherwise.\n\t */\n\tIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n\t function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n\t return this._sections.every(function (s) {\n\t return s.consumer.hasContentsOfAllSources();\n\t });\n\t };\n\t\n\t/**\n\t * Returns the original source content. The only argument is the url of the\n\t * original source file. Returns null if no original source content is\n\t * available.\n\t */\n\tIndexedSourceMapConsumer.prototype.sourceContentFor =\n\t function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t var content = section.consumer.sourceContentFor(aSource, true);\n\t if (content) {\n\t return content;\n\t }\n\t }\n\t if (nullOnMissing) {\n\t return null;\n\t }\n\t else {\n\t throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n\t }\n\t };\n\t\n\t/**\n\t * Returns the generated line and column information for the original source,\n\t * line, and column positions provided. The only argument is an object with\n\t * the following properties:\n\t *\n\t * - source: The filename of the original source.\n\t * - line: The line number in the original source.\n\t * - column: The column number in the original source.\n\t *\n\t * and an object is returned with the following properties:\n\t *\n\t * - line: The line number in the generated source, or null.\n\t * - column: The column number in the generated source, or null.\n\t */\n\tIndexedSourceMapConsumer.prototype.generatedPositionFor =\n\t function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t\n\t // Only consider this section if the requested source is in the list of\n\t // sources of the consumer.\n\t if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n\t continue;\n\t }\n\t var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n\t if (generatedPosition) {\n\t var ret = {\n\t line: generatedPosition.line +\n\t (section.generatedOffset.generatedLine - 1),\n\t column: generatedPosition.column +\n\t (section.generatedOffset.generatedLine === generatedPosition.line\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0)\n\t };\n\t return ret;\n\t }\n\t }\n\t\n\t return {\n\t line: null,\n\t column: null\n\t };\n\t };\n\t\n\t/**\n\t * Parse the mappings in a string in to a data structure which we can easily\n\t * query (the ordered arrays in the `this.__generatedMappings` and\n\t * `this.__originalMappings` properties).\n\t */\n\tIndexedSourceMapConsumer.prototype._parseMappings =\n\t function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n\t this.__generatedMappings = [];\n\t this.__originalMappings = [];\n\t for (var i = 0; i < this._sections.length; i++) {\n\t var section = this._sections[i];\n\t var sectionMappings = section.consumer._generatedMappings;\n\t for (var j = 0; j < sectionMappings.length; j++) {\n\t var mapping = sectionMappings[j];\n\t\n\t var source = section.consumer._sources.at(mapping.source);\n\t if (section.consumer.sourceRoot !== null) {\n\t source = util.join(section.consumer.sourceRoot, source);\n\t }\n\t this._sources.add(source);\n\t source = this._sources.indexOf(source);\n\t\n\t var name = section.consumer._names.at(mapping.name);\n\t this._names.add(name);\n\t name = this._names.indexOf(name);\n\t\n\t // The mappings coming from the consumer for the section have\n\t // generated positions relative to the start of the section, so we\n\t // need to offset them to be relative to the start of the concatenated\n\t // generated file.\n\t var adjustedMapping = {\n\t source: source,\n\t generatedLine: mapping.generatedLine +\n\t (section.generatedOffset.generatedLine - 1),\n\t generatedColumn: mapping.generatedColumn +\n\t (section.generatedOffset.generatedLine === mapping.generatedLine\n\t ? section.generatedOffset.generatedColumn - 1\n\t : 0),\n\t originalLine: mapping.originalLine,\n\t originalColumn: mapping.originalColumn,\n\t name: name\n\t };\n\t\n\t this.__generatedMappings.push(adjustedMapping);\n\t if (typeof adjustedMapping.originalLine === 'number') {\n\t this.__originalMappings.push(adjustedMapping);\n\t }\n\t }\n\t }\n\t\n\t quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n\t quickSort(this.__originalMappings, util.compareByOriginalPositions);\n\t };\n\t\n\texports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\texports.GREATEST_LOWER_BOUND = 1;\n\texports.LEAST_UPPER_BOUND = 2;\n\t\n\t/**\n\t * Recursive implementation of binary search.\n\t *\n\t * @param aLow Indices here and lower do not contain the needle.\n\t * @param aHigh Indices here and higher do not contain the needle.\n\t * @param aNeedle The element being searched for.\n\t * @param aHaystack The non-empty array being searched.\n\t * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t */\n\tfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n\t // This function terminates when one of the following is true:\n\t //\n\t // 1. We find the exact element we are looking for.\n\t //\n\t // 2. We did not find the exact element, but we can return the index of\n\t // the next-closest element.\n\t //\n\t // 3. We did not find the exact element, and there is no next-closest\n\t // element than the one we are searching for, so we return -1.\n\t var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n\t var cmp = aCompare(aNeedle, aHaystack[mid], true);\n\t if (cmp === 0) {\n\t // Found the element we are looking for.\n\t return mid;\n\t }\n\t else if (cmp > 0) {\n\t // Our needle is greater than aHaystack[mid].\n\t if (aHigh - mid > 1) {\n\t // The element is in the upper half.\n\t return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // The exact needle element was not found in this haystack. Determine if\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return aHigh < aHaystack.length ? aHigh : -1;\n\t } else {\n\t return mid;\n\t }\n\t }\n\t else {\n\t // Our needle is less than aHaystack[mid].\n\t if (mid - aLow > 1) {\n\t // The element is in the lower half.\n\t return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n\t }\n\t\n\t // we are in termination case (3) or (2) and return the appropriate thing.\n\t if (aBias == exports.LEAST_UPPER_BOUND) {\n\t return mid;\n\t } else {\n\t return aLow < 0 ? -1 : aLow;\n\t }\n\t }\n\t}\n\t\n\t/**\n\t * This is an implementation of binary search which will always try and return\n\t * the index of the closest element if there is no exact hit. This is because\n\t * mappings between original and generated line/col pairs are single points,\n\t * and there is an implicit region between each of them, so a miss just means\n\t * that you aren't on the very start of a region.\n\t *\n\t * @param aNeedle The element you are looking for.\n\t * @param aHaystack The array that is being searched.\n\t * @param aCompare A function which takes the needle and an element in the\n\t * array and returns -1, 0, or 1 depending on whether the needle is less\n\t * than, equal to, or greater than the element, respectively.\n\t * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n\t * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n\t * closest element that is smaller than or greater than the one we are\n\t * searching for, respectively, if the exact element cannot be found.\n\t * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n\t */\n\texports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n\t if (aHaystack.length === 0) {\n\t return -1;\n\t }\n\t\n\t var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n\t aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n\t if (index < 0) {\n\t return -1;\n\t }\n\t\n\t // We have found either the exact element, or the next-closest element than\n\t // the one we are searching for. However, there may be more than one such\n\t // element. Make sure we always return the smallest of these.\n\t while (index - 1 >= 0) {\n\t if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n\t break;\n\t }\n\t --index;\n\t }\n\t\n\t return index;\n\t};\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\t// It turns out that some (most?) JavaScript engines don't self-host\n\t// `Array.prototype.sort`. This makes sense because C++ will likely remain\n\t// faster than JS when doing raw CPU-intensive sorting. However, when using a\n\t// custom comparator function, calling back and forth between the VM's C++ and\n\t// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n\t// worse generated code for the comparator function than would be optimal. In\n\t// fact, when sorting with a comparator, these costs outweigh the benefits of\n\t// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n\t// a ~3500ms mean speed-up in `bench/bench.html`.\n\t\n\t/**\n\t * Swap the elements indexed by `x` and `y` in the array `ary`.\n\t *\n\t * @param {Array} ary\n\t * The array.\n\t * @param {Number} x\n\t * The index of the first item.\n\t * @param {Number} y\n\t * The index of the second item.\n\t */\n\tfunction swap(ary, x, y) {\n\t var temp = ary[x];\n\t ary[x] = ary[y];\n\t ary[y] = temp;\n\t}\n\t\n\t/**\n\t * Returns a random integer within the range `low .. high` inclusive.\n\t *\n\t * @param {Number} low\n\t * The lower bound on the range.\n\t * @param {Number} high\n\t * The upper bound on the range.\n\t */\n\tfunction randomIntInRange(low, high) {\n\t return Math.round(low + (Math.random() * (high - low)));\n\t}\n\t\n\t/**\n\t * The Quick Sort algorithm.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t * @param {Number} p\n\t * Start index of the array\n\t * @param {Number} r\n\t * End index of the array\n\t */\n\tfunction doQuickSort(ary, comparator, p, r) {\n\t // If our lower bound is less than our upper bound, we (1) partition the\n\t // array into two pieces and (2) recurse on each half. If it is not, this is\n\t // the empty array and our base case.\n\t\n\t if (p < r) {\n\t // (1) Partitioning.\n\t //\n\t // The partitioning chooses a pivot between `p` and `r` and moves all\n\t // elements that are less than or equal to the pivot to the before it, and\n\t // all the elements that are greater than it after it. The effect is that\n\t // once partition is done, the pivot is in the exact place it will be when\n\t // the array is put in sorted order, and it will not need to be moved\n\t // again. This runs in O(n) time.\n\t\n\t // Always choose a random pivot so that an input array which is reverse\n\t // sorted does not cause O(n^2) running time.\n\t var pivotIndex = randomIntInRange(p, r);\n\t var i = p - 1;\n\t\n\t swap(ary, pivotIndex, r);\n\t var pivot = ary[r];\n\t\n\t // Immediately after `j` is incremented in this loop, the following hold\n\t // true:\n\t //\n\t // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n\t //\n\t // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n\t for (var j = p; j < r; j++) {\n\t if (comparator(ary[j], pivot) <= 0) {\n\t i += 1;\n\t swap(ary, i, j);\n\t }\n\t }\n\t\n\t swap(ary, i + 1, j);\n\t var q = i + 1;\n\t\n\t // (2) Recurse on each half.\n\t\n\t doQuickSort(ary, comparator, p, q - 1);\n\t doQuickSort(ary, comparator, q + 1, r);\n\t }\n\t}\n\t\n\t/**\n\t * Sort the given array in-place with the given comparator function.\n\t *\n\t * @param {Array} ary\n\t * An array to sort.\n\t * @param {function} comparator\n\t * Function to use to compare two items.\n\t */\n\texports.quickSort = function (ary, comparator) {\n\t doQuickSort(ary, comparator, 0, ary.length - 1);\n\t};\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\t/* -*- Mode: js; js-indent-level: 2; -*- */\n\t/*\n\t * Copyright 2011 Mozilla Foundation and contributors\n\t * Licensed under the New BSD license. See LICENSE or:\n\t * http://opensource.org/licenses/BSD-3-Clause\n\t */\n\t\n\tvar SourceMapGenerator = __webpack_require__(1).SourceMapGenerator;\n\tvar util = __webpack_require__(4);\n\t\n\t// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n\t// operating systems these days (capturing the result).\n\tvar REGEX_NEWLINE = /(\\r?\\n)/;\n\t\n\t// Newline character code for charCodeAt() comparisons\n\tvar NEWLINE_CODE = 10;\n\t\n\t// Private symbol for identifying `SourceNode`s when multiple versions of\n\t// the source-map library are loaded. This MUST NOT CHANGE across\n\t// versions!\n\tvar isSourceNode = \"$$$isSourceNode$$$\";\n\t\n\t/**\n\t * SourceNodes provide a way to abstract over interpolating/concatenating\n\t * snippets of generated JavaScript source code while maintaining the line and\n\t * column information associated with the original source code.\n\t *\n\t * @param aLine The original line number.\n\t * @param aColumn The original column number.\n\t * @param aSource The original source's filename.\n\t * @param aChunks Optional. An array of strings which are snippets of\n\t * generated JS, or other SourceNodes.\n\t * @param aName The original identifier.\n\t */\n\tfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n\t this.children = [];\n\t this.sourceContents = {};\n\t this.line = aLine == null ? null : aLine;\n\t this.column = aColumn == null ? null : aColumn;\n\t this.source = aSource == null ? null : aSource;\n\t this.name = aName == null ? null : aName;\n\t this[isSourceNode] = true;\n\t if (aChunks != null) this.add(aChunks);\n\t}\n\t\n\t/**\n\t * Creates a SourceNode from generated code and a SourceMapConsumer.\n\t *\n\t * @param aGeneratedCode The generated code\n\t * @param aSourceMapConsumer The SourceMap for the generated code\n\t * @param aRelativePath Optional. The path that relative sources in the\n\t * SourceMapConsumer should be relative to.\n\t */\n\tSourceNode.fromStringWithSourceMap =\n\t function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n\t // The SourceNode we want to fill with the generated code\n\t // and the SourceMap\n\t var node = new SourceNode();\n\t\n\t // All even indices of this array are one line of the generated code,\n\t // while all odd indices are the newlines between two adjacent lines\n\t // (since `REGEX_NEWLINE` captures its match).\n\t // Processed fragments are accessed by calling `shiftNextLine`.\n\t var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n\t var remainingLinesIndex = 0;\n\t var shiftNextLine = function() {\n\t var lineContents = getNextLine();\n\t // The last line of a file might not have a newline.\n\t var newLine = getNextLine() || \"\";\n\t return lineContents + newLine;\n\t\n\t function getNextLine() {\n\t return remainingLinesIndex < remainingLines.length ?\n\t remainingLines[remainingLinesIndex++] : undefined;\n\t }\n\t };\n\t\n\t // We need to remember the position of \"remainingLines\"\n\t var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\t\n\t // The generate SourceNodes we need a code range.\n\t // To extract it current and last mapping is used.\n\t // Here we store the last mapping.\n\t var lastMapping = null;\n\t\n\t aSourceMapConsumer.eachMapping(function (mapping) {\n\t if (lastMapping !== null) {\n\t // We add the code from \"lastMapping\" to \"mapping\":\n\t // First check if there is a new line in between.\n\t if (lastGeneratedLine < mapping.generatedLine) {\n\t // Associate first line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t lastGeneratedLine++;\n\t lastGeneratedColumn = 0;\n\t // The remaining code is added without mapping\n\t } else {\n\t // There is no new line in between.\n\t // Associate the code between \"lastGeneratedColumn\" and\n\t // \"mapping.generatedColumn\" with \"lastMapping\"\n\t var nextLine = remainingLines[remainingLinesIndex];\n\t var code = nextLine.substr(0, mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n\t lastGeneratedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t addMappingWithCode(lastMapping, code);\n\t // No more remaining code, continue\n\t lastMapping = mapping;\n\t return;\n\t }\n\t }\n\t // We add the generated code until the first mapping\n\t // to the SourceNode without any mapping.\n\t // Each line is added as separate string.\n\t while (lastGeneratedLine < mapping.generatedLine) {\n\t node.add(shiftNextLine());\n\t lastGeneratedLine++;\n\t }\n\t if (lastGeneratedColumn < mapping.generatedColumn) {\n\t var nextLine = remainingLines[remainingLinesIndex];\n\t node.add(nextLine.substr(0, mapping.generatedColumn));\n\t remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n\t lastGeneratedColumn = mapping.generatedColumn;\n\t }\n\t lastMapping = mapping;\n\t }, this);\n\t // We have processed all mappings.\n\t if (remainingLinesIndex < remainingLines.length) {\n\t if (lastMapping) {\n\t // Associate the remaining code in the current line with \"lastMapping\"\n\t addMappingWithCode(lastMapping, shiftNextLine());\n\t }\n\t // and add the remaining lines without any mapping\n\t node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n\t }\n\t\n\t // Copy sourcesContent into SourceNode\n\t aSourceMapConsumer.sources.forEach(function (sourceFile) {\n\t var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n\t if (content != null) {\n\t if (aRelativePath != null) {\n\t sourceFile = util.join(aRelativePath, sourceFile);\n\t }\n\t node.setSourceContent(sourceFile, content);\n\t }\n\t });\n\t\n\t return node;\n\t\n\t function addMappingWithCode(mapping, code) {\n\t if (mapping === null || mapping.source === undefined) {\n\t node.add(code);\n\t } else {\n\t var source = aRelativePath\n\t ? util.join(aRelativePath, mapping.source)\n\t : mapping.source;\n\t node.add(new SourceNode(mapping.originalLine,\n\t mapping.originalColumn,\n\t source,\n\t code,\n\t mapping.name));\n\t }\n\t }\n\t };\n\t\n\t/**\n\t * Add a chunk of generated JS to this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.add = function SourceNode_add(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t aChunk.forEach(function (chunk) {\n\t this.add(chunk);\n\t }, this);\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t if (aChunk) {\n\t this.children.push(aChunk);\n\t }\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Add a chunk of generated JS to the beginning of this source node.\n\t *\n\t * @param aChunk A string snippet of generated JS code, another instance of\n\t * SourceNode, or an array where each member is one of those things.\n\t */\n\tSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n\t if (Array.isArray(aChunk)) {\n\t for (var i = aChunk.length-1; i >= 0; i--) {\n\t this.prepend(aChunk[i]);\n\t }\n\t }\n\t else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n\t this.children.unshift(aChunk);\n\t }\n\t else {\n\t throw new TypeError(\n\t \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n\t );\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Walk over the tree of JS snippets in this node and its children. The\n\t * walking function is called once for each snippet of JS and is passed that\n\t * snippet and the its original associated source's line/column location.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n\t var chunk;\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t chunk = this.children[i];\n\t if (chunk[isSourceNode]) {\n\t chunk.walk(aFn);\n\t }\n\t else {\n\t if (chunk !== '') {\n\t aFn(chunk, { source: this.source,\n\t line: this.line,\n\t column: this.column,\n\t name: this.name });\n\t }\n\t }\n\t }\n\t};\n\t\n\t/**\n\t * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n\t * each of `this.children`.\n\t *\n\t * @param aSep The separator.\n\t */\n\tSourceNode.prototype.join = function SourceNode_join(aSep) {\n\t var newChildren;\n\t var i;\n\t var len = this.children.length;\n\t if (len > 0) {\n\t newChildren = [];\n\t for (i = 0; i < len-1; i++) {\n\t newChildren.push(this.children[i]);\n\t newChildren.push(aSep);\n\t }\n\t newChildren.push(this.children[i]);\n\t this.children = newChildren;\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Call String.prototype.replace on the very right-most source snippet. Useful\n\t * for trimming whitespace from the end of a source node, etc.\n\t *\n\t * @param aPattern The pattern to replace.\n\t * @param aReplacement The thing to replace the pattern with.\n\t */\n\tSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n\t var lastChild = this.children[this.children.length - 1];\n\t if (lastChild[isSourceNode]) {\n\t lastChild.replaceRight(aPattern, aReplacement);\n\t }\n\t else if (typeof lastChild === 'string') {\n\t this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n\t }\n\t else {\n\t this.children.push(''.replace(aPattern, aReplacement));\n\t }\n\t return this;\n\t};\n\t\n\t/**\n\t * Set the source content for a source file. This will be added to the SourceMapGenerator\n\t * in the sourcesContent field.\n\t *\n\t * @param aSourceFile The filename of the source file\n\t * @param aSourceContent The content of the source file\n\t */\n\tSourceNode.prototype.setSourceContent =\n\t function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n\t this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n\t };\n\t\n\t/**\n\t * Walk over the tree of SourceNodes. The walking function is called for each\n\t * source file content and is passed the filename and source content.\n\t *\n\t * @param aFn The traversal function.\n\t */\n\tSourceNode.prototype.walkSourceContents =\n\t function SourceNode_walkSourceContents(aFn) {\n\t for (var i = 0, len = this.children.length; i < len; i++) {\n\t if (this.children[i][isSourceNode]) {\n\t this.children[i].walkSourceContents(aFn);\n\t }\n\t }\n\t\n\t var sources = Object.keys(this.sourceContents);\n\t for (var i = 0, len = sources.length; i < len; i++) {\n\t aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n\t }\n\t };\n\t\n\t/**\n\t * Return the string representation of this source node. Walks over the tree\n\t * and concatenates all the various snippets together to one string.\n\t */\n\tSourceNode.prototype.toString = function SourceNode_toString() {\n\t var str = \"\";\n\t this.walk(function (chunk) {\n\t str += chunk;\n\t });\n\t return str;\n\t};\n\t\n\t/**\n\t * Returns the string representation of this source node along with a source\n\t * map.\n\t */\n\tSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n\t var generated = {\n\t code: \"\",\n\t line: 1,\n\t column: 0\n\t };\n\t var map = new SourceMapGenerator(aArgs);\n\t var sourceMappingActive = false;\n\t var lastOriginalSource = null;\n\t var lastOriginalLine = null;\n\t var lastOriginalColumn = null;\n\t var lastOriginalName = null;\n\t this.walk(function (chunk, original) {\n\t generated.code += chunk;\n\t if (original.source !== null\n\t && original.line !== null\n\t && original.column !== null) {\n\t if(lastOriginalSource !== original.source\n\t || lastOriginalLine !== original.line\n\t || lastOriginalColumn !== original.column\n\t || lastOriginalName !== original.name) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t lastOriginalSource = original.source;\n\t lastOriginalLine = original.line;\n\t lastOriginalColumn = original.column;\n\t lastOriginalName = original.name;\n\t sourceMappingActive = true;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t }\n\t });\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t }\n\t for (var idx = 0, length = chunk.length; idx < length; idx++) {\n\t if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n\t generated.line++;\n\t generated.column = 0;\n\t // Mappings end at eol\n\t if (idx + 1 === length) {\n\t lastOriginalSource = null;\n\t sourceMappingActive = false;\n\t } else if (sourceMappingActive) {\n\t map.addMapping({\n\t source: original.source,\n\t original: {\n\t line: original.line,\n\t column: original.column\n\t },\n\t generated: {\n\t line: generated.line,\n\t column: generated.column\n\t },\n\t name: original.name\n\t });\n\t }\n\t } else {\n\t generated.column++;\n\t }\n\t }\n\t });\n\t this.walkSourceContents(function (sourceFile, sourceContent) {\n\t map.setSourceContent(sourceFile, sourceContent);\n\t });\n\t\n\t return { code: generated.code, map: map };\n\t};\n\t\n\texports.SourceNode = SourceNode;\n\n\n/***/ })\n/******/ ])\n});\n;\n\n\n// WEBPACK FOOTER //\n// source-map.min.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 42c329f865e32e011afb","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./source-map.js\n// module id = 0\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * 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\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.]*)(?::(\\d+))?(\\S*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = mappingA.source - mappingB.source;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return mappingA.name - mappingB.name;\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap)\n : new BasicSourceMapConsumer(sourceMap);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n if (source != null && sourceRoot != null) {\n source = util.join(sourceRoot, source);\n }\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: Optional. the column number in the original source.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n if (this.sourceRoot != null) {\n needle.source = util.relative(this.sourceRoot, needle.source);\n }\n if (!this._sources.has(needle.source)) {\n return [];\n }\n needle.source = this._sources.indexOf(needle.source);\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The only parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._sources.toArray().map(function (s) {\n return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;\n }, this);\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n if (this.sourceRoot != null) {\n source = util.join(this.sourceRoot, source);\n }\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n if (this.sourceRoot != null) {\n aSource = util.relative(this.sourceRoot, aSource);\n }\n\n if (this._sources.has(aSource)) {\n return this.sourcesContent[this._sources.indexOf(aSource)];\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = aSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + aSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + aSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n if (this.sourceRoot != null) {\n source = util.relative(this.sourceRoot, source);\n }\n if (!this._sources.has(source)) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n source = this._sources.indexOf(source);\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The only parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = JSON.parse(aSourceMap.replace(/^\\)\\]\\}'/, ''));\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'))\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source.\n * - column: The column number in the generated source.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null.\n * - column: The column number in the original source, or null.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source.\n * - column: The column number in the original source.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null.\n * - column: The column number in the generated source, or null.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n if (section.consumer.sourceRoot !== null) {\n source = util.join(section.consumer.sourceRoot, source);\n }\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex];\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex];\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/array-set.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/array-set.js deleted file mode 100644 index fbd5c81..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/array-set.js +++ /dev/null @@ -1,121 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = require('./util'); -var has = Object.prototype.hasOwnProperty; -var hasNativeMap = typeof Map !== "undefined"; - -/** - * A data structure which is a combination of an array and a set. Adding a new - * member is O(1), testing for membership is O(1), and finding the index of an - * element is O(1). Removing elements from the set is not supported. Only - * strings are supported for membership. - */ -function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); -} - -/** - * Static method for creating ArraySet instances from an existing array. - */ -ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var i = 0, len = aArray.length; i < len; i++) { - set.add(aArray[i], aAllowDuplicates); - } - return set; -}; - -/** - * Return how many unique items are in this ArraySet. If duplicates have been - * added, than those do not count towards the size. - * - * @returns Number - */ -ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; -}; - -/** - * Add the given string to this set. - * - * @param String aStr - */ -ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } -}; - -/** - * Is the given string a member of this set? - * - * @param String aStr - */ -ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } -}; - -/** - * What is the index of the given string in the array? - * - * @param String aStr - */ -ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); -}; - -/** - * What is the element at the given index? - * - * @param Number aIdx - */ -ArraySet.prototype.at = function ArraySet_at(aIdx) { - if (aIdx >= 0 && aIdx < this._array.length) { - return this._array[aIdx]; - } - throw new Error('No element indexed by ' + aIdx); -}; - -/** - * Returns the array representation of this set (which has the proper indices - * indicated by indexOf). Note that this is a copy of the internal array used - * for storing the members so that no one can mess with internal state. - */ -ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); -}; - -exports.ArraySet = ArraySet; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64-vlq.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64-vlq.js deleted file mode 100644 index 612b404..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64-vlq.js +++ /dev/null @@ -1,140 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - * - * Based on the Base 64 VLQ implementation in Closure Compiler: - * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java - * - * Copyright 2011 The Closure Compiler Authors. 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 Google Inc. 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 - * OWNER 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. - */ - -var base64 = require('./base64'); - -// A single base 64 digit can contain 6 bits of data. For the base 64 variable -// length quantities we use in the source map spec, the first bit is the sign, -// the next four bits are the actual value, and the 6th bit is the -// continuation bit. The continuation bit tells us whether there are more -// digits in this value following this digit. -// -// Continuation -// | Sign -// | | -// V V -// 101011 - -var VLQ_BASE_SHIFT = 5; - -// binary: 100000 -var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - -// binary: 011111 -var VLQ_BASE_MASK = VLQ_BASE - 1; - -// binary: 100000 -var VLQ_CONTINUATION_BIT = VLQ_BASE; - -/** - * Converts from a two-complement value to a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) - * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) - */ -function toVLQSigned(aValue) { - return aValue < 0 - ? ((-aValue) << 1) + 1 - : (aValue << 1) + 0; -} - -/** - * Converts to a two-complement value from a value where the sign bit is - * placed in the least significant bit. For example, as decimals: - * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 - * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 - */ -function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; -} - -/** - * Returns the base 64 VLQ encoded value. - */ -exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var vlq = toVLQSigned(aValue); - - do { - digit = vlq & VLQ_BASE_MASK; - vlq >>>= VLQ_BASE_SHIFT; - if (vlq > 0) { - // There are still more digits in this value, so we must make sure the - // continuation bit is marked. - digit |= VLQ_CONTINUATION_BIT; - } - encoded += base64.encode(digit); - } while (vlq > 0); - - return encoded; -}; - -/** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ -exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; -}; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64.js deleted file mode 100644 index 8aa86b3..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/base64.js +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); - -/** - * Encode an integer in the range of 0 to 63 to a single base 64 digit. - */ -exports.encode = function (number) { - if (0 <= number && number < intToCharMap.length) { - return intToCharMap[number]; - } - throw new TypeError("Must be between 0 and 63: " + number); -}; - -/** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ -exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; -}; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/binary-search.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/binary-search.js deleted file mode 100644 index 010ac94..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/binary-search.js +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -exports.GREATEST_LOWER_BOUND = 1; -exports.LEAST_UPPER_BOUND = 2; - -/** - * Recursive implementation of binary search. - * - * @param aLow Indices here and lower do not contain the needle. - * @param aHigh Indices here and higher do not contain the needle. - * @param aNeedle The element being searched for. - * @param aHaystack The non-empty array being searched. - * @param aCompare Function which takes two elements and returns -1, 0, or 1. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - */ -function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { - // This function terminates when one of the following is true: - // - // 1. We find the exact element we are looking for. - // - // 2. We did not find the exact element, but we can return the index of - // the next-closest element. - // - // 3. We did not find the exact element, and there is no next-closest - // element than the one we are searching for, so we return -1. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var cmp = aCompare(aNeedle, aHaystack[mid], true); - if (cmp === 0) { - // Found the element we are looking for. - return mid; - } - else if (cmp > 0) { - // Our needle is greater than aHaystack[mid]. - if (aHigh - mid > 1) { - // The element is in the upper half. - return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); - } - - // The exact needle element was not found in this haystack. Determine if - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return aHigh < aHaystack.length ? aHigh : -1; - } else { - return mid; - } - } - else { - // Our needle is less than aHaystack[mid]. - if (mid - aLow > 1) { - // The element is in the lower half. - return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); - } - - // we are in termination case (3) or (2) and return the appropriate thing. - if (aBias == exports.LEAST_UPPER_BOUND) { - return mid; - } else { - return aLow < 0 ? -1 : aLow; - } - } -} - -/** - * This is an implementation of binary search which will always try and return - * the index of the closest element if there is no exact hit. This is because - * mappings between original and generated line/col pairs are single points, - * and there is an implicit region between each of them, so a miss just means - * that you aren't on the very start of a region. - * - * @param aNeedle The element you are looking for. - * @param aHaystack The array that is being searched. - * @param aCompare A function which takes the needle and an element in the - * array and returns -1, 0, or 1 depending on whether the needle is less - * than, equal to, or greater than the element, respectively. - * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or - * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. - */ -exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { - if (aHaystack.length === 0) { - return -1; - } - - var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, - aCompare, aBias || exports.GREATEST_LOWER_BOUND); - if (index < 0) { - return -1; - } - - // We have found either the exact element, or the next-closest element than - // the one we are searching for. However, there may be more than one such - // element. Make sure we always return the smallest of these. - while (index - 1 >= 0) { - if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { - break; - } - --index; - } - - return index; -}; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/mapping-list.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/mapping-list.js deleted file mode 100644 index 06d1274..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/mapping-list.js +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = require('./util'); - -/** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ -function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; -} - -/** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ -function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; -} - -/** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. - * - * NOTE: The order of the mappings is NOT guaranteed. - */ -MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - -/** - * Add the given source mapping. - * - * @param Object aMapping - */ -MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } -}; - -/** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. - * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. - */ -MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; -}; - -exports.MappingList = MappingList; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/quick-sort.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/quick-sort.js deleted file mode 100644 index 6a7caad..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/quick-sort.js +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -// It turns out that some (most?) JavaScript engines don't self-host -// `Array.prototype.sort`. This makes sense because C++ will likely remain -// faster than JS when doing raw CPU-intensive sorting. However, when using a -// custom comparator function, calling back and forth between the VM's C++ and -// JIT'd JS is rather slow *and* loses JIT type information, resulting in -// worse generated code for the comparator function than would be optimal. In -// fact, when sorting with a comparator, these costs outweigh the benefits of -// sorting in C++. By using our own JS-implemented Quick Sort (below), we get -// a ~3500ms mean speed-up in `bench/bench.html`. - -/** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ -function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; -} - -/** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ -function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); -} - -/** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ -function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } -} - -/** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ -exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); -}; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-consumer.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-consumer.js deleted file mode 100644 index 6abcc28..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-consumer.js +++ /dev/null @@ -1,1082 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = require('./util'); -var binarySearch = require('./binary-search'); -var ArraySet = require('./array-set').ArraySet; -var base64VLQ = require('./base64-vlq'); -var quickSort = require('./quick-sort').quickSort; - -function SourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap) - : new BasicSourceMapConsumer(sourceMap); -} - -SourceMapConsumer.fromSourceMap = function(aSourceMap) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap); -} - -/** - * The version of the source mapping spec that we are consuming. - */ -SourceMapConsumer.prototype._version = 3; - -// `__generatedMappings` and `__originalMappings` are arrays that hold the -// parsed mapping coordinates from the source map's "mappings" attribute. They -// are lazily instantiated, accessed via the `_generatedMappings` and -// `_originalMappings` getters respectively, and we only parse the mappings -// and create these arrays once queried for a source location. We jump through -// these hoops because there can be many thousands of mappings, and parsing -// them is expensive, so we only want to do it if we must. -// -// Each object in the arrays is of the form: -// -// { -// generatedLine: The line number in the generated code, -// generatedColumn: The column number in the generated code, -// source: The path to the original source file that generated this -// chunk of code, -// originalLine: The line number in the original source that -// corresponds to this chunk of generated code, -// originalColumn: The column number in the original source that -// corresponds to this chunk of generated code, -// name: The name of the original symbol which generated this chunk of -// code. -// } -// -// All properties except for `generatedLine` and `generatedColumn` can be -// `null`. -// -// `_generatedMappings` is ordered by the generated positions. -// -// `_originalMappings` is ordered by the original positions. - -SourceMapConsumer.prototype.__generatedMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } -}); - -SourceMapConsumer.prototype.__originalMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } -}); - -SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - -SourceMapConsumer.GENERATED_ORDER = 1; -SourceMapConsumer.ORIGINAL_ORDER = 2; - -SourceMapConsumer.GREATEST_LOWER_BOUND = 1; -SourceMapConsumer.LEAST_UPPER_BOUND = 2; - -/** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ -SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - if (source != null && sourceRoot != null) { - source = util.join(sourceRoot, source); - } - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; - -/** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: Optional. the column number in the original source. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ -SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); - - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; - - if (this.sourceRoot != null) { - needle.source = util.relative(this.sourceRoot, needle.source); - } - if (!this._sources.has(needle.source)) { - return []; - } - needle.source = this._sources.indexOf(needle.source); - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; - - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - -exports.SourceMapConsumer = SourceMapConsumer; - -/** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The only parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ -function BasicSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); - - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); - - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this.file = file; -} - -BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - -/** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @returns BasicSourceMapConsumer - */ -BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - -/** - * The version of the source mapping spec that we are consuming. - */ -BasicSourceMapConsumer.prototype._version = 3; - -/** - * The list of original sources. - */ -Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._sources.toArray().map(function (s) { - return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s; - }, this); - } -}); - -/** - * Provide the JIT with a nice shape / hidden class. - */ -function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; -} - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - cachedSegments[str] = segment; - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); - } - } - } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - -/** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ -BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); - } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); - } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - -/** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ -BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - -/** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ -BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - if (this.sourceRoot != null) { - source = util.join(this.sourceRoot, source); - } - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } - } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; - } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - if (this.sourceRoot != null) { - aSource = util.relative(this.sourceRoot, aSource); - } - - if (this._sources.has(aSource)) { - return this.sourcesContent[this._sources.indexOf(aSource)]; - } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = aSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + aSource)) { - return this.sourcesContent[this._sources.indexOf("/" + aSource)]; - } - } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - -/** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ -BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - if (this.sourceRoot != null) { - source = util.relative(this.sourceRoot, source); - } - if (!this._sources.has(source)) { - return { - line: null, - column: null, - lastColumn: null - }; - } - source = this._sources.indexOf(source); - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - -exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - -/** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The only parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ -function IndexedSourceMapConsumer(aSourceMap) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, '')); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); - } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map')) - } - }); -} - -IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - -/** - * The version of the source mapping spec that we are consuming. - */ -IndexedSourceMapConsumer.prototype._version = 3; - -/** - * The list of original sources. - */ -Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } - } - return sources; - } -}); - -/** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. - * - column: The column number in the generated source. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. - * - column: The column number in the original source, or null. - * - name: The original identifier, or null. - */ -IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; - } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); - } - }; - -/** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. - * - column: The column number in the original source. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. - * - column: The column number in the generated source, or null. - */ -IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } - } - - return { - line: null, - column: null - }; - }; - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - if (section.consumer.sourceRoot !== null) { - source = util.join(section.consumer.sourceRoot, source); - } - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); - - // The mappings coming from the consumer for the section have - // generated positions relative to the start of the section, so we - // need to offset them to be relative to the start of the concatenated - // generated file. - var adjustedMapping = { - source: source, - generatedLine: mapping.generatedLine + - (section.generatedOffset.generatedLine - 1), - generatedColumn: mapping.generatedColumn + - (section.generatedOffset.generatedLine === mapping.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - -exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-generator.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-generator.js deleted file mode 100644 index aff1e7f..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-map-generator.js +++ /dev/null @@ -1,416 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var base64VLQ = require('./base64-vlq'); -var util = require('./util'); -var ArraySet = require('./array-set').ArraySet; -var MappingList = require('./mapping-list').MappingList; - -/** - * An instance of the SourceMapGenerator represents a source map which is - * being built incrementally. You may pass an object with the following - * properties: - * - * - file: The filename of the generated source. - * - sourceRoot: A root for all relative URLs in this source map. - */ -function SourceMapGenerator(aArgs) { - if (!aArgs) { - aArgs = {}; - } - this._file = util.getArg(aArgs, 'file', null); - this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); - this._skipValidation = util.getArg(aArgs, 'skipValidation', false); - this._sources = new ArraySet(); - this._names = new ArraySet(); - this._mappings = new MappingList(); - this._sourcesContents = null; -} - -SourceMapGenerator.prototype._version = 3; - -/** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ -SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var newMapping = { - generated: { - line: mapping.generatedLine, - column: mapping.generatedColumn - } - }; - - if (mapping.source != null) { - newMapping.source = mapping.source; - if (sourceRoot != null) { - newMapping.source = util.relative(sourceRoot, newMapping.source); - } - - newMapping.original = { - line: mapping.originalLine, - column: mapping.originalColumn - }; - - if (mapping.name != null) { - newMapping.name = mapping.name; - } - } - - generator.addMapping(newMapping); - }); - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - generator.setSourceContent(sourceFile, content); - } - }); - return generator; - }; - -/** - * Add a single mapping from original source line and column to the generated - * source's line and column for this source map being created. The mapping - * object should have the following properties: - * - * - generated: An object with the generated line and column positions. - * - original: An object with the original line and column positions. - * - source: The original source file (relative to the sourceRoot). - * - name: An optional original token name for this mapping. - */ -SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var name = util.getArg(aArgs, 'name', null); - - if (!this._skipValidation) { - this._validateMapping(generated, original, source, name); - } - - if (source != null) { - source = String(source); - if (!this._sources.has(source)) { - this._sources.add(source); - } - } - - if (name != null) { - name = String(name); - if (!this._names.has(name)) { - this._names.add(name); - } - } - - this._mappings.add({ - generatedLine: generated.line, - generatedColumn: generated.column, - originalLine: original != null && original.line, - originalColumn: original != null && original.column, - source: source, - name: name - }); - }; - -/** - * Set the source content for a source file. - */ -SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var source = aSourceFile; - if (this._sourceRoot != null) { - source = util.relative(this._sourceRoot, source); - } - - if (aSourceContent != null) { - // Add the source content to the _sourcesContents map. - // Create a new _sourcesContents map if the property is null. - if (!this._sourcesContents) { - this._sourcesContents = Object.create(null); - } - this._sourcesContents[util.toSetString(source)] = aSourceContent; - } else if (this._sourcesContents) { - // Remove the source file from the _sourcesContents map. - // If the _sourcesContents map is empty, set the property to null. - delete this._sourcesContents[util.toSetString(source)]; - if (Object.keys(this._sourcesContents).length === 0) { - this._sourcesContents = null; - } - } - }; - -/** - * Applies the mappings of a sub-source-map for a specific source file to the - * source map being generated. Each mapping to the supplied source file is - * rewritten using the supplied source map. Note: The resolution for the - * resulting mappings is the minimium of this map and the supplied map. - * - * @param aSourceMapConsumer The source map to be applied. - * @param aSourceFile Optional. The filename of the source file. - * If omitted, SourceMapConsumer's file property will be used. - * @param aSourceMapPath Optional. The dirname of the path to the source map - * to be applied. If relative, it is relative to the SourceMapConsumer. - * This parameter is needed when the two source maps aren't in the same - * directory, and the source map to be applied contains relative source - * paths. If so, those relative source paths need to be rewritten - * relative to the SourceMapGenerator. - */ -SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var sourceFile = aSourceFile; - // If aSourceFile is omitted, we will use the file property of the SourceMap - if (aSourceFile == null) { - if (aSourceMapConsumer.file == null) { - throw new Error( - 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + - 'or the source map\'s "file" property. Both were omitted.' - ); - } - sourceFile = aSourceMapConsumer.file; - } - var sourceRoot = this._sourceRoot; - // Make "sourceFile" relative if an absolute Url is passed. - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - // Applying the SourceMap can add and remove items from the sources and - // the names array. - var newSources = new ArraySet(); - var newNames = new ArraySet(); - - // Find mappings for the "sourceFile" - this._mappings.unsortedForEach(function (mapping) { - if (mapping.source === sourceFile && mapping.originalLine != null) { - // Check if it can be mapped by the source map, then update the mapping. - var original = aSourceMapConsumer.originalPositionFor({ - line: mapping.originalLine, - column: mapping.originalColumn - }); - if (original.source != null) { - // Copy mapping - mapping.source = original.source; - if (aSourceMapPath != null) { - mapping.source = util.join(aSourceMapPath, mapping.source) - } - if (sourceRoot != null) { - mapping.source = util.relative(sourceRoot, mapping.source); - } - mapping.originalLine = original.line; - mapping.originalColumn = original.column; - if (original.name != null) { - mapping.name = original.name; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var name = mapping.name; - if (name != null && !newNames.has(name)) { - newNames.add(name); - } - - }, this); - this._sources = newSources; - this._names = newNames; - - // Copy sourcesContents of applied map. - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, content); - } - }, this); - }; - -/** - * A mapping can have one of the three levels of data: - * - * 1. Just the generated position. - * 2. The Generated position, original position, and original source. - * 3. Generated and original position, original source, as well as a name - * token. - * - * To maintain consistency, we validate that any new mapping being added falls - * in to one of these categories. - */ -SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, - aName) { - // When aOriginal is truthy but has empty values for .line and .column, - // it is most likely a programmer error. In this case we throw a very - // specific error message to try to guide them the right way. - // For example: https://github.com/Polymer/polymer-bundler/pull/519 - if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { - throw new Error( - 'original.line and original.column are not numbers -- you probably meant to omit ' + - 'the original mapping entirely and only map the generated position. If so, pass ' + - 'null for the original mapping instead of an object with empty or null values.' - ); - } - - if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aGenerated.line > 0 && aGenerated.column >= 0 - && !aOriginal && !aSource && !aName) { - // Case 1. - return; - } - else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated - && aOriginal && 'line' in aOriginal && 'column' in aOriginal - && aGenerated.line > 0 && aGenerated.column >= 0 - && aOriginal.line > 0 && aOriginal.column >= 0 - && aSource) { - // Cases 2 and 3. - return; - } - else { - throw new Error('Invalid mapping: ' + JSON.stringify({ - generated: aGenerated, - source: aSource, - original: aOriginal, - name: aName - })); - } - }; - -/** - * Serialize the accumulated mappings in to the stream of base 64 VLQs - * specified by the source map format. - */ -SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var i = 0, len = mappings.length; i < len; i++) { - mapping = mappings[i]; - next = '' - - if (mapping.generatedLine !== previousGeneratedLine) { - previousGeneratedColumn = 0; - while (mapping.generatedLine !== previousGeneratedLine) { - next += ';'; - previousGeneratedLine++; - } - } - else { - if (i > 0) { - if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { - continue; - } - next += ','; - } - } - - next += base64VLQ.encode(mapping.generatedColumn - - previousGeneratedColumn); - previousGeneratedColumn = mapping.generatedColumn; - - if (mapping.source != null) { - sourceIdx = this._sources.indexOf(mapping.source); - next += base64VLQ.encode(sourceIdx - previousSource); - previousSource = sourceIdx; - - // lines are stored 0-based in SourceMap spec version 3 - next += base64VLQ.encode(mapping.originalLine - 1 - - previousOriginalLine); - previousOriginalLine = mapping.originalLine - 1; - - next += base64VLQ.encode(mapping.originalColumn - - previousOriginalColumn); - previousOriginalColumn = mapping.originalColumn; - - if (mapping.name != null) { - nameIdx = this._names.indexOf(mapping.name); - next += base64VLQ.encode(nameIdx - previousName); - previousName = nameIdx; - } - } - - result += next; - } - - return result; - }; - -SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - -/** - * Externalize the source map. - */ -SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var map = { - version: this._version, - sources: this._sources.toArray(), - names: this._names.toArray(), - mappings: this._serializeMappings() - }; - if (this._file != null) { - map.file = this._file; - } - if (this._sourceRoot != null) { - map.sourceRoot = this._sourceRoot; - } - if (this._sourcesContents) { - map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); - } - - return map; - }; - -/** - * Render the source map being generated to a string. - */ -SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - -exports.SourceMapGenerator = SourceMapGenerator; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-node.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-node.js deleted file mode 100644 index d196a53..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/source-node.js +++ /dev/null @@ -1,413 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator; -var util = require('./util'); - -// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other -// operating systems these days (capturing the result). -var REGEX_NEWLINE = /(\r?\n)/; - -// Newline character code for charCodeAt() comparisons -var NEWLINE_CODE = 10; - -// Private symbol for identifying `SourceNode`s when multiple versions of -// the source-map library are loaded. This MUST NOT CHANGE across -// versions! -var isSourceNode = "$$$isSourceNode$$$"; - -/** - * SourceNodes provide a way to abstract over interpolating/concatenating - * snippets of generated JavaScript source code while maintaining the line and - * column information associated with the original source code. - * - * @param aLine The original line number. - * @param aColumn The original column number. - * @param aSource The original source's filename. - * @param aChunks Optional. An array of strings which are snippets of - * generated JS, or other SourceNodes. - * @param aName The original identifier. - */ -function SourceNode(aLine, aColumn, aSource, aChunks, aName) { - this.children = []; - this.sourceContents = {}; - this.line = aLine == null ? null : aLine; - this.column = aColumn == null ? null : aColumn; - this.source = aSource == null ? null : aSource; - this.name = aName == null ? null : aName; - this[isSourceNode] = true; - if (aChunks != null) this.add(aChunks); -} - -/** - * Creates a SourceNode from generated code and a SourceMapConsumer. - * - * @param aGeneratedCode The generated code - * @param aSourceMapConsumer The SourceMap for the generated code - * @param aRelativePath Optional. The path that relative sources in the - * SourceMapConsumer should be relative to. - */ -SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var node = new SourceNode(); - - // All even indices of this array are one line of the generated code, - // while all odd indices are the newlines between two adjacent lines - // (since `REGEX_NEWLINE` captures its match). - // Processed fragments are accessed by calling `shiftNextLine`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var lastGeneratedLine = 1, lastGeneratedColumn = 0; - - // The generate SourceNodes we need a code range. - // To extract it current and last mapping is used. - // Here we store the last mapping. - var lastMapping = null; - - aSourceMapConsumer.eachMapping(function (mapping) { - if (lastMapping !== null) { - // We add the code from "lastMapping" to "mapping": - // First check if there is a new line in between. - if (lastGeneratedLine < mapping.generatedLine) { - // Associate first line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - lastGeneratedLine++; - lastGeneratedColumn = 0; - // The remaining code is added without mapping - } else { - // There is no new line in between. - // Associate the code between "lastGeneratedColumn" and - // "mapping.generatedColumn" with "lastMapping" - var nextLine = remainingLines[remainingLinesIndex]; - var code = nextLine.substr(0, mapping.generatedColumn - - lastGeneratedColumn); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - - lastGeneratedColumn); - lastGeneratedColumn = mapping.generatedColumn; - addMappingWithCode(lastMapping, code); - // No more remaining code, continue - lastMapping = mapping; - return; - } - } - // We add the generated code until the first mapping - // to the SourceNode without any mapping. - // Each line is added as separate string. - while (lastGeneratedLine < mapping.generatedLine) { - node.add(shiftNextLine()); - lastGeneratedLine++; - } - if (lastGeneratedColumn < mapping.generatedColumn) { - var nextLine = remainingLines[remainingLinesIndex]; - node.add(nextLine.substr(0, mapping.generatedColumn)); - remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); - lastGeneratedColumn = mapping.generatedColumn; - } - lastMapping = mapping; - }, this); - // We have processed all mappings. - if (remainingLinesIndex < remainingLines.length) { - if (lastMapping) { - // Associate the remaining code in the current line with "lastMapping" - addMappingWithCode(lastMapping, shiftNextLine()); - } - // and add the remaining lines without any mapping - node.add(remainingLines.splice(remainingLinesIndex).join("")); - } - - // Copy sourcesContent into SourceNode - aSourceMapConsumer.sources.forEach(function (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aRelativePath != null) { - sourceFile = util.join(aRelativePath, sourceFile); - } - node.setSourceContent(sourceFile, content); - } - }); - - return node; - - function addMappingWithCode(mapping, code) { - if (mapping === null || mapping.source === undefined) { - node.add(code); - } else { - var source = aRelativePath - ? util.join(aRelativePath, mapping.source) - : mapping.source; - node.add(new SourceNode(mapping.originalLine, - mapping.originalColumn, - source, - code, - mapping.name)); - } - } - }; - -/** - * Add a chunk of generated JS to this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ -SourceNode.prototype.add = function SourceNode_add(aChunk) { - if (Array.isArray(aChunk)) { - aChunk.forEach(function (chunk) { - this.add(chunk); - }, this); - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - if (aChunk) { - this.children.push(aChunk); - } - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; -}; - -/** - * Add a chunk of generated JS to the beginning of this source node. - * - * @param aChunk A string snippet of generated JS code, another instance of - * SourceNode, or an array where each member is one of those things. - */ -SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var i = aChunk.length-1; i >= 0; i--) { - this.prepend(aChunk[i]); - } - } - else if (aChunk[isSourceNode] || typeof aChunk === "string") { - this.children.unshift(aChunk); - } - else { - throw new TypeError( - "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk - ); - } - return this; -}; - -/** - * Walk over the tree of JS snippets in this node and its children. The - * walking function is called once for each snippet of JS and is passed that - * snippet and the its original associated source's line/column location. - * - * @param aFn The traversal function. - */ -SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var i = 0, len = this.children.length; i < len; i++) { - chunk = this.children[i]; - if (chunk[isSourceNode]) { - chunk.walk(aFn); - } - else { - if (chunk !== '') { - aFn(chunk, { source: this.source, - line: this.line, - column: this.column, - name: this.name }); - } - } - } -}; - -/** - * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between - * each of `this.children`. - * - * @param aSep The separator. - */ -SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var len = this.children.length; - if (len > 0) { - newChildren = []; - for (i = 0; i < len-1; i++) { - newChildren.push(this.children[i]); - newChildren.push(aSep); - } - newChildren.push(this.children[i]); - this.children = newChildren; - } - return this; -}; - -/** - * Call String.prototype.replace on the very right-most source snippet. Useful - * for trimming whitespace from the end of a source node, etc. - * - * @param aPattern The pattern to replace. - * @param aReplacement The thing to replace the pattern with. - */ -SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var lastChild = this.children[this.children.length - 1]; - if (lastChild[isSourceNode]) { - lastChild.replaceRight(aPattern, aReplacement); - } - else if (typeof lastChild === 'string') { - this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); - } - else { - this.children.push(''.replace(aPattern, aReplacement)); - } - return this; -}; - -/** - * Set the source content for a source file. This will be added to the SourceMapGenerator - * in the sourcesContent field. - * - * @param aSourceFile The filename of the source file - * @param aSourceContent The content of the source file - */ -SourceNode.prototype.setSourceContent = - function SourceNode_setSourceContent(aSourceFile, aSourceContent) { - this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; - }; - -/** - * Walk over the tree of SourceNodes. The walking function is called for each - * source file content and is passed the filename and source content. - * - * @param aFn The traversal function. - */ -SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var i = 0, len = sources.length; i < len; i++) { - aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); - } - }; - -/** - * Return the string representation of this source node. Walks over the tree - * and concatenates all the various snippets together to one string. - */ -SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; -}; - -/** - * Returns the string representation of this source node along with a source - * map. - */ -SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var lastOriginalName = null; - this.walk(function (chunk, original) { - generated.code += chunk; - if (original.source !== null - && original.line !== null - && original.column !== null) { - if(lastOriginalSource !== original.source - || lastOriginalLine !== original.line - || lastOriginalColumn !== original.column - || lastOriginalName !== original.name) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - lastOriginalSource = original.source; - lastOriginalLine = original.line; - lastOriginalColumn = original.column; - lastOriginalName = original.name; - sourceMappingActive = true; - } else if (sourceMappingActive) { - map.addMapping({ - generated: { - line: generated.line, - column: generated.column - } - }); - lastOriginalSource = null; - sourceMappingActive = false; - } - for (var idx = 0, length = chunk.length; idx < length; idx++) { - if (chunk.charCodeAt(idx) === NEWLINE_CODE) { - generated.line++; - generated.column = 0; - // Mappings end at eol - if (idx + 1 === length) { - lastOriginalSource = null; - sourceMappingActive = false; - } else if (sourceMappingActive) { - map.addMapping({ - source: original.source, - original: { - line: original.line, - column: original.column - }, - generated: { - line: generated.line, - column: generated.column - }, - name: original.name - }); - } - } else { - generated.column++; - } - } - }); - this.walkSourceContents(function (sourceFile, sourceContent) { - map.setSourceContent(sourceFile, sourceContent); - }); - - return { code: generated.code, map: map }; -}; - -exports.SourceNode = SourceNode; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/util.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/util.js deleted file mode 100644 index 44e0e45..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/lib/util.js +++ /dev/null @@ -1,417 +0,0 @@ -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -/** - * This is a helper function for getting values from parameter/options - * objects. - * - * @param args The object we are extracting values from - * @param name The name of the property we are getting. - * @param defaultValue An optional value to return if the property is missing - * from the object. If this is not specified and the property is missing, an - * error will be thrown. - */ -function getArg(aArgs, aName, aDefaultValue) { - if (aName in aArgs) { - return aArgs[aName]; - } else if (arguments.length === 3) { - return aDefaultValue; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } -} -exports.getArg = getArg; - -var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/; -var dataUrlRegexp = /^data:.+\,.+$/; - -function urlParse(aUrl) { - var match = aUrl.match(urlRegexp); - if (!match) { - return null; - } - return { - scheme: match[1], - auth: match[2], - host: match[3], - port: match[4], - path: match[5] - }; -} -exports.urlParse = urlParse; - -function urlGenerate(aParsedUrl) { - var url = ''; - if (aParsedUrl.scheme) { - url += aParsedUrl.scheme + ':'; - } - url += '//'; - if (aParsedUrl.auth) { - url += aParsedUrl.auth + '@'; - } - if (aParsedUrl.host) { - url += aParsedUrl.host; - } - if (aParsedUrl.port) { - url += ":" + aParsedUrl.port - } - if (aParsedUrl.path) { - url += aParsedUrl.path; - } - return url; -} -exports.urlGenerate = urlGenerate; - -/** - * Normalizes a path, or the path portion of a URL: - * - * - Replaces consecutive slashes with one slash. - * - Removes unnecessary '.' parts. - * - Removes unnecessary '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ -function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - - var parts = path.split(/\/+/); - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - part = parts[i]; - if (part === '.') { - parts.splice(i, 1); - } else if (part === '..') { - up++; - } else if (up > 0) { - if (part === '') { - // The first part is blank if the path is absolute. Trying to go - // above the root is a no-op. Therefore we can remove all '..' parts - // directly after the root. - parts.splice(i + 1, up); - up = 0; - } else { - parts.splice(i, 2); - up--; - } - } - } - path = parts.join('/'); - - if (path === '') { - path = isAbsolute ? '/' : '.'; - } - - if (url) { - url.path = path; - return urlGenerate(url); - } - return path; -} -exports.normalize = normalize; - -/** - * Joins two paths/URLs. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be joined with the root. - * - * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a - * scheme-relative URL: Then the scheme of aRoot, if any, is prepended - * first. - * - Otherwise aPath is a path. If aRoot is a URL, then its path portion - * is updated with the result and aRoot is returned. Otherwise the result - * is returned. - * - If aPath is absolute, the result is aPath. - * - Otherwise the two paths are joined with a slash. - * - Joining for example 'http://' and 'www.example.com' is also supported. - */ -function join(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - if (aPath === "") { - aPath = "."; - } - var aPathUrl = urlParse(aPath); - var aRootUrl = urlParse(aRoot); - if (aRootUrl) { - aRoot = aRootUrl.path || '/'; - } - - // `join(foo, '//www.example.org')` - if (aPathUrl && !aPathUrl.scheme) { - if (aRootUrl) { - aPathUrl.scheme = aRootUrl.scheme; - } - return urlGenerate(aPathUrl); - } - - if (aPathUrl || aPath.match(dataUrlRegexp)) { - return aPath; - } - - // `join('http://', 'www.example.com')` - if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { - aRootUrl.host = aPath; - return urlGenerate(aRootUrl); - } - - var joined = aPath.charAt(0) === '/' - ? aPath - : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); - - if (aRootUrl) { - aRootUrl.path = joined; - return urlGenerate(aRootUrl); - } - return joined; -} -exports.join = join; - -exports.isAbsolute = function (aPath) { - return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp); -}; - -/** - * Make a path relative to a URL or another path. - * - * @param aRoot The root path or URL. - * @param aPath The path or URL to be made relative to aRoot. - */ -function relative(aRoot, aPath) { - if (aRoot === "") { - aRoot = "."; - } - - aRoot = aRoot.replace(/\/$/, ''); - - // It is possible for the path to be above the root. In this case, simply - // checking whether the root is a prefix of the path won't work. Instead, we - // need to remove components from the root one by one, until either we find - // a prefix that fits, or we run out of components to remove. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var index = aRoot.lastIndexOf("/"); - if (index < 0) { - return aPath; - } - - // If the only part of the root that is left is the scheme (i.e. http://, - // file:///, etc.), one or more slashes (/), or simply nothing at all, we - // have exhausted all components, so the path is not relative to the root. - aRoot = aRoot.slice(0, index); - if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { - return aPath; - } - - ++level; - } - - // Make sure we add a "../" for each component we removed from the root. - return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); -} -exports.relative = relative; - -var supportsNullProto = (function () { - var obj = Object.create(null); - return !('__proto__' in obj); -}()); - -function identity (s) { - return s; -} - -/** - * Because behavior goes wacky when you set `__proto__` on objects, we - * have to prefix all the strings in our set with an arbitrary character. - * - * See https://github.com/mozilla/source-map/pull/31 and - * https://github.com/mozilla/source-map/issues/30 - * - * @param String aStr - */ -function toSetString(aStr) { - if (isProtoString(aStr)) { - return '$' + aStr; - } - - return aStr; -} -exports.toSetString = supportsNullProto ? identity : toSetString; - -function fromSetString(aStr) { - if (isProtoString(aStr)) { - return aStr.slice(1); - } - - return aStr; -} -exports.fromSetString = supportsNullProto ? identity : fromSetString; - -function isProtoString(s) { - if (!s) { - return false; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - if (s.charCodeAt(length - 1) !== 95 /* '_' */ || - s.charCodeAt(length - 2) !== 95 /* '_' */ || - s.charCodeAt(length - 3) !== 111 /* 'o' */ || - s.charCodeAt(length - 4) !== 116 /* 't' */ || - s.charCodeAt(length - 5) !== 111 /* 'o' */ || - s.charCodeAt(length - 6) !== 114 /* 'r' */ || - s.charCodeAt(length - 7) !== 112 /* 'p' */ || - s.charCodeAt(length - 8) !== 95 /* '_' */ || - s.charCodeAt(length - 9) !== 95 /* '_' */) { - return false; - } - - for (var i = length - 10; i >= 0; i--) { - if (s.charCodeAt(i) !== 36 /* '$' */) { - return false; - } - } - - return true; -} - -/** - * Comparator between two mappings where the original positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same original source/line/column, but different generated - * line and column the same. Useful when searching for a mapping with a - * stubbed out mapping. - */ -function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { - var cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0 || onlyCompareOriginal) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; -} -exports.compareByOriginalPositions = compareByOriginalPositions; - -/** - * Comparator between two mappings with deflated source and name indices where - * the generated positions are compared. - * - * Optionally pass in `true` as `onlyCompareGenerated` to consider two - * mappings with the same generated line and column, but different - * source/name/original line and column the same. Useful when searching for a - * mapping with a stubbed out mapping. - */ -function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0 || onlyCompareGenerated) { - return cmp; - } - - cmp = mappingA.source - mappingB.source; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return mappingA.name - mappingB.name; -} -exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; - -function strcmp(aStr1, aStr2) { - if (aStr1 === aStr2) { - return 0; - } - - if (aStr1 > aStr2) { - return 1; - } - - return -1; -} - -/** - * Comparator between two mappings with inflated source and name strings where - * the generated positions are compared. - */ -function compareByGeneratedPositionsInflated(mappingA, mappingB) { - var cmp = mappingA.generatedLine - mappingB.generatedLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.generatedColumn - mappingB.generatedColumn; - if (cmp !== 0) { - return cmp; - } - - cmp = strcmp(mappingA.source, mappingB.source); - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalLine - mappingB.originalLine; - if (cmp !== 0) { - return cmp; - } - - cmp = mappingA.originalColumn - mappingB.originalColumn; - if (cmp !== 0) { - return cmp; - } - - return strcmp(mappingA.name, mappingB.name); -} -exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/package.json b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/package.json deleted file mode 100644 index 048e3ae..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "source-map", - "description": "Generates and consumes source maps", - "version": "0.5.7", - "homepage": "https://github.com/mozilla/source-map", - "author": "Nick Fitzgerald ", - "contributors": [ - "Tobias Koppers ", - "Duncan Beevers ", - "Stephen Crane ", - "Ryan Seddon ", - "Miles Elam ", - "Mihai Bazon ", - "Michael Ficarra ", - "Todd Wolfson ", - "Alexander Solovyov ", - "Felix Gnass ", - "Conrad Irwin ", - "usrbincc ", - "David Glasser ", - "Chase Douglas ", - "Evan Wallace ", - "Heather Arthur ", - "Hugh Kennedy ", - "David Glasser ", - "Simon Lydell ", - "Jmeas Smith ", - "Michael Z Goddard ", - "azu ", - "John Gozde ", - "Adam Kirkton ", - "Chris Montgomery ", - "J. Ryan Stinnett ", - "Jack Herrington ", - "Chris Truter ", - "Daniel Espeset ", - "Jamie Wong ", - "Eddy Bruël ", - "Hawken Rives ", - "Gilad Peleg ", - "djchie ", - "Gary Ye ", - "Nicolas Lalevée " - ], - "repository": { - "type": "git", - "url": "http://github.com/mozilla/source-map.git" - }, - "main": "./source-map.js", - "files": [ - "source-map.js", - "lib/", - "dist/source-map.debug.js", - "dist/source-map.js", - "dist/source-map.min.js", - "dist/source-map.min.js.map" - ], - "engines": { - "node": ">=0.10.0" - }, - "license": "BSD-3-Clause", - "scripts": { - "test": "npm run build && node test/run-tests.js", - "build": "webpack --color", - "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" - }, - "devDependencies": { - "doctoc": "^0.15.0", - "webpack": "^1.12.0" - }, - "typings": "source-map" -} diff --git a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/source-map.js b/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/source-map.js deleted file mode 100644 index bc88fe8..0000000 --- a/node_modules/vinyl-sourcemaps-apply/node_modules/source-map/source-map.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - * Copyright 2009-2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE.txt or: - * http://opensource.org/licenses/BSD-3-Clause - */ -exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator; -exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer; -exports.SourceNode = require('./lib/source-node').SourceNode; diff --git a/node_modules/vinyl-sourcemaps-apply/package.json b/node_modules/vinyl-sourcemaps-apply/package.json deleted file mode 100644 index 8cba9a1..0000000 --- a/node_modules/vinyl-sourcemaps-apply/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "vinyl-sourcemaps-apply", - "version": "0.2.1", - "description": "Apply a source map to a vinyl file, merging it with preexisting source maps", - "homepage": "http://github.com/floridoo/vinyl-sourcemaps-apply", - "repository": "git://github.com/floridoo/vinyl-sourcemaps-apply.git", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [ - "vinyl", - "sourcemaps", - "source maps", - "gulp" - ], - "author": "Florian Reiterer ", - "license": "ISC", - "dependencies": { - "source-map": "^0.5.1" - } -} diff --git a/node_modules/vinyl/LICENSE b/node_modules/vinyl/LICENSE deleted file mode 100644 index 6ac3843..0000000 --- a/node_modules/vinyl/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013, 2016-2022 Blaine Bublitz and Eric Schoffstall - -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/vinyl/README.md b/node_modules/vinyl/README.md deleted file mode 100644 index 1b41177..0000000 --- a/node_modules/vinyl/README.md +++ /dev/null @@ -1,447 +0,0 @@ -

- - - -

- -# vinyl - -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] - -Virtual file format. - -## What is Vinyl? - -Vinyl is a very simple metadata object that describes a file. When you think of a file, two attributes come to mind: `path` and `contents`. These are the main attributes on a Vinyl object. A file does not necessarily represent something on your computer’s file system. You have files on S3, FTP, Dropbox, Box, CloudThingly.io and other services. Vinyl can be used to describe files from all of these sources. - -## What is a Vinyl Adapter? - -While Vinyl provides a clean way to describe a file, we also need a way to access these files. Each file source needs what I call a "Vinyl adapter". A Vinyl adapter simply exposes a `src(globs)` and a `dest(folder)` method. Each return a stream. The `src` stream produces Vinyl objects, and the `dest` stream consumes Vinyl objects. Vinyl adapters can expose extra methods that might be specific to their input/output medium, such as the `symlink` method [`vinyl-fs`][vinyl-fs] provides. - -## Usage - -```js -var Vinyl = require('vinyl'); - -var jsFile = new Vinyl({ - cwd: '/', - base: '/test/', - path: '/test/file.js', - contents: Buffer.from('var x = 123'), -}); -``` - -## API - -### `new Vinyl([options])` - -The constructor is used to create a new instance of `Vinyl`. Each instance represents a separate file, directory or symlink. - -All internally managed paths (`cwd`, `base`, `path`, `history`) are normalized and have trailing separators removed. See [Normalization and concatenation][normalization] for more information. - -Options may be passed upon instantiation to create a file with specific properties. - -#### `options` - -Options are not mutated by the constructor. - -##### `options.cwd` - -The current working directory of the file. - -Type: `String` - -Default: `process.cwd()` - -##### `options.base` - -Used for calculating the `relative` property. This is typically where a glob starts. - -Type: `String` - -Default: `options.cwd` - -##### `options.path` - -The full path to the file. - -Type: `String` - -Default: `undefined` - -##### `options.history` - -Stores the path history. If `options.path` and `options.history` are both passed, `options.path` is appended to `options.history`. All `options.history` paths are normalized by the `file.path` setter. - -Type: `Array` - -Default: `[]` (or `[options.path]` if `options.path` is passed) - -##### `options.stat` - -The result of an `fs.stat` call. This is how you mark the file as a directory or symbolic link. See [isDirectory()][is-directory], [isSymbolic()][is-symbolic] and [fs.Stats][fs-stats] for more information. - -Type: [`fs.Stats`][fs-stats] - -Default: `undefined` - -##### `options.contents` - -The contents of the file. If `options.contents` is a [`ReadableStream`][readable-stream], it is wrapped in a [`cloneable-readable`][cloneable-readable] stream. - -Type: [`ReadableStream`][readable-stream], [`Buffer`][buffer], or `null` - -Default: `null` - -##### `options.{custom}` - -Any other option properties will be directly assigned to the new Vinyl object. - -```js -var Vinyl = require('vinyl'); - -var file = new Vinyl({ foo: 'bar' }); -file.foo === 'bar'; // true -``` - -### Instance methods - -Each Vinyl object will have instance methods. Every method will be available but may return differently based on what properties were set upon instantiation or modified since. - -#### `file.isBuffer()` - -Returns `true` if the file contents are a [`Buffer`][buffer], otherwise `false`. - -#### `file.isStream()` - -Returns `true` if the file contents are a [`Stream`][stream], otherwise `false`. - -#### `file.isNull()` - -Returns `true` if the file contents are `null`, otherwise `false`. - -#### `file.isDirectory()` - -Returns `true` if the file represents a directory, otherwise `false`. - -A file is considered a directory when: - -- `file.isNull()` is `true` -- `file.stat` is an object -- `file.stat.isDirectory()` returns `true` - -When constructing a Vinyl object, pass in a valid [`fs.Stats`][fs-stats] object via `options.stat`. If you are mocking the [`fs.Stats`][fs-stats] object, you may need to stub the `isDirectory()` method. - -#### `file.isSymbolic()` - -Returns `true` if the file represents a symbolic link, otherwise `false`. - -A file is considered symbolic when: - -- `file.isNull()` is `true` -- `file.stat` is an object -- `file.stat.isSymbolicLink()` returns `true` - -When constructing a Vinyl object, pass in a valid [`fs.Stats`][fs-stats] object via `options.stat`. If you are mocking the [`fs.Stats`][fs-stats] object, you may need to stub the `isSymbolicLink()` method. - -#### `file.clone([options])` - -Returns a new Vinyl object with all attributes cloned. - -**By default custom attributes are cloned deeply.** - -If `options` or `options.deep` is `false`, custom attributes will not be cloned deeply. - -If `file.contents` is a [`Buffer`][buffer] and `options.contents` is `false`, the [`Buffer`][buffer] reference will be reused instead of copied. - -#### `file.inspect()` - -Returns a formatted-string interpretation of the Vinyl object. Automatically called by node's `console.log`. - -### Instance properties - -Each Vinyl object will have instance properties. Some may be unavailable based on what properties were set upon instantiation or modified since. - -#### `file.contents` - -Gets and sets the contents of the file. If set to a [`ReadableStream`][readable-stream], it is wrapped in a [`cloneable-readable`][cloneable-readable] stream. - -Throws when set to any value other than a [`ReadableStream`][readable-stream], a [`Buffer`][buffer] or `null`. - -Type: [`ReadableStream`][readable-stream], [`Buffer`][buffer], or `null` - -#### `file.cwd` - -Gets and sets current working directory. Will always be normalized and have trailing separators removed. - -Throws when set to any value other than non-empty strings. - -Type: `String` - -#### `file.base` - -Gets and sets base directory. Used for relative pathing (typically where a glob starts). -When `null` or `undefined`, it simply proxies the `file.cwd` property. Will always be normalized and have trailing separators removed. - -Throws when set to any value other than non-empty strings or `null`/`undefined`. - -Type: `String` - -#### `file.path` - -Gets and sets the absolute pathname string or `undefined`. Setting to a different value appends the new path to `file.history`. If set to the same value as the current path, it is ignored. All new values are normalized and have trailing separators removed. - -Throws when set to any value other than a string. - -Type: `String` - -#### `file.history` - -Array of `file.path` values the Vinyl object has had, from `file.history[0]` (original) through `file.history[file.history.length - 1]` (current). `file.history` and its elements should normally be treated as read-only and only altered indirectly by setting `file.path`. - -Type: `Array` - -#### `file.relative` - -Gets the result of `path.relative(file.base, file.path)`. - -Throws when set or when `file.path` is not set. - -Type: `String` - -Example: - -```js -var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/file.js', -}); - -console.log(file.relative); // file.js -``` - -#### `file.dirname` - -Gets and sets the dirname of `file.path`. Will always be normalized and have trailing separators removed. - -Throws when `file.path` is not set. - -Type: `String` - -Example: - -```js -var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/file.js', -}); - -console.log(file.dirname); // /test - -file.dirname = '/specs'; - -console.log(file.dirname); // /specs -console.log(file.path); // /specs/file.js -``` - -#### `file.basename` - -Gets and sets the basename of `file.path`. - -Throws when `file.path` is not set. - -Type: `String` - -Example: - -```js -var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/file.js', -}); - -console.log(file.basename); // file.js - -file.basename = 'file.txt'; - -console.log(file.basename); // file.txt -console.log(file.path); // /test/file.txt -``` - -#### `file.stem` - -Gets and sets stem (filename without suffix) of `file.path`. - -Throws when `file.path` is not set. - -Type: `String` - -Example: - -```js -var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/file.js', -}); - -console.log(file.stem); // file - -file.stem = 'foo'; - -console.log(file.stem); // foo -console.log(file.path); // /test/foo.js -``` - -#### `file.extname` - -Gets and sets extname of `file.path`. - -Throws when `file.path` is not set. - -Type: `String` - -Example: - -```js -var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/file.js', -}); - -console.log(file.extname); // .js - -file.extname = '.txt'; - -console.log(file.extname); // .txt -console.log(file.path); // /test/file.txt -``` - -#### `file.symlink` - -Gets and sets the path where the file points to if it's a symbolic link. Will always be normalized and have trailing separators removed. - -Throws when set to any value other than a string. - -Type: `String` - -### `Vinyl.isVinyl(file)` - -Static method used for checking if an object is a Vinyl file. Use this method instead of `instanceof`. - -Takes an object and returns `true` if it is a Vinyl file, otherwise returns `false`. - -**Note: This method uses an internal flag that some older versions of Vinyl didn't expose.** - -Example: - -```js -var Vinyl = require('vinyl'); - -var file = new Vinyl(); -var notAFile = {}; - -Vinyl.isVinyl(file); // true -Vinyl.isVinyl(notAFile); // false -``` - -### `Vinyl.isCustomProp(property)` - -Static method used by Vinyl when setting values inside the constructor or when copying properties in `file.clone()`. - -Takes a string `property` and returns `true` if the property is not used internally, otherwise returns `false`. - -This method is useful for inheritting from the Vinyl constructor. Read more in [Extending Vinyl][extending-vinyl]. - -Example: - -```js -var Vinyl = require('vinyl'); - -Vinyl.isCustomProp('sourceMap'); // true -Vinyl.isCustomProp('path'); // false -> internal getter/setter -``` - -## Normalization and concatenation - -Since all properties are normalized in their setters, you can just concatenate with `/`, and normalization takes care of it properly on all platforms. - -Example: - -```js -var file = new File(); -file.path = '/' + 'test' + '/' + 'foo.bar'; - -console.log(file.path); -// posix => /test/foo.bar -// win32 => \\test\\foo.bar -``` - -But never concatenate with `\`, since that is a valid filename character on posix system. - -## Extending Vinyl - -When extending Vinyl into your own class with extra features, you need to think about a few things. - -When you have your own properties that are managed internally, you need to extend the static `isCustomProp` method to return `false` when one of these properties is queried. - -```js -var Vinyl = require('vinyl'); - -var builtInProps = ['foo', '_foo']; - -class SuperFile extends Vinyl { - constructor(options) { - super(options); - this._foo = 'example internal read-only value'; - } - - get foo() { - return this._foo; - } - - static isCustomProp(name) { - return super.isCustomProp(name) && builtInProps.indexOf(name) === -1; - } -} - -// `foo` won't be assigned to the object below -new SuperFile({ foo: 'something' }); -``` - -This makes properties `foo` and `_foo` skipped when passed in options to `constructor(options)` so they don't get assigned to the new object and override your custom implementation. They also won't be copied when cloning. **Note:** The `_foo` and `foo` properties will still exist on the created/cloned object because you are assigning `_foo` in the constructor and `foo` is defined on the prototype. - -Same goes for `clone()`. If you have your own internal stuff that needs special handling during cloning, you should extend it to do so. - -## License - -MIT - - -[downloads-image]: https://img.shields.io/npm/dm/vinyl.svg?style=flat-square -[npm-url]: https://www.npmjs.com/package/vinyl -[npm-image]: https://img.shields.io/npm/v/vinyl.svg?style=flat-square - -[ci-url]: https://github.com/gulpjs/vinyl/actions?query=workflow:dev -[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/vinyl/dev?style=flat-square - -[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl -[coveralls-image]: https://img.shields.io/coveralls/gulpjs/vinyl/master.svg?style=flat-square - - - -[is-symbolic]: #issymbolic -[is-directory]: #isdirectory -[normalization]: #normalization-and-concatenation -[extending-vinyl]: #extending-vinyl -[stream]: https://nodejs.org/api/stream.html#stream_stream -[readable-stream]: https://nodejs.org/api/stream.html#stream_readable_streams -[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer -[fs-stats]: https://nodejs.org/api/fs.html#fs_class_fs_stats -[vinyl-fs]: https://github.com/gulpjs/vinyl-fs -[cloneable-readable]: https://github.com/mcollina/cloneable-readable - diff --git a/node_modules/vinyl/index.js b/node_modules/vinyl/index.js deleted file mode 100644 index 83ddf8f..0000000 --- a/node_modules/vinyl/index.js +++ /dev/null @@ -1,343 +0,0 @@ -'use strict'; - -var path = require('path'); -var util = require('util'); -var Buffer = require('buffer').Buffer; - -var clone = require('clone'); -var teex = require('teex'); -var replaceExt = require('replace-ext'); -var cloneStats = require('clone-stats'); -var removeTrailingSep = require('remove-trailing-separator'); - -var isStream = require('./lib/is-stream'); -var normalize = require('./lib/normalize'); -var inspectStream = require('./lib/inspect-stream'); - -var builtInFields = [ - '_contents', - '_symlink', - 'contents', - 'stat', - 'history', - 'path', - '_base', - 'base', - '_cwd', - 'cwd', -]; - -function File(file) { - var self = this; - - if (!file) { - file = {}; - } - - // Stat = files stats object - this.stat = file.stat || null; - - // Contents = stream, buffer, or null if not read - this.contents = file.contents || null; - - // Replay path history to ensure proper normalization and trailing sep - var history = Array.prototype.slice.call(file.history || []); - if (file.path) { - history.push(file.path); - } - this.history = []; - history.forEach(function (path) { - self.path = path; - }); - - this.cwd = file.cwd || process.cwd(); - this.base = file.base; - - this._isVinyl = true; - - this._symlink = null; - - // Set custom properties - Object.keys(file).forEach(function (key) { - if (self.constructor.isCustomProp(key)) { - self[key] = file[key]; - } - }); -} - -File.prototype.isBuffer = function () { - return Buffer.isBuffer(this.contents); -}; - -File.prototype.isStream = function () { - return isStream(this.contents); -}; - -File.prototype.isNull = function () { - return this.contents === null; -}; - -File.prototype.isDirectory = function () { - if (!this.isNull()) { - return false; - } - - if (this.stat && typeof this.stat.isDirectory === 'function') { - return this.stat.isDirectory(); - } - - return false; -}; - -File.prototype.isSymbolic = function () { - if (!this.isNull()) { - return false; - } - - if (this.stat && typeof this.stat.isSymbolicLink === 'function') { - return this.stat.isSymbolicLink(); - } - - return false; -}; - -File.prototype.clone = function (opt) { - var self = this; - - if (typeof opt === 'boolean') { - opt = { - deep: opt, - contents: true, - }; - } else if (!opt) { - opt = { - deep: true, - contents: true, - }; - } else { - opt.deep = opt.deep === true; - opt.contents = opt.contents !== false; - } - - // Clone our file contents - var contents; - if (this.isStream()) { - var streams = teex(this._contents); - this._contents = streams[0]; - contents = streams[1]; - } else if (this.isBuffer()) { - contents = opt.contents ? Buffer.from(this.contents) : this.contents; - } - - var file = new this.constructor({ - cwd: this.cwd, - base: this.base, - stat: this.stat ? cloneStats(this.stat) : null, - history: this.history.slice(), - contents: contents, - }); - - if (this.isSymbolic()) { - file.symlink = this.symlink; - } - - // Clone our custom properties - Object.keys(this).forEach(function (key) { - if (self.constructor.isCustomProp(key)) { - file[key] = opt.deep ? clone(self[key], true) : self[key]; - } - }); - return file; -}; - -// Node.js v6.6.0+ use this symbol for custom inspection. -File.prototype[util.inspect.custom] = function () { - var inspect = []; - - // Use relative path if possible - var filePath = this.path ? this.relative : null; - - if (filePath) { - inspect.push('"' + filePath + '"'); - } - - if (this.isBuffer()) { - inspect.push(this.contents.inspect()); - } - - if (this.isStream()) { - inspect.push(inspectStream(this.contents)); - } - - return ''; -}; - -File.isCustomProp = function (key) { - return builtInFields.indexOf(key) === -1; -}; - -File.isVinyl = function (file) { - return (file && file._isVinyl === true) || false; -}; - -// Virtual attributes -// Or stuff with extra logic -Object.defineProperty(File.prototype, 'contents', { - get: function () { - return this._contents; - }, - set: function (val) { - if (!Buffer.isBuffer(val) && !isStream(val) && val !== null) { - throw new Error('File.contents can only be a Buffer, a Stream, or null.'); - } - - this._contents = val; - }, -}); - -Object.defineProperty(File.prototype, 'cwd', { - get: function () { - return this._cwd; - }, - set: function (cwd) { - if (!cwd || typeof cwd !== 'string') { - throw new Error('cwd must be a non-empty string.'); - } - this._cwd = removeTrailingSep(normalize(cwd)); - }, -}); - -Object.defineProperty(File.prototype, 'base', { - get: function () { - return this._base || this._cwd; - }, - set: function (base) { - if (base == null) { - delete this._base; - return; - } - if (typeof base !== 'string' || !base) { - throw new Error('base must be a non-empty string, or null/undefined.'); - } - base = removeTrailingSep(normalize(base)); - if (base !== this._cwd) { - this._base = base; - } else { - delete this._base; - } - }, -}); - -// TODO: Should this be moved to vinyl-fs? -Object.defineProperty(File.prototype, 'relative', { - get: function () { - if (!this.path) { - throw new Error('No path specified! Can not get relative.'); - } - return path.relative(this.base, this.path); - }, - set: function () { - throw new Error( - 'File.relative is generated from the base and path attributes. Do not modify it.' - ); - }, -}); - -Object.defineProperty(File.prototype, 'dirname', { - get: function () { - if (!this.path) { - throw new Error('No path specified! Can not get dirname.'); - } - return path.dirname(this.path); - }, - set: function (dirname) { - if (!this.path) { - throw new Error('No path specified! Can not set dirname.'); - } - this.path = path.join(dirname, this.basename); - }, -}); - -Object.defineProperty(File.prototype, 'basename', { - get: function () { - if (!this.path) { - throw new Error('No path specified! Can not get basename.'); - } - return path.basename(this.path); - }, - set: function (basename) { - if (!this.path) { - throw new Error('No path specified! Can not set basename.'); - } - this.path = path.join(this.dirname, basename); - }, -}); - -// Property for getting/setting stem of the filename. -Object.defineProperty(File.prototype, 'stem', { - get: function () { - if (!this.path) { - throw new Error('No path specified! Can not get stem.'); - } - return path.basename(this.path, this.extname); - }, - set: function (stem) { - if (!this.path) { - throw new Error('No path specified! Can not set stem.'); - } - this.path = path.join(this.dirname, stem + this.extname); - }, -}); - -Object.defineProperty(File.prototype, 'extname', { - get: function () { - if (!this.path) { - throw new Error('No path specified! Can not get extname.'); - } - return path.extname(this.path); - }, - set: function (extname) { - if (!this.path) { - throw new Error('No path specified! Can not set extname.'); - } - this.path = replaceExt(this.path, extname); - }, -}); - -Object.defineProperty(File.prototype, 'path', { - get: function () { - var path = this.history[this.history.length - 1]; - if (path) { - return path; - } else { - return null; - } - }, - set: function (path) { - if (typeof path !== 'string') { - throw new Error('path should be a string.'); - } - path = removeTrailingSep(normalize(path)); - - // Record history only when path changed - if (path && path !== this.path) { - this.history.push(path); - } - }, -}); - -Object.defineProperty(File.prototype, 'symlink', { - get: function () { - return this._symlink; - }, - set: function (symlink) { - // TODO: should this set the mode to symbolic if set? - if (typeof symlink !== 'string') { - throw new Error('symlink should be a string'); - } - - this._symlink = removeTrailingSep(normalize(symlink)); - }, -}); - -module.exports = File; diff --git a/node_modules/vinyl/lib/inspect-stream.js b/node_modules/vinyl/lib/inspect-stream.js deleted file mode 100644 index 9faaa0a..0000000 --- a/node_modules/vinyl/lib/inspect-stream.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -function inspectStream(stream) { - var streamType = stream.constructor.name; - // Avoid StreamStream - if (streamType === 'Stream') { - streamType = ''; - } - - return '<' + streamType + 'Stream>'; -} - -module.exports = inspectStream; diff --git a/node_modules/vinyl/lib/is-stream.js b/node_modules/vinyl/lib/is-stream.js deleted file mode 100644 index 04882b4..0000000 --- a/node_modules/vinyl/lib/is-stream.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -function isStream(stream) { - if (!stream) { - return false; - } - - if (typeof stream.pipe !== 'function') { - return false; - } - - return true; -} - -module.exports = isStream; diff --git a/node_modules/vinyl/lib/normalize.js b/node_modules/vinyl/lib/normalize.js deleted file mode 100644 index f90dcb2..0000000 --- a/node_modules/vinyl/lib/normalize.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -var path = require('path'); - -function normalize(str) { - return str === '' ? str : path.normalize(str); -} - -module.exports = normalize; diff --git a/node_modules/vinyl/package.json b/node_modules/vinyl/package.json deleted file mode 100644 index d1a522c..0000000 --- a/node_modules/vinyl/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "vinyl", - "version": "3.0.0", - "description": "Virtual file format.", - "author": "Gulp Team (https://gulpjs.com/)", - "contributors": [ - "Eric Schoffstall ", - "Blaine Bublitz " - ], - "repository": "gulpjs/vinyl", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - }, - "main": "index.js", - "files": [ - "LICENSE", - "index.js", - "lib" - ], - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "nyc mocha --async-only" - }, - "dependencies": { - "clone": "^2.1.2", - "clone-stats": "^1.0.0", - "remove-trailing-separator": "^1.1.0", - "replace-ext": "^2.0.0", - "teex": "^1.0.1" - }, - "devDependencies": { - "eslint": "^7.32.0", - "eslint-config-gulp": "^5.0.1", - "eslint-plugin-node": "^11.1.0", - "expect": "^27.4.6", - "mocha": "^8.4.0", - "nyc": "^15.1.0", - "readable-stream": "^3.6.0", - "streamx": "^2.12.5" - }, - "nyc": { - "reporter": [ - "lcov", - "text-summary" - ] - }, - "prettier": { - "singleQuote": true - }, - "keywords": [ - "virtual", - "filesystem", - "file", - "directory", - "stat", - "path" - ] -} diff --git a/node_modules/which-typed-array/.editorconfig b/node_modules/which-typed-array/.editorconfig deleted file mode 100644 index bc228f8..0000000 --- a/node_modules/which-typed-array/.editorconfig +++ /dev/null @@ -1,20 +0,0 @@ -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-typed-array/.eslintrc b/node_modules/which-typed-array/.eslintrc deleted file mode 100644 index 8b2ada0..0000000 --- a/node_modules/which-typed-array/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", - - "rules": { - "max-statements-per-line": [2, { "max": 2 }], - }, -} diff --git a/node_modules/which-typed-array/.github/FUNDING.yml b/node_modules/which-typed-array/.github/FUNDING.yml deleted file mode 100644 index d6aa180..0000000 --- a/node_modules/which-typed-array/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# 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-typed-array -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-typed-array/.nycrc b/node_modules/which-typed-array/.nycrc deleted file mode 100644 index 1826526..0000000 --- a/node_modules/which-typed-array/.nycrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "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-typed-array/CHANGELOG.md b/node_modules/which-typed-array/CHANGELOG.md deleted file mode 100644 index 6e8db11..0000000 --- a/node_modules/which-typed-array/CHANGELOG.md +++ /dev/null @@ -1,235 +0,0 @@ -# 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.16](https://github.com/inspect-js/which-typed-array/compare/v1.1.15...v1.1.16) - 2024-11-27 - -### Commits - -- [actions] split out node 10-20, and 20+ [`8e289a9`](https://github.com/inspect-js/which-typed-array/commit/8e289a9665a32f7ea267c3ffed7451b154adbe26) -- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/node`, `@types/tape`, `auto-changelog`, `tape` [`3d4a678`](https://github.com/inspect-js/which-typed-array/commit/3d4a67872d0dbecb755e63ba4101e9ec030a5e7e) -- [Tests] replace `aud` with `npm audit` [`6fbada9`](https://github.com/inspect-js/which-typed-array/commit/6fbada976743192db47000e47eefc07708713ea0) -- [types] add an additional overload [`db5a791`](https://github.com/inspect-js/which-typed-array/commit/db5a791642cd8b4d78fe4ed4da151c4543ee0840) -- [Dev Deps] remove an unused DT package [`6bfff4c`](https://github.com/inspect-js/which-typed-array/commit/6bfff4c3b0c415cb32cd12be6fab3cbbe9e10e13) -- [Dev Deps] add missing peer dep [`05fd582`](https://github.com/inspect-js/which-typed-array/commit/05fd582a703cd68ee7613af0ef2c45546ea5d2ba) - -## [v1.1.15](https://github.com/inspect-js/which-typed-array/compare/v1.1.14...v1.1.15) - 2024-03-10 - -### Commits - -- [types] use a namespace; improve type [`f42bec3`](https://github.com/inspect-js/which-typed-array/commit/f42bec34d5c47bd9e4ab1b48dcde60c09c666712) -- [types] use shared config [`464a9e3`](https://github.com/inspect-js/which-typed-array/commit/464a9e358c2597253c747970b12032406a19b8d2) -- [actions] remove redundant finisher; use reusable workflow [`d114ee8`](https://github.com/inspect-js/which-typed-array/commit/d114ee83ceb6c7898386f4b5935a3ed9e2ec61e4) -- [Dev Deps] update `@types/node`, `tape`, `typescript`; add `@arethetypeswrong/cli` [`9cc63d8`](https://github.com/inspect-js/which-typed-array/commit/9cc63d8635e80ce6dabcb352d23050111040d747) -- [types] add a helpful hover description [`29ccf8d`](https://github.com/inspect-js/which-typed-array/commit/29ccf8dab0f805cdac6ec56d7b9cc27476708273) -- [Deps] update `available-typed-arrays`, `call-bind`, `has-tostringtag` [`7ecfd8e`](https://github.com/inspect-js/which-typed-array/commit/7ecfd8e29d09f8708f7cab7cc41fea9ae5a20867) - -## [v1.1.14](https://github.com/inspect-js/which-typed-array/compare/v1.1.13...v1.1.14) - 2024-02-01 - -### Commits - -- [patch] add types [`49c4d4c`](https://github.com/inspect-js/which-typed-array/commit/49c4d4c5db9bebb8d6f8c18a01047e44eea15e17) -- [Dev Deps] update `aud`, `npmignore`, `tape` [`e5fab7b`](https://github.com/inspect-js/which-typed-array/commit/e5fab7b3dc9df2bceb88f15c3d0a2c0176cf2567) -- [Deps] update `available-typed-arrays`, `call-bind` [`97e2b44`](https://github.com/inspect-js/which-typed-array/commit/97e2b44bad85c9183f1219e28211b3abd167677c) -- [Deps] update `has-tostringtag` [`1efa8bf`](https://github.com/inspect-js/which-typed-array/commit/1efa8bf910c080c14f011aa7c645ac88bc7a7078) - -## [v1.1.13](https://github.com/inspect-js/which-typed-array/compare/v1.1.12...v1.1.13) - 2023-10-19 - -### Commits - -- [Refactor] avoid call-binding entirely when there is no method to bind [`9ff452b`](https://github.com/inspect-js/which-typed-array/commit/9ff452b88fbd8e4419bd768d86d0ea9a87d7e310) - -## [v1.1.12](https://github.com/inspect-js/which-typed-array/compare/v1.1.11...v1.1.12) - 2023-10-19 - -### Commits - -- [Fix] somehow node 0.12 - 3 can hit here, and they lack slice but have set [`c28e9b8`](https://github.com/inspect-js/which-typed-array/commit/c28e9b84d6d68ad5f52236ba59c26b06cde6300b) -- [Deps] update `call-bind` [`a648554`](https://github.com/inspect-js/which-typed-array/commit/a64855495106235352ebb3550a860d3bfd4a1ce1) -- [Dev Deps] update `tape` [`7a094d6`](https://github.com/inspect-js/which-typed-array/commit/7a094d6f9219b903c9a9e13c559e68f0e9672b59) - -## [v1.1.11](https://github.com/inspect-js/which-typed-array/compare/v1.1.10...v1.1.11) - 2023-07-17 - -### Commits - -- [Fix] `node < v0.6` lacks proper Object toString behavior [`b8fd654`](https://github.com/inspect-js/which-typed-array/commit/b8fd65479c0bd18385378cfae79750ebf7cb6ee7) -- [Dev Deps] update `tape` [`e1734c9`](https://github.com/inspect-js/which-typed-array/commit/e1734c99d79880ab11efa55220498a7a1e887834) - -## [v1.1.10](https://github.com/inspect-js/which-typed-array/compare/v1.1.9...v1.1.10) - 2023-07-10 - -### Commits - -- [actions] update rebase action to use reusable workflow [`2c10582`](https://github.com/inspect-js/which-typed-array/commit/2c105820d77274c079cb6d040cb348396e516ef5) -- [Robustness] use `call-bind` [`b2335fd`](https://github.com/inspect-js/which-typed-array/commit/b2335fdfca80840995eea5e6fcfffc6d712279a1) -- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`ad5e41b`](https://github.com/inspect-js/which-typed-array/commit/ad5e41ba18e7d23af1f9b211215c43a64bf75d70) - -## [v1.1.9](https://github.com/inspect-js/which-typed-array/compare/v1.1.8...v1.1.9) - 2022-11-02 - -### Commits - -- [Dev Deps] update `aud`, `is-callable`, `tape` [`9a20b3c`](https://github.com/inspect-js/which-typed-array/commit/9a20b3cb8f5d087789a8160395517bffe27b4339) -- [Refactor] use `gopd` instead of `es-abstract` helper [`00157af`](https://github.com/inspect-js/which-typed-array/commit/00157af909842b8b5affa5485d3574ec92d94065) -- [Deps] update `is-typed-array` [`6714240`](https://github.com/inspect-js/which-typed-array/commit/6714240e748cbbb634cb1e405ad762bc52acde66) -- [meta] add `sideEffects` flag [`89b96cc`](https://github.com/inspect-js/which-typed-array/commit/89b96cc3decc78d9621598e94fa1c2bb87eabf2e) - -## [v1.1.8](https://github.com/inspect-js/which-typed-array/compare/v1.1.7...v1.1.8) - 2022-05-14 - -### Commits - -- [actions] reuse common workflows [`95ea6c0`](https://github.com/inspect-js/which-typed-array/commit/95ea6c02dc5ec4ed0ee1b9c4692bb060108c8637) -- [meta] use `npmignore` to autogenerate an npmignore file [`d08436a`](https://github.com/inspect-js/which-typed-array/commit/d08436a19cdd76219732f5040a01cdb92ef2820e) -- [readme] add github actions/codecov badges [`35ae3af`](https://github.com/inspect-js/which-typed-array/commit/35ae3af6a0bb328c9d9b9bbb53e47122f269d81a) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`86e6e3a`](https://github.com/inspect-js/which-typed-array/commit/86e6e3af60b2436f0ff34968d9d6240a23f40528) -- [actions] update codecov uploader [`0aa6e30`](https://github.com/inspect-js/which-typed-array/commit/0aa6e3026ab4198c4364737ed4f0315a2ecc432a) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`a881a78`](https://github.com/inspect-js/which-typed-array/commit/a881a785f094e823e1cefe2ae9e4ebe31a8e996e) -- [Refactor] use `for-each` instead of `foreach` [`9dafa03`](https://github.com/inspect-js/which-typed-array/commit/9dafa0377fc5c690059a9d454f1dd4d365c5c902) -- [Deps] update `es-abstract`, `is-typed-array` [`0684022`](https://github.com/inspect-js/which-typed-array/commit/068402297608f321a4ec99ebce741b3eb38fcfdd) -- [Deps] update `es-abstract`, `is-typed-array` [`633a529`](https://github.com/inspect-js/which-typed-array/commit/633a529081b5c48d9675abb8aea425e6e33d528e) - -## [v1.1.7](https://github.com/inspect-js/which-typed-array/compare/v1.1.6...v1.1.7) - 2021-08-30 - -### Commits - -- [Refactor] use `globalThis` if available [`2a16d1f`](https://github.com/inspect-js/which-typed-array/commit/2a16d1fd520871ce6b23c60f0bd2113cf33b2533) -- [meta] changelog cleanup [`ba99f56`](https://github.com/inspect-js/which-typed-array/commit/ba99f56b45e6acde7aef4a1f34bb00e44088ccee) -- [Dev Deps] update `@ljharb/eslint-config` [`19a6e04`](https://github.com/inspect-js/which-typed-array/commit/19a6e04ce0094fb3fd6d0d2cbc58d320556ddf50) -- [Deps] update `available-typed-arrays` [`50dbc58`](https://github.com/inspect-js/which-typed-array/commit/50dbc5810a24c468b49409e1f0a79d03501e3dd6) -- [Deps] update `is-typed-array` [`c1b83ea`](https://github.com/inspect-js/which-typed-array/commit/c1b83eae65f042e46b6ae941ac4e814b7965a0f7) - -## [v1.1.6](https://github.com/inspect-js/which-typed-array/compare/v1.1.5...v1.1.6) - 2021-08-06 - -### Fixed - -- [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString [`#51`](https://github.com/inspect-js/which-typed-array/issues/51) [`#49`](https://github.com/inspect-js/which-typed-array/issues/49) - -### Commits - -- [Dev Deps] update `is-callable`, `tape` [`63eb1e3`](https://github.com/inspect-js/which-typed-array/commit/63eb1e3faede3f328bbbb4a5fcffc2e4769cf4ec) -- [Deps] update `is-typed-array` [`c5056f0`](https://github.com/inspect-js/which-typed-array/commit/c5056f0007d4c9434f1fa69eff183109468b4769) - -## [v1.1.5](https://github.com/inspect-js/which-typed-array/compare/v1.1.4...v1.1.5) - 2021-08-05 - -### Commits - -- [actions] use `node/install` instead of `node/run`; use `codecov` action [`63fa8dd`](https://github.com/inspect-js/which-typed-array/commit/63fa8dd1dc9c0f0dbbaa16d1de0eb89797324c5d) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `tape` [`1107c74`](https://github.com/inspect-js/which-typed-array/commit/1107c74c52ed6eb4a719faec88e16c4343976d73) -- [Deps] update `available-typed-arrays`, `call-bind`, `es-abstract`, `is-typed-array` [`f953454`](https://github.com/inspect-js/which-typed-array/commit/f953454b2c6f589f09573ddc961431f970c2e1b6) -- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`8aee720`](https://github.com/inspect-js/which-typed-array/commit/8aee7207abcd72c799ac324b214fbb6ca7ae4a28) -- [meta] use `prepublishOnly` script for npm 7+ [`6c5167b`](https://github.com/inspect-js/which-typed-array/commit/6c5167b4cd06cb62a5487a2e797d8e41cc2970b1) - -## [v1.1.4](https://github.com/inspect-js/which-typed-array/compare/v1.1.3...v1.1.4) - 2020-12-05 - -### Commits - -- [meta] npmignore github action workflows [`aa427e7`](https://github.com/inspect-js/which-typed-array/commit/aa427e79a230a985953695a8129ceb6bb7d42527) - -## [v1.1.3](https://github.com/inspect-js/which-typed-array/compare/v1.1.2...v1.1.3) - 2020-12-05 - -### Commits - -- [Tests] migrate tests to Github Actions [`803d4dd`](https://github.com/inspect-js/which-typed-array/commit/803d4ddb601ff03e587be792bd452de0e2783d03) -- [Tests] run `nyc` on all tests [`205a13f`](https://github.com/inspect-js/which-typed-array/commit/205a13f7aa172e014ddc2079c84af6ba575581c8) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `is-callable`, `tape` [`97ceb07`](https://github.com/inspect-js/which-typed-array/commit/97ceb070d5aea1c3a696c6f695800ae468bafc0b) -- [actions] add "Allow Edits" workflow [`b140492`](https://github.com/inspect-js/which-typed-array/commit/b14049211eff32bd4149767def4f939483810051) -- [Deps] update `es-abstract`; use `call-bind` where applicable [`2abdb87`](https://github.com/inspect-js/which-typed-array/commit/2abdb871961b4e1b58925115a7d56a9cc5966a02) -- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`256d34b`](https://github.com/inspect-js/which-typed-array/commit/256d34b8bdb67b8af0e9f83c9a318e54f3340e3b) -- [Dev Deps] update `auto-changelog`; add `aud` [`ddea96f`](https://github.com/inspect-js/which-typed-array/commit/ddea96fe320dbdd0c7d7569812399a7f64d43e04) -- [meta] gitignore nyc output [`8a812bd`](https://github.com/inspect-js/which-typed-array/commit/8a812bd1ce7c5609988fb4fe2e9af2089eccd07d) - -## [v1.1.2](https://github.com/inspect-js/which-typed-array/compare/v1.1.1...v1.1.2) - 2020-04-07 - -### Commits - -- [Dev Deps] update `make-arrow-function`, `make-generator-function` [`28c61ef`](https://github.com/inspect-js/which-typed-array/commit/28c61eff4903ff6509f65c2f500858b9cb4636f1) -- [Dev Deps] update `@ljharb/eslint-config` [`a233879`](https://github.com/inspect-js/which-typed-array/commit/a2338798d3a4a3169cda54e322b2f2eb0e976ad0) -- [Dev Deps] update `auto-changelog` [`df0134c`](https://github.com/inspect-js/which-typed-array/commit/df0134c0e20ec6d94993988ad670e1b3cf350bea) -- [Fix] move `foreach` to dependencies [`6ef29c0`](https://github.com/inspect-js/which-typed-array/commit/6ef29c0dbb91a7ec21df7ce8736f99f41efea39e) -- [Tests] only audit prod deps [`eb21044`](https://github.com/inspect-js/which-typed-array/commit/eb210446bd7a433657204d2314ef56fe264c21ad) -- [Deps] update `es-abstract` [`5ef0236`](https://github.com/inspect-js/which-typed-array/commit/5ef02368d9876a1074123aa7725d6759b4f3e358) -- [Dev Deps] update `tape` [`7456037`](https://github.com/inspect-js/which-typed-array/commit/745603728c6c3da8bdddee321e8a9196f4827aa3) -- [Deps] update `available-typed-arrays` [`8a856c9`](https://github.com/inspect-js/which-typed-array/commit/8a856c9aa707c1e6f7a52e834485356b31395ea6) - -## [v1.1.1](https://github.com/inspect-js/which-typed-array/compare/v1.1.0...v1.1.1) - 2020-01-24 - -### Commits - -- [Tests] use shared travis-ci configs [`0a627d9`](https://github.com/inspect-js/which-typed-array/commit/0a627d9694d0eabdaee63b19e605584166995a79) -- [meta] add `auto-changelog` [`2a14c58`](https://github.com/inspect-js/which-typed-array/commit/2a14c58b79f72e32ef2078efb40d31a4bf8c197a) -- [meta] remove unused Makefile and associated utilities [`75f7f22`](https://github.com/inspect-js/which-typed-array/commit/75f7f222199f42618c290de363c542b11f5a5632) -- [Tests] up to `node` `v12.10`, `v11.15`, `v10.16`, `v8.16`, `v6.17` [`4162327`](https://github.com/inspect-js/which-typed-array/commit/416232725e7d127cbd886af0f8988dae612a342f) -- [Refactor] use `es-abstract`’s `callBound`, `available-typed-arrays`, `has-symbols` [`9b04a2a`](https://github.com/inspect-js/which-typed-array/commit/9b04a2a14c758600cffcf59485b7b3c85839c266) -- [readme] fix repo URLs, remove testling [`03ed52f`](https://github.com/inspect-js/which-typed-array/commit/03ed52f3ae4fcd35614bcda7e947b14e62009c71) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `replace`, `semver`, `tape` [`bfbcf3e`](https://github.com/inspect-js/which-typed-array/commit/bfbcf3ec9c449bd0089ed805c01a32ba4e7e5938) -- [actions] add automatic rebasing / merge commit blocking [`cc88ac5`](https://github.com/inspect-js/which-typed-array/commit/cc88ac56bcfb71cb26c656ebde4c560a22fadd85) -- [meta] create FUNDING.yml [`acbc723`](https://github.com/inspect-js/which-typed-array/commit/acbc7230929b1256c83df28be4a456eed3e147e9) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `is-callable`, `tape` [`f1ab63e`](https://github.com/inspect-js/which-typed-array/commit/f1ab63e9366027eae2e29398c035181dac164132) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest` [`ac9f50b`](https://github.com/inspect-js/which-typed-array/commit/ac9f50b59558933292dff993df2e68eaa44b07e2) -- [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops [`aaaa15d`](https://github.com/inspect-js/which-typed-array/commit/aaaa15dfb5bd8228c0cfb8f2aba267efb405b0a1) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`602fc9a`](https://github.com/inspect-js/which-typed-array/commit/602fc9a0a7d708236f90c76f592e6a980ecde940) -- [Deps] update `available-typed-arrays`, `is-typed-array` [`b2d69b6`](https://github.com/inspect-js/which-typed-array/commit/b2d69b639bf14344d09f8512dbc060cd4f533161) -- [meta] add `funding` field [`156f613`](https://github.com/inspect-js/which-typed-array/commit/156f613d0ce547c4b15e1ae279198b66e3cef55e) - -## [v1.1.0](https://github.com/inspect-js/which-typed-array/compare/v1.0.1...v1.1.0) - 2019-02-16 - -### Commits - -- [Tests] remove `jscs` [`381c9b4`](https://github.com/inspect-js/which-typed-array/commit/381c9b4bd858da1adedf23d8555af3a3ed901a83) -- [Tests] up to `node` `v8.2`, `v7.10`, `v6.11`, `v5.8`; improve matrix; newer npm breaks on older node [`7015c19`](https://github.com/inspect-js/which-typed-array/commit/7015c196ba86540b04d18d9b1d2c368909492023) -- [Tests] up to `node` `v10.0`, `v9.11`, `v8.11`, `v6.14`, `v4.9`; use `nvm install-latest-npm` [`ad67885`](https://github.com/inspect-js/which-typed-array/commit/ad678853e245986720d7650be1c974a9ff3ac814) -- [Tests] up to `node` `v11.6`, `v10.15`, `v8.15`, `v6.16` [`dd94bfb`](https://github.com/inspect-js/which-typed-array/commit/dd94bfb6309a92d1537352f2d1100f9e913ebc01) -- [Refactor] use an array instead of an object for storing Typed Array names [`de98bc1`](https://github.com/inspect-js/which-typed-array/commit/de98bc1d44af92909a34212e276deb5d79ac428a) -- [meta] ignore `test.html` [`06cfb1b`](https://github.com/inspect-js/which-typed-array/commit/06cfb1bc0ca7881d1bd1621fa946a16366cd6afc) -- [Tests] up to `node` `v7.0`, `v6.9`, `v4.6`; improve test matrix [`df76eaa`](https://github.com/inspect-js/which-typed-array/commit/df76eaa39b94b28147e81a89bb587e8aa3e3dba3) -- [New] add `BigInt64Array` and `BigUint64Array` [`d6bca3a`](https://github.com/inspect-js/which-typed-array/commit/d6bca3a68ccfe33f6659a24b770068e89dab1592) -- [Dev Deps] update `jscs`, `nsp`, `eslint` [`f23b45b`](https://github.com/inspect-js/which-typed-array/commit/f23b45b2796bd1f63ddddf28b4b80b9709478cb3) -- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `semver`, `tape` [`ddb4484`](https://github.com/inspect-js/which-typed-array/commit/ddb4484adc3b45c4396632611556055f3b2f5990) -- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `is-callable`, `replace`, `semver`, `tape` [`4524e59`](https://github.com/inspect-js/which-typed-array/commit/4524e593e9387c185d5632696c62c1600c0b380f) -- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`1ec7056`](https://github.com/inspect-js/which-typed-array/commit/1ec70568565c479a6168b03e0a5aec6ec9ac5a21) -- [Dev Deps] update `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config` [`799487d`](https://github.com/inspect-js/which-typed-array/commit/799487d666b32d1ae0d27cfededf2f5480c5faea) -- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver` [`8092598`](https://github.com/inspect-js/which-typed-array/commit/8092598998a1f9f8005b4e3d299eb09c96fa2e21) -- [Tests] up to `node` `v11.10` [`a5aabb1`](https://github.com/inspect-js/which-typed-array/commit/a5aabb1910e8408f857a791253487824c7c758d3) -- [Dev Deps] update `@ljharb/eslint-config`, `eslint`, `nsp`, `semver`, `tape` [`277be33`](https://github.com/inspect-js/which-typed-array/commit/277be331d9f05ff95644d6bcd896547ca620cd8e) -- [Tests] use `npm audit` instead of `nsp` [`ee97dc7`](https://github.com/inspect-js/which-typed-array/commit/ee97dc7c5d384d68f60ce6cb5a85d9509e75f72b) -- [Dev Deps] update `tape`, `eslint`, `@ljharb/eslint-config` [`262ffb0`](https://github.com/inspect-js/which-typed-array/commit/262ffb025facb0795b33fbd5131183bdbc0a40f6) -- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`d6bbcfc`](https://github.com/inspect-js/which-typed-array/commit/d6bbcfc3eea427f0156fbdcf9ae11dbf3745a755) -- [Tests] up to `node` `v6.2` [`2ff89eb`](https://github.com/inspect-js/which-typed-array/commit/2ff89eb91754146c0bc1ae689f37458d84f6e690) -- Only apps should have lockfiles [`e2bc271`](https://github.com/inspect-js/which-typed-array/commit/e2bc271e1e9a6481a2836f892177825a808c331c) -- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`b79e93b`](https://github.com/inspect-js/which-typed-array/commit/b79e93bf15c871ce0ff24fa3ad61001707eea463) -- [Dev Deps] update `nsp`, `eslint`, `@ljharb/eslint-config` [`016dbff`](https://github.com/inspect-js/which-typed-array/commit/016dbff8c49c32cda7ec80d86006c8a7c43bc40c) -- [Dev Deps] update `eslint`, `tape` [`6ce4bbc`](https://github.com/inspect-js/which-typed-array/commit/6ce4bbc5f6caf632cbcf9ababbfe36e1bf4093d7) -- [Tests] on `node` `v10.1` [`f0683a0`](https://github.com/inspect-js/which-typed-array/commit/f0683a0c17e039e926ecaad4c4c341cd8e5878f1) -- [Tests] up to `node` `v7.2` [`2f29cef`](https://github.com/inspect-js/which-typed-array/commit/2f29cef42d30f87259cd6687c25a79ae4651d0c9) -- [Dev Deps] update `replace` [`73b5ba6`](https://github.com/inspect-js/which-typed-array/commit/73b5ba6e87638d13553985977cab9d1bad33e242) -- [Deps] update `function-bind` [`c8a18c2`](https://github.com/inspect-js/which-typed-array/commit/c8a18c2982e6b126ecc1d4655ec2e53b05535b20) -- [Tests] on `node` `v5.12` [`812102b`](https://github.com/inspect-js/which-typed-array/commit/812102bf223422da8f7a89e5a1308214dd158571) -- [Tests] on `node` `v5.10` [`271584f`](https://github.com/inspect-js/which-typed-array/commit/271584f3a8b10ef68a7d419ac0062b444e63d07c) - -## [v1.0.1](https://github.com/inspect-js/which-typed-array/compare/v1.0.0...v1.0.1) - 2016-03-19 - -### Commits - -- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`, `is-callable` [`4a628c5`](https://github.com/inspect-js/which-typed-array/commit/4a628c520d8e080a9fa7e8218947d3b2ceedca72) -- [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is-callable` [`8e09372`](https://github.com/inspect-js/which-typed-array/commit/8e09372ded877a191cbf777060483227d5071e84) -- [Tests] up to `node` `v5.6`, `v4.3` [`3a35bf9`](https://github.com/inspect-js/which-typed-array/commit/3a35bf9fb9c7f8e6ac1b579ed2754087351ad1a5) -- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`9410d5e`](https://github.com/inspect-js/which-typed-array/commit/9410d5e35db4b834827b31ea1723bbeebbcde5ba) -- [Fix] `Symbol.toStringTag` is on the super-[[Prototype]] of Float32Array, not the [[Prototype]]. [`7c40a3a`](https://github.com/inspect-js/which-typed-array/commit/7c40a3a05046bbbd188340fb19471ad913e4af05) -- [Tests] up to `node` `v5.9`, `v4.4` [`07878e7`](https://github.com/inspect-js/which-typed-array/commit/07878e7cd23d586ddb9e85a03f675e0a574db246) -- Use the object form of "author" in package.json [`65caa56`](https://github.com/inspect-js/which-typed-array/commit/65caa560d1c0c15c1080b25a9df55c7373c73f08) -- [Tests] use pretest/posttest for linting/security [`c170f7e`](https://github.com/inspect-js/which-typed-array/commit/c170f7ebcf07475d6420f2d2d2d08b1646280cd4) -- [Deps] update `is-typed-array` [`9ab324e`](https://github.com/inspect-js/which-typed-array/commit/9ab324e746a7552b2d9363777fc5c9f5c2e31ce7) -- [Deps] update `function-bind` [`a723142`](https://github.com/inspect-js/which-typed-array/commit/a723142c70a5b6a4f8f5feecc9705619590f4eeb) -- [Deps] update `is-typed-array` [`ed82ce4`](https://github.com/inspect-js/which-typed-array/commit/ed82ce4e8ecc657fc6e839d23ef6347497bc93be) -- [Tests] on `node` `v4.2` [`f581c20`](https://github.com/inspect-js/which-typed-array/commit/f581c2031990668894a8e5a08eaf01a2548e822c) - -## v1.0.0 - 2015-10-05 - -### Commits - -- Dotfiles / Makefile [`667f89a`](https://github.com/inspect-js/which-typed-array/commit/667f89a9046502594e2559dbf5568e062af3b770) -- Tests. [`a14d05e`](https://github.com/inspect-js/which-typed-array/commit/a14d05ef443d2ac678cb0567befc0abf8cf21709) -- package.json [`560b1aa`](https://github.com/inspect-js/which-typed-array/commit/560b1aa4f8bbc5d41d9cee96c93faf08c25be0e5) -- Read me [`a22096e`](https://github.com/inspect-js/which-typed-array/commit/a22096e05773f93b34e672d3f743ec6f1963bc24) -- Implementation [`0b1ae28`](https://github.com/inspect-js/which-typed-array/commit/0b1ae2848372f6256cf075d687e3722878e67aca) -- Initial commit [`4b32f0a`](https://github.com/inspect-js/which-typed-array/commit/4b32f0a9d32165d6ab91797d6971ea83cf4ce9da) diff --git a/node_modules/which-typed-array/LICENSE b/node_modules/which-typed-array/LICENSE deleted file mode 100644 index b43df44..0000000 --- a/node_modules/which-typed-array/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -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/which-typed-array/README.md b/node_modules/which-typed-array/README.md deleted file mode 100644 index 1b922cd..0000000 --- a/node_modules/which-typed-array/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# which-typed-array [![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] - -Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag. - -## Example - -```js -var whichTypedArray = require('which-typed-array'); -var assert = require('assert'); - -assert.equal(false, whichTypedArray(undefined)); -assert.equal(false, whichTypedArray(null)); -assert.equal(false, whichTypedArray(false)); -assert.equal(false, whichTypedArray(true)); -assert.equal(false, whichTypedArray([])); -assert.equal(false, whichTypedArray({})); -assert.equal(false, whichTypedArray(/a/g)); -assert.equal(false, whichTypedArray(new RegExp('a', 'g'))); -assert.equal(false, whichTypedArray(new Date())); -assert.equal(false, whichTypedArray(42)); -assert.equal(false, whichTypedArray(NaN)); -assert.equal(false, whichTypedArray(Infinity)); -assert.equal(false, whichTypedArray(new Number(42))); -assert.equal(false, whichTypedArray('foo')); -assert.equal(false, whichTypedArray(Object('foo'))); -assert.equal(false, whichTypedArray(function () {})); -assert.equal(false, whichTypedArray(function* () {})); -assert.equal(false, whichTypedArray(x => x * x)); -assert.equal(false, whichTypedArray([])); - -assert.equal('Int8Array', whichTypedArray(new Int8Array())); -assert.equal('Uint8Array', whichTypedArray(new Uint8Array())); -assert.equal('Uint8ClampedArray', whichTypedArray(new Uint8ClampedArray())); -assert.equal('Int16Array', whichTypedArray(new Int16Array())); -assert.equal('Uint16Array', whichTypedArray(new Uint16Array())); -assert.equal('Int32Array', whichTypedArray(new Int32Array())); -assert.equal('Uint32Array', whichTypedArray(new Uint32Array())); -assert.equal('Float32Array', whichTypedArray(new Float32Array())); -assert.equal('Float64Array', whichTypedArray(new Float64Array())); -assert.equal('BigInt64Array', whichTypedArray(new BigInt64Array())); -assert.equal('BigUint64Array', whichTypedArray(new BigUint64Array())); -``` - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[package-url]: https://npmjs.org/package/which-typed-array -[npm-version-svg]: https://versionbadg.es/inspect-js/which-typed-array.svg -[deps-svg]: https://david-dm.org/inspect-js/which-typed-array.svg -[deps-url]: https://david-dm.org/inspect-js/which-typed-array -[dev-deps-svg]: https://david-dm.org/inspect-js/which-typed-array/dev-status.svg -[dev-deps-url]: https://david-dm.org/inspect-js/which-typed-array#info=devDependencies -[npm-badge-png]: https://nodei.co/npm/which-typed-array.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/which-typed-array.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/which-typed-array.svg -[downloads-url]: https://npm-stat.com/charts.html?package=which-typed-array -[codecov-image]: https://codecov.io/gh/inspect-js/which-typed-array/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/inspect-js/which-typed-array/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/which-typed-array -[actions-url]: https://github.com/inspect-js/which-typed-array/actions diff --git a/node_modules/which-typed-array/index.d.ts b/node_modules/which-typed-array/index.d.ts deleted file mode 100644 index f897670..0000000 --- a/node_modules/which-typed-array/index.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Determines the type of the given collection, or returns false. - * - * @param {unknown} value The potential collection - * @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null - */ -declare function whichTypedArray(value: Int8Array): 'Int8Array'; -declare function whichTypedArray(value: Uint8Array): 'Uint8Array'; -declare function whichTypedArray(value: Uint8ClampedArray): 'Uint8ClampedArray'; -declare function whichTypedArray(value: Int16Array): 'Int16Array'; -declare function whichTypedArray(value: Uint16Array): 'Uint16Array'; -declare function whichTypedArray(value: Int32Array): 'Int32Array'; -declare function whichTypedArray(value: Uint32Array): 'Uint32Array'; -declare function whichTypedArray(value: Float32Array): 'Float32Array'; -declare function whichTypedArray(value: Float64Array): 'Float64Array'; -declare function whichTypedArray(value: BigInt64Array): 'BigInt64Array'; -declare function whichTypedArray(value: BigUint64Array): 'BigUint64Array'; -declare function whichTypedArray(value: whichTypedArray.TypedArray): whichTypedArray.TypedArrayName; -declare function whichTypedArray(value: unknown): false | null; - -declare namespace whichTypedArray { - type TypedArrayName = - | 'Int8Array' - | 'Uint8Array' - | 'Uint8ClampedArray' - | 'Int16Array' - | 'Uint16Array' - | 'Int32Array' - | 'Uint32Array' - | 'Float32Array' - | 'Float64Array' - | 'BigInt64Array' - | 'BigUint64Array'; - - type TypedArray = - | Int8Array - | Uint8Array - | Uint8ClampedArray - | Int16Array - | Uint16Array - | Int32Array - | Uint32Array - | Float32Array - | Float64Array - | BigInt64Array - | BigUint64Array; - - type TypedArrayConstructor = - | Int8ArrayConstructor - | Uint8ArrayConstructor - | Uint8ClampedArrayConstructor - | Int16ArrayConstructor - | Uint16ArrayConstructor - | Int32ArrayConstructor - | Uint32ArrayConstructor - | Float32ArrayConstructor - | Float64ArrayConstructor - | BigInt64ArrayConstructor - | BigUint64ArrayConstructor; -} - -export = whichTypedArray; diff --git a/node_modules/which-typed-array/index.js b/node_modules/which-typed-array/index.js deleted file mode 100644 index 1a6edc5..0000000 --- a/node_modules/which-typed-array/index.js +++ /dev/null @@ -1,116 +0,0 @@ -'use strict'; - -var forEach = require('for-each'); -var availableTypedArrays = require('available-typed-arrays'); -var callBind = require('call-bind'); -var callBound = require('call-bind/callBound'); -var gOPD = require('gopd'); - -/** @type {(O: object) => string} */ -var $toString = callBound('Object.prototype.toString'); -var hasToStringTag = require('has-tostringtag/shams')(); - -var g = typeof globalThis === 'undefined' ? global : globalThis; -var typedArrays = availableTypedArrays(); - -var $slice = callBound('String.prototype.slice'); -var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - -/** @type {(array: readonly T[], value: unknown) => number} */ -var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { - for (var i = 0; i < array.length; i += 1) { - if (array[i] === value) { - return i; - } - } - return -1; -}; - -/** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ -/** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ -var cache = { __proto__: null }; -if (hasToStringTag && gOPD && getPrototypeOf) { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - // @ts-expect-error TS won't narrow inside a closure - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - // @ts-expect-error TS won't narrow inside a closure - descriptor = gOPD(superProto, Symbol.toStringTag); - } - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(descriptor.get); - } - }); -} else { - forEach(typedArrays, function (typedArray) { - var arr = new g[typedArray](); - var fn = arr.slice || arr.set; - if (fn) { - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(fn); - } - }); -} - -/** @type {(value: object) => false | import('.').TypedArrayName} */ -var tryTypedArrays = function tryAllTypedArrays(value) { - /** @type {ReturnType} */ var found = false; - forEach( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), - /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ - function (getter, typedArray) { - if (!found) { - try { - // @ts-expect-error TODO: fix - if ('$' + getter(value) === typedArray) { - found = $slice(typedArray, 1); - } - } catch (e) { /**/ } - } - } - ); - return found; -}; - -/** @type {(value: object) => false | import('.').TypedArrayName} */ -var trySlices = function tryAllSlices(value) { - /** @type {ReturnType} */ var found = false; - forEach( - // eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ (cache), - /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) { - if (!found) { - try { - // @ts-expect-error TODO: fix - getter(value); - found = $slice(name, 1); - } catch (e) { /**/ } - } - } - ); - return found; -}; - -/** @type {import('.')} */ -module.exports = function whichTypedArray(value) { - if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag) { - /** @type {string} */ - var tag = $slice($toString(value), 8, -1); - if ($indexOf(typedArrays, tag) > -1) { - return tag; - } - if (tag !== 'Object') { - return false; - } - // node < 0.6 hits here on real Typed Arrays - return trySlices(value); - } - if (!gOPD) { return null; } // unknown engine - return tryTypedArrays(value); -}; diff --git a/node_modules/which-typed-array/package.json b/node_modules/which-typed-array/package.json deleted file mode 100644 index 7202539..0000000 --- a/node_modules/which-typed-array/package.json +++ /dev/null @@ -1,127 +0,0 @@ -{ - "name": "which-typed-array", - "version": "1.1.16", - "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": "Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.", - "license": "MIT", - "main": "index.js", - "types": "./index.d.ts", - "sideEffects": false, - "scripts": { - "prepack": "npmignore --auto --commentLines=autogenerated", - "prepublishOnly": "safe-publish-latest", - "prepublish": "not-in-publish || npm run prepublishOnly", - "pretest": "npm run --silent lint", - "test": "npm run tests-only && npm run test:harmony", - "tests-only": "nyc tape test", - "test:harmony": "nyc node --harmony --es-staging test", - "posttest": "npx npm@'>=10.2' audit --production", - "lint": "eslint --ext=js,mjs .", - "postlint": "tsc -p . && attw -P", - "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/which-typed-array.git" - }, - "keywords": [ - "array", - "TypedArray", - "typed array", - "which", - "typed", - "Int8Array", - "Uint8Array", - "Uint8ClampedArray", - "Int16Array", - "Uint16Array", - "Int32Array", - "Uint32Array", - "Float32Array", - "Float64Array", - "ES6", - "toStringTag", - "Symbol.toStringTag", - "@@toStringTag" - ], - "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.2" - }, - "devDependencies": { - "@arethetypeswrong/cli": "^0.17.0", - "@ljharb/eslint-config": "^21.1.1", - "@ljharb/tsconfig": "^0.2.0", - "@types/call-bind": "^1.0.5", - "@types/for-each": "^0.3.3", - "@types/gopd": "^1.0.3", - "@types/is-callable": "^1.1.2", - "@types/make-arrow-function": "^1.2.2", - "@types/make-generator-function": "^2.0.3", - "@types/tape": "^5.6.5", - "auto-changelog": "^2.5.0", - "encoding": "^0.1.13", - "eslint": "=8.8.0", - "in-publish": "^2.0.1", - "is-callable": "^1.2.7", - "make-arrow-function": "^1.2.0", - "make-generator-function": "^2.0.0", - "npmignore": "^0.3.1", - "nyc": "^10.3.2", - "safe-publish-latest": "^2.0.0", - "tape": "^5.9.0", - "typescript": "next" - }, - "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 - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - } -} diff --git a/node_modules/which-typed-array/test/index.js b/node_modules/which-typed-array/test/index.js deleted file mode 100644 index d79453a..0000000 --- a/node_modules/which-typed-array/test/index.js +++ /dev/null @@ -1,105 +0,0 @@ -'use strict'; - -var test = require('tape'); -var whichTypedArray = require('../'); -var isCallable = require('is-callable'); -var hasToStringTag = require('has-tostringtag/shams')(); -var generators = require('make-generator-function')(); -var arrows = require('make-arrow-function').list(); -var forEach = require('for-each'); - -var typedArrayNames = [ - 'Int8Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array', - 'BigInt64Array', - 'BigUint64Array' -]; - -test('not arrays', function (t) { - t.test('non-number/string primitives', function (st) { - // @ts-expect-error - st.equal(false, whichTypedArray(), 'undefined is not typed array'); - st.equal(false, whichTypedArray(null), 'null is not typed array'); - st.equal(false, whichTypedArray(false), 'false is not typed array'); - st.equal(false, whichTypedArray(true), 'true is not typed array'); - st.end(); - }); - - t.equal(false, whichTypedArray({}), 'object is not typed array'); - t.equal(false, whichTypedArray(/a/g), 'regex literal is not typed array'); - t.equal(false, whichTypedArray(new RegExp('a', 'g')), 'regex object is not typed array'); - t.equal(false, whichTypedArray(new Date()), 'new Date() is not typed array'); - - t.test('numbers', function (st) { - st.equal(false, whichTypedArray(42), 'number is not typed array'); - st.equal(false, whichTypedArray(Object(42)), 'number object is not typed array'); - st.equal(false, whichTypedArray(NaN), 'NaN is not typed array'); - st.equal(false, whichTypedArray(Infinity), 'Infinity is not typed array'); - st.end(); - }); - - t.test('strings', function (st) { - st.equal(false, whichTypedArray('foo'), 'string primitive is not typed array'); - st.equal(false, whichTypedArray(Object('foo')), 'string object is not typed array'); - st.end(); - }); - - t.end(); -}); - -test('Functions', function (t) { - t.equal(false, whichTypedArray(function () {}), 'function is not typed array'); - t.end(); -}); - -test('Generators', { skip: generators.length === 0 }, function (t) { - forEach(generators, function (genFn) { - t.equal(false, whichTypedArray(genFn), 'generator function ' + genFn + ' is not typed array'); - }); - t.end(); -}); - -test('Arrow functions', { skip: arrows.length === 0 }, function (t) { - forEach(arrows, function (arrowFn) { - t.equal(false, whichTypedArray(arrowFn), 'arrow function ' + arrowFn + ' is not typed array'); - }); - t.end(); -}); - -test('@@toStringTag', { skip: !hasToStringTag }, function (t) { - forEach(typedArrayNames, function (typedArray) { - // @ts-expect-error TODO: fix - if (typeof global[typedArray] === 'function') { - // @ts-expect-error TODO: fix - var fakeTypedArray = []; - // @ts-expect-error TODO: fix - fakeTypedArray[Symbol.toStringTag] = typedArray; - // @ts-expect-error TODO: fix - t.equal(false, whichTypedArray(fakeTypedArray), 'faked ' + typedArray + ' is not typed array'); - } else { - t.comment('# SKIP ' + typedArray + ' is not supported'); - } - }); - t.end(); -}); - -test('Typed Arrays', function (t) { - forEach(typedArrayNames, function (typedArray) { - // @ts-expect-error TODO: fix - /** @type {import('../').TypedArrayConstructor} */ var TypedArray = global[typedArray]; - if (isCallable(TypedArray)) { - var arr = new TypedArray(10); - t.equal(whichTypedArray(arr), typedArray, 'new ' + typedArray + '(10) is typed array of type ' + typedArray); - } else { - t.comment('# SKIP ' + typedArray + ' is not supported'); - } - }); - t.end(); -}); diff --git a/node_modules/which-typed-array/tsconfig.json b/node_modules/which-typed-array/tsconfig.json deleted file mode 100644 index 6716d81..0000000 --- a/node_modules/which-typed-array/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "@ljharb/tsconfig", - "compilerOptions": { - "target": "ES2021", - }, - "exclude": [ - "coverage" - ] -} diff --git a/node_modules/which/CHANGELOG.md b/node_modules/which/CHANGELOG.md deleted file mode 100644 index 7fb1f20..0000000 --- a/node_modules/which/CHANGELOG.md +++ /dev/null @@ -1,166 +0,0 @@ -# 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 deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/which/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index cd83350..0000000 --- a/node_modules/which/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# 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 deleted file mode 100755 index 7cee372..0000000 --- a/node_modules/which/bin/node-which +++ /dev/null @@ -1,52 +0,0 @@ -#!/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 deleted file mode 100644 index 97ad7fb..0000000 --- a/node_modules/which/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "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 deleted file mode 100644 index 82afffd..0000000 --- a/node_modules/which/which.js +++ /dev/null @@ -1,125 +0,0 @@ -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 deleted file mode 100644 index 842218c..0000000 --- a/node_modules/word-wrap/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -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/word-wrap/README.md b/node_modules/word-wrap/README.md deleted file mode 100644 index 3305953..0000000 --- a/node_modules/word-wrap/README.md +++ /dev/null @@ -1,201 +0,0 @@ -# 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. - -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 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 - -
-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: - -* [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): Returns an array of unique words, or the number of occurrences of each word in… [more](https://github.com/jonschlinkert/unique-words) | [homepage](https://github.com/jonschlinkert/unique-words "Returns an array of unique words, or the number of occurrences of each word in a string or list.") -* [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.") - -### Contributors - -| **Commits** | **Contributor** | -| --- | --- | -| 47 | [jonschlinkert](https://github.com/jonschlinkert) | -| 7 | [OlafConijn](https://github.com/OlafConijn) | -| 3 | [doowb](https://github.com/doowb) | -| 2 | [aashutoshrathi](https://github.com/aashutoshrathi) | -| 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 | [leonard-thieu](https://github.com/leonard-thieu) | -| 1 | [mohd-akram](https://github.com/mohd-akram) | -| 1 | [toddself](https://github.com/toddself) | -| 1 | [wolfgang42](https://github.com/wolfgang42) | -| 1 | [zachhale](https://github.com/zachhale) | - -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2023, [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 July 22, 2023._ \ No newline at end of file diff --git a/node_modules/word-wrap/index.d.ts b/node_modules/word-wrap/index.d.ts deleted file mode 100644 index 07e06f8..0000000 --- a/node_modules/word-wrap/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * 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; - } -} diff --git a/node_modules/word-wrap/index.js b/node_modules/word-wrap/index.js deleted file mode 100644 index 08f1e41..0000000 --- a/node_modules/word-wrap/index.js +++ /dev/null @@ -1,61 +0,0 @@ -/*! - * word-wrap - * - * Copyright (c) 2014-2023, Jon Schlinkert. - * Released under the MIT License. - */ - -function trimEnd(str) { - let lastCharPos = str.length - 1; - let lastChar = str[lastCharPos]; - while(lastChar === ' ' || lastChar === '\t') { - lastChar = str[--lastCharPos]; - } - return str.substring(0, lastCharPos + 1); -} - -function trimTabAndSpaces(str) { - const lines = str.split('\n'); - const trimmedLines = lines.map((line) => trimEnd(line)); - return trimmedLines.join('\n'); -} - -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 = trimTabAndSpaces(result); - } - return result; -}; - -function identity(str) { - return str; -} diff --git a/node_modules/word-wrap/package.json b/node_modules/word-wrap/package.json deleted file mode 100644 index 459246d..0000000 --- a/node_modules/word-wrap/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "word-wrap", - "description": "Wrap words to a specified length.", - "version": "1.2.5", - "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/wrap-ansi/index.js b/node_modules/wrap-ansi/index.js deleted file mode 100755 index d502255..0000000 --- a/node_modules/wrap-ansi/index.js +++ /dev/null @@ -1,216 +0,0 @@ -'use strict'; -const stringWidth = require('string-width'); -const stripAnsi = require('strip-ansi'); -const ansiStyles = require('ansi-styles'); - -const ESCAPES = new Set([ - '\u001B', - '\u009B' -]); - -const END_CODE = 39; - -const ANSI_ESCAPE_BELL = '\u0007'; -const ANSI_CSI = '['; -const ANSI_OSC = ']'; -const ANSI_SGR_TERMINATOR = 'm'; -const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`; - -const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`; -const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`; - -// Calculate the length of words split on ' ', ignoring -// the extra characters added by ansi escape codes -const wordLengths = string => string.split(' ').map(character => stringWidth(character)); - -// Wrap a long word across multiple rows -// Ansi escape codes do not count towards length -const wrapWord = (rows, word, columns) => { - const characters = [...word]; - - let isInsideEscape = false; - let isInsideLinkEscape = false; - let visible = stringWidth(stripAnsi(rows[rows.length - 1])); - - for (const [index, character] of characters.entries()) { - const characterLength = stringWidth(character); - - if (visible + characterLength <= columns) { - rows[rows.length - 1] += character; - } else { - rows.push(character); - visible = 0; - } - - if (ESCAPES.has(character)) { - isInsideEscape = true; - isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK); - } - - if (isInsideEscape) { - if (isInsideLinkEscape) { - if (character === ANSI_ESCAPE_BELL) { - isInsideEscape = false; - isInsideLinkEscape = false; - } - } else if (character === ANSI_SGR_TERMINATOR) { - isInsideEscape = false; - } - - continue; - } - - visible += characterLength; - - if (visible === columns && index < characters.length - 1) { - rows.push(''); - visible = 0; - } - } - - // It's possible that the last row we copy over is only - // ansi escape characters, handle this edge-case - if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { - rows[rows.length - 2] += rows.pop(); - } -}; - -// Trims spaces from a string ignoring invisible sequences -const stringVisibleTrimSpacesRight = string => { - const words = string.split(' '); - let last = words.length; - - while (last > 0) { - if (stringWidth(words[last - 1]) > 0) { - break; - } - - last--; - } - - if (last === words.length) { - return string; - } - - return words.slice(0, last).join(' ') + words.slice(last).join(''); -}; - -// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode -// -// 'hard' will never allow a string to take up more than columns characters -// -// 'soft' allows long words to expand past the column length -const exec = (string, columns, options = {}) => { - if (options.trim !== false && string.trim() === '') { - return ''; - } - - let returnValue = ''; - let escapeCode; - let escapeUrl; - - const lengths = wordLengths(string); - let rows = ['']; - - for (const [index, word] of string.split(' ').entries()) { - if (options.trim !== false) { - rows[rows.length - 1] = rows[rows.length - 1].trimStart(); - } - - let rowLength = stringWidth(rows[rows.length - 1]); - - if (index !== 0) { - if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { - // If we start with a new word but the current row length equals the length of the columns, add a new row - rows.push(''); - rowLength = 0; - } - - if (rowLength > 0 || options.trim === false) { - rows[rows.length - 1] += ' '; - rowLength++; - } - } - - // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' - if (options.hard && lengths[index] > columns) { - const remainingColumns = (columns - rowLength); - const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); - const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); - if (breaksStartingNextLine < breaksStartingThisLine) { - rows.push(''); - } - - wrapWord(rows, word, columns); - continue; - } - - if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { - if (options.wordWrap === false && rowLength < columns) { - wrapWord(rows, word, columns); - continue; - } - - rows.push(''); - } - - if (rowLength + lengths[index] > columns && options.wordWrap === false) { - wrapWord(rows, word, columns); - continue; - } - - rows[rows.length - 1] += word; - } - - if (options.trim !== false) { - rows = rows.map(stringVisibleTrimSpacesRight); - } - - const pre = [...rows.join('\n')]; - - for (const [index, character] of pre.entries()) { - returnValue += character; - - if (ESCAPES.has(character)) { - const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?\\d+)m|\\${ANSI_ESCAPE_LINK}(?.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}}; - if (groups.code !== undefined) { - const code = Number.parseFloat(groups.code); - escapeCode = code === END_CODE ? undefined : code; - } else if (groups.uri !== undefined) { - escapeUrl = groups.uri.length === 0 ? undefined : groups.uri; - } - } - - const code = ansiStyles.codes.get(Number(escapeCode)); - - if (pre[index + 1] === '\n') { - if (escapeUrl) { - returnValue += wrapAnsiHyperlink(''); - } - - if (escapeCode && code) { - returnValue += wrapAnsi(code); - } - } else if (character === '\n') { - if (escapeCode && code) { - returnValue += wrapAnsi(escapeCode); - } - - if (escapeUrl) { - returnValue += wrapAnsiHyperlink(escapeUrl); - } - } - } - - return returnValue; -}; - -// For each newline, invoke the method separately -module.exports = (string, columns, options) => { - return String(string) - .normalize() - .replace(/\r\n/g, '\n') - .split('\n') - .map(line => exec(line, columns, options)) - .join('\n'); -}; diff --git a/node_modules/wrap-ansi/license b/node_modules/wrap-ansi/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/wrap-ansi/license +++ /dev/null @@ -1,9 +0,0 @@ -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/wrap-ansi/package.json b/node_modules/wrap-ansi/package.json deleted file mode 100644 index dfb2f4f..0000000 --- a/node_modules/wrap-ansi/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "wrap-ansi", - "version": "7.0.0", - "description": "Wordwrap a string with ANSI escape codes", - "license": "MIT", - "repository": "chalk/wrap-ansi", - "funding": "https://github.com/chalk/wrap-ansi?sponsor=1", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && nyc ava" - }, - "files": [ - "index.js" - ], - "keywords": [ - "wrap", - "break", - "wordwrap", - "wordbreak", - "linewrap", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "devDependencies": { - "ava": "^2.1.0", - "chalk": "^4.0.0", - "coveralls": "^3.0.3", - "has-ansi": "^4.0.0", - "nyc": "^15.0.1", - "xo": "^0.29.1" - } -} diff --git a/node_modules/wrap-ansi/readme.md b/node_modules/wrap-ansi/readme.md deleted file mode 100644 index 68779ba..0000000 --- a/node_modules/wrap-ansi/readme.md +++ /dev/null @@ -1,91 +0,0 @@ -# wrap-ansi [![Build Status](https://travis-ci.com/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.com/chalk/wrap-ansi) [![Coverage Status](https://coveralls.io/repos/github/chalk/wrap-ansi/badge.svg?branch=master)](https://coveralls.io/github/chalk/wrap-ansi?branch=master) - -> Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) - -## Install - -``` -$ npm install wrap-ansi -``` - -## Usage - -```js -const chalk = require('chalk'); -const wrapAnsi = require('wrap-ansi'); - -const input = 'The quick brown ' + chalk.red('fox jumped over ') + - 'the lazy ' + chalk.green('dog and then ran away with the unicorn.'); - -console.log(wrapAnsi(input, 20)); -``` - - - -## API - -### wrapAnsi(string, columns, options?) - -Wrap words to the specified column width. - -#### string - -Type: `string` - -String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`. - -#### columns - -Type: `number` - -Number of columns to wrap the text to. - -#### options - -Type: `object` - -##### hard - -Type: `boolean`\ -Default: `false` - -By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width. - -##### wordWrap - -Type: `boolean`\ -Default: `true` - -By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary. - -##### trim - -Type: `boolean`\ -Default: `true` - -Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim. - -## Related - -- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes -- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal -- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right -- [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures. - -## Maintainers - -- [Sindre Sorhus](https://github.com/sindresorhus) -- [Josh Junon](https://github.com/qix-) -- [Benjamin Coe](https://github.com/bcoe) - ---- - -
- - 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/wrappy/LICENSE b/node_modules/wrappy/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/wrappy/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 98eab25..0000000 --- a/node_modules/wrappy/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# 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 deleted file mode 100644 index 1307520..0000000 --- a/node_modules/wrappy/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "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 deleted file mode 100644 index bb7e7d6..0000000 --- a/node_modules/wrappy/wrappy.js +++ /dev/null @@ -1,33 +0,0 @@ -// 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/y18n/CHANGELOG.md b/node_modules/y18n/CHANGELOG.md deleted file mode 100644 index 244d838..0000000 --- a/node_modules/y18n/CHANGELOG.md +++ /dev/null @@ -1,100 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [5.0.8](https://www.github.com/yargs/y18n/compare/v5.0.7...v5.0.8) (2021-04-07) - - -### Bug Fixes - -* **deno:** force modern release for Deno ([b1c215a](https://www.github.com/yargs/y18n/commit/b1c215aed714bee5830e76de3e335504dc2c4dab)) - -### [5.0.7](https://www.github.com/yargs/y18n/compare/v5.0.6...v5.0.7) (2021-04-07) - - -### Bug Fixes - -* **deno:** force release for deno ([#121](https://www.github.com/yargs/y18n/issues/121)) ([d3f2560](https://www.github.com/yargs/y18n/commit/d3f2560e6cedf2bfa2352e9eec044da53f9a06b2)) - -### [5.0.6](https://www.github.com/yargs/y18n/compare/v5.0.5...v5.0.6) (2021-04-05) - - -### Bug Fixes - -* **webpack:** skip readFileSync if not defined ([#117](https://www.github.com/yargs/y18n/issues/117)) ([6966fa9](https://www.github.com/yargs/y18n/commit/6966fa91d2881cc6a6c531e836099e01f4da1616)) - -### [5.0.5](https://www.github.com/yargs/y18n/compare/v5.0.4...v5.0.5) (2020-10-25) - - -### Bug Fixes - -* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25)) - -### [5.0.4](https://www.github.com/yargs/y18n/compare/v5.0.3...v5.0.4) (2020-10-16) - - -### Bug Fixes - -* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#105](https://www.github.com/yargs/y18n/issues/105)) ([4f85d80](https://www.github.com/yargs/y18n/commit/4f85d80dbaae6d2c7899ae394f7ad97805df4886)) - -### [5.0.3](https://www.github.com/yargs/y18n/compare/v5.0.2...v5.0.3) (2020-10-16) - - -### Bug Fixes - -* **exports:** node 13.0-13.6 require a string fallback ([#103](https://www.github.com/yargs/y18n/issues/103)) ([e39921e](https://www.github.com/yargs/y18n/commit/e39921e1017f88f5d8ea97ddea854ffe92d68e74)) - -### [5.0.2](https://www.github.com/yargs/y18n/compare/v5.0.1...v5.0.2) (2020-10-01) - - -### Bug Fixes - -* **deno:** update types for deno ^1.4.0 ([#100](https://www.github.com/yargs/y18n/issues/100)) ([3834d9a](https://www.github.com/yargs/y18n/commit/3834d9ab1332f2937c935ada5e76623290efae81)) - -### [5.0.1](https://www.github.com/yargs/y18n/compare/v5.0.0...v5.0.1) (2020-09-05) - - -### Bug Fixes - -* main had old index path ([#98](https://www.github.com/yargs/y18n/issues/98)) ([124f7b0](https://www.github.com/yargs/y18n/commit/124f7b047ba9596bdbdf64459988304e77f3de1b)) - -## [5.0.0](https://www.github.com/yargs/y18n/compare/v4.0.0...v5.0.0) (2020-09-05) - - -### ⚠ BREAKING CHANGES - -* exports maps are now used, which modifies import behavior. -* drops Node 6 and 4. begin following Node.js LTS schedule (#89) - -### Features - -* add support for ESM and Deno [#95](https://www.github.com/yargs/y18n/issues/95)) ([4d7ae94](https://www.github.com/yargs/y18n/commit/4d7ae94bcb42e84164e2180366474b1cd321ed94)) - - -### Build System - -* drops Node 6 and 4. begin following Node.js LTS schedule ([#89](https://www.github.com/yargs/y18n/issues/89)) ([3cc0c28](https://www.github.com/yargs/y18n/commit/3cc0c287240727b84eaf1927f903612ec80f5e43)) - -### 4.0.1 (2020-10-25) - - -### Bug Fixes - -* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/7de58ca0d315990cdb38234e97fc66254cdbcd71)) - -## [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10) - - -### Bug Fixes - -* allow support for falsy values like 0 in tagged literal ([#45](https://github.com/yargs/y18n/issues/45)) ([c926123](https://github.com/yargs/y18n/commit/c926123)) - - -### Features - -* **__:** added tagged template literal support ([#44](https://github.com/yargs/y18n/issues/44)) ([0598daf](https://github.com/yargs/y18n/commit/0598daf)) - - -### BREAKING CHANGES - -* **__:** dropping Node 0.10/Node 0.12 support diff --git a/node_modules/y18n/LICENSE b/node_modules/y18n/LICENSE deleted file mode 100644 index 3c157f0..0000000 --- a/node_modules/y18n/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright (c) 2015, 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/y18n/README.md b/node_modules/y18n/README.md deleted file mode 100644 index 5102bb1..0000000 --- a/node_modules/y18n/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# y18n - -[![NPM version][npm-image]][npm-url] -[![js-standard-style][standard-image]][standard-url] -[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) - -The bare-bones internationalization library used by yargs. - -Inspired by [i18n](https://www.npmjs.com/package/i18n). - -## Examples - -_simple string translation:_ - -```js -const __ = require('y18n')().__; - -console.log(__('my awesome string %s', 'foo')); -``` - -output: - -`my awesome string foo` - -_using tagged template literals_ - -```js -const __ = require('y18n')().__; - -const str = 'foo'; - -console.log(__`my awesome string ${str}`); -``` - -output: - -`my awesome string foo` - -_pluralization support:_ - -```js -const __n = require('y18n')().__n; - -console.log(__n('one fish %s', '%d fishes %s', 2, 'foo')); -``` - -output: - -`2 fishes foo` - -## Deno Example - -As of `v5` `y18n` supports [Deno](https://github.com/denoland/deno): - -```typescript -import y18n from "https://deno.land/x/y18n/deno.ts"; - -const __ = y18n({ - locale: 'pirate', - directory: './test/locales' -}).__ - -console.info(__`Hi, ${'Ben'} ${'Coe'}!`) -``` - -You will need to run with `--allow-read` to load alternative locales. - -## JSON Language Files - -The JSON language files should be stored in a `./locales` folder. -File names correspond to locales, e.g., `en.json`, `pirate.json`. - -When strings are observed for the first time they will be -added to the JSON file corresponding to the current locale. - -## Methods - -### require('y18n')(config) - -Create an instance of y18n with the config provided, options include: - -* `directory`: the locale directory, default `./locales`. -* `updateFiles`: should newly observed strings be updated in file, default `true`. -* `locale`: what locale should be used. -* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`) - be allowed if a file matching the locale does not exist (e.g. `en_US.json`), - default `true`. - -### y18n.\_\_(str, arg, arg, arg) - -Print a localized string, `%s` will be replaced with `arg`s. - -This function can also be used as a tag for a template literal. You can use it -like this: __`hello ${'world'}`. This will be equivalent to -`__('hello %s', 'world')`. - -### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg) - -Print a localized string with appropriate pluralization. If `%d` is provided -in the string, the `count` will replace this placeholder. - -### y18n.setLocale(str) - -Set the current locale being used. - -### y18n.getLocale() - -What locale is currently being used? - -### y18n.updateLocale(obj) - -Update the current locale with the key value pairs in `obj`. - -## Supported Node.js Versions - -Libraries in this ecosystem make a best effort to track -[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a -post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a). - -## License - -ISC - -[npm-url]: https://npmjs.org/package/y18n -[npm-image]: https://img.shields.io/npm/v/y18n.svg -[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg -[standard-url]: https://github.com/feross/standard diff --git a/node_modules/y18n/build/index.cjs b/node_modules/y18n/build/index.cjs deleted file mode 100644 index b2731e1..0000000 --- a/node_modules/y18n/build/index.cjs +++ /dev/null @@ -1,203 +0,0 @@ -'use strict'; - -var fs = require('fs'); -var util = require('util'); -var path = require('path'); - -let shim; -class Y18N { - constructor(opts) { - // configurable options. - opts = opts || {}; - this.directory = opts.directory || './locales'; - this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true; - this.locale = opts.locale || 'en'; - this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true; - // internal stuff. - this.cache = Object.create(null); - this.writeQueue = []; - } - __(...args) { - if (typeof arguments[0] !== 'string') { - return this._taggedLiteral(arguments[0], ...arguments); - } - const str = args.shift(); - let cb = function () { }; // start with noop. - if (typeof args[args.length - 1] === 'function') - cb = args.pop(); - cb = cb || function () { }; // noop. - if (!this.cache[this.locale]) - this._readLocaleFile(); - // we've observed a new string, update the language file. - if (!this.cache[this.locale][str] && this.updateFiles) { - this.cache[this.locale][str] = str; - // include the current directory and locale, - // since these values could change before the - // write is performed. - this._enqueueWrite({ - directory: this.directory, - locale: this.locale, - cb - }); - } - else { - cb(); - } - return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args)); - } - __n() { - const args = Array.prototype.slice.call(arguments); - const singular = args.shift(); - const plural = args.shift(); - const quantity = args.shift(); - let cb = function () { }; // start with noop. - if (typeof args[args.length - 1] === 'function') - cb = args.pop(); - if (!this.cache[this.locale]) - this._readLocaleFile(); - let str = quantity === 1 ? singular : plural; - if (this.cache[this.locale][singular]) { - const entry = this.cache[this.locale][singular]; - str = entry[quantity === 1 ? 'one' : 'other']; - } - // we've observed a new string, update the language file. - if (!this.cache[this.locale][singular] && this.updateFiles) { - this.cache[this.locale][singular] = { - one: singular, - other: plural - }; - // include the current directory and locale, - // since these values could change before the - // write is performed. - this._enqueueWrite({ - directory: this.directory, - locale: this.locale, - cb - }); - } - else { - cb(); - } - // if a %d placeholder is provided, add quantity - // to the arguments expanded by util.format. - const values = [str]; - if (~str.indexOf('%d')) - values.push(quantity); - return shim.format.apply(shim.format, values.concat(args)); - } - setLocale(locale) { - this.locale = locale; - } - getLocale() { - return this.locale; - } - updateLocale(obj) { - if (!this.cache[this.locale]) - this._readLocaleFile(); - for (const key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - this.cache[this.locale][key] = obj[key]; - } - } - } - _taggedLiteral(parts, ...args) { - let str = ''; - parts.forEach(function (part, i) { - const arg = args[i + 1]; - str += part; - if (typeof arg !== 'undefined') { - str += '%s'; - } - }); - return this.__.apply(this, [str].concat([].slice.call(args, 1))); - } - _enqueueWrite(work) { - this.writeQueue.push(work); - if (this.writeQueue.length === 1) - this._processWriteQueue(); - } - _processWriteQueue() { - const _this = this; - const work = this.writeQueue[0]; - // destructure the enqueued work. - const directory = work.directory; - const locale = work.locale; - const cb = work.cb; - const languageFile = this._resolveLocaleFile(directory, locale); - const serializedLocale = JSON.stringify(this.cache[locale], null, 2); - shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) { - _this.writeQueue.shift(); - if (_this.writeQueue.length > 0) - _this._processWriteQueue(); - cb(err); - }); - } - _readLocaleFile() { - let localeLookup = {}; - const languageFile = this._resolveLocaleFile(this.directory, this.locale); - try { - // When using a bundler such as webpack, readFileSync may not be defined: - if (shim.fs.readFileSync) { - localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8')); - } - } - catch (err) { - if (err instanceof SyntaxError) { - err.message = 'syntax error in ' + languageFile; - } - if (err.code === 'ENOENT') - localeLookup = {}; - else - throw err; - } - this.cache[this.locale] = localeLookup; - } - _resolveLocaleFile(directory, locale) { - let file = shim.resolve(directory, './', locale + '.json'); - if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) { - // attempt fallback to language only - const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json'); - if (this._fileExistsSync(languageFile)) - file = languageFile; - } - return file; - } - _fileExistsSync(file) { - return shim.exists(file); - } -} -function y18n$1(opts, _shim) { - shim = _shim; - const y18n = new Y18N(opts); - return { - __: y18n.__.bind(y18n), - __n: y18n.__n.bind(y18n), - setLocale: y18n.setLocale.bind(y18n), - getLocale: y18n.getLocale.bind(y18n), - updateLocale: y18n.updateLocale.bind(y18n), - locale: y18n.locale - }; -} - -var nodePlatformShim = { - fs: { - readFileSync: fs.readFileSync, - writeFile: fs.writeFile - }, - format: util.format, - resolve: path.resolve, - exists: (file) => { - try { - return fs.statSync(file).isFile(); - } - catch (err) { - return false; - } - } -}; - -const y18n = (opts) => { - return y18n$1(opts, nodePlatformShim); -}; - -module.exports = y18n; diff --git a/node_modules/y18n/build/lib/cjs.js b/node_modules/y18n/build/lib/cjs.js deleted file mode 100644 index ff58470..0000000 --- a/node_modules/y18n/build/lib/cjs.js +++ /dev/null @@ -1,6 +0,0 @@ -import { y18n as _y18n } from './index.js'; -import nodePlatformShim from './platform-shims/node.js'; -const y18n = (opts) => { - return _y18n(opts, nodePlatformShim); -}; -export default y18n; diff --git a/node_modules/y18n/build/lib/index.js b/node_modules/y18n/build/lib/index.js deleted file mode 100644 index e38f335..0000000 --- a/node_modules/y18n/build/lib/index.js +++ /dev/null @@ -1,174 +0,0 @@ -let shim; -class Y18N { - constructor(opts) { - // configurable options. - opts = opts || {}; - this.directory = opts.directory || './locales'; - this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true; - this.locale = opts.locale || 'en'; - this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true; - // internal stuff. - this.cache = Object.create(null); - this.writeQueue = []; - } - __(...args) { - if (typeof arguments[0] !== 'string') { - return this._taggedLiteral(arguments[0], ...arguments); - } - const str = args.shift(); - let cb = function () { }; // start with noop. - if (typeof args[args.length - 1] === 'function') - cb = args.pop(); - cb = cb || function () { }; // noop. - if (!this.cache[this.locale]) - this._readLocaleFile(); - // we've observed a new string, update the language file. - if (!this.cache[this.locale][str] && this.updateFiles) { - this.cache[this.locale][str] = str; - // include the current directory and locale, - // since these values could change before the - // write is performed. - this._enqueueWrite({ - directory: this.directory, - locale: this.locale, - cb - }); - } - else { - cb(); - } - return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args)); - } - __n() { - const args = Array.prototype.slice.call(arguments); - const singular = args.shift(); - const plural = args.shift(); - const quantity = args.shift(); - let cb = function () { }; // start with noop. - if (typeof args[args.length - 1] === 'function') - cb = args.pop(); - if (!this.cache[this.locale]) - this._readLocaleFile(); - let str = quantity === 1 ? singular : plural; - if (this.cache[this.locale][singular]) { - const entry = this.cache[this.locale][singular]; - str = entry[quantity === 1 ? 'one' : 'other']; - } - // we've observed a new string, update the language file. - if (!this.cache[this.locale][singular] && this.updateFiles) { - this.cache[this.locale][singular] = { - one: singular, - other: plural - }; - // include the current directory and locale, - // since these values could change before the - // write is performed. - this._enqueueWrite({ - directory: this.directory, - locale: this.locale, - cb - }); - } - else { - cb(); - } - // if a %d placeholder is provided, add quantity - // to the arguments expanded by util.format. - const values = [str]; - if (~str.indexOf('%d')) - values.push(quantity); - return shim.format.apply(shim.format, values.concat(args)); - } - setLocale(locale) { - this.locale = locale; - } - getLocale() { - return this.locale; - } - updateLocale(obj) { - if (!this.cache[this.locale]) - this._readLocaleFile(); - for (const key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - this.cache[this.locale][key] = obj[key]; - } - } - } - _taggedLiteral(parts, ...args) { - let str = ''; - parts.forEach(function (part, i) { - const arg = args[i + 1]; - str += part; - if (typeof arg !== 'undefined') { - str += '%s'; - } - }); - return this.__.apply(this, [str].concat([].slice.call(args, 1))); - } - _enqueueWrite(work) { - this.writeQueue.push(work); - if (this.writeQueue.length === 1) - this._processWriteQueue(); - } - _processWriteQueue() { - const _this = this; - const work = this.writeQueue[0]; - // destructure the enqueued work. - const directory = work.directory; - const locale = work.locale; - const cb = work.cb; - const languageFile = this._resolveLocaleFile(directory, locale); - const serializedLocale = JSON.stringify(this.cache[locale], null, 2); - shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) { - _this.writeQueue.shift(); - if (_this.writeQueue.length > 0) - _this._processWriteQueue(); - cb(err); - }); - } - _readLocaleFile() { - let localeLookup = {}; - const languageFile = this._resolveLocaleFile(this.directory, this.locale); - try { - // When using a bundler such as webpack, readFileSync may not be defined: - if (shim.fs.readFileSync) { - localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8')); - } - } - catch (err) { - if (err instanceof SyntaxError) { - err.message = 'syntax error in ' + languageFile; - } - if (err.code === 'ENOENT') - localeLookup = {}; - else - throw err; - } - this.cache[this.locale] = localeLookup; - } - _resolveLocaleFile(directory, locale) { - let file = shim.resolve(directory, './', locale + '.json'); - if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) { - // attempt fallback to language only - const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json'); - if (this._fileExistsSync(languageFile)) - file = languageFile; - } - return file; - } - _fileExistsSync(file) { - return shim.exists(file); - } -} -export function y18n(opts, _shim) { - shim = _shim; - const y18n = new Y18N(opts); - return { - __: y18n.__.bind(y18n), - __n: y18n.__n.bind(y18n), - setLocale: y18n.setLocale.bind(y18n), - getLocale: y18n.getLocale.bind(y18n), - updateLocale: y18n.updateLocale.bind(y18n), - locale: y18n.locale - }; -} diff --git a/node_modules/y18n/build/lib/platform-shims/node.js b/node_modules/y18n/build/lib/platform-shims/node.js deleted file mode 100644 index 181208b..0000000 --- a/node_modules/y18n/build/lib/platform-shims/node.js +++ /dev/null @@ -1,19 +0,0 @@ -import { readFileSync, statSync, writeFile } from 'fs'; -import { format } from 'util'; -import { resolve } from 'path'; -export default { - fs: { - readFileSync, - writeFile - }, - format, - resolve, - exists: (file) => { - try { - return statSync(file).isFile(); - } - catch (err) { - return false; - } - } -}; diff --git a/node_modules/y18n/index.mjs b/node_modules/y18n/index.mjs deleted file mode 100644 index 46c8213..0000000 --- a/node_modules/y18n/index.mjs +++ /dev/null @@ -1,8 +0,0 @@ -import shim from './build/lib/platform-shims/node.js' -import { y18n as _y18n } from './build/lib/index.js' - -const y18n = (opts) => { - return _y18n(opts, shim) -} - -export default y18n diff --git a/node_modules/y18n/package.json b/node_modules/y18n/package.json deleted file mode 100644 index 4e5c1ca..0000000 --- a/node_modules/y18n/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "y18n", - "version": "5.0.8", - "description": "the bare-bones internationalization library used by yargs", - "exports": { - ".": [ - { - "import": "./index.mjs", - "require": "./build/index.cjs" - }, - "./build/index.cjs" - ] - }, - "type": "module", - "module": "./build/lib/index.js", - "keywords": [ - "i18n", - "internationalization", - "yargs" - ], - "homepage": "https://github.com/yargs/y18n", - "bugs": { - "url": "https://github.com/yargs/y18n/issues" - }, - "repository": "yargs/y18n", - "license": "ISC", - "author": "Ben Coe ", - "main": "./build/index.cjs", - "scripts": { - "check": "standardx **/*.ts **/*.cjs **/*.mjs", - "fix": "standardx --fix **/*.ts **/*.cjs **/*.mjs", - "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs", - "test": "c8 --reporter=text --reporter=html mocha test/*.cjs", - "test:esm": "c8 --reporter=text --reporter=html mocha test/esm/*.mjs", - "posttest": "npm run check", - "coverage": "c8 report --check-coverage", - "precompile": "rimraf build", - "compile": "tsc", - "postcompile": "npm run build:cjs", - "build:cjs": "rollup -c", - "prepare": "npm run compile" - }, - "devDependencies": { - "@types/node": "^14.6.4", - "@wessberg/rollup-plugin-ts": "^1.3.1", - "c8": "^7.3.0", - "chai": "^4.0.1", - "cross-env": "^7.0.2", - "gts": "^3.0.0", - "mocha": "^8.0.0", - "rimraf": "^3.0.2", - "rollup": "^2.26.10", - "standardx": "^7.0.0", - "ts-transform-default-export": "^1.0.2", - "typescript": "^4.0.0" - }, - "files": [ - "build", - "index.mjs", - "!*.d.ts" - ], - "engines": { - "node": ">=10" - }, - "standardx": { - "ignore": [ - "build" - ] - } -} diff --git a/node_modules/yargs-parser/CHANGELOG.md b/node_modules/yargs-parser/CHANGELOG.md deleted file mode 100644 index 584eb86..0000000 --- a/node_modules/yargs-parser/CHANGELOG.md +++ /dev/null @@ -1,308 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -## [21.1.1](https://github.com/yargs/yargs-parser/compare/yargs-parser-v21.1.0...yargs-parser-v21.1.1) (2022-08-04) - - -### Bug Fixes - -* **typescript:** ignore .cts files during publish ([#454](https://github.com/yargs/yargs-parser/issues/454)) ([d69f9c3](https://github.com/yargs/yargs-parser/commit/d69f9c3a91c3ad2f9494d0a94e29a8b76c41b81b)), closes [#452](https://github.com/yargs/yargs-parser/issues/452) - -## [21.1.0](https://github.com/yargs/yargs-parser/compare/yargs-parser-v21.0.1...yargs-parser-v21.1.0) (2022-08-03) - - -### Features - -* allow the browser build to be imported ([#443](https://github.com/yargs/yargs-parser/issues/443)) ([a89259f](https://github.com/yargs/yargs-parser/commit/a89259ff41d6f5312b3ce8a30bef343a993f395a)) - - -### Bug Fixes - -* **halt-at-non-option:** prevent known args from being parsed when "unknown-options-as-args" is enabled ([#438](https://github.com/yargs/yargs-parser/issues/438)) ([c474bc1](https://github.com/yargs/yargs-parser/commit/c474bc10c3aa0ae864b95e5722730114ef15f573)) -* node version check now uses process.versions.node ([#450](https://github.com/yargs/yargs-parser/issues/450)) ([d07bcdb](https://github.com/yargs/yargs-parser/commit/d07bcdbe43075f7201fbe8a08e491217247fe1f1)) -* parse options ending with 3+ hyphens ([#434](https://github.com/yargs/yargs-parser/issues/434)) ([4f1060b](https://github.com/yargs/yargs-parser/commit/4f1060b50759fadbac3315c5117b0c3d65b0a7d8)) - -### [21.0.1](https://github.com/yargs/yargs-parser/compare/yargs-parser-v21.0.0...yargs-parser-v21.0.1) (2022-02-27) - - -### Bug Fixes - -* return deno env object ([#432](https://github.com/yargs/yargs-parser/issues/432)) ([b00eb87](https://github.com/yargs/yargs-parser/commit/b00eb87b4860a890dd2dab0d6058241bbfd2b3ec)) - -## [21.0.0](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.9...yargs-parser-v21.0.0) (2021-11-15) - - -### ⚠ BREAKING CHANGES - -* drops support for 10 (#421) - -### Bug Fixes - -* esm json import ([#416](https://www.github.com/yargs/yargs-parser/issues/416)) ([90f970a](https://www.github.com/yargs/yargs-parser/commit/90f970a6482dd4f5b5eb18d38596dd6f02d73edf)) -* parser should preserve inner quotes ([#407](https://www.github.com/yargs/yargs-parser/issues/407)) ([ae11f49](https://www.github.com/yargs/yargs-parser/commit/ae11f496a8318ea8885aa25015d429b33713c314)) - - -### Code Refactoring - -* drops support for 10 ([#421](https://www.github.com/yargs/yargs-parser/issues/421)) ([3aaf878](https://www.github.com/yargs/yargs-parser/commit/3aaf8784f5c7f2aec6108c1c6a55537fa7e3b5c1)) - -### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20) - - -### Bug Fixes - -* **build:** fixed automated release pipeline ([1fe9135](https://www.github.com/yargs/yargs-parser/commit/1fe9135884790a083615419b2861683e2597dac3)) - -### [20.2.8](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.7...yargs-parser-v20.2.8) (2021-06-20) - - -### Bug Fixes - -* **locale:** Turkish camelize and decamelize issues with toLocaleLowerCase/toLocaleUpperCase ([2617303](https://www.github.com/yargs/yargs-parser/commit/261730383e02448562f737b94bbd1f164aed5143)) -* **perf:** address slow parse when using unknown-options-as-args ([#394](https://www.github.com/yargs/yargs-parser/issues/394)) ([441f059](https://www.github.com/yargs/yargs-parser/commit/441f059d585d446551068ad213db79ac91daf83a)) -* **string-utils:** detect [0,1] ranged values as numbers ([#388](https://www.github.com/yargs/yargs-parser/issues/388)) ([efcc32c](https://www.github.com/yargs/yargs-parser/commit/efcc32c2d6b09aba31abfa2db9bd947befe5586b)) - -### [20.2.7](https://www.github.com/yargs/yargs-parser/compare/v20.2.6...v20.2.7) (2021-03-10) - - -### Bug Fixes - -* **deno:** force release for Deno ([6687c97](https://www.github.com/yargs/yargs-parser/commit/6687c972d0f3ca7865a97908dde3080b05f8b026)) - -### [20.2.6](https://www.github.com/yargs/yargs-parser/compare/v20.2.5...v20.2.6) (2021-02-22) - - -### Bug Fixes - -* **populate--:** -- should always be array ([#354](https://www.github.com/yargs/yargs-parser/issues/354)) ([585ae8f](https://www.github.com/yargs/yargs-parser/commit/585ae8ffad74cc02974f92d788e750137fd65146)) - -### [20.2.5](https://www.github.com/yargs/yargs-parser/compare/v20.2.4...v20.2.5) (2021-02-13) - - -### Bug Fixes - -* do not lowercase camel cased string ([#348](https://www.github.com/yargs/yargs-parser/issues/348)) ([5f4da1f](https://www.github.com/yargs/yargs-parser/commit/5f4da1f17d9d50542d2aaa206c9806ce3e320335)) - -### [20.2.4](https://www.github.com/yargs/yargs-parser/compare/v20.2.3...v20.2.4) (2020-11-09) - - -### Bug Fixes - -* **deno:** address import issues in Deno ([#339](https://www.github.com/yargs/yargs-parser/issues/339)) ([3b54e5e](https://www.github.com/yargs/yargs-parser/commit/3b54e5eef6e9a7b7c6eec7c12bab3ba3b8ba8306)) - -### [20.2.3](https://www.github.com/yargs/yargs-parser/compare/v20.2.2...v20.2.3) (2020-10-16) - - -### Bug Fixes - -* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#336](https://www.github.com/yargs/yargs-parser/issues/336)) ([3ae7242](https://www.github.com/yargs/yargs-parser/commit/3ae7242040ff876d28dabded60ac226e00150c88)) - -### [20.2.2](https://www.github.com/yargs/yargs-parser/compare/v20.2.1...v20.2.2) (2020-10-14) - - -### Bug Fixes - -* **exports:** node 13.0-13.6 require a string fallback ([#333](https://www.github.com/yargs/yargs-parser/issues/333)) ([291aeda](https://www.github.com/yargs/yargs-parser/commit/291aeda06b685b7a015d83bdf2558e180b37388d)) - -### [20.2.1](https://www.github.com/yargs/yargs-parser/compare/v20.2.0...v20.2.1) (2020-10-01) - - -### Bug Fixes - -* **deno:** update types for deno ^1.4.0 ([#330](https://www.github.com/yargs/yargs-parser/issues/330)) ([0ab92e5](https://www.github.com/yargs/yargs-parser/commit/0ab92e50b090f11196334c048c9c92cecaddaf56)) - -## [20.2.0](https://www.github.com/yargs/yargs-parser/compare/v20.1.0...v20.2.0) (2020-09-21) - - -### Features - -* **string-utils:** export looksLikeNumber helper ([#324](https://www.github.com/yargs/yargs-parser/issues/324)) ([c8580a2](https://www.github.com/yargs/yargs-parser/commit/c8580a2327b55f6342acecb6e72b62963d506750)) - - -### Bug Fixes - -* **unknown-options-as-args:** convert positionals that look like numbers ([#326](https://www.github.com/yargs/yargs-parser/issues/326)) ([f85ebb4](https://www.github.com/yargs/yargs-parser/commit/f85ebb4face9d4b0f56147659404cbe0002f3dad)) - -## [20.1.0](https://www.github.com/yargs/yargs-parser/compare/v20.0.0...v20.1.0) (2020-09-20) - - -### Features - -* adds parse-positional-numbers configuration ([#321](https://www.github.com/yargs/yargs-parser/issues/321)) ([9cec00a](https://www.github.com/yargs/yargs-parser/commit/9cec00a622251292ffb7dce6f78f5353afaa0d4c)) - - -### Bug Fixes - -* **build:** update release-please; make labels kick off builds ([#323](https://www.github.com/yargs/yargs-parser/issues/323)) ([09f448b](https://www.github.com/yargs/yargs-parser/commit/09f448b4cd66e25d2872544718df46dab8af062a)) - -## [20.0.0](https://www.github.com/yargs/yargs-parser/compare/v19.0.4...v20.0.0) (2020-09-09) - - -### ⚠ BREAKING CHANGES - -* do not ship type definitions (#318) - -### Bug Fixes - -* only strip camel case if hyphenated ([#316](https://www.github.com/yargs/yargs-parser/issues/316)) ([95a9e78](https://www.github.com/yargs/yargs-parser/commit/95a9e785127b9bbf2d1db1f1f808ca1fb100e82a)), closes [#315](https://www.github.com/yargs/yargs-parser/issues/315) - - -### Code Refactoring - -* do not ship type definitions ([#318](https://www.github.com/yargs/yargs-parser/issues/318)) ([8fbd56f](https://www.github.com/yargs/yargs-parser/commit/8fbd56f1d0b6c44c30fca62708812151ca0ce330)) - -### [19.0.4](https://www.github.com/yargs/yargs-parser/compare/v19.0.3...v19.0.4) (2020-08-27) - - -### Bug Fixes - -* **build:** fixing publication ([#310](https://www.github.com/yargs/yargs-parser/issues/310)) ([5d3c6c2](https://www.github.com/yargs/yargs-parser/commit/5d3c6c29a9126248ba601920d9cf87c78e161ff5)) - -### [19.0.3](https://www.github.com/yargs/yargs-parser/compare/v19.0.2...v19.0.3) (2020-08-27) - - -### Bug Fixes - -* **build:** switch to action for publish ([#308](https://www.github.com/yargs/yargs-parser/issues/308)) ([5c2f305](https://www.github.com/yargs/yargs-parser/commit/5c2f30585342bcd8aaf926407c863099d256d174)) - -### [19.0.2](https://www.github.com/yargs/yargs-parser/compare/v19.0.1...v19.0.2) (2020-08-27) - - -### Bug Fixes - -* **types:** envPrefix should be optional ([#305](https://www.github.com/yargs/yargs-parser/issues/305)) ([ae3f180](https://www.github.com/yargs/yargs-parser/commit/ae3f180e14df2de2fd962145f4518f9aa0e76523)) - -### [19.0.1](https://www.github.com/yargs/yargs-parser/compare/v19.0.0...v19.0.1) (2020-08-09) - - -### Bug Fixes - -* **build:** push tag created for deno ([2186a14](https://www.github.com/yargs/yargs-parser/commit/2186a14989749887d56189867602e39e6679f8b0)) - -## [19.0.0](https://www.github.com/yargs/yargs-parser/compare/v18.1.3...v19.0.0) (2020-08-09) - - -### ⚠ BREAKING CHANGES - -* adds support for ESM and Deno (#295) -* **ts:** projects using `@types/yargs-parser` may see variations in type definitions. -* drops Node 6. begin following Node.js LTS schedule (#278) - -### Features - -* adds support for ESM and Deno ([#295](https://www.github.com/yargs/yargs-parser/issues/295)) ([195bc4a](https://www.github.com/yargs/yargs-parser/commit/195bc4a7f20c2a8f8e33fbb6ba96ef6e9a0120a1)) -* expose camelCase and decamelize helpers ([#296](https://www.github.com/yargs/yargs-parser/issues/296)) ([39154ce](https://www.github.com/yargs/yargs-parser/commit/39154ceb5bdcf76b5f59a9219b34cedb79b67f26)) -* **deps:** update to latest camelcase/decamelize ([#281](https://www.github.com/yargs/yargs-parser/issues/281)) ([8931ab0](https://www.github.com/yargs/yargs-parser/commit/8931ab08f686cc55286f33a95a83537da2be5516)) - - -### Bug Fixes - -* boolean numeric short option ([#294](https://www.github.com/yargs/yargs-parser/issues/294)) ([f600082](https://www.github.com/yargs/yargs-parser/commit/f600082c959e092076caf420bbbc9d7a231e2418)) -* raise permission error for Deno if config load fails ([#298](https://www.github.com/yargs/yargs-parser/issues/298)) ([1174e2b](https://www.github.com/yargs/yargs-parser/commit/1174e2b3f0c845a1cd64e14ffc3703e730567a84)) -* **deps:** update dependency decamelize to v3 ([#274](https://www.github.com/yargs/yargs-parser/issues/274)) ([4d98698](https://www.github.com/yargs/yargs-parser/commit/4d98698bc6767e84ec54a0842908191739be73b7)) -* **types:** switch back to using Partial types ([#293](https://www.github.com/yargs/yargs-parser/issues/293)) ([bdc80ba](https://www.github.com/yargs/yargs-parser/commit/bdc80ba59fa13bc3025ce0a85e8bad9f9da24ea7)) - - -### Build System - -* drops Node 6. begin following Node.js LTS schedule ([#278](https://www.github.com/yargs/yargs-parser/issues/278)) ([9014ed7](https://www.github.com/yargs/yargs-parser/commit/9014ed722a32768b96b829e65a31705db5c1458a)) - - -### Code Refactoring - -* **ts:** move index.js to TypeScript ([#292](https://www.github.com/yargs/yargs-parser/issues/292)) ([f78d2b9](https://www.github.com/yargs/yargs-parser/commit/f78d2b97567ac4828624406e420b4047c710b789)) - -### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16) - - -### Bug Fixes - -* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e)) - -### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26) - - -### Bug Fixes - -* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13)) - -### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16) - - -### Bug Fixes - -* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential -prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2)) - -## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07) - - -### Features - -* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f)) - -## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02) - - -### ⚠ BREAKING CHANGES - -* the narg count is now enforced when parsing arrays. - -### Features - -* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c)) - -## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01) - - -### Features - -* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb)) - -### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29) - - -### Bug Fixes - -* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba)) - -## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10) - - -### ⚠ BREAKING CHANGES - -* this reverts parsing behavior of booleans to that of yargs@14 -* objects used during parsing are now created with a null -prototype. There may be some scenarios where this change in behavior -leaks externally. - -### Features - -* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5)) -* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732)) - - -### Bug Fixes - -* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346)) -* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c)) -* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de)) -* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5)) - -## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01) - - -### ⚠ BREAKING CHANGES - -* populate error if incompatible narg/count or array/count options are used (#191) - -### Features - -* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0)) -* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9)) - - -### Reverts - -* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf)) diff --git a/node_modules/yargs-parser/LICENSE.txt b/node_modules/yargs-parser/LICENSE.txt deleted file mode 100644 index 836440b..0000000 --- a/node_modules/yargs-parser/LICENSE.txt +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2016, 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/yargs-parser/README.md b/node_modules/yargs-parser/README.md deleted file mode 100644 index 2614840..0000000 --- a/node_modules/yargs-parser/README.md +++ /dev/null @@ -1,518 +0,0 @@ -# yargs-parser - -![ci](https://github.com/yargs/yargs-parser/workflows/ci/badge.svg) -[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser) -[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) -![nycrc config on GitHub](https://img.shields.io/nycrc/yargs/yargs-parser) - -The mighty option parser used by [yargs](https://github.com/yargs/yargs). - -visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions. - - - -## Example - -```sh -npm i yargs-parser --save -``` - -```js -const argv = require('yargs-parser')(process.argv.slice(2)) -console.log(argv) -``` - -```console -$ node example.js --foo=33 --bar hello -{ _: [], foo: 33, bar: 'hello' } -``` - -_or parse a string!_ - -```js -const argv = require('yargs-parser')('--foo=99 --bar=33') -console.log(argv) -``` - -```console -{ _: [], foo: 99, bar: 33 } -``` - -Convert an array of mixed types before passing to `yargs-parser`: - -```js -const parse = require('yargs-parser') -parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string -parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings -``` - -## Deno Example - -As of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno): - -```typescript -import parser from "https://deno.land/x/yargs_parser/deno.ts"; - -const argv = parser('--foo=99 --bar=9987930', { - string: ['bar'] -}) -console.log(argv) -``` - -## ESM Example - -As of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_): - -**Node.js:** - -```js -import parser from 'yargs-parser' - -const argv = parser('--foo=99 --bar=9987930', { - string: ['bar'] -}) -console.log(argv) -``` - -**Browsers:** - -```html - - - - -``` - -## API - -### parser(args, opts={}) - -Parses command line arguments returning a simple mapping of keys and values. - -**expects:** - -* `args`: a string or array of strings representing the options to parse. -* `opts`: provide a set of hints indicating how `args` should be parsed: - * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`. - * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.
- Indicate that keys should be parsed as an array and coerced to booleans / numbers:
- `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`. - * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`. - * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided - (or throws an error). For arrays the function is called only once for the entire array:
- `{coerce: {foo: function (arg) {return modifiedArg}}}`. - * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed). - * `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:
- `{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`. - * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)). - * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`. - * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`. - * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed. - * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`. - * `opts.normalize`: `path.normalize()` will be applied to values set to this key. - * `opts.number`: keys should be treated as numbers. - * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`). - -**returns:** - -* `obj`: an object representing the parsed value of `args` - * `key/value`: key value pairs for each argument and their aliases. - * `_`: an array representing the positional arguments. - * [optional] `--`: an array with arguments after the end-of-options flag `--`. - -### require('yargs-parser').detailed(args, opts={}) - -Parses a command line string, returning detailed information required by the -yargs engine. - -**expects:** - -* `args`: a string or array of strings representing options to parse. -* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`. - -**returns:** - -* `argv`: an object representing the parsed value of `args` - * `key/value`: key value pairs for each argument and their aliases. - * `_`: an array representing the positional arguments. - * [optional] `--`: an array with arguments after the end-of-options flag `--`. -* `error`: populated with an error object if an exception occurred during parsing. -* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`. -* `newAliases`: any new aliases added via camel-case expansion: - * `boolean`: `{ fooBar: true }` -* `defaulted`: any new argument created by `opts.default`, no aliases included. - * `boolean`: `{ foo: true }` -* `configuration`: given by default settings and `opts.configuration`. - - - -### Configuration - -The yargs-parser applies several automated transformations on the keys provided -in `args`. These features can be turned on and off using the `configuration` field -of `opts`. - -```js -var parsed = parser(['--no-dice'], { - configuration: { - 'boolean-negation': false - } -}) -``` - -### short option groups - -* default: `true`. -* key: `short-option-groups`. - -Should a group of short-options be treated as boolean flags? - -```console -$ node example.js -abc -{ _: [], a: true, b: true, c: true } -``` - -_if disabled:_ - -```console -$ node example.js -abc -{ _: [], abc: true } -``` - -### camel-case expansion - -* default: `true`. -* key: `camel-case-expansion`. - -Should hyphenated arguments be expanded into camel-case aliases? - -```console -$ node example.js --foo-bar -{ _: [], 'foo-bar': true, fooBar: true } -``` - -_if disabled:_ - -```console -$ node example.js --foo-bar -{ _: [], 'foo-bar': true } -``` - -### dot-notation - -* default: `true` -* key: `dot-notation` - -Should keys that contain `.` be treated as objects? - -```console -$ node example.js --foo.bar -{ _: [], foo: { bar: true } } -``` - -_if disabled:_ - -```console -$ node example.js --foo.bar -{ _: [], "foo.bar": true } -``` - -### parse numbers - -* default: `true` -* key: `parse-numbers` - -Should keys that look like numbers be treated as such? - -```console -$ node example.js --foo=99.3 -{ _: [], foo: 99.3 } -``` - -_if disabled:_ - -```console -$ node example.js --foo=99.3 -{ _: [], foo: "99.3" } -``` - -### parse positional numbers - -* default: `true` -* key: `parse-positional-numbers` - -Should positional keys that look like numbers be treated as such. - -```console -$ node example.js 99.3 -{ _: [99.3] } -``` - -_if disabled:_ - -```console -$ node example.js 99.3 -{ _: ['99.3'] } -``` - -### boolean negation - -* default: `true` -* key: `boolean-negation` - -Should variables prefixed with `--no` be treated as negations? - -```console -$ node example.js --no-foo -{ _: [], foo: false } -``` - -_if disabled:_ - -```console -$ node example.js --no-foo -{ _: [], "no-foo": true } -``` - -### combine arrays - -* default: `false` -* key: `combine-arrays` - -Should arrays be combined when provided by both command line arguments and -a configuration file. - -### duplicate arguments array - -* default: `true` -* key: `duplicate-arguments-array` - -Should arguments be coerced into an array when duplicated: - -```console -$ node example.js -x 1 -x 2 -{ _: [], x: [1, 2] } -``` - -_if disabled:_ - -```console -$ node example.js -x 1 -x 2 -{ _: [], x: 2 } -``` - -### flatten duplicate arrays - -* default: `true` -* key: `flatten-duplicate-arrays` - -Should array arguments be coerced into a single array when duplicated: - -```console -$ node example.js -x 1 2 -x 3 4 -{ _: [], x: [1, 2, 3, 4] } -``` - -_if disabled:_ - -```console -$ node example.js -x 1 2 -x 3 4 -{ _: [], x: [[1, 2], [3, 4]] } -``` - -### greedy arrays - -* default: `true` -* key: `greedy-arrays` - -Should arrays consume more than one positional argument following their flag. - -```console -$ node example --arr 1 2 -{ _: [], arr: [1, 2] } -``` - -_if disabled:_ - -```console -$ node example --arr 1 2 -{ _: [2], arr: [1] } -``` - -**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.** - -### nargs eats options - -* default: `false` -* key: `nargs-eats-options` - -Should nargs consume dash options as well as positional arguments. - -### negation prefix - -* default: `no-` -* key: `negation-prefix` - -The prefix to use for negated boolean variables. - -```console -$ node example.js --no-foo -{ _: [], foo: false } -``` - -_if set to `quux`:_ - -```console -$ node example.js --quuxfoo -{ _: [], foo: false } -``` - -### populate -- - -* default: `false`. -* key: `populate--` - -Should unparsed flags be stored in `--` or `_`. - -_If disabled:_ - -```console -$ node example.js a -b -- x y -{ _: [ 'a', 'x', 'y' ], b: true } -``` - -_If enabled:_ - -```console -$ node example.js a -b -- x y -{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true } -``` - -### set placeholder key - -* default: `false`. -* key: `set-placeholder-key`. - -Should a placeholder be added for keys not set via the corresponding CLI argument? - -_If disabled:_ - -```console -$ node example.js -a 1 -c 2 -{ _: [], a: 1, c: 2 } -``` - -_If enabled:_ - -```console -$ node example.js -a 1 -c 2 -{ _: [], a: 1, b: undefined, c: 2 } -``` - -### halt at non-option - -* default: `false`. -* key: `halt-at-non-option`. - -Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line. - -_If disabled:_ - -```console -$ node example.js -a run b -x y -{ _: [ 'b' ], a: 'run', x: 'y' } -``` - -_If enabled:_ - -```console -$ node example.js -a run b -x y -{ _: [ 'b', '-x', 'y' ], a: 'run' } -``` - -### strip aliased - -* default: `false` -* key: `strip-aliased` - -Should aliases be removed before returning results? - -_If disabled:_ - -```console -$ node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 } -``` - -_If enabled:_ - -```console -$ node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1 } -``` - -### strip dashed - -* default: `false` -* key: `strip-dashed` - -Should dashed keys be removed before returning results? This option has no effect if -`camel-case-expansion` is disabled. - -_If disabled:_ - -```console -$ node example.js --test-field 1 -{ _: [], 'test-field': 1, testField: 1 } -``` - -_If enabled:_ - -```console -$ node example.js --test-field 1 -{ _: [], testField: 1 } -``` - -### unknown options as args - -* default: `false` -* key: `unknown-options-as-args` - -Should unknown options be treated like regular arguments? An unknown option is one that is not -configured in `opts`. - -_If disabled_ - -```console -$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2 -{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true } -``` - -_If enabled_ - -```console -$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2 -{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' } -``` - -## Supported Node.js Versions - -Libraries in this ecosystem make a best effort to track -[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a -post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a). - -## Special Thanks - -The yargs project evolves from optimist and minimist. It owes its -existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/ - -## License - -ISC diff --git a/node_modules/yargs-parser/browser.js b/node_modules/yargs-parser/browser.js deleted file mode 100644 index 241202c..0000000 --- a/node_modules/yargs-parser/browser.js +++ /dev/null @@ -1,29 +0,0 @@ -// Main entrypoint for ESM web browser environments. Avoids using Node.js -// specific libraries, such as "path". -// -// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc. -import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js' -import { YargsParser } from './build/lib/yargs-parser.js' -const parser = new YargsParser({ - cwd: () => { return '' }, - format: (str, arg) => { return str.replace('%s', arg) }, - normalize: (str) => { return str }, - resolve: (str) => { return str }, - require: () => { - throw Error('loading config from files not currently supported in browser') - }, - env: () => {} -}) - -const yargsParser = function Parser (args, opts) { - const result = parser.parse(args.slice(), opts) - return result.argv -} -yargsParser.detailed = function (args, opts) { - return parser.parse(args.slice(), opts) -} -yargsParser.camelCase = camelCase -yargsParser.decamelize = decamelize -yargsParser.looksLikeNumber = looksLikeNumber - -export default yargsParser diff --git a/node_modules/yargs-parser/build/index.cjs b/node_modules/yargs-parser/build/index.cjs deleted file mode 100644 index cf6f50f..0000000 --- a/node_modules/yargs-parser/build/index.cjs +++ /dev/null @@ -1,1050 +0,0 @@ -'use strict'; - -var util = require('util'); -var path = require('path'); -var fs = require('fs'); - -function camelCase(str) { - const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase(); - if (!isCamelCase) { - str = str.toLowerCase(); - } - if (str.indexOf('-') === -1 && str.indexOf('_') === -1) { - return str; - } - else { - let camelcase = ''; - let nextChrUpper = false; - const leadingHyphens = str.match(/^-+/); - for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) { - let chr = str.charAt(i); - if (nextChrUpper) { - nextChrUpper = false; - chr = chr.toUpperCase(); - } - if (i !== 0 && (chr === '-' || chr === '_')) { - nextChrUpper = true; - } - else if (chr !== '-' && chr !== '_') { - camelcase += chr; - } - } - return camelcase; - } -} -function decamelize(str, joinString) { - const lowercase = str.toLowerCase(); - joinString = joinString || '-'; - let notCamelcase = ''; - for (let i = 0; i < str.length; i++) { - const chrLower = lowercase.charAt(i); - const chrString = str.charAt(i); - if (chrLower !== chrString && i > 0) { - notCamelcase += `${joinString}${lowercase.charAt(i)}`; - } - else { - notCamelcase += chrString; - } - } - return notCamelcase; -} -function looksLikeNumber(x) { - if (x === null || x === undefined) - return false; - if (typeof x === 'number') - return true; - if (/^0x[0-9a-f]+$/i.test(x)) - return true; - if (/^0[^.]/.test(x)) - return false; - return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); -} - -function tokenizeArgString(argString) { - if (Array.isArray(argString)) { - return argString.map(e => typeof e !== 'string' ? e + '' : e); - } - argString = argString.trim(); - let i = 0; - let prevC = null; - let c = null; - let opening = null; - const args = []; - for (let ii = 0; ii < argString.length; ii++) { - prevC = c; - c = argString.charAt(ii); - if (c === ' ' && !opening) { - if (!(prevC === ' ')) { - i++; - } - continue; - } - if (c === opening) { - opening = null; - } - else if ((c === "'" || c === '"') && !opening) { - opening = c; - } - if (!args[i]) - args[i] = ''; - args[i] += c; - } - return args; -} - -var DefaultValuesForTypeKey; -(function (DefaultValuesForTypeKey) { - DefaultValuesForTypeKey["BOOLEAN"] = "boolean"; - DefaultValuesForTypeKey["STRING"] = "string"; - DefaultValuesForTypeKey["NUMBER"] = "number"; - DefaultValuesForTypeKey["ARRAY"] = "array"; -})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {})); - -let mixin; -class YargsParser { - constructor(_mixin) { - mixin = _mixin; - } - parse(argsInput, options) { - const opts = Object.assign({ - alias: undefined, - array: undefined, - boolean: undefined, - config: undefined, - configObjects: undefined, - configuration: undefined, - coerce: undefined, - count: undefined, - default: undefined, - envPrefix: undefined, - narg: undefined, - normalize: undefined, - string: undefined, - number: undefined, - __: undefined, - key: undefined - }, options); - const args = tokenizeArgString(argsInput); - const inputIsString = typeof argsInput === 'string'; - const aliases = combineAliases(Object.assign(Object.create(null), opts.alias)); - const configuration = Object.assign({ - 'boolean-negation': true, - 'camel-case-expansion': true, - 'combine-arrays': false, - 'dot-notation': true, - 'duplicate-arguments-array': true, - 'flatten-duplicate-arrays': true, - 'greedy-arrays': true, - 'halt-at-non-option': false, - 'nargs-eats-options': false, - 'negation-prefix': 'no-', - 'parse-numbers': true, - 'parse-positional-numbers': true, - 'populate--': false, - 'set-placeholder-key': false, - 'short-option-groups': true, - 'strip-aliased': false, - 'strip-dashed': false, - 'unknown-options-as-args': false - }, opts.configuration); - const defaults = Object.assign(Object.create(null), opts.default); - const configObjects = opts.configObjects || []; - const envPrefix = opts.envPrefix; - const notFlagsOption = configuration['populate--']; - const notFlagsArgv = notFlagsOption ? '--' : '_'; - const newAliases = Object.create(null); - const defaulted = Object.create(null); - const __ = opts.__ || mixin.format; - const flags = { - aliases: Object.create(null), - arrays: Object.create(null), - bools: Object.create(null), - strings: Object.create(null), - numbers: Object.create(null), - counts: Object.create(null), - normalize: Object.create(null), - configs: Object.create(null), - nargs: Object.create(null), - coercions: Object.create(null), - keys: [] - }; - const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/; - const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)'); - [].concat(opts.array || []).filter(Boolean).forEach(function (opt) { - const key = typeof opt === 'object' ? opt.key : opt; - const assignment = Object.keys(opt).map(function (key) { - const arrayFlagKeys = { - boolean: 'bools', - string: 'strings', - number: 'numbers' - }; - return arrayFlagKeys[key]; - }).filter(Boolean).pop(); - if (assignment) { - flags[assignment][key] = true; - } - flags.arrays[key] = true; - flags.keys.push(key); - }); - [].concat(opts.boolean || []).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - flags.keys.push(key); - }); - [].concat(opts.string || []).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - flags.keys.push(key); - }); - [].concat(opts.number || []).filter(Boolean).forEach(function (key) { - flags.numbers[key] = true; - flags.keys.push(key); - }); - [].concat(opts.count || []).filter(Boolean).forEach(function (key) { - flags.counts[key] = true; - flags.keys.push(key); - }); - [].concat(opts.normalize || []).filter(Boolean).forEach(function (key) { - flags.normalize[key] = true; - flags.keys.push(key); - }); - if (typeof opts.narg === 'object') { - Object.entries(opts.narg).forEach(([key, value]) => { - if (typeof value === 'number') { - flags.nargs[key] = value; - flags.keys.push(key); - } - }); - } - if (typeof opts.coerce === 'object') { - Object.entries(opts.coerce).forEach(([key, value]) => { - if (typeof value === 'function') { - flags.coercions[key] = value; - flags.keys.push(key); - } - }); - } - if (typeof opts.config !== 'undefined') { - if (Array.isArray(opts.config) || typeof opts.config === 'string') { - [].concat(opts.config).filter(Boolean).forEach(function (key) { - flags.configs[key] = true; - }); - } - else if (typeof opts.config === 'object') { - Object.entries(opts.config).forEach(([key, value]) => { - if (typeof value === 'boolean' || typeof value === 'function') { - flags.configs[key] = value; - } - }); - } - } - extendAliases(opts.key, aliases, opts.default, flags.arrays); - Object.keys(defaults).forEach(function (key) { - (flags.aliases[key] || []).forEach(function (alias) { - defaults[alias] = defaults[key]; - }); - }); - let error = null; - checkConfiguration(); - let notFlags = []; - const argv = Object.assign(Object.create(null), { _: [] }); - const argvReturn = {}; - for (let i = 0; i < args.length; i++) { - const arg = args[i]; - const truncatedArg = arg.replace(/^-{3,}/, '---'); - let broken; - let key; - let letters; - let m; - let next; - let value; - if (arg !== '--' && /^-/.test(arg) && isUnknownOptionAsArg(arg)) { - pushPositional(arg); - } - else if (truncatedArg.match(/^---+(=|$)/)) { - pushPositional(arg); - continue; - } - else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) { - m = arg.match(/^--?([^=]+)=([\s\S]*)$/); - if (m !== null && Array.isArray(m) && m.length >= 3) { - if (checkAllAliases(m[1], flags.arrays)) { - i = eatArray(i, m[1], args, m[2]); - } - else if (checkAllAliases(m[1], flags.nargs) !== false) { - i = eatNargs(i, m[1], args, m[2]); - } - else { - setArg(m[1], m[2], true); - } - } - } - else if (arg.match(negatedBoolean) && configuration['boolean-negation']) { - m = arg.match(negatedBoolean); - if (m !== null && Array.isArray(m) && m.length >= 2) { - key = m[1]; - setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false); - } - } - else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) { - m = arg.match(/^--?(.+)/); - if (m !== null && Array.isArray(m) && m.length >= 2) { - key = m[1]; - if (checkAllAliases(key, flags.arrays)) { - i = eatArray(i, key, args); - } - else if (checkAllAliases(key, flags.nargs) !== false) { - i = eatNargs(i, key, args); - } - else { - next = args[i + 1]; - if (next !== undefined && (!next.match(/^-/) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next); - i++; - } - else { - setArg(key, defaultValue(key)); - } - } - } - } - else if (arg.match(/^-.\..+=/)) { - m = arg.match(/^-([^=]+)=([\s\S]*)$/); - if (m !== null && Array.isArray(m) && m.length >= 3) { - setArg(m[1], m[2]); - } - } - else if (arg.match(/^-.\..+/) && !arg.match(negative)) { - next = args[i + 1]; - m = arg.match(/^-(.\..+)/); - if (m !== null && Array.isArray(m) && m.length >= 2) { - key = m[1]; - if (next !== undefined && !next.match(/^-/) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next); - i++; - } - else { - setArg(key, defaultValue(key)); - } - } - } - else if (arg.match(/^-[^-]+/) && !arg.match(negative)) { - letters = arg.slice(1, -1).split(''); - broken = false; - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2); - if (letters[j + 1] && letters[j + 1] === '=') { - value = arg.slice(j + 3); - key = letters[j]; - if (checkAllAliases(key, flags.arrays)) { - i = eatArray(i, key, args, value); - } - else if (checkAllAliases(key, flags.nargs) !== false) { - i = eatNargs(i, key, args, value); - } - else { - setArg(key, value); - } - broken = true; - break; - } - if (next === '-') { - setArg(letters[j], next); - continue; - } - if (/[A-Za-z]/.test(letters[j]) && - /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) && - checkAllAliases(next, flags.bools) === false) { - setArg(letters[j], next); - broken = true; - break; - } - if (letters[j + 1] && letters[j + 1].match(/\W/)) { - setArg(letters[j], next); - broken = true; - break; - } - else { - setArg(letters[j], defaultValue(letters[j])); - } - } - key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (checkAllAliases(key, flags.arrays)) { - i = eatArray(i, key, args); - } - else if (checkAllAliases(key, flags.nargs) !== false) { - i = eatNargs(i, key, args); - } - else { - next = args[i + 1]; - if (next !== undefined && (!/^(-|--)[^-]/.test(next) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next); - i++; - } - else { - setArg(key, defaultValue(key)); - } - } - } - } - else if (arg.match(/^-[0-9]$/) && - arg.match(negative) && - checkAllAliases(arg.slice(1), flags.bools)) { - key = arg.slice(1); - setArg(key, defaultValue(key)); - } - else if (arg === '--') { - notFlags = args.slice(i + 1); - break; - } - else if (configuration['halt-at-non-option']) { - notFlags = args.slice(i); - break; - } - else { - pushPositional(arg); - } - } - applyEnvVars(argv, true); - applyEnvVars(argv, false); - setConfig(argv); - setConfigObjects(); - applyDefaultsAndAliases(argv, flags.aliases, defaults, true); - applyCoercions(argv); - if (configuration['set-placeholder-key']) - setPlaceholderKeys(argv); - Object.keys(flags.counts).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) - setArg(key, 0); - }); - if (notFlagsOption && notFlags.length) - argv[notFlagsArgv] = []; - notFlags.forEach(function (key) { - argv[notFlagsArgv].push(key); - }); - if (configuration['camel-case-expansion'] && configuration['strip-dashed']) { - Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => { - delete argv[key]; - }); - } - if (configuration['strip-aliased']) { - [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => { - if (configuration['camel-case-expansion'] && alias.includes('-')) { - delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')]; - } - delete argv[alias]; - }); - } - function pushPositional(arg) { - const maybeCoercedNumber = maybeCoerceNumber('_', arg); - if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') { - argv._.push(maybeCoercedNumber); - } - } - function eatNargs(i, key, args, argAfterEqualSign) { - let ii; - let toEat = checkAllAliases(key, flags.nargs); - toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat; - if (toEat === 0) { - if (!isUndefined(argAfterEqualSign)) { - error = Error(__('Argument unexpected for: %s', key)); - } - setArg(key, defaultValue(key)); - return i; - } - let available = isUndefined(argAfterEqualSign) ? 0 : 1; - if (configuration['nargs-eats-options']) { - if (args.length - (i + 1) + available < toEat) { - error = Error(__('Not enough arguments following: %s', key)); - } - available = toEat; - } - else { - for (ii = i + 1; ii < args.length; ii++) { - if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii])) - available++; - else - break; - } - if (available < toEat) - error = Error(__('Not enough arguments following: %s', key)); - } - let consumed = Math.min(available, toEat); - if (!isUndefined(argAfterEqualSign) && consumed > 0) { - setArg(key, argAfterEqualSign); - consumed--; - } - for (ii = i + 1; ii < (consumed + i + 1); ii++) { - setArg(key, args[ii]); - } - return (i + consumed); - } - function eatArray(i, key, args, argAfterEqualSign) { - let argsToSet = []; - let next = argAfterEqualSign || args[i + 1]; - const nargsCount = checkAllAliases(key, flags.nargs); - if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) { - argsToSet.push(true); - } - else if (isUndefined(next) || - (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) { - if (defaults[key] !== undefined) { - const defVal = defaults[key]; - argsToSet = Array.isArray(defVal) ? defVal : [defVal]; - } - } - else { - if (!isUndefined(argAfterEqualSign)) { - argsToSet.push(processValue(key, argAfterEqualSign, true)); - } - for (let ii = i + 1; ii < args.length; ii++) { - if ((!configuration['greedy-arrays'] && argsToSet.length > 0) || - (nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount)) - break; - next = args[ii]; - if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) - break; - i = ii; - argsToSet.push(processValue(key, next, inputIsString)); - } - } - if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) || - (isNaN(nargsCount) && argsToSet.length === 0))) { - error = Error(__('Not enough arguments following: %s', key)); - } - setArg(key, argsToSet); - return i; - } - function setArg(key, val, shouldStripQuotes = inputIsString) { - if (/-/.test(key) && configuration['camel-case-expansion']) { - const alias = key.split('.').map(function (prop) { - return camelCase(prop); - }).join('.'); - addNewAlias(key, alias); - } - const value = processValue(key, val, shouldStripQuotes); - const splitKey = key.split('.'); - setKey(argv, splitKey, value); - if (flags.aliases[key]) { - flags.aliases[key].forEach(function (x) { - const keyProperties = x.split('.'); - setKey(argv, keyProperties, value); - }); - } - if (splitKey.length > 1 && configuration['dot-notation']) { - (flags.aliases[splitKey[0]] || []).forEach(function (x) { - let keyProperties = x.split('.'); - const a = [].concat(splitKey); - a.shift(); - keyProperties = keyProperties.concat(a); - if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) { - setKey(argv, keyProperties, value); - } - }); - } - if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) { - const keys = [key].concat(flags.aliases[key] || []); - keys.forEach(function (key) { - Object.defineProperty(argvReturn, key, { - enumerable: true, - get() { - return val; - }, - set(value) { - val = typeof value === 'string' ? mixin.normalize(value) : value; - } - }); - }); - } - } - function addNewAlias(key, alias) { - if (!(flags.aliases[key] && flags.aliases[key].length)) { - flags.aliases[key] = [alias]; - newAliases[alias] = true; - } - if (!(flags.aliases[alias] && flags.aliases[alias].length)) { - addNewAlias(alias, key); - } - } - function processValue(key, val, shouldStripQuotes) { - if (shouldStripQuotes) { - val = stripQuotes(val); - } - if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) { - if (typeof val === 'string') - val = val === 'true'; - } - let value = Array.isArray(val) - ? val.map(function (v) { return maybeCoerceNumber(key, v); }) - : maybeCoerceNumber(key, val); - if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) { - value = increment(); - } - if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) { - if (Array.isArray(val)) - value = val.map((val) => { return mixin.normalize(val); }); - else - value = mixin.normalize(val); - } - return value; - } - function maybeCoerceNumber(key, value) { - if (!configuration['parse-positional-numbers'] && key === '_') - return value; - if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) { - const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`)))); - if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) { - value = Number(value); - } - } - return value; - } - function setConfig(argv) { - const configLookup = Object.create(null); - applyDefaultsAndAliases(configLookup, flags.aliases, defaults); - Object.keys(flags.configs).forEach(function (configKey) { - const configPath = argv[configKey] || configLookup[configKey]; - if (configPath) { - try { - let config = null; - const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath); - const resolveConfig = flags.configs[configKey]; - if (typeof resolveConfig === 'function') { - try { - config = resolveConfig(resolvedConfigPath); - } - catch (e) { - config = e; - } - if (config instanceof Error) { - error = config; - return; - } - } - else { - config = mixin.require(resolvedConfigPath); - } - setConfigObject(config); - } - catch (ex) { - if (ex.name === 'PermissionDenied') - error = ex; - else if (argv[configKey]) - error = Error(__('Invalid JSON config file: %s', configPath)); - } - } - }); - } - function setConfigObject(config, prev) { - Object.keys(config).forEach(function (key) { - const value = config[key]; - const fullKey = prev ? prev + '.' + key : key; - if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) { - setConfigObject(value, fullKey); - } - else { - if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) { - setArg(fullKey, value); - } - } - }); - } - function setConfigObjects() { - if (typeof configObjects !== 'undefined') { - configObjects.forEach(function (configObject) { - setConfigObject(configObject); - }); - } - } - function applyEnvVars(argv, configOnly) { - if (typeof envPrefix === 'undefined') - return; - const prefix = typeof envPrefix === 'string' ? envPrefix : ''; - const env = mixin.env(); - Object.keys(env).forEach(function (envVar) { - if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) { - const keys = envVar.split('__').map(function (key, i) { - if (i === 0) { - key = key.substring(prefix.length); - } - return camelCase(key); - }); - if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) { - setArg(keys.join('.'), env[envVar]); - } - } - }); - } - function applyCoercions(argv) { - let coerce; - const applied = new Set(); - Object.keys(argv).forEach(function (key) { - if (!applied.has(key)) { - coerce = checkAllAliases(key, flags.coercions); - if (typeof coerce === 'function') { - try { - const value = maybeCoerceNumber(key, coerce(argv[key])); - ([].concat(flags.aliases[key] || [], key)).forEach(ali => { - applied.add(ali); - argv[ali] = value; - }); - } - catch (err) { - error = err; - } - } - } - }); - } - function setPlaceholderKeys(argv) { - flags.keys.forEach((key) => { - if (~key.indexOf('.')) - return; - if (typeof argv[key] === 'undefined') - argv[key] = undefined; - }); - return argv; - } - function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) { - Object.keys(defaults).forEach(function (key) { - if (!hasKey(obj, key.split('.'))) { - setKey(obj, key.split('.'), defaults[key]); - if (canLog) - defaulted[key] = true; - (aliases[key] || []).forEach(function (x) { - if (hasKey(obj, x.split('.'))) - return; - setKey(obj, x.split('.'), defaults[key]); - }); - } - }); - } - function hasKey(obj, keys) { - let o = obj; - if (!configuration['dot-notation']) - keys = [keys.join('.')]; - keys.slice(0, -1).forEach(function (key) { - o = (o[key] || {}); - }); - const key = keys[keys.length - 1]; - if (typeof o !== 'object') - return false; - else - return key in o; - } - function setKey(obj, keys, value) { - let o = obj; - if (!configuration['dot-notation']) - keys = [keys.join('.')]; - keys.slice(0, -1).forEach(function (key) { - key = sanitizeKey(key); - if (typeof o === 'object' && o[key] === undefined) { - o[key] = {}; - } - if (typeof o[key] !== 'object' || Array.isArray(o[key])) { - if (Array.isArray(o[key])) { - o[key].push({}); - } - else { - o[key] = [o[key], {}]; - } - o = o[key][o[key].length - 1]; - } - else { - o = o[key]; - } - }); - const key = sanitizeKey(keys[keys.length - 1]); - const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays); - const isValueArray = Array.isArray(value); - let duplicate = configuration['duplicate-arguments-array']; - if (!duplicate && checkAllAliases(key, flags.nargs)) { - duplicate = true; - if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) { - o[key] = undefined; - } - } - if (value === increment()) { - o[key] = increment(o[key]); - } - else if (Array.isArray(o[key])) { - if (duplicate && isTypeArray && isValueArray) { - o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]); - } - else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) { - o[key] = value; - } - else { - o[key] = o[key].concat([value]); - } - } - else if (o[key] === undefined && isTypeArray) { - o[key] = isValueArray ? value : [value]; - } - else if (duplicate && !(o[key] === undefined || - checkAllAliases(key, flags.counts) || - checkAllAliases(key, flags.bools))) { - o[key] = [o[key], value]; - } - else { - o[key] = value; - } - } - function extendAliases(...args) { - args.forEach(function (obj) { - Object.keys(obj || {}).forEach(function (key) { - if (flags.aliases[key]) - return; - flags.aliases[key] = [].concat(aliases[key] || []); - flags.aliases[key].concat(key).forEach(function (x) { - if (/-/.test(x) && configuration['camel-case-expansion']) { - const c = camelCase(x); - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c); - newAliases[c] = true; - } - } - }); - flags.aliases[key].concat(key).forEach(function (x) { - if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) { - const c = decamelize(x, '-'); - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c); - newAliases[c] = true; - } - } - }); - flags.aliases[key].forEach(function (x) { - flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); - }); - } - function checkAllAliases(key, flag) { - const toCheck = [].concat(flags.aliases[key] || [], key); - const keys = Object.keys(flag); - const setAlias = toCheck.find(key => keys.includes(key)); - return setAlias ? flag[setAlias] : false; - } - function hasAnyFlag(key) { - const flagsKeys = Object.keys(flags); - const toCheck = [].concat(flagsKeys.map(k => flags[k])); - return toCheck.some(function (flag) { - return Array.isArray(flag) ? flag.includes(key) : flag[key]; - }); - } - function hasFlagsMatching(arg, ...patterns) { - const toCheck = [].concat(...patterns); - return toCheck.some(function (pattern) { - const match = arg.match(pattern); - return match && hasAnyFlag(match[1]); - }); - } - function hasAllShortFlags(arg) { - if (arg.match(negative) || !arg.match(/^-[^-]+/)) { - return false; - } - let hasAllFlags = true; - let next; - const letters = arg.slice(1).split(''); - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2); - if (!hasAnyFlag(letters[j])) { - hasAllFlags = false; - break; - } - if ((letters[j + 1] && letters[j + 1] === '=') || - next === '-' || - (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) || - (letters[j + 1] && letters[j + 1].match(/\W/))) { - break; - } - } - return hasAllFlags; - } - function isUnknownOptionAsArg(arg) { - return configuration['unknown-options-as-args'] && isUnknownOption(arg); - } - function isUnknownOption(arg) { - arg = arg.replace(/^-{3,}/, '--'); - if (arg.match(negative)) { - return false; - } - if (hasAllShortFlags(arg)) { - return false; - } - const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/; - const normalFlag = /^-+([^=]+?)$/; - const flagEndingInHyphen = /^-+([^=]+?)-$/; - const flagEndingInDigits = /^-+([^=]+?\d+)$/; - const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/; - return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters); - } - function defaultValue(key) { - if (!checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts) && - `${key}` in defaults) { - return defaults[key]; - } - else { - return defaultForType(guessType(key)); - } - } - function defaultForType(type) { - const def = { - [DefaultValuesForTypeKey.BOOLEAN]: true, - [DefaultValuesForTypeKey.STRING]: '', - [DefaultValuesForTypeKey.NUMBER]: undefined, - [DefaultValuesForTypeKey.ARRAY]: [] - }; - return def[type]; - } - function guessType(key) { - let type = DefaultValuesForTypeKey.BOOLEAN; - if (checkAllAliases(key, flags.strings)) - type = DefaultValuesForTypeKey.STRING; - else if (checkAllAliases(key, flags.numbers)) - type = DefaultValuesForTypeKey.NUMBER; - else if (checkAllAliases(key, flags.bools)) - type = DefaultValuesForTypeKey.BOOLEAN; - else if (checkAllAliases(key, flags.arrays)) - type = DefaultValuesForTypeKey.ARRAY; - return type; - } - function isUndefined(num) { - return num === undefined; - } - function checkConfiguration() { - Object.keys(flags.counts).find(key => { - if (checkAllAliases(key, flags.arrays)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key)); - return true; - } - else if (checkAllAliases(key, flags.nargs)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key)); - return true; - } - return false; - }); - } - return { - aliases: Object.assign({}, flags.aliases), - argv: Object.assign(argvReturn, argv), - configuration: configuration, - defaulted: Object.assign({}, defaulted), - error: error, - newAliases: Object.assign({}, newAliases) - }; - } -} -function combineAliases(aliases) { - const aliasArrays = []; - const combined = Object.create(null); - let change = true; - Object.keys(aliases).forEach(function (key) { - aliasArrays.push([].concat(aliases[key], key)); - }); - while (change) { - change = false; - for (let i = 0; i < aliasArrays.length; i++) { - for (let ii = i + 1; ii < aliasArrays.length; ii++) { - const intersect = aliasArrays[i].filter(function (v) { - return aliasArrays[ii].indexOf(v) !== -1; - }); - if (intersect.length) { - aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]); - aliasArrays.splice(ii, 1); - change = true; - break; - } - } - } - } - aliasArrays.forEach(function (aliasArray) { - aliasArray = aliasArray.filter(function (v, i, self) { - return self.indexOf(v) === i; - }); - const lastAlias = aliasArray.pop(); - if (lastAlias !== undefined && typeof lastAlias === 'string') { - combined[lastAlias] = aliasArray; - } - }); - return combined; -} -function increment(orig) { - return orig !== undefined ? orig + 1 : 1; -} -function sanitizeKey(key) { - if (key === '__proto__') - return '___proto___'; - return key; -} -function stripQuotes(val) { - return (typeof val === 'string' && - (val[0] === "'" || val[0] === '"') && - val[val.length - 1] === val[0]) - ? val.substring(1, val.length - 1) - : val; -} - -var _a, _b, _c; -const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION) - ? Number(process.env.YARGS_MIN_NODE_VERSION) - : 12; -const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1); -if (nodeVersion) { - const major = Number(nodeVersion.match(/^([^.]+)/)[1]); - if (major < minNodeVersion) { - throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`); - } -} -const env = process ? process.env : {}; -const parser = new YargsParser({ - cwd: process.cwd, - env: () => { - return env; - }, - format: util.format, - normalize: path.normalize, - resolve: path.resolve, - require: (path) => { - if (typeof require !== 'undefined') { - return require(path); - } - else if (path.match(/\.json$/)) { - return JSON.parse(fs.readFileSync(path, 'utf8')); - } - else { - throw Error('only .json config files are supported in ESM'); - } - } -}); -const yargsParser = function Parser(args, opts) { - const result = parser.parse(args.slice(), opts); - return result.argv; -}; -yargsParser.detailed = function (args, opts) { - return parser.parse(args.slice(), opts); -}; -yargsParser.camelCase = camelCase; -yargsParser.decamelize = decamelize; -yargsParser.looksLikeNumber = looksLikeNumber; - -module.exports = yargsParser; diff --git a/node_modules/yargs-parser/build/lib/index.js b/node_modules/yargs-parser/build/lib/index.js deleted file mode 100644 index 43ef485..0000000 --- a/node_modules/yargs-parser/build/lib/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js - * CJS and ESM environments. - * - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - */ -var _a, _b, _c; -import { format } from 'util'; -import { normalize, resolve } from 'path'; -import { camelCase, decamelize, looksLikeNumber } from './string-utils.js'; -import { YargsParser } from './yargs-parser.js'; -import { readFileSync } from 'fs'; -// See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our -// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only. -const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION) - ? Number(process.env.YARGS_MIN_NODE_VERSION) - : 12; -const nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1); -if (nodeVersion) { - const major = Number(nodeVersion.match(/^([^.]+)/)[1]); - if (major < minNodeVersion) { - throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`); - } -} -// Creates a yargs-parser instance using Node.js standard libraries: -const env = process ? process.env : {}; -const parser = new YargsParser({ - cwd: process.cwd, - env: () => { - return env; - }, - format, - normalize, - resolve, - // TODO: figure out a way to combine ESM and CJS coverage, such that - // we can exercise all the lines below: - require: (path) => { - if (typeof require !== 'undefined') { - return require(path); - } - else if (path.match(/\.json$/)) { - // Addresses: https://github.com/yargs/yargs/issues/2040 - return JSON.parse(readFileSync(path, 'utf8')); - } - else { - throw Error('only .json config files are supported in ESM'); - } - } -}); -const yargsParser = function Parser(args, opts) { - const result = parser.parse(args.slice(), opts); - return result.argv; -}; -yargsParser.detailed = function (args, opts) { - return parser.parse(args.slice(), opts); -}; -yargsParser.camelCase = camelCase; -yargsParser.decamelize = decamelize; -yargsParser.looksLikeNumber = looksLikeNumber; -export default yargsParser; diff --git a/node_modules/yargs-parser/build/lib/string-utils.js b/node_modules/yargs-parser/build/lib/string-utils.js deleted file mode 100644 index 4e8bd99..0000000 --- a/node_modules/yargs-parser/build/lib/string-utils.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - */ -export function camelCase(str) { - // Handle the case where an argument is provided as camel case, e.g., fooBar. - // by ensuring that the string isn't already mixed case: - const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase(); - if (!isCamelCase) { - str = str.toLowerCase(); - } - if (str.indexOf('-') === -1 && str.indexOf('_') === -1) { - return str; - } - else { - let camelcase = ''; - let nextChrUpper = false; - const leadingHyphens = str.match(/^-+/); - for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) { - let chr = str.charAt(i); - if (nextChrUpper) { - nextChrUpper = false; - chr = chr.toUpperCase(); - } - if (i !== 0 && (chr === '-' || chr === '_')) { - nextChrUpper = true; - } - else if (chr !== '-' && chr !== '_') { - camelcase += chr; - } - } - return camelcase; - } -} -export function decamelize(str, joinString) { - const lowercase = str.toLowerCase(); - joinString = joinString || '-'; - let notCamelcase = ''; - for (let i = 0; i < str.length; i++) { - const chrLower = lowercase.charAt(i); - const chrString = str.charAt(i); - if (chrLower !== chrString && i > 0) { - notCamelcase += `${joinString}${lowercase.charAt(i)}`; - } - else { - notCamelcase += chrString; - } - } - return notCamelcase; -} -export function looksLikeNumber(x) { - if (x === null || x === undefined) - return false; - // if loaded from config, may already be a number. - if (typeof x === 'number') - return true; - // hexadecimal. - if (/^0x[0-9a-f]+$/i.test(x)) - return true; - // don't treat 0123 as a number; as it drops the leading '0'. - if (/^0[^.]/.test(x)) - return false; - return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); -} diff --git a/node_modules/yargs-parser/build/lib/tokenize-arg-string.js b/node_modules/yargs-parser/build/lib/tokenize-arg-string.js deleted file mode 100644 index 5e732ef..0000000 --- a/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - */ -// take an un-split argv string and tokenize it. -export function tokenizeArgString(argString) { - if (Array.isArray(argString)) { - return argString.map(e => typeof e !== 'string' ? e + '' : e); - } - argString = argString.trim(); - let i = 0; - let prevC = null; - let c = null; - let opening = null; - const args = []; - for (let ii = 0; ii < argString.length; ii++) { - prevC = c; - c = argString.charAt(ii); - // split on spaces unless we're in quotes. - if (c === ' ' && !opening) { - if (!(prevC === ' ')) { - i++; - } - continue; - } - // don't split the string if we're in matching - // opening or closing single and double quotes. - if (c === opening) { - opening = null; - } - else if ((c === "'" || c === '"') && !opening) { - opening = c; - } - if (!args[i]) - args[i] = ''; - args[i] += c; - } - return args; -} diff --git a/node_modules/yargs-parser/build/lib/yargs-parser-types.js b/node_modules/yargs-parser/build/lib/yargs-parser-types.js deleted file mode 100644 index 63b7c31..0000000 --- a/node_modules/yargs-parser/build/lib/yargs-parser-types.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - */ -export var DefaultValuesForTypeKey; -(function (DefaultValuesForTypeKey) { - DefaultValuesForTypeKey["BOOLEAN"] = "boolean"; - DefaultValuesForTypeKey["STRING"] = "string"; - DefaultValuesForTypeKey["NUMBER"] = "number"; - DefaultValuesForTypeKey["ARRAY"] = "array"; -})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {})); diff --git a/node_modules/yargs-parser/build/lib/yargs-parser.js b/node_modules/yargs-parser/build/lib/yargs-parser.js deleted file mode 100644 index 415d4bc..0000000 --- a/node_modules/yargs-parser/build/lib/yargs-parser.js +++ /dev/null @@ -1,1045 +0,0 @@ -/** - * @license - * Copyright (c) 2016, Contributors - * SPDX-License-Identifier: ISC - */ -import { tokenizeArgString } from './tokenize-arg-string.js'; -import { DefaultValuesForTypeKey } from './yargs-parser-types.js'; -import { camelCase, decamelize, looksLikeNumber } from './string-utils.js'; -let mixin; -export class YargsParser { - constructor(_mixin) { - mixin = _mixin; - } - parse(argsInput, options) { - const opts = Object.assign({ - alias: undefined, - array: undefined, - boolean: undefined, - config: undefined, - configObjects: undefined, - configuration: undefined, - coerce: undefined, - count: undefined, - default: undefined, - envPrefix: undefined, - narg: undefined, - normalize: undefined, - string: undefined, - number: undefined, - __: undefined, - key: undefined - }, options); - // allow a string argument to be passed in rather - // than an argv array. - const args = tokenizeArgString(argsInput); - // tokenizeArgString adds extra quotes to args if argsInput is a string - // only strip those extra quotes in processValue if argsInput is a string - const inputIsString = typeof argsInput === 'string'; - // aliases might have transitive relationships, normalize this. - const aliases = combineAliases(Object.assign(Object.create(null), opts.alias)); - const configuration = Object.assign({ - 'boolean-negation': true, - 'camel-case-expansion': true, - 'combine-arrays': false, - 'dot-notation': true, - 'duplicate-arguments-array': true, - 'flatten-duplicate-arrays': true, - 'greedy-arrays': true, - 'halt-at-non-option': false, - 'nargs-eats-options': false, - 'negation-prefix': 'no-', - 'parse-numbers': true, - 'parse-positional-numbers': true, - 'populate--': false, - 'set-placeholder-key': false, - 'short-option-groups': true, - 'strip-aliased': false, - 'strip-dashed': false, - 'unknown-options-as-args': false - }, opts.configuration); - const defaults = Object.assign(Object.create(null), opts.default); - const configObjects = opts.configObjects || []; - const envPrefix = opts.envPrefix; - const notFlagsOption = configuration['populate--']; - const notFlagsArgv = notFlagsOption ? '--' : '_'; - const newAliases = Object.create(null); - const defaulted = Object.create(null); - // allow a i18n handler to be passed in, default to a fake one (util.format). - const __ = opts.__ || mixin.format; - const flags = { - aliases: Object.create(null), - arrays: Object.create(null), - bools: Object.create(null), - strings: Object.create(null), - numbers: Object.create(null), - counts: Object.create(null), - normalize: Object.create(null), - configs: Object.create(null), - nargs: Object.create(null), - coercions: Object.create(null), - keys: [] - }; - const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/; - const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)'); - [].concat(opts.array || []).filter(Boolean).forEach(function (opt) { - const key = typeof opt === 'object' ? opt.key : opt; - // assign to flags[bools|strings|numbers] - const assignment = Object.keys(opt).map(function (key) { - const arrayFlagKeys = { - boolean: 'bools', - string: 'strings', - number: 'numbers' - }; - return arrayFlagKeys[key]; - }).filter(Boolean).pop(); - // assign key to be coerced - if (assignment) { - flags[assignment][key] = true; - } - flags.arrays[key] = true; - flags.keys.push(key); - }); - [].concat(opts.boolean || []).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - flags.keys.push(key); - }); - [].concat(opts.string || []).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - flags.keys.push(key); - }); - [].concat(opts.number || []).filter(Boolean).forEach(function (key) { - flags.numbers[key] = true; - flags.keys.push(key); - }); - [].concat(opts.count || []).filter(Boolean).forEach(function (key) { - flags.counts[key] = true; - flags.keys.push(key); - }); - [].concat(opts.normalize || []).filter(Boolean).forEach(function (key) { - flags.normalize[key] = true; - flags.keys.push(key); - }); - if (typeof opts.narg === 'object') { - Object.entries(opts.narg).forEach(([key, value]) => { - if (typeof value === 'number') { - flags.nargs[key] = value; - flags.keys.push(key); - } - }); - } - if (typeof opts.coerce === 'object') { - Object.entries(opts.coerce).forEach(([key, value]) => { - if (typeof value === 'function') { - flags.coercions[key] = value; - flags.keys.push(key); - } - }); - } - if (typeof opts.config !== 'undefined') { - if (Array.isArray(opts.config) || typeof opts.config === 'string') { - ; - [].concat(opts.config).filter(Boolean).forEach(function (key) { - flags.configs[key] = true; - }); - } - else if (typeof opts.config === 'object') { - Object.entries(opts.config).forEach(([key, value]) => { - if (typeof value === 'boolean' || typeof value === 'function') { - flags.configs[key] = value; - } - }); - } - } - // create a lookup table that takes into account all - // combinations of aliases: {f: ['foo'], foo: ['f']} - extendAliases(opts.key, aliases, opts.default, flags.arrays); - // apply default values to all aliases. - Object.keys(defaults).forEach(function (key) { - (flags.aliases[key] || []).forEach(function (alias) { - defaults[alias] = defaults[key]; - }); - }); - let error = null; - checkConfiguration(); - let notFlags = []; - const argv = Object.assign(Object.create(null), { _: [] }); - // TODO(bcoe): for the first pass at removing object prototype we didn't - // remove all prototypes from objects returned by this API, we might want - // to gradually move towards doing so. - const argvReturn = {}; - for (let i = 0; i < args.length; i++) { - const arg = args[i]; - const truncatedArg = arg.replace(/^-{3,}/, '---'); - let broken; - let key; - let letters; - let m; - let next; - let value; - // any unknown option (except for end-of-options, "--") - if (arg !== '--' && /^-/.test(arg) && isUnknownOptionAsArg(arg)) { - pushPositional(arg); - // ---, ---=, ----, etc, - } - else if (truncatedArg.match(/^---+(=|$)/)) { - // options without key name are invalid. - pushPositional(arg); - continue; - // -- separated by = - } - else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - m = arg.match(/^--?([^=]+)=([\s\S]*)$/); - // arrays format = '--f=a b c' - if (m !== null && Array.isArray(m) && m.length >= 3) { - if (checkAllAliases(m[1], flags.arrays)) { - i = eatArray(i, m[1], args, m[2]); - } - else if (checkAllAliases(m[1], flags.nargs) !== false) { - // nargs format = '--f=monkey washing cat' - i = eatNargs(i, m[1], args, m[2]); - } - else { - setArg(m[1], m[2], true); - } - } - } - else if (arg.match(negatedBoolean) && configuration['boolean-negation']) { - m = arg.match(negatedBoolean); - if (m !== null && Array.isArray(m) && m.length >= 2) { - key = m[1]; - setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false); - } - // -- separated by space. - } - else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) { - m = arg.match(/^--?(.+)/); - if (m !== null && Array.isArray(m) && m.length >= 2) { - key = m[1]; - if (checkAllAliases(key, flags.arrays)) { - // array format = '--foo a b c' - i = eatArray(i, key, args); - } - else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '--foo a b c' - // should be truthy even if: flags.nargs[key] === 0 - i = eatNargs(i, key, args); - } - else { - next = args[i + 1]; - if (next !== undefined && (!next.match(/^-/) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next); - i++; - } - else { - setArg(key, defaultValue(key)); - } - } - } - // dot-notation flag separated by '='. - } - else if (arg.match(/^-.\..+=/)) { - m = arg.match(/^-([^=]+)=([\s\S]*)$/); - if (m !== null && Array.isArray(m) && m.length >= 3) { - setArg(m[1], m[2]); - } - // dot-notation flag separated by space. - } - else if (arg.match(/^-.\..+/) && !arg.match(negative)) { - next = args[i + 1]; - m = arg.match(/^-(.\..+)/); - if (m !== null && Array.isArray(m) && m.length >= 2) { - key = m[1]; - if (next !== undefined && !next.match(/^-/) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next); - i++; - } - else { - setArg(key, defaultValue(key)); - } - } - } - else if (arg.match(/^-[^-]+/) && !arg.match(negative)) { - letters = arg.slice(1, -1).split(''); - broken = false; - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2); - if (letters[j + 1] && letters[j + 1] === '=') { - value = arg.slice(j + 3); - key = letters[j]; - if (checkAllAliases(key, flags.arrays)) { - // array format = '-f=a b c' - i = eatArray(i, key, args, value); - } - else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '-f=monkey washing cat' - i = eatNargs(i, key, args, value); - } - else { - setArg(key, value); - } - broken = true; - break; - } - if (next === '-') { - setArg(letters[j], next); - continue; - } - // current letter is an alphabetic character and next value is a number - if (/[A-Za-z]/.test(letters[j]) && - /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) && - checkAllAliases(next, flags.bools) === false) { - setArg(letters[j], next); - broken = true; - break; - } - if (letters[j + 1] && letters[j + 1].match(/\W/)) { - setArg(letters[j], next); - broken = true; - break; - } - else { - setArg(letters[j], defaultValue(letters[j])); - } - } - key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (checkAllAliases(key, flags.arrays)) { - // array format = '-f a b c' - i = eatArray(i, key, args); - } - else if (checkAllAliases(key, flags.nargs) !== false) { - // nargs format = '-f a b c' - // should be truthy even if: flags.nargs[key] === 0 - i = eatNargs(i, key, args); - } - else { - next = args[i + 1]; - if (next !== undefined && (!/^(-|--)[^-]/.test(next) || - next.match(negative)) && - !checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts)) { - setArg(key, next); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next); - i++; - } - else { - setArg(key, defaultValue(key)); - } - } - } - } - else if (arg.match(/^-[0-9]$/) && - arg.match(negative) && - checkAllAliases(arg.slice(1), flags.bools)) { - // single-digit boolean alias, e.g: xargs -0 - key = arg.slice(1); - setArg(key, defaultValue(key)); - } - else if (arg === '--') { - notFlags = args.slice(i + 1); - break; - } - else if (configuration['halt-at-non-option']) { - notFlags = args.slice(i); - break; - } - else { - pushPositional(arg); - } - } - // order of precedence: - // 1. command line arg - // 2. value from env var - // 3. value from config file - // 4. value from config objects - // 5. configured default value - applyEnvVars(argv, true); // special case: check env vars that point to config file - applyEnvVars(argv, false); - setConfig(argv); - setConfigObjects(); - applyDefaultsAndAliases(argv, flags.aliases, defaults, true); - applyCoercions(argv); - if (configuration['set-placeholder-key']) - setPlaceholderKeys(argv); - // for any counts either not in args or without an explicit default, set to 0 - Object.keys(flags.counts).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) - setArg(key, 0); - }); - // '--' defaults to undefined. - if (notFlagsOption && notFlags.length) - argv[notFlagsArgv] = []; - notFlags.forEach(function (key) { - argv[notFlagsArgv].push(key); - }); - if (configuration['camel-case-expansion'] && configuration['strip-dashed']) { - Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => { - delete argv[key]; - }); - } - if (configuration['strip-aliased']) { - ; - [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => { - if (configuration['camel-case-expansion'] && alias.includes('-')) { - delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')]; - } - delete argv[alias]; - }); - } - // Push argument into positional array, applying numeric coercion: - function pushPositional(arg) { - const maybeCoercedNumber = maybeCoerceNumber('_', arg); - if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') { - argv._.push(maybeCoercedNumber); - } - } - // how many arguments should we consume, based - // on the nargs option? - function eatNargs(i, key, args, argAfterEqualSign) { - let ii; - let toEat = checkAllAliases(key, flags.nargs); - // NaN has a special meaning for the array type, indicating that one or - // more values are expected. - toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat; - if (toEat === 0) { - if (!isUndefined(argAfterEqualSign)) { - error = Error(__('Argument unexpected for: %s', key)); - } - setArg(key, defaultValue(key)); - return i; - } - let available = isUndefined(argAfterEqualSign) ? 0 : 1; - if (configuration['nargs-eats-options']) { - // classic behavior, yargs eats positional and dash arguments. - if (args.length - (i + 1) + available < toEat) { - error = Error(__('Not enough arguments following: %s', key)); - } - available = toEat; - } - else { - // nargs will not consume flag arguments, e.g., -abc, --foo, - // and terminates when one is observed. - for (ii = i + 1; ii < args.length; ii++) { - if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii])) - available++; - else - break; - } - if (available < toEat) - error = Error(__('Not enough arguments following: %s', key)); - } - let consumed = Math.min(available, toEat); - if (!isUndefined(argAfterEqualSign) && consumed > 0) { - setArg(key, argAfterEqualSign); - consumed--; - } - for (ii = i + 1; ii < (consumed + i + 1); ii++) { - setArg(key, args[ii]); - } - return (i + consumed); - } - // if an option is an array, eat all non-hyphenated arguments - // following it... YUM! - // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"] - function eatArray(i, key, args, argAfterEqualSign) { - let argsToSet = []; - let next = argAfterEqualSign || args[i + 1]; - // If both array and nargs are configured, enforce the nargs count: - const nargsCount = checkAllAliases(key, flags.nargs); - if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) { - argsToSet.push(true); - } - else if (isUndefined(next) || - (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) { - // for keys without value ==> argsToSet remains an empty [] - // set user default value, if available - if (defaults[key] !== undefined) { - const defVal = defaults[key]; - argsToSet = Array.isArray(defVal) ? defVal : [defVal]; - } - } - else { - // value in --option=value is eaten as is - if (!isUndefined(argAfterEqualSign)) { - argsToSet.push(processValue(key, argAfterEqualSign, true)); - } - for (let ii = i + 1; ii < args.length; ii++) { - if ((!configuration['greedy-arrays'] && argsToSet.length > 0) || - (nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount)) - break; - next = args[ii]; - if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) - break; - i = ii; - argsToSet.push(processValue(key, next, inputIsString)); - } - } - // If both array and nargs are configured, create an error if less than - // nargs positionals were found. NaN has special meaning, indicating - // that at least one value is required (more are okay). - if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) || - (isNaN(nargsCount) && argsToSet.length === 0))) { - error = Error(__('Not enough arguments following: %s', key)); - } - setArg(key, argsToSet); - return i; - } - function setArg(key, val, shouldStripQuotes = inputIsString) { - if (/-/.test(key) && configuration['camel-case-expansion']) { - const alias = key.split('.').map(function (prop) { - return camelCase(prop); - }).join('.'); - addNewAlias(key, alias); - } - const value = processValue(key, val, shouldStripQuotes); - const splitKey = key.split('.'); - setKey(argv, splitKey, value); - // handle populating aliases of the full key - if (flags.aliases[key]) { - flags.aliases[key].forEach(function (x) { - const keyProperties = x.split('.'); - setKey(argv, keyProperties, value); - }); - } - // handle populating aliases of the first element of the dot-notation key - if (splitKey.length > 1 && configuration['dot-notation']) { - ; - (flags.aliases[splitKey[0]] || []).forEach(function (x) { - let keyProperties = x.split('.'); - // expand alias with nested objects in key - const a = [].concat(splitKey); - a.shift(); // nuke the old key. - keyProperties = keyProperties.concat(a); - // populate alias only if is not already an alias of the full key - // (already populated above) - if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) { - setKey(argv, keyProperties, value); - } - }); - } - // Set normalize getter and setter when key is in 'normalize' but isn't an array - if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) { - const keys = [key].concat(flags.aliases[key] || []); - keys.forEach(function (key) { - Object.defineProperty(argvReturn, key, { - enumerable: true, - get() { - return val; - }, - set(value) { - val = typeof value === 'string' ? mixin.normalize(value) : value; - } - }); - }); - } - } - function addNewAlias(key, alias) { - if (!(flags.aliases[key] && flags.aliases[key].length)) { - flags.aliases[key] = [alias]; - newAliases[alias] = true; - } - if (!(flags.aliases[alias] && flags.aliases[alias].length)) { - addNewAlias(alias, key); - } - } - function processValue(key, val, shouldStripQuotes) { - // strings may be quoted, clean this up as we assign values. - if (shouldStripQuotes) { - val = stripQuotes(val); - } - // handle parsing boolean arguments --foo=true --bar false. - if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) { - if (typeof val === 'string') - val = val === 'true'; - } - let value = Array.isArray(val) - ? val.map(function (v) { return maybeCoerceNumber(key, v); }) - : maybeCoerceNumber(key, val); - // increment a count given as arg (either no value or value parsed as boolean) - if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) { - value = increment(); - } - // Set normalized value when key is in 'normalize' and in 'arrays' - if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) { - if (Array.isArray(val)) - value = val.map((val) => { return mixin.normalize(val); }); - else - value = mixin.normalize(val); - } - return value; - } - function maybeCoerceNumber(key, value) { - if (!configuration['parse-positional-numbers'] && key === '_') - return value; - if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) { - const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`)))); - if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) { - value = Number(value); - } - } - return value; - } - // set args from config.json file, this should be - // applied last so that defaults can be applied. - function setConfig(argv) { - const configLookup = Object.create(null); - // expand defaults/aliases, in-case any happen to reference - // the config.json file. - applyDefaultsAndAliases(configLookup, flags.aliases, defaults); - Object.keys(flags.configs).forEach(function (configKey) { - const configPath = argv[configKey] || configLookup[configKey]; - if (configPath) { - try { - let config = null; - const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath); - const resolveConfig = flags.configs[configKey]; - if (typeof resolveConfig === 'function') { - try { - config = resolveConfig(resolvedConfigPath); - } - catch (e) { - config = e; - } - if (config instanceof Error) { - error = config; - return; - } - } - else { - config = mixin.require(resolvedConfigPath); - } - setConfigObject(config); - } - catch (ex) { - // Deno will receive a PermissionDenied error if an attempt is - // made to load config without the --allow-read flag: - if (ex.name === 'PermissionDenied') - error = ex; - else if (argv[configKey]) - error = Error(__('Invalid JSON config file: %s', configPath)); - } - } - }); - } - // set args from config object. - // it recursively checks nested objects. - function setConfigObject(config, prev) { - Object.keys(config).forEach(function (key) { - const value = config[key]; - const fullKey = prev ? prev + '.' + key : key; - // if the value is an inner object and we have dot-notation - // enabled, treat inner objects in config the same as - // heavily nested dot notations (foo.bar.apple). - if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) { - // if the value is an object but not an array, check nested object - setConfigObject(value, fullKey); - } - else { - // setting arguments via CLI takes precedence over - // values within the config file. - if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) { - setArg(fullKey, value); - } - } - }); - } - // set all config objects passed in opts - function setConfigObjects() { - if (typeof configObjects !== 'undefined') { - configObjects.forEach(function (configObject) { - setConfigObject(configObject); - }); - } - } - function applyEnvVars(argv, configOnly) { - if (typeof envPrefix === 'undefined') - return; - const prefix = typeof envPrefix === 'string' ? envPrefix : ''; - const env = mixin.env(); - Object.keys(env).forEach(function (envVar) { - if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) { - // get array of nested keys and convert them to camel case - const keys = envVar.split('__').map(function (key, i) { - if (i === 0) { - key = key.substring(prefix.length); - } - return camelCase(key); - }); - if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) { - setArg(keys.join('.'), env[envVar]); - } - } - }); - } - function applyCoercions(argv) { - let coerce; - const applied = new Set(); - Object.keys(argv).forEach(function (key) { - if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases - coerce = checkAllAliases(key, flags.coercions); - if (typeof coerce === 'function') { - try { - const value = maybeCoerceNumber(key, coerce(argv[key])); - ([].concat(flags.aliases[key] || [], key)).forEach(ali => { - applied.add(ali); - argv[ali] = value; - }); - } - catch (err) { - error = err; - } - } - } - }); - } - function setPlaceholderKeys(argv) { - flags.keys.forEach((key) => { - // don't set placeholder keys for dot notation options 'foo.bar'. - if (~key.indexOf('.')) - return; - if (typeof argv[key] === 'undefined') - argv[key] = undefined; - }); - return argv; - } - function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) { - Object.keys(defaults).forEach(function (key) { - if (!hasKey(obj, key.split('.'))) { - setKey(obj, key.split('.'), defaults[key]); - if (canLog) - defaulted[key] = true; - (aliases[key] || []).forEach(function (x) { - if (hasKey(obj, x.split('.'))) - return; - setKey(obj, x.split('.'), defaults[key]); - }); - } - }); - } - function hasKey(obj, keys) { - let o = obj; - if (!configuration['dot-notation']) - keys = [keys.join('.')]; - keys.slice(0, -1).forEach(function (key) { - o = (o[key] || {}); - }); - const key = keys[keys.length - 1]; - if (typeof o !== 'object') - return false; - else - return key in o; - } - function setKey(obj, keys, value) { - let o = obj; - if (!configuration['dot-notation']) - keys = [keys.join('.')]; - keys.slice(0, -1).forEach(function (key) { - // TODO(bcoe): in the next major version of yargs, switch to - // Object.create(null) for dot notation: - key = sanitizeKey(key); - if (typeof o === 'object' && o[key] === undefined) { - o[key] = {}; - } - if (typeof o[key] !== 'object' || Array.isArray(o[key])) { - // ensure that o[key] is an array, and that the last item is an empty object. - if (Array.isArray(o[key])) { - o[key].push({}); - } - else { - o[key] = [o[key], {}]; - } - // we want to update the empty object at the end of the o[key] array, so set o to that object - o = o[key][o[key].length - 1]; - } - else { - o = o[key]; - } - }); - // TODO(bcoe): in the next major version of yargs, switch to - // Object.create(null) for dot notation: - const key = sanitizeKey(keys[keys.length - 1]); - const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays); - const isValueArray = Array.isArray(value); - let duplicate = configuration['duplicate-arguments-array']; - // nargs has higher priority than duplicate - if (!duplicate && checkAllAliases(key, flags.nargs)) { - duplicate = true; - if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) { - o[key] = undefined; - } - } - if (value === increment()) { - o[key] = increment(o[key]); - } - else if (Array.isArray(o[key])) { - if (duplicate && isTypeArray && isValueArray) { - o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]); - } - else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) { - o[key] = value; - } - else { - o[key] = o[key].concat([value]); - } - } - else if (o[key] === undefined && isTypeArray) { - o[key] = isValueArray ? value : [value]; - } - else if (duplicate && !(o[key] === undefined || - checkAllAliases(key, flags.counts) || - checkAllAliases(key, flags.bools))) { - o[key] = [o[key], value]; - } - else { - o[key] = value; - } - } - // extend the aliases list with inferred aliases. - function extendAliases(...args) { - args.forEach(function (obj) { - Object.keys(obj || {}).forEach(function (key) { - // short-circuit if we've already added a key - // to the aliases array, for example it might - // exist in both 'opts.default' and 'opts.key'. - if (flags.aliases[key]) - return; - flags.aliases[key] = [].concat(aliases[key] || []); - // For "--option-name", also set argv.optionName - flags.aliases[key].concat(key).forEach(function (x) { - if (/-/.test(x) && configuration['camel-case-expansion']) { - const c = camelCase(x); - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c); - newAliases[c] = true; - } - } - }); - // For "--optionName", also set argv['option-name'] - flags.aliases[key].concat(key).forEach(function (x) { - if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) { - const c = decamelize(x, '-'); - if (c !== key && flags.aliases[key].indexOf(c) === -1) { - flags.aliases[key].push(c); - newAliases[c] = true; - } - } - }); - flags.aliases[key].forEach(function (x) { - flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); - }); - } - function checkAllAliases(key, flag) { - const toCheck = [].concat(flags.aliases[key] || [], key); - const keys = Object.keys(flag); - const setAlias = toCheck.find(key => keys.includes(key)); - return setAlias ? flag[setAlias] : false; - } - function hasAnyFlag(key) { - const flagsKeys = Object.keys(flags); - const toCheck = [].concat(flagsKeys.map(k => flags[k])); - return toCheck.some(function (flag) { - return Array.isArray(flag) ? flag.includes(key) : flag[key]; - }); - } - function hasFlagsMatching(arg, ...patterns) { - const toCheck = [].concat(...patterns); - return toCheck.some(function (pattern) { - const match = arg.match(pattern); - return match && hasAnyFlag(match[1]); - }); - } - // based on a simplified version of the short flag group parsing logic - function hasAllShortFlags(arg) { - // if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group - if (arg.match(negative) || !arg.match(/^-[^-]+/)) { - return false; - } - let hasAllFlags = true; - let next; - const letters = arg.slice(1).split(''); - for (let j = 0; j < letters.length; j++) { - next = arg.slice(j + 2); - if (!hasAnyFlag(letters[j])) { - hasAllFlags = false; - break; - } - if ((letters[j + 1] && letters[j + 1] === '=') || - next === '-' || - (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) || - (letters[j + 1] && letters[j + 1].match(/\W/))) { - break; - } - } - return hasAllFlags; - } - function isUnknownOptionAsArg(arg) { - return configuration['unknown-options-as-args'] && isUnknownOption(arg); - } - function isUnknownOption(arg) { - arg = arg.replace(/^-{3,}/, '--'); - // ignore negative numbers - if (arg.match(negative)) { - return false; - } - // if this is a short option group and all of them are configured, it isn't unknown - if (hasAllShortFlags(arg)) { - return false; - } - // e.g. '--count=2' - const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/; - // e.g. '-a' or '--arg' - const normalFlag = /^-+([^=]+?)$/; - // e.g. '-a-' - const flagEndingInHyphen = /^-+([^=]+?)-$/; - // e.g. '-abc123' - const flagEndingInDigits = /^-+([^=]+?\d+)$/; - // e.g. '-a/usr/local' - const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/; - // check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method - return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters); - } - // make a best effort to pick a default value - // for an option based on name and type. - function defaultValue(key) { - if (!checkAllAliases(key, flags.bools) && - !checkAllAliases(key, flags.counts) && - `${key}` in defaults) { - return defaults[key]; - } - else { - return defaultForType(guessType(key)); - } - } - // return a default value, given the type of a flag., - function defaultForType(type) { - const def = { - [DefaultValuesForTypeKey.BOOLEAN]: true, - [DefaultValuesForTypeKey.STRING]: '', - [DefaultValuesForTypeKey.NUMBER]: undefined, - [DefaultValuesForTypeKey.ARRAY]: [] - }; - return def[type]; - } - // given a flag, enforce a default type. - function guessType(key) { - let type = DefaultValuesForTypeKey.BOOLEAN; - if (checkAllAliases(key, flags.strings)) - type = DefaultValuesForTypeKey.STRING; - else if (checkAllAliases(key, flags.numbers)) - type = DefaultValuesForTypeKey.NUMBER; - else if (checkAllAliases(key, flags.bools)) - type = DefaultValuesForTypeKey.BOOLEAN; - else if (checkAllAliases(key, flags.arrays)) - type = DefaultValuesForTypeKey.ARRAY; - return type; - } - function isUndefined(num) { - return num === undefined; - } - // check user configuration settings for inconsistencies - function checkConfiguration() { - // count keys should not be set as array/narg - Object.keys(flags.counts).find(key => { - if (checkAllAliases(key, flags.arrays)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key)); - return true; - } - else if (checkAllAliases(key, flags.nargs)) { - error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key)); - return true; - } - return false; - }); - } - return { - aliases: Object.assign({}, flags.aliases), - argv: Object.assign(argvReturn, argv), - configuration: configuration, - defaulted: Object.assign({}, defaulted), - error: error, - newAliases: Object.assign({}, newAliases) - }; - } -} -// if any aliases reference each other, we should -// merge them together. -function combineAliases(aliases) { - const aliasArrays = []; - const combined = Object.create(null); - let change = true; - // turn alias lookup hash {key: ['alias1', 'alias2']} into - // a simple array ['key', 'alias1', 'alias2'] - Object.keys(aliases).forEach(function (key) { - aliasArrays.push([].concat(aliases[key], key)); - }); - // combine arrays until zero changes are - // made in an iteration. - while (change) { - change = false; - for (let i = 0; i < aliasArrays.length; i++) { - for (let ii = i + 1; ii < aliasArrays.length; ii++) { - const intersect = aliasArrays[i].filter(function (v) { - return aliasArrays[ii].indexOf(v) !== -1; - }); - if (intersect.length) { - aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]); - aliasArrays.splice(ii, 1); - change = true; - break; - } - } - } - } - // map arrays back to the hash-lookup (de-dupe while - // we're at it). - aliasArrays.forEach(function (aliasArray) { - aliasArray = aliasArray.filter(function (v, i, self) { - return self.indexOf(v) === i; - }); - const lastAlias = aliasArray.pop(); - if (lastAlias !== undefined && typeof lastAlias === 'string') { - combined[lastAlias] = aliasArray; - } - }); - return combined; -} -// this function should only be called when a count is given as an arg -// it is NOT called to set a default value -// thus we can start the count at 1 instead of 0 -function increment(orig) { - return orig !== undefined ? orig + 1 : 1; -} -// TODO(bcoe): in the next major version of yargs, switch to -// Object.create(null) for dot notation: -function sanitizeKey(key) { - if (key === '__proto__') - return '___proto___'; - return key; -} -function stripQuotes(val) { - return (typeof val === 'string' && - (val[0] === "'" || val[0] === '"') && - val[val.length - 1] === val[0]) - ? val.substring(1, val.length - 1) - : val; -} diff --git a/node_modules/yargs-parser/package.json b/node_modules/yargs-parser/package.json deleted file mode 100644 index decd0c3..0000000 --- a/node_modules/yargs-parser/package.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "yargs-parser", - "version": "21.1.1", - "description": "the mighty option parser used by yargs", - "main": "build/index.cjs", - "exports": { - ".": [ - { - "import": "./build/lib/index.js", - "require": "./build/index.cjs" - }, - "./build/index.cjs" - ], - "./browser": [ - "./browser.js" - ] - }, - "type": "module", - "module": "./build/lib/index.js", - "scripts": { - "check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'", - "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'", - "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs", - "test": "c8 --reporter=text --reporter=html mocha test/*.cjs", - "test:esm": "c8 --reporter=text --reporter=html mocha test/*.mjs", - "test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'", - "pretest:typescript": "npm run pretest", - "test:typescript": "c8 mocha ./build/test/typescript/*.js", - "coverage": "c8 report --check-coverage", - "precompile": "rimraf build", - "compile": "tsc", - "postcompile": "npm run build:cjs", - "build:cjs": "rollup -c", - "prepare": "npm run compile" - }, - "repository": { - "type": "git", - "url": "https://github.com/yargs/yargs-parser.git" - }, - "keywords": [ - "argument", - "parser", - "yargs", - "command", - "cli", - "parsing", - "option", - "args", - "argument" - ], - "author": "Ben Coe ", - "license": "ISC", - "devDependencies": { - "@types/chai": "^4.2.11", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.4", - "@typescript-eslint/eslint-plugin": "^3.10.1", - "@typescript-eslint/parser": "^3.10.1", - "c8": "^7.3.0", - "chai": "^4.2.0", - "cross-env": "^7.0.2", - "eslint": "^7.0.0", - "eslint-plugin-import": "^2.20.1", - "eslint-plugin-node": "^11.0.0", - "gts": "^3.0.0", - "mocha": "^10.0.0", - "puppeteer": "^16.0.0", - "rimraf": "^3.0.2", - "rollup": "^2.22.1", - "rollup-plugin-cleanup": "^3.1.1", - "rollup-plugin-ts": "^3.0.2", - "serve": "^14.0.0", - "standardx": "^7.0.0", - "start-server-and-test": "^1.11.2", - "ts-transform-default-export": "^1.0.2", - "typescript": "^4.0.0" - }, - "files": [ - "browser.js", - "build", - "!*.d.ts", - "!*.d.cts" - ], - "engines": { - "node": ">=12" - }, - "standardx": { - "ignore": [ - "build" - ] - } -} diff --git a/node_modules/yargs/LICENSE b/node_modules/yargs/LICENSE deleted file mode 100644 index b0145ca..0000000 --- a/node_modules/yargs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.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/yargs/README.md b/node_modules/yargs/README.md deleted file mode 100644 index 51f5b22..0000000 --- a/node_modules/yargs/README.md +++ /dev/null @@ -1,204 +0,0 @@ -

- -

-

Yargs

-

- Yargs be a node.js library fer hearties tryin' ter parse optstrings -

- -
- -![ci](https://github.com/yargs/yargs/workflows/ci/badge.svg) -[![NPM version][npm-image]][npm-url] -[![js-standard-style][standard-image]][standard-url] -[![Coverage][coverage-image]][coverage-url] -[![Conventional Commits][conventional-commits-image]][conventional-commits-url] -[![Slack][slack-image]][slack-url] - -## Description -Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface. - -It gives you: - -* commands and (grouped) options (`my-program.js serve --port=5000`). -* a dynamically generated help menu based on your arguments: - -``` -mocha [spec..] - -Run tests with Mocha - -Commands - mocha inspect [spec..] Run tests with Mocha [default] - mocha init create a client-side Mocha setup at - -Rules & Behavior - --allow-uncaught Allow uncaught errors to propagate [boolean] - --async-only, -A Require all tests to use a callback (async) or - return a Promise [boolean] -``` - -* bash-completion shortcuts for commands and options. -* and [tons more](/docs/api.md). - -## Installation - -Stable version: -```bash -npm i yargs -``` - -Bleeding edge version with the most recent features: -```bash -npm i yargs@next -``` - -## Usage - -### Simple Example - -```javascript -#!/usr/bin/env node -const yargs = require('yargs/yargs') -const { hideBin } = require('yargs/helpers') -const argv = yargs(hideBin(process.argv)).argv - -if (argv.ships > 3 && argv.distance < 53.5) { - console.log('Plunder more riffiwobbles!') -} else { - console.log('Retreat from the xupptumblers!') -} -``` - -```bash -$ ./plunder.js --ships=4 --distance=22 -Plunder more riffiwobbles! - -$ ./plunder.js --ships 12 --distance 98.7 -Retreat from the xupptumblers! -``` - -> Note: `hideBin` is a shorthand for [`process.argv.slice(2)`](https://nodejs.org/en/knowledge/command-line/how-to-parse-command-line-arguments/). It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690). - -### Complex Example - -```javascript -#!/usr/bin/env node -const yargs = require('yargs/yargs') -const { hideBin } = require('yargs/helpers') - -yargs(hideBin(process.argv)) - .command('serve [port]', 'start the server', (yargs) => { - return yargs - .positional('port', { - describe: 'port to bind on', - default: 5000 - }) - }, (argv) => { - if (argv.verbose) console.info(`start server on :${argv.port}`) - serve(argv.port) - }) - .option('verbose', { - alias: 'v', - type: 'boolean', - description: 'Run with verbose logging' - }) - .parse() -``` - -Run the example above with `--help` to see the help for the application. - -## Supported Platforms - -### TypeScript - -yargs has type definitions at [@types/yargs][type-definitions]. - -``` -npm i @types/yargs --save-dev -``` - -See usage examples in [docs](/docs/typescript.md). - -### Deno - -As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno): - -```typescript -import yargs from 'https://deno.land/x/yargs/deno.ts' -import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts' - -yargs(Deno.args) - .command('download ', 'download a list of files', (yargs: any) => { - return yargs.positional('files', { - describe: 'a list of files to do something with' - }) - }, (argv: Arguments) => { - console.info(argv) - }) - .strictCommands() - .demandCommand(1) - .parse() -``` - -### ESM - -As of `v16`,`yargs` supports ESM imports: - -```js -import yargs from 'yargs' -import { hideBin } from 'yargs/helpers' - -yargs(hideBin(process.argv)) - .command('curl ', 'fetch the contents of the URL', () => {}, (argv) => { - console.info(argv) - }) - .demandCommand(1) - .parse() -``` - -### Usage in Browser - -See examples of using yargs in the browser in [docs](/docs/browser.md). - -## Community - -Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com). - -## Documentation - -### Table of Contents - -* [Yargs' API](/docs/api.md) -* [Examples](/docs/examples.md) -* [Parsing Tricks](/docs/tricks.md) - * [Stop the Parser](/docs/tricks.md#stop) - * [Negating Boolean Arguments](/docs/tricks.md#negate) - * [Numbers](/docs/tricks.md#numbers) - * [Arrays](/docs/tricks.md#arrays) - * [Objects](/docs/tricks.md#objects) - * [Quotes](/docs/tricks.md#quotes) -* [Advanced Topics](/docs/advanced.md) - * [Composing Your App Using Commands](/docs/advanced.md#commands) - * [Building Configurable CLI Apps](/docs/advanced.md#configuration) - * [Customizing Yargs' Parser](/docs/advanced.md#customizing) - * [Bundling yargs](/docs/bundling.md) -* [Contributing](/contributing.md) - -## Supported Node.js Versions - -Libraries in this ecosystem make a best effort to track -[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a -post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a). - -[npm-url]: https://www.npmjs.com/package/yargs -[npm-image]: https://img.shields.io/npm/v/yargs.svg -[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg -[standard-url]: http://standardjs.com/ -[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg -[conventional-commits-url]: https://conventionalcommits.org/ -[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg -[slack-url]: http://devtoolscommunity.herokuapp.com -[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs -[coverage-image]: https://img.shields.io/nycrc/yargs/yargs -[coverage-url]: https://github.com/yargs/yargs/blob/main/.nycrc diff --git a/node_modules/yargs/browser.d.ts b/node_modules/yargs/browser.d.ts deleted file mode 100644 index 21f3fc6..0000000 --- a/node_modules/yargs/browser.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import {YargsFactory} from './build/lib/yargs-factory'; - -declare const Yargs: ReturnType; - -export default Yargs; diff --git a/node_modules/yargs/browser.mjs b/node_modules/yargs/browser.mjs deleted file mode 100644 index 2d0d6e9..0000000 --- a/node_modules/yargs/browser.mjs +++ /dev/null @@ -1,7 +0,0 @@ -// Bootstrap yargs for browser: -import browserPlatformShim from './lib/platform-shims/browser.mjs'; -import {YargsFactory} from './build/lib/yargs-factory.js'; - -const Yargs = YargsFactory(browserPlatformShim); - -export default Yargs; diff --git a/node_modules/yargs/build/index.cjs b/node_modules/yargs/build/index.cjs deleted file mode 100644 index e9cf013..0000000 --- a/node_modules/yargs/build/index.cjs +++ /dev/null @@ -1 +0,0 @@ -"use strict";var t=require("assert");class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let s,i=[];function n(t,o,a,h){s=h;let l={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return l;const r=/\.json|\..*rc$/.test(t.extends);let h=null;if(r)h=function(t,e){return s.path.resolve(t,e)}(o,t.extends);else try{h=require.resolve(t.extends)}catch(e){return t}!function(t){if(i.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(h),i.push(h),l=r?JSON.parse(s.readFileSync(h,"utf8")):require(t.extends),delete t.extends,l=n(l,s.path.dirname(h),a,s)}return i=[],a?r(l,t):Object.assign({},l,t)}function r(t,e){const s={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(s,t);for(const n of Object.keys(e))i(e[n])&&i(s[n])?s[n]=r(t[n],e[n]):s[n]=e[n];return s}function o(t){const e=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),s=/\.*[\][<>]/g,i=e.shift();if(!i)throw new Error(`No command found in: ${t}`);const n={cmd:i.replace(s,""),demanded:[],optional:[]};return e.forEach(((t,i)=>{let r=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&i===e.length-1&&(r=!0),/^\[/.test(t)?n.optional.push({cmd:t.replace(s,"").split("|"),variadic:r}):n.demanded.push({cmd:t.replace(s,"").split("|"),variadic:r})})),n}const a=["first","second","third","fourth","fifth","sixth"];function h(t,s,i){try{let n=0;const[r,a,h]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,i],f=[].slice.call(a);for(;f.length&&void 0===f[f.length-1];)f.pop();const d=h||f.length;if(du)throw new e(`Too many arguments provided. Expected max ${u} but received ${d}.`);r.demanded.forEach((t=>{const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1})),r.optional.forEach((t=>{if(0===f.length)return;const e=l(f.shift());0===t.cmd.filter((t=>t===e||"*"===t)).length&&c(e,t.cmd,n),n+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,i){throw new e(`Invalid ${a[i]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,e,s,i){s.assert.notStrictEqual(t,e,i)}function u(t,e){e.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},e=(()=>!0)){const s={};return p(t).forEach((i=>{e(i,t[i])&&(s[i]=t[i])})),s}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var b=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function O(t,e,s,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(t,s):n?n.value=s:e.set(t,s),s}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,s=!0,i=!1){if(h(" [boolean] [boolean] [boolean]",[t,e,s],arguments.length),Array.isArray(t)){for(let i=0;i{const i=[...s[e]||[],e];return!t.option||!i.includes(t.option)})),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,e,s,i){return s.reduce(((t,s)=>{if(s.applyBeforeValidation!==i)return t;if(s.mutates){if(s.applied)return t;s.applied=!0}if(f(t))return t.then((t=>Promise.all([t,s(t,e)]))).then((([t,e])=>Object.assign(t,e)));{const i=s(t,e);return f(i)?i.then((e=>Object.assign(t,e))):Object.assign(t,i)}}),t)}function j(t,e,s=(t=>{throw t})){try{const s="function"==typeof t?t():t;return f(s)?s.then((t=>e(t))):e(s)}catch(t){return s(t)}}const M=/(^\*)|(^\$0)/;class _{constructor(t,e,s,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=t,this.globalMiddleware=s,this.validation=e}addDirectory(t,e,s,i){"boolean"!=typeof(i=i||{}).recurse&&(i.recurse=!1),Array.isArray(i.extensions)||(i.extensions=["js"]);const n="function"==typeof i.visit?i.visit:t=>t;i.visit=(t,e,s)=>{const i=n(t,e,s);if(i){if(this.requireCache.has(e))return i;this.requireCache.add(e),this.addHandler(i)}return i},this.shim.requireDirectory({require:e,filename:s},t,i)}addHandler(t,e,s,i,n,r){let a=[];const h=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(n);if(i=i||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...a]=t;else for(const e of t)this.addHandler(e);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let e=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(e=[].concat(e).concat(t.aliases)),void this.addHandler(e,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(s))return void this.addHandler([t].concat(a),e,s.builder,s.handler,s.middlewares,s.deprecated)}if("string"==typeof t){const n=o(t);a=a.map((t=>o(t).cmd));let l=!1;const c=[n.cmd].concat(a).filter((t=>!M.test(t)||(l=!0,!1)));0===c.length&&l&&c.push("$0"),l&&(n.cmd=c[0],a=c.slice(1),t=t.replace(M,n.cmd)),a.forEach((t=>{this.aliasMap[t]=n.cmd})),!1!==e&&this.usage.command(t,e,l,a,r),this.handlers[n.cmd]={original:t,description:e,handler:i,builder:s||{},middlewares:h,deprecated:r,demanded:n.demanded,optional:n.optional},l&&(this.defaultCommand=this.handlers[n.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,s,i,n,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,a=e.getInternalMethods().getContext(),h=a.commands.slice(),l=!t;t&&(a.commands.push(t),a.fullCommands.push(o.original));const c=this.applyBuilderUpdateUsageAndParse(l,o,e,s.aliases,h,i,n,r);return f(c)?c.then((t=>this.applyMiddlewareAndGetResult(l,o,t.innerArgv,a,n,t.aliases,e))):this.applyMiddlewareAndGetResult(l,o,c.innerArgv,a,n,c.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,s,i,n,r,o,a){const h=e.builder;let l=s;if(x(h)){s.getInternalMethods().getUsageInstance().freeze();const c=h(s.getInternalMethods().reset(i),a);if(f(c))return c.then((i=>{var a;return l=(a=i)&&"function"==typeof a.getInternalMethods?i:s,this.parseAndUpdateUsage(t,e,l,n,r,o)}))}else(function(t){return"object"==typeof t})(h)&&(s.getInternalMethods().getUsageInstance().freeze(),l=s.getInternalMethods().reset(i),Object.keys(e.builder).forEach((t=>{l.option(t,h[t])})));return this.parseAndUpdateUsage(t,e,l,n,r,o)}parseAndUpdateUsage(t,e,s,i,n,r){t&&s.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(s)&&s.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,e),e.description);const o=s.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,n,r);return f(o)?o.then((t=>({aliases:s.parsed.aliases,innerArgv:t}))):{aliases:s.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,e){const s=M.test(e.original)?e.original.replace(M,"").trim():e.original,i=t.filter((t=>!M.test(t)));return i.push(s),`$0 ${i.join(" ")}`}handleValidationAndGetResult(t,e,s,i,n,r,o,a){if(!r.getInternalMethods().getHasOutput()){const e=r.getInternalMethods().runValidation(n,a,r.parsed.error,t);s=j(s,(t=>(e(t),t)))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const i=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(s,i,!1,!1),s=j(s=C(s,r,o,!1),(t=>{const s=e.handler(t);return f(s)?s.then((()=>t)):t})),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(s)&&!r.getInternalMethods().hasParseCallback()&&s.catch((t=>{try{r.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(i.commands.pop(),i.fullCommands.pop()),s}applyMiddlewareAndGetResult(t,e,s,i,n,r,o){let a={};if(n)return s;o.getInternalMethods().getHasOutput()||(a=this.populatePositionals(e,s,i,o));const h=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),l=C(s,o,h,!0);return f(l)?l.then((s=>this.handleValidationAndGetResult(t,e,s,i,r,o,h,a))):this.handleValidationAndGetResult(t,e,l,i,r,o,h,a)}populatePositionals(t,e,s,i){e._=e._.slice(s.commands.length);const n=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(n.length,e._.length);n.length;){const t=n.shift();this.populatePositional(t,e,o)}for(;r.length;){const t=r.shift();this.populatePositional(t,e,o)}return e._=s.commands.concat(e._.map((t=>""+t))),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),i),o}populatePositional(t,e,s){const i=t.cmd[0];t.variadic?s[i]=e._.splice(0).map(String):e._.length&&(s[i]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},s=o(t);return s.demanded.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i,e.demand[s]=!0})),s.optional.forEach((t=>{const[s,...i]=t.cmd;t.variadic&&(e.array.push(s),e.default[s]=[]),e.alias[s]=i})),e}postProcessPositionals(t,e,s,i){const n=Object.assign({},i.getOptions());n.default=Object.assign(s.default,n.default);for(const t of Object.keys(s.alias))n.alias[t]=(n.alias[t]||[]).concat(s.alias[t]);n.array=n.array.concat(s.array),n.config={};const r=[];if(Object.keys(e).forEach((t=>{e[t].map((e=>{n.configuration["unknown-options-as-args"]&&(n.key[t]=!0),r.push(`--${t}`),r.push(e)}))})),!r.length)return;const o=Object.assign({},n.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(r,Object.assign({},n,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{const s=Object.keys(e);Object.keys(e).forEach((t=>{s.push(...a.aliases[t])})),Object.keys(a.argv).forEach((n=>{s.includes(n)&&(e[n]||(e[n]=a.argv[n]),!this.isInConfigs(i,n)&&!this.isDefaulted(i,n)&&Object.prototype.hasOwnProperty.call(t,n)&&Object.prototype.hasOwnProperty.call(a.argv,n)&&(Array.isArray(t[n])||Array.isArray(a.argv[n]))?t[n]=[].concat(t[n],a.argv[n]):t[n]=a.argv[n])}))}}isDefaulted(t,e){const{default:s}=t.getOptions();return Object.prototype.hasOwnProperty.call(s,e)||Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:s}=t.getOptions();return s.some((t=>Object.prototype.hasOwnProperty.call(t,e)))||s.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(e))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const e=M.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(e,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(x(e))return e(t,!0);k(e)||Object.keys(e).forEach((s=>{t.option(s,e[s])}))}moduleName(t){const e=function(t){if("undefined"==typeof require)return null;for(let e,s=0,i=Object.keys(require.cache);s{const s=e;s._handle&&s.isTTY&&"function"==typeof s._handle.setBlocking&&s._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function P(t,s){const i=s.y18n.__,n={},r=[];n.failFn=function(t){r.push(t)};let o=null,a=null,h=!0;n.showHelpOnFail=function(e=!0,s){const[i,r]="string"==typeof e?[!0,e]:[e,s];return t.getInternalMethods().isGlobalContext()&&(a=r),o=r,h=i,n};let l=!1;n.fail=function(s,i){const c=t.getInternalMethods().getLoggerInstance();if(!r.length){if(t.getExitProcess()&&E(!0),!l){l=!0,h&&(t.showHelp("error"),c.error()),(s||i)&&c.error(s||i);const e=o||a;e&&((s||i)&&c.error(""),c.error(e))}if(i=i||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,i);throw i}for(let t=r.length-1;t>=0;--t){const e=r[t];if(A(e)){if(i)throw i;if(s)throw Error(s)}else e(s,i,n)}};let c=[],f=!1;n.usage=(t,e)=>null===t?(f=!0,c=[],n):(f=!1,c.push([t,e||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>f,n.getPositionalGroupName=()=>i("Positionals:");let d=[];n.example=(t,e)=>{d.push([t,e||""])};let u=[];n.command=function(t,e,s,i,n=!1){s&&(u=u.map((t=>(t[2]=!1,t)))),u.push([t,e||"",s,i,n])},n.getCommands=()=>u;let p={};n.describe=function(t,e){Array.isArray(t)?t.forEach((t=>{n.describe(t,e)})):"object"==typeof t?Object.keys(t).forEach((e=>{n.describe(e,t[e])})):p[t]=e},n.getDescriptions=()=>p;let m=[];n.epilog=t=>{m.push(t)};let y,b=!1;n.wrap=t=>{b=!0,y=t},n.getWrap=()=>s.getEnv("YARGS_DISABLE_WRAP")?null:(b||(y=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),b=!0),y);const v="__yargsString__:";function O(t,e,i){let n=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{n=Math.max(s.stringWidth(i?`${i} ${I(t[0])}`:I(t[0]))+$(t[0]),n)})),e&&(n=Math.min(n,parseInt((.5*e).toString(),10))),n}let w;function C(e){return t.getOptions().hiddenOptions.indexOf(e)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,e){let s=`[${i("default:")} `;if(void 0===t&&!e)return null;if(e)s+=e;else switch(typeof t){case"string":s+=`"${t}"`;break;case"object":s+=JSON.stringify(t);break;default:s+=t}return`${s}]`}n.deferY18nLookup=t=>v+t,n.help=function(){if(w)return w;!function(){const e=t.getDemandedOptions(),s=t.getOptions();(Object.keys(s.alias)||[]).forEach((i=>{s.alias[i].forEach((r=>{p[r]&&n.describe(i,p[r]),r in e&&t.demandOption(i,e[r]),s.boolean.includes(r)&&t.boolean(i),s.count.includes(r)&&t.count(i),s.string.includes(r)&&t.string(i),s.normalize.includes(r)&&t.normalize(i),s.array.includes(r)&&t.array(i),s.number.includes(r)&&t.number(i)}))}))}();const e=t.customScriptName?t.$0:s.path.basename(t.$0),r=t.getDemandedOptions(),o=t.getDemandedCommands(),a=t.getDeprecatedOptions(),h=t.getGroups(),l=t.getOptions();let g=[];g=g.concat(Object.keys(p)),g=g.concat(Object.keys(r)),g=g.concat(Object.keys(o)),g=g.concat(Object.keys(l.default)),g=g.filter(C),g=Object.keys(g.reduce(((t,e)=>("_"!==e&&(t[e]=!0),t)),{}));const y=n.getWrap(),b=s.cliui({width:y,wrap:!!y});if(!f)if(c.length)c.forEach((t=>{b.div({text:`${t[0].replace(/\$0/g,e)}`}),t[1]&&b.div({text:`${t[1]}`,padding:[1,0,0,0]})})),b.div();else if(u.length){let t=null;t=o._?`${e} <${i("command")}>\n`:`${e} [${i("command")}]\n`,b.div(`${t}`)}if(u.length>1||1===u.length&&!u[0][2]){b.div(i("Commands:"));const s=t.getInternalMethods().getContext(),n=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(u=u.sort(((t,e)=>t[0].localeCompare(e[0]))));const r=e?`${e} `:"";u.forEach((t=>{const s=`${r}${n}${t[0].replace(/^\$0 ?/,"")}`;b.span({text:s,padding:[0,2,0,2],width:O(u,y,`${e}${n}`)+4},{text:t[1]});const o=[];t[2]&&o.push(`[${i("default")}]`),t[3]&&t[3].length&&o.push(`[${i("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?o.push(`[${i("deprecated: %s",t[4])}]`):o.push(`[${i("deprecated")}]`)),o.length?b.div({text:o.join(" "),padding:[0,0,0,2],align:"right"}):b.div()})),b.div()}const M=(Object.keys(l.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);g=g.filter((e=>!t.parsed.newAliases[e]&&M.every((t=>-1===(l.alias[t]||[]).indexOf(e)))));const _=i("Options:");h[_]||(h[_]=[]),function(t,e,s,i){let n=[],r=null;Object.keys(s).forEach((t=>{n=n.concat(s[t])})),t.forEach((t=>{r=[t].concat(e[t]),r.some((t=>-1!==n.indexOf(t)))||s[i].push(t)}))}(g,l.alias,h,_);const k=t=>/^--/.test(I(t)),x=Object.keys(h).filter((t=>h[t].length>0)).map((t=>({groupName:t,normalizedKeys:h[t].filter(C).map((t=>{if(M.includes(t))return t;for(let e,s=0;void 0!==(e=M[s]);s++)if((l.alias[e]||[]).includes(t))return e;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:e})=>{const s=e.reduce(((e,s)=>(e[s]=[s].concat(l.alias[s]||[]).map((e=>t===n.getPositionalGroupName()?e:(/^[0-9]$/.test(e)?l.boolean.includes(s)?"-":"--":e.length>1?"--":"-")+e)).sort(((t,e)=>k(t)===k(e)?0:k(t)?1:-1)).join(", "),e)),{});return{groupName:t,normalizedKeys:e,switches:s}}));if(x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).some((({normalizedKeys:t,switches:e})=>!t.every((t=>k(e[t])))))&&x.filter((({groupName:t})=>t!==n.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:e})=>{t.forEach((t=>{var s,i;k(e[t])&&(e[t]=(s=e[t],i=4,S(s)?{text:s.text,indentation:s.indentation+i}:{text:s,indentation:i}))}))})),x.forEach((({groupName:e,normalizedKeys:s,switches:o})=>{b.div(e),s.forEach((e=>{const s=o[e];let h=p[e]||"",c=null;h.includes(v)&&(h=i(h.substring(16))),l.boolean.includes(e)&&(c=`[${i("boolean")}]`),l.count.includes(e)&&(c=`[${i("count")}]`),l.string.includes(e)&&(c=`[${i("string")}]`),l.normalize.includes(e)&&(c=`[${i("string")}]`),l.array.includes(e)&&(c=`[${i("array")}]`),l.number.includes(e)&&(c=`[${i("number")}]`);const f=[e in a?(d=a[e],"string"==typeof d?`[${i("deprecated: %s",d)}]`:`[${i("deprecated")}]`):null,c,e in r?`[${i("required")}]`:null,l.choices&&l.choices[e]?`[${i("choices:")} ${n.stringifiedValues(l.choices[e])}]`:null,j(l.default[e],l.defaultDescription[e])].filter(Boolean).join(" ");var d;b.span({text:I(s),padding:[0,2,0,2+$(s)],width:O(o,y)+4},h);const u=!0===t.getInternalMethods().getUsageConfiguration()["hide-types"];f&&!u?b.div({text:f,padding:[0,0,0,2],align:"right"}):b.div()})),b.div()})),d.length&&(b.div(i("Examples:")),d.forEach((t=>{t[0]=t[0].replace(/\$0/g,e)})),d.forEach((t=>{""===t[1]?b.div({text:t[0],padding:[0,2,0,2]}):b.div({text:t[0],padding:[0,2,0,2],width:O(d,y)+4},{text:t[1]})})),b.div()),m.length>0){const t=m.map((t=>t.replace(/\$0/g,e))).join("\n");b.div(`${t}\n`)}return b.toString().replace(/\s*$/,"")},n.cacheHelpMessage=function(){w=this.help()},n.clearCachedHelpMessage=function(){w=void 0},n.hasCachedHelpMessage=function(){return!!w},n.showHelp=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(n.help())},n.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):i("generated-value"),")"].join(""),n.stringifiedValues=function(t,e){let s="";const i=e||", ",n=[].concat(t);return t&&n.length?(n.forEach((t=>{s.length&&(s+=i),s+=JSON.stringify(t)})),s):s};let M=null;n.version=t=>{M=t},n.showVersion=e=>{const s=t.getInternalMethods().getLoggerInstance();e||(e="error");("function"==typeof e?e:s[e])(M)},n.reset=function(t){return o=null,l=!1,c=[],f=!1,m=[],d=[],u=[],p=g(p,(e=>!t[e])),n};const _=[];return n.freeze=function(){_.push({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p})},n.unfreeze=function(t=!1){const e=_.pop();e&&(t?(p={...e.descriptions,...p},u=[...e.commands,...u],c=[...e.usages,...c],d=[...e.examples,...d],m=[...e.epilogs,...m]):({failMessage:o,failureOutput:l,usages:c,usageDisabled:f,epilogs:m,examples:d,commands:u,descriptions:p}=e))},n}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,e,s,i){var n,r,o;this.yargs=t,this.usage=e,this.command=s,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(o=(null===(n=this.shim.getEnv("SHELL"))||void 0===n?void 0:n.includes("zsh"))||(null===(r=this.shim.getEnv("ZSH_NAME"))||void 0===r?void 0:r.includes("zsh")))&&void 0!==o&&o}defaultCompletion(t,e,s,i){const n=this.command.getCommandHandlers();for(let e=0,s=t.length;e{const i=o(s[0]).cmd;if(-1===e.indexOf(i))if(this.zshShell){const e=s[1]||"";t.push(i.replace(/:/g,"\\:")+":"+e)}else t.push(i)}))}optionCompletions(t,e,s,i){if((i.match(/^-/)||""===i&&0===t.length)&&!this.previousArgHasChoices(e)){const s=this.yargs.getOptions(),n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach((r=>{const o=!!s.configuration["boolean-negation"]&&s.boolean.includes(r);n.includes(r)||s.hiddenOptions.includes(r)||this.argsContainKey(e,r,o)||this.completeOptionKey(r,t,i,o&&!!s.default[r])}))}}choicesFromOptionsCompletions(t,e,s,i){if(this.previousArgHasChoices(e)){const s=this.getPreviousArgChoices(e);s&&s.length>0&&t.push(...s.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,e,s,i){if(""===i&&t.length>0&&this.previousArgHasChoices(e))return;const n=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=n[s._.length-r-1];if(!o)return;const a=this.yargs.getOptions().choices[o]||[];for(const e of a)e.startsWith(i)&&t.push(e.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],s="";if(!e.startsWith("-")&&t.length>1&&(s=e,e=t[t.length-2]),!e.startsWith("-"))return;const i=e.replace(/^-+/,""),n=this.yargs.getOptions(),r=[i,...this.yargs.getAliases()[i]||[]];let o;for(const t of r)if(Object.prototype.hasOwnProperty.call(n.key,t)&&Array.isArray(n.choices[t])){o=n.choices[t];break}return o?o.filter((t=>!s||t.startsWith(s))):void 0}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return void 0!==e&&e.length>0}argsContainKey(t,e,s){const i=e=>-1!==t.indexOf((/^[^0-9]$/.test(e)?"-":"--")+e);if(i(e))return!0;if(s&&i(`no-${e}`))return!0;if(this.aliases)for(const t of this.aliases[e])if(i(t))return!0;return!1}completeOptionKey(t,e,s,i){var n,r,o,a;let h=t;if(this.zshShell){const e=this.usage.getDescriptions(),s=null===(r=null===(n=null==this?void 0:this.aliases)||void 0===n?void 0:n[t])||void 0===r?void 0:r.find((t=>{const s=e[t];return"string"==typeof s&&s.length>0})),i=s?e[s]:void 0,l=null!==(a=null!==(o=e[t])&&void 0!==o?o:i)&&void 0!==a?a:"";h=`${t.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const l=!/^--/.test(s)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";e.push(l+h),i&&e.push(l+"no-"+h)}customCompletion(t,e,s,i){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(s,e);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{i(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{i(t,void 0)}))})):i(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(s,e,((n=i)=>this.defaultCompletion(t,e,s,n)),(t=>{i(null,t)})):this.customCompletionFunction(s,e,(t=>{i(null,t)}))}getCompletion(t,e){const s=t.length?t[t.length-1]:"",i=this.yargs.parse(t,!0),n=this.customCompletionFunction?i=>this.customCompletion(t,i,s,e):i=>this.defaultCompletion(t,i,s,e);return f(i)?i.then(n):n(i)}generateCompletionScript(t,e){let s=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const i=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),s=s.replace(/{{app_name}}/g,i),s=s.replace(/{{completion_command}}/g,e),s.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,e){if(0===t.length)return e.length;if(0===e.length)return t.length;const s=[];let i,n;for(i=0;i<=e.length;i++)s[i]=[i];for(n=0;n<=t.length;n++)s[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?s[i][n]=s[i-1][n-1]:i>1&&n>1&&e.charAt(i-2)===t.charAt(n-1)&&e.charAt(i-1)===t.charAt(n-2)?s[i][n]=s[i-2][n-2]+1:s[i][n]=Math.min(s[i-1][n-1]+1,Math.min(s[i][n-1]+1,s[i-1][n]+1));return s[e.length][t.length]}const H=["$0","--","_"];var z,W,q,U,F,L,V,G,R,T,B,Y,K,J,Z,X,Q,tt,et,st,it,nt,rt,ot,at,ht,lt,ct,ft,dt,ut,pt,gt,mt,yt;const bt=Symbol("copyDoubleDash"),vt=Symbol("copyDoubleDash"),Ot=Symbol("deleteFromParserHintObject"),wt=Symbol("emitWarning"),Ct=Symbol("freeze"),jt=Symbol("getDollarZero"),Mt=Symbol("getParserConfiguration"),_t=Symbol("getUsageConfiguration"),kt=Symbol("guessLocale"),xt=Symbol("guessVersion"),Et=Symbol("parsePositionalNumbers"),At=Symbol("pkgUp"),Pt=Symbol("populateParserHintArray"),St=Symbol("populateParserHintSingleValueDictionary"),$t=Symbol("populateParserHintArrayDictionary"),It=Symbol("populateParserHintDictionary"),Dt=Symbol("sanitizeKey"),Nt=Symbol("setKey"),Ht=Symbol("unfreeze"),zt=Symbol("validateAsync"),Wt=Symbol("getCommandInstance"),qt=Symbol("getContext"),Ut=Symbol("getHasOutput"),Ft=Symbol("getLoggerInstance"),Lt=Symbol("getParseContext"),Vt=Symbol("getUsageInstance"),Gt=Symbol("getValidationInstance"),Rt=Symbol("hasParseCallback"),Tt=Symbol("isGlobalContext"),Bt=Symbol("postProcess"),Yt=Symbol("rebase"),Kt=Symbol("reset"),Jt=Symbol("runYargsParserAndExecuteCommands"),Zt=Symbol("runValidation"),Xt=Symbol("setHasOutput"),Qt=Symbol("kTrackManuallySetKeys");class te{constructor(t=[],e,s,i){this.customScriptName=!1,this.parsed=!1,z.set(this,void 0),W.set(this,void 0),q.set(this,{commands:[],fullCommands:[]}),U.set(this,null),F.set(this,null),L.set(this,"show-hidden"),V.set(this,null),G.set(this,!0),R.set(this,{}),T.set(this,!0),B.set(this,[]),Y.set(this,void 0),K.set(this,{}),J.set(this,!1),Z.set(this,null),X.set(this,!0),Q.set(this,void 0),tt.set(this,""),et.set(this,void 0),st.set(this,void 0),it.set(this,{}),nt.set(this,null),rt.set(this,null),ot.set(this,{}),at.set(this,{}),ht.set(this,void 0),lt.set(this,!1),ct.set(this,void 0),ft.set(this,!1),dt.set(this,!1),ut.set(this,!1),pt.set(this,void 0),gt.set(this,{}),mt.set(this,null),yt.set(this,void 0),O(this,ct,i,"f"),O(this,ht,t,"f"),O(this,W,e,"f"),O(this,st,s,"f"),O(this,Y,new w(this),"f"),this.$0=this[jt](),this[Kt](),O(this,z,v(this,z,"f"),"f"),O(this,pt,v(this,pt,"f"),"f"),O(this,yt,v(this,yt,"f"),"f"),O(this,et,v(this,et,"f"),"f"),v(this,et,"f").showHiddenOpt=v(this,L,"f"),O(this,Q,this[vt](),"f")}addHelpOpt(t,e){return h("[string|boolean] [string]",[t,e],arguments.length),v(this,Z,"f")&&(this[Ot](v(this,Z,"f")),O(this,Z,null,"f")),!1===t&&void 0===e||(O(this,Z,"string"==typeof t?t:"help","f"),this.boolean(v(this,Z,"f")),this.describe(v(this,Z,"f"),e||v(this,pt,"f").deferY18nLookup("Show help"))),this}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(h("[string|boolean] [string]",[t,e],arguments.length),!1===t&&void 0===e)return this;const s="string"==typeof t?t:v(this,L,"f");return this.boolean(s),this.describe(s,e||v(this,pt,"f").deferY18nLookup("Show hidden options")),v(this,et,"f").showHiddenOpt=s,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return h(" [string|array]",[t,e],arguments.length),this[$t](this.alias.bind(this),"alias",t,e),this}array(t){return h("",[t],arguments.length),this[Pt]("array",t),this[Qt](t),this}boolean(t){return h("",[t],arguments.length),this[Pt]("boolean",t),this[Qt](t),this}check(t,e){return h(" [boolean]",[t,e],arguments.length),this.middleware(((e,s)=>j((()=>t(e,s.getOptions())),(s=>(s?("string"==typeof s||s instanceof Error)&&v(this,pt,"f").fail(s.toString(),s):v(this,pt,"f").fail(v(this,ct,"f").y18n.__("Argument check failed: %s",t.toString())),e)),(t=>(v(this,pt,"f").fail(t.message?t.message:t.toString(),t),e)))),!1,e),this}choices(t,e){return h(" [string|array]",[t,e],arguments.length),this[$t](this.choices.bind(this),"choices",t,e),this}coerce(t,s){if(h(" [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const e of t)this.coerce(e,s);return this}if("object"==typeof t){for(const e of Object.keys(t))this.coerce(e,t[e]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,et,"f").key[t]=!0,v(this,Y,"f").addCoerceMiddleware(((i,n)=>{let r;return Object.prototype.hasOwnProperty.call(i,t)?j((()=>(r=n.getAliases(),s(i[t]))),(e=>{i[t]=e;const s=n.getInternalMethods().getParserConfiguration()["strip-aliased"];if(r[t]&&!0!==s)for(const s of r[t])i[s]=e;return i}),(t=>{throw new e(t.message)})):i}),t),this}conflicts(t,e){return h(" [string|array]",[t,e],arguments.length),v(this,yt,"f").conflicts(t,e),this}config(t="config",e,s){return h("[object|string] [string|function] [function]",[t,e,s],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof e&&(s=e,e=void 0),this.describe(t,e||v(this,pt,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,et,"f").config[t]=s||!0})),this):(t=n(t,v(this,W,"f"),this[Mt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(t),this)}completion(t,e,s){return h("[string] [string|boolean|function] [function]",[t,e,s],arguments.length),"function"==typeof e&&(s=e,e=void 0),O(this,F,t||v(this,F,"f")||"completion","f"),e||!1===e||(e="generate completion script"),this.command(v(this,F,"f"),e),s&&v(this,U,"f").registerFunction(s),this}command(t,e,s,i,n,r){return h(" [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,s,i,n,r],arguments.length),v(this,z,"f").addHandler(t,e,s,i,n,r),this}commands(t,e,s,i,n,r){return this.command(t,e,s,i,n,r)}commandDir(t,e){h(" [object]",[t,e],arguments.length);const s=v(this,st,"f")||v(this,ct,"f").require;return v(this,z,"f").addDirectory(t,s,v(this,ct,"f").getCallerFile(),e),this}count(t){return h("",[t],arguments.length),this[Pt]("count",t),this[Qt](t),this}default(t,e,s){return h(" [*] [string]",[t,e,s],arguments.length),s&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]=s),"function"==typeof e&&(u(t,v(this,ct,"f")),v(this,et,"f").defaultDescription[t]||(v(this,et,"f").defaultDescription[t]=v(this,pt,"f").functionDescription(e)),e=e.call()),this[St](this.default.bind(this),"default",t,e),this}defaults(t,e,s){return this.default(t,e,s)}demandCommand(t=1,e,s,i){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,s,i],arguments.length),"number"!=typeof e&&(s=e,e=1/0),this.global("_",!1),v(this,et,"f").demandedCommands._={min:t,max:e,minMsg:s,maxMsg:i},this}demand(t,e,s){return Array.isArray(e)?(e.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})),e=1/0):"number"!=typeof e&&(s=e,e=1/0),"number"==typeof t?(d(s,!0,v(this,ct,"f")),this.demandCommand(t,e,s,s)):Array.isArray(t)?t.forEach((t=>{d(s,!0,v(this,ct,"f")),this.demandOption(t,s)})):"string"==typeof s?this.demandOption(t,s):!0!==s&&void 0!==s||this.demandOption(t),this}demandOption(t,e){return h(" [string]",[t,e],arguments.length),this[St](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return h(" [string|boolean]",[t,e],arguments.length),v(this,et,"f").deprecatedOptions[t]=e,this}describe(t,e){return h(" [string]",[t,e],arguments.length),this[Nt](t,!0),v(this,pt,"f").describe(t,e),this}detectLocale(t){return h("",[t],arguments.length),O(this,G,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,et,"f").envPrefix:v(this,et,"f").envPrefix=t||"",this}epilogue(t){return h("",[t],arguments.length),v(this,pt,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return h(" [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):v(this,pt,"f").example(t,e),this}exit(t,e){O(this,J,!0,"f"),O(this,V,e,"f"),v(this,T,"f")&&v(this,ct,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,T,t,"f"),this}fail(t){if(h("",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,pt,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return h(" [function]",[t,e],arguments.length),e?v(this,U,"f").getCompletion(t,e):new Promise(((e,s)=>{v(this,U,"f").getCompletion(t,((t,i)=>{t?s(t):e(i)}))}))}getDemandedOptions(){return h([],0),v(this,et,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,et,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,et,"f").deprecatedOptions}getDetectLocale(){return v(this,G,"f")}getExitProcess(){return v(this,T,"f")}getGroups(){return Object.assign({},v(this,K,"f"),v(this,at,"f"))}getHelp(){if(O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[Jt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,pt,"f").help()))}const t=v(this,z,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,pt,"f").help()))}return Promise.resolve(v(this,pt,"f").help())}getOptions(){return v(this,et,"f")}getStrict(){return v(this,ft,"f")}getStrictCommands(){return v(this,dt,"f")}getStrictOptions(){return v(this,ut,"f")}global(t,e){return h(" [boolean]",[t,e],arguments.length),t=[].concat(t),!1!==e?v(this,et,"f").local=v(this,et,"f").local.filter((e=>-1===t.indexOf(e))):t.forEach((t=>{v(this,et,"f").local.includes(t)||v(this,et,"f").local.push(t)})),this}group(t,e){h(" ",[t,e],arguments.length);const s=v(this,at,"f")[e]||v(this,K,"f")[e];v(this,at,"f")[e]&&delete v(this,at,"f")[e];const i={};return v(this,K,"f")[e]=(s||[]).concat(t).filter((t=>!i[t]&&(i[t]=!0))),this}hide(t){return h("",[t],arguments.length),v(this,et,"f").hiddenOptions.push(t),this}implies(t,e){return h(" [number|string|array]",[t,e],arguments.length),v(this,yt,"f").implies(t,e),this}locale(t){return h("[string]",[t],arguments.length),void 0===t?(this[kt](),v(this,ct,"f").y18n.getLocale()):(O(this,G,!1,"f"),v(this,ct,"f").y18n.setLocale(t),this)}middleware(t,e,s){return v(this,Y,"f").addMiddleware(t,!!e,s)}nargs(t,e){return h(" [number]",[t,e],arguments.length),this[St](this.nargs.bind(this),"narg",t,e),this}normalize(t){return h("",[t],arguments.length),this[Pt]("normalize",t),this}number(t){return h("",[t],arguments.length),this[Pt]("number",t),this[Qt](t),this}option(t,e){if(h(" [object]",[t,e],arguments.length),"object"==typeof t)Object.keys(t).forEach((e=>{this.options(e,t[e])}));else{"object"!=typeof e&&(e={}),this[Qt](t),!v(this,mt,"f")||"version"!==t&&"version"!==(null==e?void 0:e.alias)||this[wt](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,et,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const s=e.deprecate||e.deprecated;s&&this.deprecateOption(t,s);const i=e.demand||e.required||e.require;i&&this.demand(t,i),e.demandOption&&this.demandOption(t,"string"==typeof e.demandOption?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),void 0!==e.implies&&this.implies(t,e.implies),void 0!==e.nargs&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||"boolean"===e.type)&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||"array"===e.type)&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||"number"===e.type)&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||"string"===e.type)&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||"count"===e.type)&&this.count(t),"boolean"==typeof e.global&&this.global(t,e.global),e.defaultDescription&&(v(this,et,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const n=e.describe||e.description||e.desc,r=v(this,pt,"f").getDescriptions();Object.prototype.hasOwnProperty.call(r,t)&&"string"!=typeof n||this.describe(t,n),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,s){h("[string|array] [function|boolean|object] [function]",[t,e,s],arguments.length),this[Ct](),void 0===t&&(t=v(this,ht,"f")),"object"==typeof e&&(O(this,rt,e,"f"),e=s),"function"==typeof e&&(O(this,nt,e,"f"),e=!1),e||O(this,ht,t,"f"),v(this,nt,"f")&&O(this,T,!1,"f");const i=this[Jt](t,!!e),n=this.parsed;return v(this,U,"f").setParsed(this.parsed),f(i)?i.then((t=>(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),t,v(this,tt,"f")),t))).catch((t=>{throw v(this,nt,"f")&&v(this,nt,"f")(t,this.parsed.argv,v(this,tt,"f")),t})).finally((()=>{this[Ht](),this.parsed=n})):(v(this,nt,"f")&&v(this,nt,"f").call(this,v(this,V,"f"),i,v(this,tt,"f")),this[Ht](),this.parsed=n,i)}parseAsync(t,e,s){const i=this.parse(t,e,s);return f(i)?i:Promise.resolve(i)}parseSync(t,s,i){const n=this.parse(t,s,i);if(f(n))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return n}parserConfiguration(t){return h("",[t],arguments.length),O(this,it,t,"f"),this}pkgConf(t,e){h(" [string]",[t,e],arguments.length);let s=null;const i=this[At](e||v(this,W,"f"));return i[t]&&"object"==typeof i[t]&&(s=n(i[t],e||v(this,W,"f"),this[Mt]()["deep-merge-config"]||!1,v(this,ct,"f")),v(this,et,"f").configObjects=(v(this,et,"f").configObjects||[]).concat(s)),this}positional(t,e){h(" ",[t,e],arguments.length);const s=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=g(e,((t,e)=>!("type"===t&&!["string","number","boolean"].includes(e))&&s.includes(t)));const i=v(this,q,"f").fullCommands[v(this,q,"f").fullCommands.length-1],n=i?v(this,z,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return p(n).forEach((s=>{const i=n[s];Array.isArray(i)?-1!==i.indexOf(t)&&(e[s]=!0):i[t]&&!(s in e)&&(e[s]=i[t])})),this.group(t,v(this,pt,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,lt,t,"f"),this}required(t,e,s){return this.demand(t,e,s)}require(t,e,s){return this.demand(t,e,s)}requiresArg(t){return h(" [number]",[t],arguments.length),"string"==typeof t&&v(this,et,"f").narg[t]||this[St](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,e){return h("[string] [string]",[t,e],arguments.length),t=t||this.$0,v(this,Q,"f").log(v(this,U,"f").generateCompletionScript(t,e||v(this,F,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,J,!0,"f"),!v(this,pt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[Jt](v(this,ht,"f"),void 0,void 0,0,!0);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}const e=v(this,z,"f").runDefaultBuilderOn(this);if(f(e))return e.then((()=>{v(this,pt,"f").showHelp(t)})),this}return v(this,pt,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return h("[boolean|string] [string]",[t,e],arguments.length),v(this,pt,"f").showHelpOnFail(t,e),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,pt,"f").showVersion(t),this}skipValidation(t){return h("",[t],arguments.length),this[Pt]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,ft,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,dt,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,ut,!1!==t,"f"),this}string(t){return h("",[t],arguments.length),this[Pt]("string",t),this[Qt](t),this}terminalWidth(){return h([],0),v(this,ct,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("",[t],arguments.length),O(this,G,!1,"f"),v(this,ct,"f").y18n.updateLocale(t),this}usage(t,s,i,n){if(h(" [string|boolean] [function|object] [function]",[t,s,i,n],arguments.length),void 0!==s){if(d(t,null,v(this,ct,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,i,n);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,pt,"f").usage(t),this}usageConfiguration(t){return h("",[t],arguments.length),O(this,gt,t,"f"),this}version(t,e,s){const i="version";if(h("[boolean|string] [string] [string]",[t,e,s],arguments.length),v(this,mt,"f")&&(this[Ot](v(this,mt,"f")),v(this,pt,"f").version(void 0),O(this,mt,null,"f")),0===arguments.length)s=this[xt](),t=i;else if(1===arguments.length){if(!1===t)return this;s=t,t=i}else 2===arguments.length&&(s=e,e=void 0);return O(this,mt,"string"==typeof t?t:i,"f"),e=e||v(this,pt,"f").deferY18nLookup("Show version number"),v(this,pt,"f").version(s||void 0),this.boolean(v(this,mt,"f")),this.describe(v(this,mt,"f"),e),this}wrap(t){return h("",[t],arguments.length),v(this,pt,"f").wrap(t),this}[(z=new WeakMap,W=new WeakMap,q=new WeakMap,U=new WeakMap,F=new WeakMap,L=new WeakMap,V=new WeakMap,G=new WeakMap,R=new WeakMap,T=new WeakMap,B=new WeakMap,Y=new WeakMap,K=new WeakMap,J=new WeakMap,Z=new WeakMap,X=new WeakMap,Q=new WeakMap,tt=new WeakMap,et=new WeakMap,st=new WeakMap,it=new WeakMap,nt=new WeakMap,rt=new WeakMap,ot=new WeakMap,at=new WeakMap,ht=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,gt=new WeakMap,mt=new WeakMap,yt=new WeakMap,bt)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[vt](){return{log:(...t)=>{this[Rt]()||console.log(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")},error:(...t)=>{this[Rt]()||console.error(...t),O(this,J,!0,"f"),v(this,tt,"f").length&&O(this,tt,v(this,tt,"f")+"\n","f"),O(this,tt,v(this,tt,"f")+t.join(" "),"f")}}}[Ot](t){p(v(this,et,"f")).forEach((e=>{if("configObjects"===e)return;const s=v(this,et,"f")[e];Array.isArray(s)?s.includes(t)&&s.splice(s.indexOf(t),1):"object"==typeof s&&delete s[t]})),delete v(this,pt,"f").getDescriptions()[t]}[wt](t,e,s){v(this,R,"f")[s]||(v(this,ct,"f").process.emitWarning(t,e),v(this,R,"f")[s]=!0)}[Ct](){v(this,B,"f").push({options:v(this,et,"f"),configObjects:v(this,et,"f").configObjects.slice(0),exitProcess:v(this,T,"f"),groups:v(this,K,"f"),strict:v(this,ft,"f"),strictCommands:v(this,dt,"f"),strictOptions:v(this,ut,"f"),completionCommand:v(this,F,"f"),output:v(this,tt,"f"),exitError:v(this,V,"f"),hasOutput:v(this,J,"f"),parsed:this.parsed,parseFn:v(this,nt,"f"),parseContext:v(this,rt,"f")}),v(this,pt,"f").freeze(),v(this,yt,"f").freeze(),v(this,z,"f").freeze(),v(this,Y,"f").freeze()}[jt](){let t,e="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ct,"f").process.argv()[0])?v(this,ct,"f").process.argv().slice(1,2):v(this,ct,"f").process.argv().slice(0,1),e=t.map((t=>{const e=this[Yt](v(this,W,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&e.lengthe.includes("package.json")?"package.json":void 0));d(i,void 0,v(this,ct,"f")),s=JSON.parse(v(this,ct,"f").readFileSync(i,"utf8"))}catch(t){}return v(this,ot,"f")[e]=s||{},v(this,ot,"f")[e]}[Pt](t,e){(e=[].concat(e)).forEach((e=>{e=this[Dt](e),v(this,et,"f")[t].push(e)}))}[St](t,e,s,i){this[It](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=s}))}[$t](t,e,s,i){this[It](t,e,s,i,((t,e,s)=>{v(this,et,"f")[t][e]=(v(this,et,"f")[t][e]||[]).concat(s)}))}[It](t,e,s,i,n){if(Array.isArray(s))s.forEach((e=>{t(e,i)}));else if((t=>"object"==typeof t)(s))for(const e of p(s))t(e,s[e]);else n(e,this[Dt](s),i)}[Dt](t){return"__proto__"===t?"___proto___":t}[Nt](t,e){return this[St](this[Nt].bind(this),"key",t,e),this}[Ht](){var t,e,s,i,n,r,o,a,h,l,c,f;const u=v(this,B,"f").pop();let p;d(u,void 0,v(this,ct,"f")),t=this,e=this,s=this,i=this,n=this,r=this,o=this,a=this,h=this,l=this,c=this,f=this,({options:{set value(e){O(t,et,e,"f")}}.value,configObjects:p,exitProcess:{set value(t){O(e,T,t,"f")}}.value,groups:{set value(t){O(s,K,t,"f")}}.value,output:{set value(t){O(i,tt,t,"f")}}.value,exitError:{set value(t){O(n,V,t,"f")}}.value,hasOutput:{set value(t){O(r,J,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(o,ft,t,"f")}}.value,strictCommands:{set value(t){O(a,dt,t,"f")}}.value,strictOptions:{set value(t){O(h,ut,t,"f")}}.value,completionCommand:{set value(t){O(l,F,t,"f")}}.value,parseFn:{set value(t){O(c,nt,t,"f")}}.value,parseContext:{set value(t){O(f,rt,t,"f")}}.value}=u),v(this,et,"f").configObjects=p,v(this,pt,"f").unfreeze(),v(this,yt,"f").unfreeze(),v(this,z,"f").unfreeze(),v(this,Y,"f").unfreeze()}[zt](t,e){return j(e,(e=>(t(e),e)))}getInternalMethods(){return{getCommandInstance:this[Wt].bind(this),getContext:this[qt].bind(this),getHasOutput:this[Ut].bind(this),getLoggerInstance:this[Ft].bind(this),getParseContext:this[Lt].bind(this),getParserConfiguration:this[Mt].bind(this),getUsageConfiguration:this[_t].bind(this),getUsageInstance:this[Vt].bind(this),getValidationInstance:this[Gt].bind(this),hasParseCallback:this[Rt].bind(this),isGlobalContext:this[Tt].bind(this),postProcess:this[Bt].bind(this),reset:this[Kt].bind(this),runValidation:this[Zt].bind(this),runYargsParserAndExecuteCommands:this[Jt].bind(this),setHasOutput:this[Xt].bind(this)}}[Wt](){return v(this,z,"f")}[qt](){return v(this,q,"f")}[Ut](){return v(this,J,"f")}[Ft](){return v(this,Q,"f")}[Lt](){return v(this,rt,"f")||{}}[Vt](){return v(this,pt,"f")}[Gt](){return v(this,yt,"f")}[Rt](){return!!v(this,nt,"f")}[Tt](){return v(this,X,"f")}[Bt](t,e,s,i){if(s)return t;if(f(t))return t;e||(t=this[bt](t));return(this[Mt]()["parse-positional-numbers"]||void 0===this[Mt]()["parse-positional-numbers"])&&(t=this[Et](t)),i&&(t=C(t,this,v(this,Y,"f").getMiddleware(),!1)),t}[Kt](t={}){O(this,et,v(this,et,"f")||{},"f");const e={};e.local=v(this,et,"f").local||[],e.configObjects=v(this,et,"f").configObjects||[];const s={};e.local.forEach((e=>{s[e]=!0,(t[e]||[]).forEach((t=>{s[t]=!0}))})),Object.assign(v(this,at,"f"),Object.keys(v(this,K,"f")).reduce(((t,e)=>{const i=v(this,K,"f")[e].filter((t=>!(t in s)));return i.length>0&&(t[e]=i),t}),{})),O(this,K,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{e[t]=(v(this,et,"f")[t]||[]).filter((t=>!s[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{e[t]=g(v(this,et,"f")[t],(t=>!s[t]))})),e.envPrefix=v(this,et,"f").envPrefix,O(this,et,e,"f"),O(this,pt,v(this,pt,"f")?v(this,pt,"f").reset(s):P(this,v(this,ct,"f")),"f"),O(this,yt,v(this,yt,"f")?v(this,yt,"f").reset(s):function(t,e,s){const i=s.y18n.__,n=s.y18n.__n,r={nonOptionCount:function(s){const i=t.getDemandedCommands(),r=s._.length+(s["--"]?s["--"].length:0)-t.getInternalMethods().getContext().commands.length;i._&&(ri._.max)&&(ri._.max&&(void 0!==i._.maxMsg?e.fail(i._.maxMsg?i._.maxMsg.replace(/\$0/g,r.toString()).replace(/\$1/,i._.max.toString()):null):e.fail(n("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",r,r.toString(),i._.max.toString()))))},positionalCount:function(t,s){s{H.includes(e)||Object.prototype.hasOwnProperty.call(o,e)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),e)||r.isValidAndSomeAliasIsNotNew(e,i)||f.push(e)})),h&&(d.commands.length>0||c.length>0||a)&&s._.slice(d.commands.length).forEach((t=>{c.includes(""+t)||f.push(""+t)})),h){const e=(null===(l=t.getDemandedCommands()._)||void 0===l?void 0:l.max)||0,i=d.commands.length+e;i{t=String(t),d.commands.includes(t)||f.includes(t)||f.push(t)}))}f.length&&e.fail(n("Unknown argument: %s","Unknown arguments: %s",f.length,f.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(s){const i=t.getInternalMethods().getCommandInstance().getCommands(),r=[],o=t.getInternalMethods().getContext();return(o.commands.length>0||i.length>0)&&s._.slice(o.commands.length).forEach((t=>{i.includes(""+t)||r.push(""+t)})),r.length>0&&(e.fail(n("Unknown command: %s","Unknown commands: %s",r.length,r.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(e,s){if(!Object.prototype.hasOwnProperty.call(s,e))return!1;const i=t.parsed.newAliases;return[e,...s[e]].some((t=>!Object.prototype.hasOwnProperty.call(i,t)||!i[e]))},limitedChoices:function(s){const n=t.getOptions(),r={};if(!Object.keys(n.choices).length)return;Object.keys(s).forEach((t=>{-1===H.indexOf(t)&&Object.prototype.hasOwnProperty.call(n.choices,t)&&[].concat(s[t]).forEach((e=>{-1===n.choices[t].indexOf(e)&&void 0!==e&&(r[t]=(r[t]||[]).concat(e))}))}));const o=Object.keys(r);if(!o.length)return;let a=i("Invalid values:");o.forEach((t=>{a+=`\n ${i("Argument: %s, Given: %s, Choices: %s",t,e.stringifiedValues(r[t]),e.stringifiedValues(n.choices[t]))}`})),e.fail(a)}};let o={};function a(t,e){const s=Number(e);return"number"==typeof(e=isNaN(s)?e:s)?e=t._.length>=e:e.match(/^--no-.+/)?(e=e.match(/^--no-(.+)/)[1],e=!Object.prototype.hasOwnProperty.call(t,e)):e=Object.prototype.hasOwnProperty.call(t,e),e}r.implies=function(e,i){h(" [array|number|string]",[e,i],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.implies(t,e[t])})):(t.global(e),o[e]||(o[e]=[]),Array.isArray(i)?i.forEach((t=>r.implies(e,t))):(d(i,void 0,s),o[e].push(i)))},r.getImplied=function(){return o},r.implications=function(t){const s=[];if(Object.keys(o).forEach((e=>{const i=e;(o[e]||[]).forEach((e=>{let n=i;const r=e;n=a(t,n),e=a(t,e),n&&!e&&s.push(` ${i} -> ${r}`)}))})),s.length){let t=`${i("Implications failed:")}\n`;s.forEach((e=>{t+=e})),e.fail(t)}};let l={};r.conflicts=function(e,s){h(" [array|string]",[e,s],arguments.length),"object"==typeof e?Object.keys(e).forEach((t=>{r.conflicts(t,e[t])})):(t.global(e),l[e]||(l[e]=[]),Array.isArray(s)?s.forEach((t=>r.conflicts(e,t))):l[e].push(s))},r.getConflicting=()=>l,r.conflicting=function(n){Object.keys(n).forEach((t=>{l[t]&&l[t].forEach((s=>{s&&void 0!==n[t]&&void 0!==n[s]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,s))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach((t=>{l[t].forEach((r=>{r&&void 0!==n[s.Parser.camelCase(t)]&&void 0!==n[s.Parser.camelCase(r)]&&e.fail(i("Arguments %s and %s are mutually exclusive",t,r))}))}))},r.recommendCommands=function(t,s){s=s.sort(((t,e)=>e.length-t.length));let n=null,r=1/0;for(let e,i=0;void 0!==(e=s[i]);i++){const s=N(t,e);s<=3&&s!t[e])),l=g(l,(e=>!t[e])),r};const c=[];return r.freeze=function(){c.push({implied:o,conflicting:l})},r.unfreeze=function(){const t=c.pop();d(t,void 0,s),({implied:o,conflicting:l}=t)},r}(this,v(this,pt,"f"),v(this,ct,"f")),"f"),O(this,z,v(this,z,"f")?v(this,z,"f").reset():function(t,e,s,i){return new _(t,e,s,i)}(v(this,pt,"f"),v(this,yt,"f"),v(this,Y,"f"),v(this,ct,"f")),"f"),v(this,U,"f")||O(this,U,function(t,e,s,i){return new D(t,e,s,i)}(this,v(this,pt,"f"),v(this,z,"f"),v(this,ct,"f")),"f"),v(this,Y,"f").reset(),O(this,F,null,"f"),O(this,tt,"","f"),O(this,V,null,"f"),O(this,J,!1,"f"),this.parsed=!1,this}[Yt](t,e){return v(this,ct,"f").path.relative(t,e)}[Jt](t,s,i,n=0,r=!1){let o=!!i||r;t=t||v(this,ht,"f"),v(this,et,"f").__=v(this,ct,"f").y18n.__,v(this,et,"f").configuration=this[Mt]();const a=!!v(this,et,"f").configuration["populate--"],h=Object.assign({},v(this,et,"f").configuration,{"populate--":!0}),l=v(this,ct,"f").Parser.detailed(t,Object.assign({},v(this,et,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),c=Object.assign(l.argv,v(this,rt,"f"));let d;const u=l.aliases;let p=!1,g=!1;Object.keys(c).forEach((t=>{t===v(this,Z,"f")&&c[t]?p=!0:t===v(this,mt,"f")&&c[t]&&(g=!0)})),c.$0=this.$0,this.parsed=l,0===n&&v(this,pt,"f").clearCachedHelpMessage();try{if(this[kt](),s)return this[Bt](c,a,!!i,!1);if(v(this,Z,"f")){[v(this,Z,"f")].concat(u[v(this,Z,"f")]||[]).filter((t=>t.length>1)).includes(""+c._[c._.length-1])&&(c._.pop(),p=!0)}O(this,X,!1,"f");const h=v(this,z,"f").getCommands(),m=v(this,U,"f").completionKey in c,y=p||m||r;if(c._.length){if(h.length){let t;for(let e,s=n||0;void 0!==c._[s];s++){if(e=String(c._[s]),h.includes(e)&&e!==v(this,F,"f")){const t=v(this,z,"f").runCommand(e,this,l,s+1,r,p||g||r);return this[Bt](t,a,!!i,!1)}if(!t&&e!==v(this,F,"f")){t=e;break}}!v(this,z,"f").hasDefaultCommand()&&v(this,lt,"f")&&t&&!y&&v(this,yt,"f").recommendCommands(t,h)}v(this,F,"f")&&c._.includes(v(this,F,"f"))&&!m&&(v(this,T,"f")&&E(!0),this.showCompletionScript(),this.exit(0))}if(v(this,z,"f").hasDefaultCommand()&&!y){const t=v(this,z,"f").runCommand(null,this,l,0,r,p||g||r);return this[Bt](t,a,!!i,!1)}if(m){v(this,T,"f")&&E(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,U,"f").completionKey}`)+1);return v(this,U,"f").getCompletion(s,((t,s)=>{if(t)throw new e(t.message);(s||[]).forEach((t=>{v(this,Q,"f").log(t)})),this.exit(0)})),this[Bt](c,!a,!!i,!1)}if(v(this,J,"f")||(p?(v(this,T,"f")&&E(!0),o=!0,this.showHelp("log"),this.exit(0)):g&&(v(this,T,"f")&&E(!0),o=!0,v(this,pt,"f").showVersion("log"),this.exit(0))),!o&&v(this,et,"f").skipValidation.length>0&&(o=Object.keys(c).some((t=>v(this,et,"f").skipValidation.indexOf(t)>=0&&!0===c[t]))),!o){if(l.error)throw new e(l.error.message);if(!m){const t=this[Zt](u,{},l.error);i||(d=C(c,this,v(this,Y,"f").getMiddleware(),!0)),d=this[zt](t,null!=d?d:c),f(d)&&!i&&(d=d.then((()=>C(c,this,v(this,Y,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,pt,"f").fail(t.message,t)}return this[Bt](null!=d?d:c,a,!!i,!0)}[Zt](t,s,i,n){const r={...this.getDemandedOptions()};return o=>{if(i)throw new e(i.message);v(this,yt,"f").nonOptionCount(o),v(this,yt,"f").requiredArguments(o,r);let a=!1;v(this,dt,"f")&&(a=v(this,yt,"f").unknownCommands(o)),v(this,ft,"f")&&!a?v(this,yt,"f").unknownArguments(o,t,s,!!n):v(this,ut,"f")&&v(this,yt,"f").unknownArguments(o,t,{},!1,!1),v(this,yt,"f").limitedChoices(o),v(this,yt,"f").implications(o),v(this,yt,"f").conflicting(o)}}[Xt](){O(this,J,!0,"f")}[Qt](t){if("string"==typeof t)v(this,et,"f").key[t]=!0;else for(const e of t)v(this,et,"f").key[e]=!0}}var ee,se;const{readFileSync:ie}=require("fs"),{inspect:ne}=require("util"),{resolve:re}=require("path"),oe=require("y18n"),ae=require("yargs-parser");var he,le={assert:{notStrictEqual:t.notStrictEqual,strictEqual:t.strictEqual},cliui:require("cliui"),findUp:require("escalade/sync"),getEnv:t=>process.env[t],getCallerFile:require("get-caller-file"),getProcessArgvBin:y,inspect:ne,mainFilename:null!==(se=null===(ee=null===require||void 0===require?void 0:require.main)||void 0===ee?void 0:ee.filename)&&void 0!==se?se:process.cwd(),Parser:ae,path:require("path"),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,e)=>process.emitWarning(t,e),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:ie,require:require,requireDirectory:require("require-directory"),stringWidth:require("string-width"),y18n:oe({directory:re(__dirname,"../locales"),updateFiles:!1})};const ce=(null===(he=null===process||void 0===process?void 0:process.env)||void 0===he?void 0:he.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1]){const i=new te(t,e,s,de);return Object.defineProperty(i,"argv",{get:()=>i.parse(),enumerable:!0}),i.help(),i.version(),i}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:fe,processArgv:b,YError:e};module.exports=ue; diff --git a/node_modules/yargs/build/lib/argsert.js b/node_modules/yargs/build/lib/argsert.js deleted file mode 100644 index be5b3aa..0000000 --- a/node_modules/yargs/build/lib/argsert.js +++ /dev/null @@ -1,62 +0,0 @@ -import { YError } from './yerror.js'; -import { parseCommand } from './parse-command.js'; -const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']; -export function argsert(arg1, arg2, arg3) { - function parseArgs() { - return typeof arg1 === 'object' - ? [{ demanded: [], optional: [] }, arg1, arg2] - : [ - parseCommand(`cmd ${arg1}`), - arg2, - arg3, - ]; - } - try { - let position = 0; - const [parsed, callerArguments, _length] = parseArgs(); - const args = [].slice.call(callerArguments); - while (args.length && args[args.length - 1] === undefined) - args.pop(); - const length = _length || args.length; - if (length < parsed.demanded.length) { - throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`); - } - const totalCommands = parsed.demanded.length + parsed.optional.length; - if (length > totalCommands) { - throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`); - } - parsed.demanded.forEach(demanded => { - const arg = args.shift(); - const observedType = guessType(arg); - const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*'); - if (matchingTypes.length === 0) - argumentTypeError(observedType, demanded.cmd, position); - position += 1; - }); - parsed.optional.forEach(optional => { - if (args.length === 0) - return; - const arg = args.shift(); - const observedType = guessType(arg); - const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*'); - if (matchingTypes.length === 0) - argumentTypeError(observedType, optional.cmd, position); - position += 1; - }); - } - catch (err) { - console.warn(err.stack); - } -} -function guessType(arg) { - if (Array.isArray(arg)) { - return 'array'; - } - else if (arg === null) { - return 'null'; - } - return typeof arg; -} -function argumentTypeError(observedType, allowedTypes, position) { - throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`); -} diff --git a/node_modules/yargs/build/lib/command.js b/node_modules/yargs/build/lib/command.js deleted file mode 100644 index 47c1ed6..0000000 --- a/node_modules/yargs/build/lib/command.js +++ /dev/null @@ -1,449 +0,0 @@ -import { assertNotStrictEqual, } from './typings/common-types.js'; -import { isPromise } from './utils/is-promise.js'; -import { applyMiddleware, commandMiddlewareFactory, } from './middleware.js'; -import { parseCommand } from './parse-command.js'; -import { isYargsInstance, } from './yargs-factory.js'; -import { maybeAsyncResult } from './utils/maybe-async-result.js'; -import whichModule from './utils/which-module.js'; -const DEFAULT_MARKER = /(^\*)|(^\$0)/; -export class CommandInstance { - constructor(usage, validation, globalMiddleware, shim) { - this.requireCache = new Set(); - this.handlers = {}; - this.aliasMap = {}; - this.frozens = []; - this.shim = shim; - this.usage = usage; - this.globalMiddleware = globalMiddleware; - this.validation = validation; - } - addDirectory(dir, req, callerFile, opts) { - opts = opts || {}; - if (typeof opts.recurse !== 'boolean') - opts.recurse = false; - if (!Array.isArray(opts.extensions)) - opts.extensions = ['js']; - const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o; - opts.visit = (obj, joined, filename) => { - const visited = parentVisit(obj, joined, filename); - if (visited) { - if (this.requireCache.has(joined)) - return visited; - else - this.requireCache.add(joined); - this.addHandler(visited); - } - return visited; - }; - this.shim.requireDirectory({ require: req, filename: callerFile }, dir, opts); - } - addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) { - let aliases = []; - const middlewares = commandMiddlewareFactory(commandMiddleware); - handler = handler || (() => { }); - if (Array.isArray(cmd)) { - if (isCommandAndAliases(cmd)) { - [cmd, ...aliases] = cmd; - } - else { - for (const command of cmd) { - this.addHandler(command); - } - } - } - else if (isCommandHandlerDefinition(cmd)) { - let command = Array.isArray(cmd.command) || typeof cmd.command === 'string' - ? cmd.command - : this.moduleName(cmd); - if (cmd.aliases) - command = [].concat(command).concat(cmd.aliases); - this.addHandler(command, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated); - return; - } - else if (isCommandBuilderDefinition(builder)) { - this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated); - return; - } - if (typeof cmd === 'string') { - const parsedCommand = parseCommand(cmd); - aliases = aliases.map(alias => parseCommand(alias).cmd); - let isDefault = false; - const parsedAliases = [parsedCommand.cmd].concat(aliases).filter(c => { - if (DEFAULT_MARKER.test(c)) { - isDefault = true; - return false; - } - return true; - }); - if (parsedAliases.length === 0 && isDefault) - parsedAliases.push('$0'); - if (isDefault) { - parsedCommand.cmd = parsedAliases[0]; - aliases = parsedAliases.slice(1); - cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd); - } - aliases.forEach(alias => { - this.aliasMap[alias] = parsedCommand.cmd; - }); - if (description !== false) { - this.usage.command(cmd, description, isDefault, aliases, deprecated); - } - this.handlers[parsedCommand.cmd] = { - original: cmd, - description, - handler, - builder: builder || {}, - middlewares, - deprecated, - demanded: parsedCommand.demanded, - optional: parsedCommand.optional, - }; - if (isDefault) - this.defaultCommand = this.handlers[parsedCommand.cmd]; - } - } - getCommandHandlers() { - return this.handlers; - } - getCommands() { - return Object.keys(this.handlers).concat(Object.keys(this.aliasMap)); - } - hasDefaultCommand() { - return !!this.defaultCommand; - } - runCommand(command, yargs, parsed, commandIndex, helpOnly, helpOrVersionSet) { - const commandHandler = this.handlers[command] || - this.handlers[this.aliasMap[command]] || - this.defaultCommand; - const currentContext = yargs.getInternalMethods().getContext(); - const parentCommands = currentContext.commands.slice(); - const isDefaultCommand = !command; - if (command) { - currentContext.commands.push(command); - currentContext.fullCommands.push(commandHandler.original); - } - const builderResult = this.applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, parsed.aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet); - return isPromise(builderResult) - ? builderResult.then(result => this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, result.innerArgv, currentContext, helpOnly, result.aliases, yargs)) - : this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, builderResult.innerArgv, currentContext, helpOnly, builderResult.aliases, yargs); - } - applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet) { - const builder = commandHandler.builder; - let innerYargs = yargs; - if (isCommandBuilderCallback(builder)) { - yargs.getInternalMethods().getUsageInstance().freeze(); - const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet); - if (isPromise(builderOutput)) { - return builderOutput.then(output => { - innerYargs = isYargsInstance(output) ? output : yargs; - return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly); - }); - } - } - else if (isCommandBuilderOptionDefinitions(builder)) { - yargs.getInternalMethods().getUsageInstance().freeze(); - innerYargs = yargs.getInternalMethods().reset(aliases); - Object.keys(commandHandler.builder).forEach(key => { - innerYargs.option(key, builder[key]); - }); - } - return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly); - } - parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly) { - if (isDefaultCommand) - innerYargs.getInternalMethods().getUsageInstance().unfreeze(true); - if (this.shouldUpdateUsage(innerYargs)) { - innerYargs - .getInternalMethods() - .getUsageInstance() - .usage(this.usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); - } - const innerArgv = innerYargs - .getInternalMethods() - .runYargsParserAndExecuteCommands(null, undefined, true, commandIndex, helpOnly); - return isPromise(innerArgv) - ? innerArgv.then(argv => ({ - aliases: innerYargs.parsed.aliases, - innerArgv: argv, - })) - : { - aliases: innerYargs.parsed.aliases, - innerArgv: innerArgv, - }; - } - shouldUpdateUsage(yargs) { - return (!yargs.getInternalMethods().getUsageInstance().getUsageDisabled() && - yargs.getInternalMethods().getUsageInstance().getUsage().length === 0); - } - usageFromParentCommandsCommandHandler(parentCommands, commandHandler) { - const c = DEFAULT_MARKER.test(commandHandler.original) - ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() - : commandHandler.original; - const pc = parentCommands.filter(c => { - return !DEFAULT_MARKER.test(c); - }); - pc.push(c); - return `$0 ${pc.join(' ')}`; - } - handleValidationAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, aliases, yargs, middlewares, positionalMap) { - if (!yargs.getInternalMethods().getHasOutput()) { - const validation = yargs - .getInternalMethods() - .runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand); - innerArgv = maybeAsyncResult(innerArgv, result => { - validation(result); - return result; - }); - } - if (commandHandler.handler && !yargs.getInternalMethods().getHasOutput()) { - yargs.getInternalMethods().setHasOutput(); - const populateDoubleDash = !!yargs.getOptions().configuration['populate--']; - yargs - .getInternalMethods() - .postProcess(innerArgv, populateDoubleDash, false, false); - innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false); - innerArgv = maybeAsyncResult(innerArgv, result => { - const handlerResult = commandHandler.handler(result); - return isPromise(handlerResult) - ? handlerResult.then(() => result) - : result; - }); - if (!isDefaultCommand) { - yargs.getInternalMethods().getUsageInstance().cacheHelpMessage(); - } - if (isPromise(innerArgv) && - !yargs.getInternalMethods().hasParseCallback()) { - innerArgv.catch(error => { - try { - yargs.getInternalMethods().getUsageInstance().fail(null, error); - } - catch (_err) { - } - }); - } - } - if (!isDefaultCommand) { - currentContext.commands.pop(); - currentContext.fullCommands.pop(); - } - return innerArgv; - } - applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) { - let positionalMap = {}; - if (helpOnly) - return innerArgv; - if (!yargs.getInternalMethods().getHasOutput()) { - positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs); - } - const middlewares = this.globalMiddleware - .getMiddleware() - .slice(0) - .concat(commandHandler.middlewares); - const maybePromiseArgv = applyMiddleware(innerArgv, yargs, middlewares, true); - return isPromise(maybePromiseArgv) - ? maybePromiseArgv.then(resolvedInnerArgv => this.handleValidationAndGetResult(isDefaultCommand, commandHandler, resolvedInnerArgv, currentContext, aliases, yargs, middlewares, positionalMap)) - : this.handleValidationAndGetResult(isDefaultCommand, commandHandler, maybePromiseArgv, currentContext, aliases, yargs, middlewares, positionalMap); - } - populatePositionals(commandHandler, argv, context, yargs) { - argv._ = argv._.slice(context.commands.length); - const demanded = commandHandler.demanded.slice(0); - const optional = commandHandler.optional.slice(0); - const positionalMap = {}; - this.validation.positionalCount(demanded.length, argv._.length); - while (demanded.length) { - const demand = demanded.shift(); - this.populatePositional(demand, argv, positionalMap); - } - while (optional.length) { - const maybe = optional.shift(); - this.populatePositional(maybe, argv, positionalMap); - } - argv._ = context.commands.concat(argv._.map(a => '' + a)); - this.postProcessPositionals(argv, positionalMap, this.cmdToParseOptions(commandHandler.original), yargs); - return positionalMap; - } - populatePositional(positional, argv, positionalMap) { - const cmd = positional.cmd[0]; - if (positional.variadic) { - positionalMap[cmd] = argv._.splice(0).map(String); - } - else { - if (argv._.length) - positionalMap[cmd] = [String(argv._.shift())]; - } - } - cmdToParseOptions(cmdString) { - const parseOptions = { - array: [], - default: {}, - alias: {}, - demand: {}, - }; - const parsed = parseCommand(cmdString); - parsed.demanded.forEach(d => { - const [cmd, ...aliases] = d.cmd; - if (d.variadic) { - parseOptions.array.push(cmd); - parseOptions.default[cmd] = []; - } - parseOptions.alias[cmd] = aliases; - parseOptions.demand[cmd] = true; - }); - parsed.optional.forEach(o => { - const [cmd, ...aliases] = o.cmd; - if (o.variadic) { - parseOptions.array.push(cmd); - parseOptions.default[cmd] = []; - } - parseOptions.alias[cmd] = aliases; - }); - return parseOptions; - } - postProcessPositionals(argv, positionalMap, parseOptions, yargs) { - const options = Object.assign({}, yargs.getOptions()); - options.default = Object.assign(parseOptions.default, options.default); - for (const key of Object.keys(parseOptions.alias)) { - options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]); - } - options.array = options.array.concat(parseOptions.array); - options.config = {}; - const unparsed = []; - Object.keys(positionalMap).forEach(key => { - positionalMap[key].map(value => { - if (options.configuration['unknown-options-as-args']) - options.key[key] = true; - unparsed.push(`--${key}`); - unparsed.push(value); - }); - }); - if (!unparsed.length) - return; - const config = Object.assign({}, options.configuration, { - 'populate--': false, - }); - const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, { - configuration: config, - })); - if (parsed.error) { - yargs - .getInternalMethods() - .getUsageInstance() - .fail(parsed.error.message, parsed.error); - } - else { - const positionalKeys = Object.keys(positionalMap); - Object.keys(positionalMap).forEach(key => { - positionalKeys.push(...parsed.aliases[key]); - }); - Object.keys(parsed.argv).forEach(key => { - if (positionalKeys.includes(key)) { - if (!positionalMap[key]) - positionalMap[key] = parsed.argv[key]; - if (!this.isInConfigs(yargs, key) && - !this.isDefaulted(yargs, key) && - Object.prototype.hasOwnProperty.call(argv, key) && - Object.prototype.hasOwnProperty.call(parsed.argv, key) && - (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) { - argv[key] = [].concat(argv[key], parsed.argv[key]); - } - else { - argv[key] = parsed.argv[key]; - } - } - }); - } - } - isDefaulted(yargs, key) { - const { default: defaults } = yargs.getOptions(); - return (Object.prototype.hasOwnProperty.call(defaults, key) || - Object.prototype.hasOwnProperty.call(defaults, this.shim.Parser.camelCase(key))); - } - isInConfigs(yargs, key) { - const { configObjects } = yargs.getOptions(); - return (configObjects.some(c => Object.prototype.hasOwnProperty.call(c, key)) || - configObjects.some(c => Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key)))); - } - runDefaultBuilderOn(yargs) { - if (!this.defaultCommand) - return; - if (this.shouldUpdateUsage(yargs)) { - const commandString = DEFAULT_MARKER.test(this.defaultCommand.original) - ? this.defaultCommand.original - : this.defaultCommand.original.replace(/^[^[\]<>]*/, '$0 '); - yargs - .getInternalMethods() - .getUsageInstance() - .usage(commandString, this.defaultCommand.description); - } - const builder = this.defaultCommand.builder; - if (isCommandBuilderCallback(builder)) { - return builder(yargs, true); - } - else if (!isCommandBuilderDefinition(builder)) { - Object.keys(builder).forEach(key => { - yargs.option(key, builder[key]); - }); - } - return undefined; - } - moduleName(obj) { - const mod = whichModule(obj); - if (!mod) - throw new Error(`No command name given for module: ${this.shim.inspect(obj)}`); - return this.commandFromFilename(mod.filename); - } - commandFromFilename(filename) { - return this.shim.path.basename(filename, this.shim.path.extname(filename)); - } - extractDesc({ describe, description, desc }) { - for (const test of [describe, description, desc]) { - if (typeof test === 'string' || test === false) - return test; - assertNotStrictEqual(test, true, this.shim); - } - return false; - } - freeze() { - this.frozens.push({ - handlers: this.handlers, - aliasMap: this.aliasMap, - defaultCommand: this.defaultCommand, - }); - } - unfreeze() { - const frozen = this.frozens.pop(); - assertNotStrictEqual(frozen, undefined, this.shim); - ({ - handlers: this.handlers, - aliasMap: this.aliasMap, - defaultCommand: this.defaultCommand, - } = frozen); - } - reset() { - this.handlers = {}; - this.aliasMap = {}; - this.defaultCommand = undefined; - this.requireCache = new Set(); - return this; - } -} -export function command(usage, validation, globalMiddleware, shim) { - return new CommandInstance(usage, validation, globalMiddleware, shim); -} -export function isCommandBuilderDefinition(builder) { - return (typeof builder === 'object' && - !!builder.builder && - typeof builder.handler === 'function'); -} -function isCommandAndAliases(cmd) { - return cmd.every(c => typeof c === 'string'); -} -export function isCommandBuilderCallback(builder) { - return typeof builder === 'function'; -} -function isCommandBuilderOptionDefinitions(builder) { - return typeof builder === 'object'; -} -export function isCommandHandlerDefinition(cmd) { - return typeof cmd === 'object' && !Array.isArray(cmd); -} diff --git a/node_modules/yargs/build/lib/completion-templates.js b/node_modules/yargs/build/lib/completion-templates.js deleted file mode 100644 index 2c4dcb5..0000000 --- a/node_modules/yargs/build/lib/completion-templates.js +++ /dev/null @@ -1,48 +0,0 @@ -export const completionShTemplate = `###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc -# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local cur_word args type_list - - cur_word="\${COMP_WORDS[COMP_CWORD]}" - args=("\${COMP_WORDS[@]}") - - # ask yargs to generate completions. - type_list=$({{app_path}} --get-yargs-completions "\${args[@]}") - - COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) ) - - # if no match was found, fall back to filename completion - if [ \${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`; -export const completionZshTemplate = `#compdef {{app_name}} -###-begin-{{app_name}}-completions-### -# -# yargs command completion script -# -# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX. -# -_{{app_name}}_yargs_completions() -{ - local reply - local si=$IFS - IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}")) - IFS=$si - _describe 'values' reply -} -compdef _{{app_name}}_yargs_completions {{app_name}} -###-end-{{app_name}}-completions-### -`; diff --git a/node_modules/yargs/build/lib/completion.js b/node_modules/yargs/build/lib/completion.js deleted file mode 100644 index cef2bbe..0000000 --- a/node_modules/yargs/build/lib/completion.js +++ /dev/null @@ -1,243 +0,0 @@ -import { isCommandBuilderCallback } from './command.js'; -import { assertNotStrictEqual } from './typings/common-types.js'; -import * as templates from './completion-templates.js'; -import { isPromise } from './utils/is-promise.js'; -import { parseCommand } from './parse-command.js'; -export class Completion { - constructor(yargs, usage, command, shim) { - var _a, _b, _c; - this.yargs = yargs; - this.usage = usage; - this.command = command; - this.shim = shim; - this.completionKey = 'get-yargs-completions'; - this.aliases = null; - this.customCompletionFunction = null; - this.indexAfterLastReset = 0; - this.zshShell = - (_c = (((_a = this.shim.getEnv('SHELL')) === null || _a === void 0 ? void 0 : _a.includes('zsh')) || - ((_b = this.shim.getEnv('ZSH_NAME')) === null || _b === void 0 ? void 0 : _b.includes('zsh')))) !== null && _c !== void 0 ? _c : false; - } - defaultCompletion(args, argv, current, done) { - const handlers = this.command.getCommandHandlers(); - for (let i = 0, ii = args.length; i < ii; ++i) { - if (handlers[args[i]] && handlers[args[i]].builder) { - const builder = handlers[args[i]].builder; - if (isCommandBuilderCallback(builder)) { - this.indexAfterLastReset = i + 1; - const y = this.yargs.getInternalMethods().reset(); - builder(y, true); - return y.argv; - } - } - } - const completions = []; - this.commandCompletions(completions, args, current); - this.optionCompletions(completions, args, argv, current); - this.choicesFromOptionsCompletions(completions, args, argv, current); - this.choicesFromPositionalsCompletions(completions, args, argv, current); - done(null, completions); - } - commandCompletions(completions, args, current) { - const parentCommands = this.yargs - .getInternalMethods() - .getContext().commands; - if (!current.match(/^-/) && - parentCommands[parentCommands.length - 1] !== current && - !this.previousArgHasChoices(args)) { - this.usage.getCommands().forEach(usageCommand => { - const commandName = parseCommand(usageCommand[0]).cmd; - if (args.indexOf(commandName) === -1) { - if (!this.zshShell) { - completions.push(commandName); - } - else { - const desc = usageCommand[1] || ''; - completions.push(commandName.replace(/:/g, '\\:') + ':' + desc); - } - } - }); - } - } - optionCompletions(completions, args, argv, current) { - if ((current.match(/^-/) || (current === '' && completions.length === 0)) && - !this.previousArgHasChoices(args)) { - const options = this.yargs.getOptions(); - const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || []; - Object.keys(options.key).forEach(key => { - const negable = !!options.configuration['boolean-negation'] && - options.boolean.includes(key); - const isPositionalKey = positionalKeys.includes(key); - if (!isPositionalKey && - !options.hiddenOptions.includes(key) && - !this.argsContainKey(args, key, negable)) { - this.completeOptionKey(key, completions, current, negable && !!options.default[key]); - } - }); - } - } - choicesFromOptionsCompletions(completions, args, argv, current) { - if (this.previousArgHasChoices(args)) { - const choices = this.getPreviousArgChoices(args); - if (choices && choices.length > 0) { - completions.push(...choices.map(c => c.replace(/:/g, '\\:'))); - } - } - } - choicesFromPositionalsCompletions(completions, args, argv, current) { - if (current === '' && - completions.length > 0 && - this.previousArgHasChoices(args)) { - return; - } - const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || []; - const offset = Math.max(this.indexAfterLastReset, this.yargs.getInternalMethods().getContext().commands.length + - 1); - const positionalKey = positionalKeys[argv._.length - offset - 1]; - if (!positionalKey) { - return; - } - const choices = this.yargs.getOptions().choices[positionalKey] || []; - for (const choice of choices) { - if (choice.startsWith(current)) { - completions.push(choice.replace(/:/g, '\\:')); - } - } - } - getPreviousArgChoices(args) { - if (args.length < 1) - return; - let previousArg = args[args.length - 1]; - let filter = ''; - if (!previousArg.startsWith('-') && args.length > 1) { - filter = previousArg; - previousArg = args[args.length - 2]; - } - if (!previousArg.startsWith('-')) - return; - const previousArgKey = previousArg.replace(/^-+/, ''); - const options = this.yargs.getOptions(); - const possibleAliases = [ - previousArgKey, - ...(this.yargs.getAliases()[previousArgKey] || []), - ]; - let choices; - for (const possibleAlias of possibleAliases) { - if (Object.prototype.hasOwnProperty.call(options.key, possibleAlias) && - Array.isArray(options.choices[possibleAlias])) { - choices = options.choices[possibleAlias]; - break; - } - } - if (choices) { - return choices.filter(choice => !filter || choice.startsWith(filter)); - } - } - previousArgHasChoices(args) { - const choices = this.getPreviousArgChoices(args); - return choices !== undefined && choices.length > 0; - } - argsContainKey(args, key, negable) { - const argsContains = (s) => args.indexOf((/^[^0-9]$/.test(s) ? '-' : '--') + s) !== -1; - if (argsContains(key)) - return true; - if (negable && argsContains(`no-${key}`)) - return true; - if (this.aliases) { - for (const alias of this.aliases[key]) { - if (argsContains(alias)) - return true; - } - } - return false; - } - completeOptionKey(key, completions, current, negable) { - var _a, _b, _c, _d; - let keyWithDesc = key; - if (this.zshShell) { - const descs = this.usage.getDescriptions(); - const aliasKey = (_b = (_a = this === null || this === void 0 ? void 0 : this.aliases) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.find(alias => { - const desc = descs[alias]; - return typeof desc === 'string' && desc.length > 0; - }); - const descFromAlias = aliasKey ? descs[aliasKey] : undefined; - const desc = (_d = (_c = descs[key]) !== null && _c !== void 0 ? _c : descFromAlias) !== null && _d !== void 0 ? _d : ''; - keyWithDesc = `${key.replace(/:/g, '\\:')}:${desc - .replace('__yargsString__:', '') - .replace(/(\r\n|\n|\r)/gm, ' ')}`; - } - const startsByTwoDashes = (s) => /^--/.test(s); - const isShortOption = (s) => /^[^0-9]$/.test(s); - const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--'; - completions.push(dashes + keyWithDesc); - if (negable) { - completions.push(dashes + 'no-' + keyWithDesc); - } - } - customCompletion(args, argv, current, done) { - assertNotStrictEqual(this.customCompletionFunction, null, this.shim); - if (isSyncCompletionFunction(this.customCompletionFunction)) { - const result = this.customCompletionFunction(current, argv); - if (isPromise(result)) { - return result - .then(list => { - this.shim.process.nextTick(() => { - done(null, list); - }); - }) - .catch(err => { - this.shim.process.nextTick(() => { - done(err, undefined); - }); - }); - } - return done(null, result); - } - else if (isFallbackCompletionFunction(this.customCompletionFunction)) { - return this.customCompletionFunction(current, argv, (onCompleted = done) => this.defaultCompletion(args, argv, current, onCompleted), completions => { - done(null, completions); - }); - } - else { - return this.customCompletionFunction(current, argv, completions => { - done(null, completions); - }); - } - } - getCompletion(args, done) { - const current = args.length ? args[args.length - 1] : ''; - const argv = this.yargs.parse(args, true); - const completionFunction = this.customCompletionFunction - ? (argv) => this.customCompletion(args, argv, current, done) - : (argv) => this.defaultCompletion(args, argv, current, done); - return isPromise(argv) - ? argv.then(completionFunction) - : completionFunction(argv); - } - generateCompletionScript($0, cmd) { - let script = this.zshShell - ? templates.completionZshTemplate - : templates.completionShTemplate; - const name = this.shim.path.basename($0); - if ($0.match(/\.js$/)) - $0 = `./${$0}`; - script = script.replace(/{{app_name}}/g, name); - script = script.replace(/{{completion_command}}/g, cmd); - return script.replace(/{{app_path}}/g, $0); - } - registerFunction(fn) { - this.customCompletionFunction = fn; - } - setParsed(parsed) { - this.aliases = parsed.aliases; - } -} -export function completion(yargs, usage, command, shim) { - return new Completion(yargs, usage, command, shim); -} -function isSyncCompletionFunction(completionFunction) { - return completionFunction.length < 3; -} -function isFallbackCompletionFunction(completionFunction) { - return completionFunction.length > 3; -} diff --git a/node_modules/yargs/build/lib/middleware.js b/node_modules/yargs/build/lib/middleware.js deleted file mode 100644 index 4e561a7..0000000 --- a/node_modules/yargs/build/lib/middleware.js +++ /dev/null @@ -1,88 +0,0 @@ -import { argsert } from './argsert.js'; -import { isPromise } from './utils/is-promise.js'; -export class GlobalMiddleware { - constructor(yargs) { - this.globalMiddleware = []; - this.frozens = []; - this.yargs = yargs; - } - addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) { - argsert(' [boolean] [boolean] [boolean]', [callback, applyBeforeValidation, global], arguments.length); - if (Array.isArray(callback)) { - for (let i = 0; i < callback.length; i++) { - if (typeof callback[i] !== 'function') { - throw Error('middleware must be a function'); - } - const m = callback[i]; - m.applyBeforeValidation = applyBeforeValidation; - m.global = global; - } - Array.prototype.push.apply(this.globalMiddleware, callback); - } - else if (typeof callback === 'function') { - const m = callback; - m.applyBeforeValidation = applyBeforeValidation; - m.global = global; - m.mutates = mutates; - this.globalMiddleware.push(callback); - } - return this.yargs; - } - addCoerceMiddleware(callback, option) { - const aliases = this.yargs.getAliases(); - this.globalMiddleware = this.globalMiddleware.filter(m => { - const toCheck = [...(aliases[option] || []), option]; - if (!m.option) - return true; - else - return !toCheck.includes(m.option); - }); - callback.option = option; - return this.addMiddleware(callback, true, true, true); - } - getMiddleware() { - return this.globalMiddleware; - } - freeze() { - this.frozens.push([...this.globalMiddleware]); - } - unfreeze() { - const frozen = this.frozens.pop(); - if (frozen !== undefined) - this.globalMiddleware = frozen; - } - reset() { - this.globalMiddleware = this.globalMiddleware.filter(m => m.global); - } -} -export function commandMiddlewareFactory(commandMiddleware) { - if (!commandMiddleware) - return []; - return commandMiddleware.map(middleware => { - middleware.applyBeforeValidation = false; - return middleware; - }); -} -export function applyMiddleware(argv, yargs, middlewares, beforeValidation) { - return middlewares.reduce((acc, middleware) => { - if (middleware.applyBeforeValidation !== beforeValidation) { - return acc; - } - if (middleware.mutates) { - if (middleware.applied) - return acc; - middleware.applied = true; - } - if (isPromise(acc)) { - return acc - .then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)])) - .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj)); - } - else { - const result = middleware(acc, yargs); - return isPromise(result) - ? result.then(middlewareObj => Object.assign(acc, middlewareObj)) - : Object.assign(acc, result); - } - }, argv); -} diff --git a/node_modules/yargs/build/lib/parse-command.js b/node_modules/yargs/build/lib/parse-command.js deleted file mode 100644 index 4989f53..0000000 --- a/node_modules/yargs/build/lib/parse-command.js +++ /dev/null @@ -1,32 +0,0 @@ -export function parseCommand(cmd) { - const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' '); - const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/); - const bregex = /\.*[\][<>]/g; - const firstCommand = splitCommand.shift(); - if (!firstCommand) - throw new Error(`No command found in: ${cmd}`); - const parsedCommand = { - cmd: firstCommand.replace(bregex, ''), - demanded: [], - optional: [], - }; - splitCommand.forEach((cmd, i) => { - let variadic = false; - cmd = cmd.replace(/\s/g, ''); - if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1) - variadic = true; - if (/^\[/.test(cmd)) { - parsedCommand.optional.push({ - cmd: cmd.replace(bregex, '').split('|'), - variadic, - }); - } - else { - parsedCommand.demanded.push({ - cmd: cmd.replace(bregex, '').split('|'), - variadic, - }); - } - }); - return parsedCommand; -} diff --git a/node_modules/yargs/build/lib/typings/common-types.js b/node_modules/yargs/build/lib/typings/common-types.js deleted file mode 100644 index 73e1773..0000000 --- a/node_modules/yargs/build/lib/typings/common-types.js +++ /dev/null @@ -1,9 +0,0 @@ -export function assertNotStrictEqual(actual, expected, shim, message) { - shim.assert.notStrictEqual(actual, expected, message); -} -export function assertSingleKey(actual, shim) { - shim.assert.strictEqual(typeof actual, 'string'); -} -export function objectKeys(object) { - return Object.keys(object); -} diff --git a/node_modules/yargs/build/lib/typings/yargs-parser-types.js b/node_modules/yargs/build/lib/typings/yargs-parser-types.js deleted file mode 100644 index cb0ff5c..0000000 --- a/node_modules/yargs/build/lib/typings/yargs-parser-types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/node_modules/yargs/build/lib/usage.js b/node_modules/yargs/build/lib/usage.js deleted file mode 100644 index 0127c13..0000000 --- a/node_modules/yargs/build/lib/usage.js +++ /dev/null @@ -1,584 +0,0 @@ -import { objFilter } from './utils/obj-filter.js'; -import { YError } from './yerror.js'; -import setBlocking from './utils/set-blocking.js'; -function isBoolean(fail) { - return typeof fail === 'boolean'; -} -export function usage(yargs, shim) { - const __ = shim.y18n.__; - const self = {}; - const fails = []; - self.failFn = function failFn(f) { - fails.push(f); - }; - let failMessage = null; - let globalFailMessage = null; - let showHelpOnFail = true; - self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) { - const [enabled, message] = typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2]; - if (yargs.getInternalMethods().isGlobalContext()) { - globalFailMessage = message; - } - failMessage = message; - showHelpOnFail = enabled; - return self; - }; - let failureOutput = false; - self.fail = function fail(msg, err) { - const logger = yargs.getInternalMethods().getLoggerInstance(); - if (fails.length) { - for (let i = fails.length - 1; i >= 0; --i) { - const fail = fails[i]; - if (isBoolean(fail)) { - if (err) - throw err; - else if (msg) - throw Error(msg); - } - else { - fail(msg, err, self); - } - } - } - else { - if (yargs.getExitProcess()) - setBlocking(true); - if (!failureOutput) { - failureOutput = true; - if (showHelpOnFail) { - yargs.showHelp('error'); - logger.error(); - } - if (msg || err) - logger.error(msg || err); - const globalOrCommandFailMessage = failMessage || globalFailMessage; - if (globalOrCommandFailMessage) { - if (msg || err) - logger.error(''); - logger.error(globalOrCommandFailMessage); - } - } - err = err || new YError(msg); - if (yargs.getExitProcess()) { - return yargs.exit(1); - } - else if (yargs.getInternalMethods().hasParseCallback()) { - return yargs.exit(1, err); - } - else { - throw err; - } - } - }; - let usages = []; - let usageDisabled = false; - self.usage = (msg, description) => { - if (msg === null) { - usageDisabled = true; - usages = []; - return self; - } - usageDisabled = false; - usages.push([msg, description || '']); - return self; - }; - self.getUsage = () => { - return usages; - }; - self.getUsageDisabled = () => { - return usageDisabled; - }; - self.getPositionalGroupName = () => { - return __('Positionals:'); - }; - let examples = []; - self.example = (cmd, description) => { - examples.push([cmd, description || '']); - }; - let commands = []; - self.command = function command(cmd, description, isDefault, aliases, deprecated = false) { - if (isDefault) { - commands = commands.map(cmdArray => { - cmdArray[2] = false; - return cmdArray; - }); - } - commands.push([cmd, description || '', isDefault, aliases, deprecated]); - }; - self.getCommands = () => commands; - let descriptions = {}; - self.describe = function describe(keyOrKeys, desc) { - if (Array.isArray(keyOrKeys)) { - keyOrKeys.forEach(k => { - self.describe(k, desc); - }); - } - else if (typeof keyOrKeys === 'object') { - Object.keys(keyOrKeys).forEach(k => { - self.describe(k, keyOrKeys[k]); - }); - } - else { - descriptions[keyOrKeys] = desc; - } - }; - self.getDescriptions = () => descriptions; - let epilogs = []; - self.epilog = msg => { - epilogs.push(msg); - }; - let wrapSet = false; - let wrap; - self.wrap = cols => { - wrapSet = true; - wrap = cols; - }; - self.getWrap = () => { - if (shim.getEnv('YARGS_DISABLE_WRAP')) { - return null; - } - if (!wrapSet) { - wrap = windowWidth(); - wrapSet = true; - } - return wrap; - }; - const deferY18nLookupPrefix = '__yargsString__:'; - self.deferY18nLookup = str => deferY18nLookupPrefix + str; - self.help = function help() { - if (cachedHelpMessage) - return cachedHelpMessage; - normalizeAliases(); - const base$0 = yargs.customScriptName - ? yargs.$0 - : shim.path.basename(yargs.$0); - const demandedOptions = yargs.getDemandedOptions(); - const demandedCommands = yargs.getDemandedCommands(); - const deprecatedOptions = yargs.getDeprecatedOptions(); - const groups = yargs.getGroups(); - const options = yargs.getOptions(); - let keys = []; - keys = keys.concat(Object.keys(descriptions)); - keys = keys.concat(Object.keys(demandedOptions)); - keys = keys.concat(Object.keys(demandedCommands)); - keys = keys.concat(Object.keys(options.default)); - keys = keys.filter(filterHiddenOptions); - keys = Object.keys(keys.reduce((acc, key) => { - if (key !== '_') - acc[key] = true; - return acc; - }, {})); - const theWrap = self.getWrap(); - const ui = shim.cliui({ - width: theWrap, - wrap: !!theWrap, - }); - if (!usageDisabled) { - if (usages.length) { - usages.forEach(usage => { - ui.div({ text: `${usage[0].replace(/\$0/g, base$0)}` }); - if (usage[1]) { - ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] }); - } - }); - ui.div(); - } - else if (commands.length) { - let u = null; - if (demandedCommands._) { - u = `${base$0} <${__('command')}>\n`; - } - else { - u = `${base$0} [${__('command')}]\n`; - } - ui.div(`${u}`); - } - } - if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) { - ui.div(__('Commands:')); - const context = yargs.getInternalMethods().getContext(); - const parentCommands = context.commands.length - ? `${context.commands.join(' ')} ` - : ''; - if (yargs.getInternalMethods().getParserConfiguration()['sort-commands'] === - true) { - commands = commands.sort((a, b) => a[0].localeCompare(b[0])); - } - const prefix = base$0 ? `${base$0} ` : ''; - commands.forEach(command => { - const commandString = `${prefix}${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; - ui.span({ - text: commandString, - padding: [0, 2, 0, 2], - width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4, - }, { text: command[1] }); - const hints = []; - if (command[2]) - hints.push(`[${__('default')}]`); - if (command[3] && command[3].length) { - hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`); - } - if (command[4]) { - if (typeof command[4] === 'string') { - hints.push(`[${__('deprecated: %s', command[4])}]`); - } - else { - hints.push(`[${__('deprecated')}]`); - } - } - if (hints.length) { - ui.div({ - text: hints.join(' '), - padding: [0, 0, 0, 2], - align: 'right', - }); - } - else { - ui.div(); - } - }); - ui.div(); - } - const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []); - keys = keys.filter(key => !yargs.parsed.newAliases[key] && - aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1)); - const defaultGroup = __('Options:'); - if (!groups[defaultGroup]) - groups[defaultGroup] = []; - addUngroupedKeys(keys, options.alias, groups, defaultGroup); - const isLongSwitch = (sw) => /^--/.test(getText(sw)); - const displayedGroups = Object.keys(groups) - .filter(groupName => groups[groupName].length > 0) - .map(groupName => { - const normalizedKeys = groups[groupName] - .filter(filterHiddenOptions) - .map(key => { - if (aliasKeys.includes(key)) - return key; - for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) { - if ((options.alias[aliasKey] || []).includes(key)) - return aliasKey; - } - return key; - }); - return { groupName, normalizedKeys }; - }) - .filter(({ normalizedKeys }) => normalizedKeys.length > 0) - .map(({ groupName, normalizedKeys }) => { - const switches = normalizedKeys.reduce((acc, key) => { - acc[key] = [key] - .concat(options.alias[key] || []) - .map(sw => { - if (groupName === self.getPositionalGroupName()) - return sw; - else { - return ((/^[0-9]$/.test(sw) - ? options.boolean.includes(key) - ? '-' - : '--' - : sw.length > 1 - ? '--' - : '-') + sw); - } - }) - .sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2) - ? 0 - : isLongSwitch(sw1) - ? 1 - : -1) - .join(', '); - return acc; - }, {}); - return { groupName, normalizedKeys, switches }; - }); - const shortSwitchesUsed = displayedGroups - .filter(({ groupName }) => groupName !== self.getPositionalGroupName()) - .some(({ normalizedKeys, switches }) => !normalizedKeys.every(key => isLongSwitch(switches[key]))); - if (shortSwitchesUsed) { - displayedGroups - .filter(({ groupName }) => groupName !== self.getPositionalGroupName()) - .forEach(({ normalizedKeys, switches }) => { - normalizedKeys.forEach(key => { - if (isLongSwitch(switches[key])) { - switches[key] = addIndentation(switches[key], '-x, '.length); - } - }); - }); - } - displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => { - ui.div(groupName); - normalizedKeys.forEach(key => { - const kswitch = switches[key]; - let desc = descriptions[key] || ''; - let type = null; - if (desc.includes(deferY18nLookupPrefix)) - desc = __(desc.substring(deferY18nLookupPrefix.length)); - if (options.boolean.includes(key)) - type = `[${__('boolean')}]`; - if (options.count.includes(key)) - type = `[${__('count')}]`; - if (options.string.includes(key)) - type = `[${__('string')}]`; - if (options.normalize.includes(key)) - type = `[${__('string')}]`; - if (options.array.includes(key)) - type = `[${__('array')}]`; - if (options.number.includes(key)) - type = `[${__('number')}]`; - const deprecatedExtra = (deprecated) => typeof deprecated === 'string' - ? `[${__('deprecated: %s', deprecated)}]` - : `[${__('deprecated')}]`; - const extra = [ - key in deprecatedOptions - ? deprecatedExtra(deprecatedOptions[key]) - : null, - type, - key in demandedOptions ? `[${__('required')}]` : null, - options.choices && options.choices[key] - ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` - : null, - defaultString(options.default[key], options.defaultDescription[key]), - ] - .filter(Boolean) - .join(' '); - ui.span({ - text: getText(kswitch), - padding: [0, 2, 0, 2 + getIndentation(kswitch)], - width: maxWidth(switches, theWrap) + 4, - }, desc); - const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()['hide-types'] === - true; - if (extra && !shouldHideOptionExtras) - ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }); - else - ui.div(); - }); - ui.div(); - }); - if (examples.length) { - ui.div(__('Examples:')); - examples.forEach(example => { - example[0] = example[0].replace(/\$0/g, base$0); - }); - examples.forEach(example => { - if (example[1] === '') { - ui.div({ - text: example[0], - padding: [0, 2, 0, 2], - }); - } - else { - ui.div({ - text: example[0], - padding: [0, 2, 0, 2], - width: maxWidth(examples, theWrap) + 4, - }, { - text: example[1], - }); - } - }); - ui.div(); - } - if (epilogs.length > 0) { - const e = epilogs - .map(epilog => epilog.replace(/\$0/g, base$0)) - .join('\n'); - ui.div(`${e}\n`); - } - return ui.toString().replace(/\s*$/, ''); - }; - function maxWidth(table, theWrap, modifier) { - let width = 0; - if (!Array.isArray(table)) { - table = Object.values(table).map(v => [v]); - } - table.forEach(v => { - width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width); - }); - if (theWrap) - width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10)); - return width; - } - function normalizeAliases() { - const demandedOptions = yargs.getDemandedOptions(); - const options = yargs.getOptions(); - (Object.keys(options.alias) || []).forEach(key => { - options.alias[key].forEach(alias => { - if (descriptions[alias]) - self.describe(key, descriptions[alias]); - if (alias in demandedOptions) - yargs.demandOption(key, demandedOptions[alias]); - if (options.boolean.includes(alias)) - yargs.boolean(key); - if (options.count.includes(alias)) - yargs.count(key); - if (options.string.includes(alias)) - yargs.string(key); - if (options.normalize.includes(alias)) - yargs.normalize(key); - if (options.array.includes(alias)) - yargs.array(key); - if (options.number.includes(alias)) - yargs.number(key); - }); - }); - } - let cachedHelpMessage; - self.cacheHelpMessage = function () { - cachedHelpMessage = this.help(); - }; - self.clearCachedHelpMessage = function () { - cachedHelpMessage = undefined; - }; - self.hasCachedHelpMessage = function () { - return !!cachedHelpMessage; - }; - function addUngroupedKeys(keys, aliases, groups, defaultGroup) { - let groupedKeys = []; - let toCheck = null; - Object.keys(groups).forEach(group => { - groupedKeys = groupedKeys.concat(groups[group]); - }); - keys.forEach(key => { - toCheck = [key].concat(aliases[key]); - if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) { - groups[defaultGroup].push(key); - } - }); - return groupedKeys; - } - function filterHiddenOptions(key) { - return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 || - yargs.parsed.argv[yargs.getOptions().showHiddenOpt]); - } - self.showHelp = (level) => { - const logger = yargs.getInternalMethods().getLoggerInstance(); - if (!level) - level = 'error'; - const emit = typeof level === 'function' ? level : logger[level]; - emit(self.help()); - }; - self.functionDescription = fn => { - const description = fn.name - ? shim.Parser.decamelize(fn.name, '-') - : __('generated-value'); - return ['(', description, ')'].join(''); - }; - self.stringifiedValues = function stringifiedValues(values, separator) { - let string = ''; - const sep = separator || ', '; - const array = [].concat(values); - if (!values || !array.length) - return string; - array.forEach(value => { - if (string.length) - string += sep; - string += JSON.stringify(value); - }); - return string; - }; - function defaultString(value, defaultDescription) { - let string = `[${__('default:')} `; - if (value === undefined && !defaultDescription) - return null; - if (defaultDescription) { - string += defaultDescription; - } - else { - switch (typeof value) { - case 'string': - string += `"${value}"`; - break; - case 'object': - string += JSON.stringify(value); - break; - default: - string += value; - } - } - return `${string}]`; - } - function windowWidth() { - const maxWidth = 80; - if (shim.process.stdColumns) { - return Math.min(maxWidth, shim.process.stdColumns); - } - else { - return maxWidth; - } - } - let version = null; - self.version = ver => { - version = ver; - }; - self.showVersion = level => { - const logger = yargs.getInternalMethods().getLoggerInstance(); - if (!level) - level = 'error'; - const emit = typeof level === 'function' ? level : logger[level]; - emit(version); - }; - self.reset = function reset(localLookup) { - failMessage = null; - failureOutput = false; - usages = []; - usageDisabled = false; - epilogs = []; - examples = []; - commands = []; - descriptions = objFilter(descriptions, k => !localLookup[k]); - return self; - }; - const frozens = []; - self.freeze = function freeze() { - frozens.push({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions, - }); - }; - self.unfreeze = function unfreeze(defaultCommand = false) { - const frozen = frozens.pop(); - if (!frozen) - return; - if (defaultCommand) { - descriptions = { ...frozen.descriptions, ...descriptions }; - commands = [...frozen.commands, ...commands]; - usages = [...frozen.usages, ...usages]; - examples = [...frozen.examples, ...examples]; - epilogs = [...frozen.epilogs, ...epilogs]; - } - else { - ({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions, - } = frozen); - } - }; - return self; -} -function isIndentedText(text) { - return typeof text === 'object'; -} -function addIndentation(text, indent) { - return isIndentedText(text) - ? { text: text.text, indentation: text.indentation + indent } - : { text, indentation: indent }; -} -function getIndentation(text) { - return isIndentedText(text) ? text.indentation : 0; -} -function getText(text) { - return isIndentedText(text) ? text.text : text; -} diff --git a/node_modules/yargs/build/lib/utils/apply-extends.js b/node_modules/yargs/build/lib/utils/apply-extends.js deleted file mode 100644 index 0e593b4..0000000 --- a/node_modules/yargs/build/lib/utils/apply-extends.js +++ /dev/null @@ -1,59 +0,0 @@ -import { YError } from '../yerror.js'; -let previouslyVisitedConfigs = []; -let shim; -export function applyExtends(config, cwd, mergeExtends, _shim) { - shim = _shim; - let defaultConfig = {}; - if (Object.prototype.hasOwnProperty.call(config, 'extends')) { - if (typeof config.extends !== 'string') - return defaultConfig; - const isPath = /\.json|\..*rc$/.test(config.extends); - let pathToDefault = null; - if (!isPath) { - try { - pathToDefault = require.resolve(config.extends); - } - catch (_err) { - return config; - } - } - else { - pathToDefault = getPathToDefaultConfig(cwd, config.extends); - } - checkForCircularExtends(pathToDefault); - previouslyVisitedConfigs.push(pathToDefault); - defaultConfig = isPath - ? JSON.parse(shim.readFileSync(pathToDefault, 'utf8')) - : require(config.extends); - delete config.extends; - defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim); - } - previouslyVisitedConfigs = []; - return mergeExtends - ? mergeDeep(defaultConfig, config) - : Object.assign({}, defaultConfig, config); -} -function checkForCircularExtends(cfgPath) { - if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) { - throw new YError(`Circular extended configurations: '${cfgPath}'.`); - } -} -function getPathToDefaultConfig(cwd, pathToExtend) { - return shim.path.resolve(cwd, pathToExtend); -} -function mergeDeep(config1, config2) { - const target = {}; - function isObject(obj) { - return obj && typeof obj === 'object' && !Array.isArray(obj); - } - Object.assign(target, config1); - for (const key of Object.keys(config2)) { - if (isObject(config2[key]) && isObject(target[key])) { - target[key] = mergeDeep(config1[key], config2[key]); - } - else { - target[key] = config2[key]; - } - } - return target; -} diff --git a/node_modules/yargs/build/lib/utils/is-promise.js b/node_modules/yargs/build/lib/utils/is-promise.js deleted file mode 100644 index d250c08..0000000 --- a/node_modules/yargs/build/lib/utils/is-promise.js +++ /dev/null @@ -1,5 +0,0 @@ -export function isPromise(maybePromise) { - return (!!maybePromise && - !!maybePromise.then && - typeof maybePromise.then === 'function'); -} diff --git a/node_modules/yargs/build/lib/utils/levenshtein.js b/node_modules/yargs/build/lib/utils/levenshtein.js deleted file mode 100644 index 60575ef..0000000 --- a/node_modules/yargs/build/lib/utils/levenshtein.js +++ /dev/null @@ -1,34 +0,0 @@ -export function levenshtein(a, b) { - if (a.length === 0) - return b.length; - if (b.length === 0) - return a.length; - const matrix = []; - let i; - for (i = 0; i <= b.length; i++) { - matrix[i] = [i]; - } - let j; - for (j = 0; j <= a.length; j++) { - matrix[0][j] = j; - } - for (i = 1; i <= b.length; i++) { - for (j = 1; j <= a.length; j++) { - if (b.charAt(i - 1) === a.charAt(j - 1)) { - matrix[i][j] = matrix[i - 1][j - 1]; - } - else { - if (i > 1 && - j > 1 && - b.charAt(i - 2) === a.charAt(j - 1) && - b.charAt(i - 1) === a.charAt(j - 2)) { - matrix[i][j] = matrix[i - 2][j - 2] + 1; - } - else { - matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1)); - } - } - } - } - return matrix[b.length][a.length]; -} diff --git a/node_modules/yargs/build/lib/utils/maybe-async-result.js b/node_modules/yargs/build/lib/utils/maybe-async-result.js deleted file mode 100644 index 8c6a40c..0000000 --- a/node_modules/yargs/build/lib/utils/maybe-async-result.js +++ /dev/null @@ -1,17 +0,0 @@ -import { isPromise } from './is-promise.js'; -export function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => { - throw err; -}) { - try { - const result = isFunction(getResult) ? getResult() : getResult; - return isPromise(result) - ? result.then((result) => resultHandler(result)) - : resultHandler(result); - } - catch (err) { - return errorHandler(err); - } -} -function isFunction(arg) { - return typeof arg === 'function'; -} diff --git a/node_modules/yargs/build/lib/utils/obj-filter.js b/node_modules/yargs/build/lib/utils/obj-filter.js deleted file mode 100644 index cd68ad2..0000000 --- a/node_modules/yargs/build/lib/utils/obj-filter.js +++ /dev/null @@ -1,10 +0,0 @@ -import { objectKeys } from '../typings/common-types.js'; -export function objFilter(original = {}, filter = () => true) { - const obj = {}; - objectKeys(original).forEach(key => { - if (filter(key, original[key])) { - obj[key] = original[key]; - } - }); - return obj; -} diff --git a/node_modules/yargs/build/lib/utils/process-argv.js b/node_modules/yargs/build/lib/utils/process-argv.js deleted file mode 100644 index 74dc9e4..0000000 --- a/node_modules/yargs/build/lib/utils/process-argv.js +++ /dev/null @@ -1,17 +0,0 @@ -function getProcessArgvBinIndex() { - if (isBundledElectronApp()) - return 0; - return 1; -} -function isBundledElectronApp() { - return isElectronApp() && !process.defaultApp; -} -function isElectronApp() { - return !!process.versions.electron; -} -export function hideBin(argv) { - return argv.slice(getProcessArgvBinIndex() + 1); -} -export function getProcessArgvBin() { - return process.argv[getProcessArgvBinIndex()]; -} diff --git a/node_modules/yargs/build/lib/utils/set-blocking.js b/node_modules/yargs/build/lib/utils/set-blocking.js deleted file mode 100644 index 88fb806..0000000 --- a/node_modules/yargs/build/lib/utils/set-blocking.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function setBlocking(blocking) { - if (typeof process === 'undefined') - return; - [process.stdout, process.stderr].forEach(_stream => { - const stream = _stream; - if (stream._handle && - stream.isTTY && - typeof stream._handle.setBlocking === 'function') { - stream._handle.setBlocking(blocking); - } - }); -} diff --git a/node_modules/yargs/build/lib/utils/which-module.js b/node_modules/yargs/build/lib/utils/which-module.js deleted file mode 100644 index 5974e22..0000000 --- a/node_modules/yargs/build/lib/utils/which-module.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function whichModule(exported) { - if (typeof require === 'undefined') - return null; - for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) { - mod = require.cache[files[i]]; - if (mod.exports === exported) - return mod; - } - return null; -} diff --git a/node_modules/yargs/build/lib/validation.js b/node_modules/yargs/build/lib/validation.js deleted file mode 100644 index bd2e1b8..0000000 --- a/node_modules/yargs/build/lib/validation.js +++ /dev/null @@ -1,305 +0,0 @@ -import { argsert } from './argsert.js'; -import { assertNotStrictEqual, } from './typings/common-types.js'; -import { levenshtein as distance } from './utils/levenshtein.js'; -import { objFilter } from './utils/obj-filter.js'; -const specialKeys = ['$0', '--', '_']; -export function validation(yargs, usage, shim) { - const __ = shim.y18n.__; - const __n = shim.y18n.__n; - const self = {}; - self.nonOptionCount = function nonOptionCount(argv) { - const demandedCommands = yargs.getDemandedCommands(); - const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0); - const _s = positionalCount - yargs.getInternalMethods().getContext().commands.length; - if (demandedCommands._ && - (_s < demandedCommands._.min || _s > demandedCommands._.max)) { - if (_s < demandedCommands._.min) { - if (demandedCommands._.minMsg !== undefined) { - usage.fail(demandedCommands._.minMsg - ? demandedCommands._.minMsg - .replace(/\$0/g, _s.toString()) - .replace(/\$1/, demandedCommands._.min.toString()) - : null); - } - else { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s.toString(), demandedCommands._.min.toString())); - } - } - else if (_s > demandedCommands._.max) { - if (demandedCommands._.maxMsg !== undefined) { - usage.fail(demandedCommands._.maxMsg - ? demandedCommands._.maxMsg - .replace(/\$0/g, _s.toString()) - .replace(/\$1/, demandedCommands._.max.toString()) - : null); - } - else { - usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s.toString(), demandedCommands._.max.toString())); - } - } - } - }; - self.positionalCount = function positionalCount(required, observed) { - if (observed < required) { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed + '', required + '')); - } - }; - self.requiredArguments = function requiredArguments(argv, demandedOptions) { - let missing = null; - for (const key of Object.keys(demandedOptions)) { - if (!Object.prototype.hasOwnProperty.call(argv, key) || - typeof argv[key] === 'undefined') { - missing = missing || {}; - missing[key] = demandedOptions[key]; - } - } - if (missing) { - const customMsgs = []; - for (const key of Object.keys(missing)) { - const msg = missing[key]; - if (msg && customMsgs.indexOf(msg) < 0) { - customMsgs.push(msg); - } - } - const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : ''; - usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg)); - } - }; - self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) { - var _a; - const commandKeys = yargs - .getInternalMethods() - .getCommandInstance() - .getCommands(); - const unknown = []; - const currentContext = yargs.getInternalMethods().getContext(); - Object.keys(argv).forEach(key => { - if (!specialKeys.includes(key) && - !Object.prototype.hasOwnProperty.call(positionalMap, key) && - !Object.prototype.hasOwnProperty.call(yargs.getInternalMethods().getParseContext(), key) && - !self.isValidAndSomeAliasIsNotNew(key, aliases)) { - unknown.push(key); - } - }); - if (checkPositionals && - (currentContext.commands.length > 0 || - commandKeys.length > 0 || - isDefaultCommand)) { - argv._.slice(currentContext.commands.length).forEach(key => { - if (!commandKeys.includes('' + key)) { - unknown.push('' + key); - } - }); - } - if (checkPositionals) { - const demandedCommands = yargs.getDemandedCommands(); - const maxNonOptDemanded = ((_a = demandedCommands._) === null || _a === void 0 ? void 0 : _a.max) || 0; - const expected = currentContext.commands.length + maxNonOptDemanded; - if (expected < argv._.length) { - argv._.slice(expected).forEach(key => { - key = String(key); - if (!currentContext.commands.includes(key) && - !unknown.includes(key)) { - unknown.push(key); - } - }); - } - } - if (unknown.length) { - usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.map(s => (s.trim() ? s : `"${s}"`)).join(', '))); - } - }; - self.unknownCommands = function unknownCommands(argv) { - const commandKeys = yargs - .getInternalMethods() - .getCommandInstance() - .getCommands(); - const unknown = []; - const currentContext = yargs.getInternalMethods().getContext(); - if (currentContext.commands.length > 0 || commandKeys.length > 0) { - argv._.slice(currentContext.commands.length).forEach(key => { - if (!commandKeys.includes('' + key)) { - unknown.push('' + key); - } - }); - } - if (unknown.length > 0) { - usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', '))); - return true; - } - else { - return false; - } - }; - self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) { - if (!Object.prototype.hasOwnProperty.call(aliases, key)) { - return false; - } - const newAliases = yargs.parsed.newAliases; - return [key, ...aliases[key]].some(a => !Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]); - }; - self.limitedChoices = function limitedChoices(argv) { - const options = yargs.getOptions(); - const invalid = {}; - if (!Object.keys(options.choices).length) - return; - Object.keys(argv).forEach(key => { - if (specialKeys.indexOf(key) === -1 && - Object.prototype.hasOwnProperty.call(options.choices, key)) { - [].concat(argv[key]).forEach(value => { - if (options.choices[key].indexOf(value) === -1 && - value !== undefined) { - invalid[key] = (invalid[key] || []).concat(value); - } - }); - } - }); - const invalidKeys = Object.keys(invalid); - if (!invalidKeys.length) - return; - let msg = __('Invalid values:'); - invalidKeys.forEach(key => { - msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`; - }); - usage.fail(msg); - }; - let implied = {}; - self.implies = function implies(key, value) { - argsert(' [array|number|string]', [key, value], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach(k => { - self.implies(k, key[k]); - }); - } - else { - yargs.global(key); - if (!implied[key]) { - implied[key] = []; - } - if (Array.isArray(value)) { - value.forEach(i => self.implies(key, i)); - } - else { - assertNotStrictEqual(value, undefined, shim); - implied[key].push(value); - } - } - }; - self.getImplied = function getImplied() { - return implied; - }; - function keyExists(argv, val) { - const num = Number(val); - val = isNaN(num) ? val : num; - if (typeof val === 'number') { - val = argv._.length >= val; - } - else if (val.match(/^--no-.+/)) { - val = val.match(/^--no-(.+)/)[1]; - val = !Object.prototype.hasOwnProperty.call(argv, val); - } - else { - val = Object.prototype.hasOwnProperty.call(argv, val); - } - return val; - } - self.implications = function implications(argv) { - const implyFail = []; - Object.keys(implied).forEach(key => { - const origKey = key; - (implied[key] || []).forEach(value => { - let key = origKey; - const origValue = value; - key = keyExists(argv, key); - value = keyExists(argv, value); - if (key && !value) { - implyFail.push(` ${origKey} -> ${origValue}`); - } - }); - }); - if (implyFail.length) { - let msg = `${__('Implications failed:')}\n`; - implyFail.forEach(value => { - msg += value; - }); - usage.fail(msg); - } - }; - let conflicting = {}; - self.conflicts = function conflicts(key, value) { - argsert(' [array|string]', [key, value], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach(k => { - self.conflicts(k, key[k]); - }); - } - else { - yargs.global(key); - if (!conflicting[key]) { - conflicting[key] = []; - } - if (Array.isArray(value)) { - value.forEach(i => self.conflicts(key, i)); - } - else { - conflicting[key].push(value); - } - } - }; - self.getConflicting = () => conflicting; - self.conflicting = function conflictingFn(argv) { - Object.keys(argv).forEach(key => { - if (conflicting[key]) { - conflicting[key].forEach(value => { - if (value && argv[key] !== undefined && argv[value] !== undefined) { - usage.fail(__('Arguments %s and %s are mutually exclusive', key, value)); - } - }); - } - }); - if (yargs.getInternalMethods().getParserConfiguration()['strip-dashed']) { - Object.keys(conflicting).forEach(key => { - conflicting[key].forEach(value => { - if (value && - argv[shim.Parser.camelCase(key)] !== undefined && - argv[shim.Parser.camelCase(value)] !== undefined) { - usage.fail(__('Arguments %s and %s are mutually exclusive', key, value)); - } - }); - }); - } - }; - self.recommendCommands = function recommendCommands(cmd, potentialCommands) { - const threshold = 3; - potentialCommands = potentialCommands.sort((a, b) => b.length - a.length); - let recommended = null; - let bestDistance = Infinity; - for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) { - const d = distance(cmd, candidate); - if (d <= threshold && d < bestDistance) { - bestDistance = d; - recommended = candidate; - } - } - if (recommended) - usage.fail(__('Did you mean %s?', recommended)); - }; - self.reset = function reset(localLookup) { - implied = objFilter(implied, k => !localLookup[k]); - conflicting = objFilter(conflicting, k => !localLookup[k]); - return self; - }; - const frozens = []; - self.freeze = function freeze() { - frozens.push({ - implied, - conflicting, - }); - }; - self.unfreeze = function unfreeze() { - const frozen = frozens.pop(); - assertNotStrictEqual(frozen, undefined, shim); - ({ implied, conflicting } = frozen); - }; - return self; -} diff --git a/node_modules/yargs/build/lib/yargs-factory.js b/node_modules/yargs/build/lib/yargs-factory.js deleted file mode 100644 index c4b1d50..0000000 --- a/node_modules/yargs/build/lib/yargs-factory.js +++ /dev/null @@ -1,1512 +0,0 @@ -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var _YargsInstance_command, _YargsInstance_cwd, _YargsInstance_context, _YargsInstance_completion, _YargsInstance_completionCommand, _YargsInstance_defaultShowHiddenOpt, _YargsInstance_exitError, _YargsInstance_detectLocale, _YargsInstance_emittedWarnings, _YargsInstance_exitProcess, _YargsInstance_frozens, _YargsInstance_globalMiddleware, _YargsInstance_groups, _YargsInstance_hasOutput, _YargsInstance_helpOpt, _YargsInstance_isGlobalContext, _YargsInstance_logger, _YargsInstance_output, _YargsInstance_options, _YargsInstance_parentRequire, _YargsInstance_parserConfig, _YargsInstance_parseFn, _YargsInstance_parseContext, _YargsInstance_pkgs, _YargsInstance_preservedGroups, _YargsInstance_processArgs, _YargsInstance_recommendCommands, _YargsInstance_shim, _YargsInstance_strict, _YargsInstance_strictCommands, _YargsInstance_strictOptions, _YargsInstance_usage, _YargsInstance_usageConfig, _YargsInstance_versionOpt, _YargsInstance_validation; -import { command as Command, } from './command.js'; -import { assertNotStrictEqual, assertSingleKey, objectKeys, } from './typings/common-types.js'; -import { YError } from './yerror.js'; -import { usage as Usage } from './usage.js'; -import { argsert } from './argsert.js'; -import { completion as Completion, } from './completion.js'; -import { validation as Validation, } from './validation.js'; -import { objFilter } from './utils/obj-filter.js'; -import { applyExtends } from './utils/apply-extends.js'; -import { applyMiddleware, GlobalMiddleware, } from './middleware.js'; -import { isPromise } from './utils/is-promise.js'; -import { maybeAsyncResult } from './utils/maybe-async-result.js'; -import setBlocking from './utils/set-blocking.js'; -export function YargsFactory(_shim) { - return (processArgs = [], cwd = _shim.process.cwd(), parentRequire) => { - const yargs = new YargsInstance(processArgs, cwd, parentRequire, _shim); - Object.defineProperty(yargs, 'argv', { - get: () => { - return yargs.parse(); - }, - enumerable: true, - }); - yargs.help(); - yargs.version(); - return yargs; - }; -} -const kCopyDoubleDash = Symbol('copyDoubleDash'); -const kCreateLogger = Symbol('copyDoubleDash'); -const kDeleteFromParserHintObject = Symbol('deleteFromParserHintObject'); -const kEmitWarning = Symbol('emitWarning'); -const kFreeze = Symbol('freeze'); -const kGetDollarZero = Symbol('getDollarZero'); -const kGetParserConfiguration = Symbol('getParserConfiguration'); -const kGetUsageConfiguration = Symbol('getUsageConfiguration'); -const kGuessLocale = Symbol('guessLocale'); -const kGuessVersion = Symbol('guessVersion'); -const kParsePositionalNumbers = Symbol('parsePositionalNumbers'); -const kPkgUp = Symbol('pkgUp'); -const kPopulateParserHintArray = Symbol('populateParserHintArray'); -const kPopulateParserHintSingleValueDictionary = Symbol('populateParserHintSingleValueDictionary'); -const kPopulateParserHintArrayDictionary = Symbol('populateParserHintArrayDictionary'); -const kPopulateParserHintDictionary = Symbol('populateParserHintDictionary'); -const kSanitizeKey = Symbol('sanitizeKey'); -const kSetKey = Symbol('setKey'); -const kUnfreeze = Symbol('unfreeze'); -const kValidateAsync = Symbol('validateAsync'); -const kGetCommandInstance = Symbol('getCommandInstance'); -const kGetContext = Symbol('getContext'); -const kGetHasOutput = Symbol('getHasOutput'); -const kGetLoggerInstance = Symbol('getLoggerInstance'); -const kGetParseContext = Symbol('getParseContext'); -const kGetUsageInstance = Symbol('getUsageInstance'); -const kGetValidationInstance = Symbol('getValidationInstance'); -const kHasParseCallback = Symbol('hasParseCallback'); -const kIsGlobalContext = Symbol('isGlobalContext'); -const kPostProcess = Symbol('postProcess'); -const kRebase = Symbol('rebase'); -const kReset = Symbol('reset'); -const kRunYargsParserAndExecuteCommands = Symbol('runYargsParserAndExecuteCommands'); -const kRunValidation = Symbol('runValidation'); -const kSetHasOutput = Symbol('setHasOutput'); -const kTrackManuallySetKeys = Symbol('kTrackManuallySetKeys'); -export class YargsInstance { - constructor(processArgs = [], cwd, parentRequire, shim) { - this.customScriptName = false; - this.parsed = false; - _YargsInstance_command.set(this, void 0); - _YargsInstance_cwd.set(this, void 0); - _YargsInstance_context.set(this, { commands: [], fullCommands: [] }); - _YargsInstance_completion.set(this, null); - _YargsInstance_completionCommand.set(this, null); - _YargsInstance_defaultShowHiddenOpt.set(this, 'show-hidden'); - _YargsInstance_exitError.set(this, null); - _YargsInstance_detectLocale.set(this, true); - _YargsInstance_emittedWarnings.set(this, {}); - _YargsInstance_exitProcess.set(this, true); - _YargsInstance_frozens.set(this, []); - _YargsInstance_globalMiddleware.set(this, void 0); - _YargsInstance_groups.set(this, {}); - _YargsInstance_hasOutput.set(this, false); - _YargsInstance_helpOpt.set(this, null); - _YargsInstance_isGlobalContext.set(this, true); - _YargsInstance_logger.set(this, void 0); - _YargsInstance_output.set(this, ''); - _YargsInstance_options.set(this, void 0); - _YargsInstance_parentRequire.set(this, void 0); - _YargsInstance_parserConfig.set(this, {}); - _YargsInstance_parseFn.set(this, null); - _YargsInstance_parseContext.set(this, null); - _YargsInstance_pkgs.set(this, {}); - _YargsInstance_preservedGroups.set(this, {}); - _YargsInstance_processArgs.set(this, void 0); - _YargsInstance_recommendCommands.set(this, false); - _YargsInstance_shim.set(this, void 0); - _YargsInstance_strict.set(this, false); - _YargsInstance_strictCommands.set(this, false); - _YargsInstance_strictOptions.set(this, false); - _YargsInstance_usage.set(this, void 0); - _YargsInstance_usageConfig.set(this, {}); - _YargsInstance_versionOpt.set(this, null); - _YargsInstance_validation.set(this, void 0); - __classPrivateFieldSet(this, _YargsInstance_shim, shim, "f"); - __classPrivateFieldSet(this, _YargsInstance_processArgs, processArgs, "f"); - __classPrivateFieldSet(this, _YargsInstance_cwd, cwd, "f"); - __classPrivateFieldSet(this, _YargsInstance_parentRequire, parentRequire, "f"); - __classPrivateFieldSet(this, _YargsInstance_globalMiddleware, new GlobalMiddleware(this), "f"); - this.$0 = this[kGetDollarZero](); - this[kReset](); - __classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f"), "f"); - __classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), "f"); - __classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f"), "f"); - __classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f"), "f"); - __classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f"); - __classPrivateFieldSet(this, _YargsInstance_logger, this[kCreateLogger](), "f"); - } - addHelpOpt(opt, msg) { - const defaultHelpOpt = 'help'; - argsert('[string|boolean] [string]', [opt, msg], arguments.length); - if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) { - this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")); - __classPrivateFieldSet(this, _YargsInstance_helpOpt, null, "f"); - } - if (opt === false && msg === undefined) - return this; - __classPrivateFieldSet(this, _YargsInstance_helpOpt, typeof opt === 'string' ? opt : defaultHelpOpt, "f"); - this.boolean(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")); - this.describe(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"), msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show help')); - return this; - } - help(opt, msg) { - return this.addHelpOpt(opt, msg); - } - addShowHiddenOpt(opt, msg) { - argsert('[string|boolean] [string]', [opt, msg], arguments.length); - if (opt === false && msg === undefined) - return this; - const showHiddenOpt = typeof opt === 'string' ? opt : __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f"); - this.boolean(showHiddenOpt); - this.describe(showHiddenOpt, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show hidden options')); - __classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = showHiddenOpt; - return this; - } - showHidden(opt, msg) { - return this.addShowHiddenOpt(opt, msg); - } - alias(key, value) { - argsert(' [string|array]', [key, value], arguments.length); - this[kPopulateParserHintArrayDictionary](this.alias.bind(this), 'alias', key, value); - return this; - } - array(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('array', keys); - this[kTrackManuallySetKeys](keys); - return this; - } - boolean(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('boolean', keys); - this[kTrackManuallySetKeys](keys); - return this; - } - check(f, global) { - argsert(' [boolean]', [f, global], arguments.length); - this.middleware((argv, _yargs) => { - return maybeAsyncResult(() => { - return f(argv, _yargs.getOptions()); - }, (result) => { - if (!result) { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(__classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__('Argument check failed: %s', f.toString())); - } - else if (typeof result === 'string' || result instanceof Error) { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(result.toString(), result); - } - return argv; - }, (err) => { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(err.message ? err.message : err.toString(), err); - return argv; - }); - }, false, global); - return this; - } - choices(key, value) { - argsert(' [string|array]', [key, value], arguments.length); - this[kPopulateParserHintArrayDictionary](this.choices.bind(this), 'choices', key, value); - return this; - } - coerce(keys, value) { - argsert(' [function]', [keys, value], arguments.length); - if (Array.isArray(keys)) { - if (!value) { - throw new YError('coerce callback must be provided'); - } - for (const key of keys) { - this.coerce(key, value); - } - return this; - } - else if (typeof keys === 'object') { - for (const key of Object.keys(keys)) { - this.coerce(key, keys[key]); - } - return this; - } - if (!value) { - throw new YError('coerce callback must be provided'); - } - __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true; - __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addCoerceMiddleware((argv, yargs) => { - let aliases; - const shouldCoerce = Object.prototype.hasOwnProperty.call(argv, keys); - if (!shouldCoerce) { - return argv; - } - return maybeAsyncResult(() => { - aliases = yargs.getAliases(); - return value(argv[keys]); - }, (result) => { - argv[keys] = result; - const stripAliased = yargs - .getInternalMethods() - .getParserConfiguration()['strip-aliased']; - if (aliases[keys] && stripAliased !== true) { - for (const alias of aliases[keys]) { - argv[alias] = result; - } - } - return argv; - }, (err) => { - throw new YError(err.message); - }); - }, keys); - return this; - } - conflicts(key1, key2) { - argsert(' [string|array]', [key1, key2], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").conflicts(key1, key2); - return this; - } - config(key = 'config', msg, parseFn) { - argsert('[object|string] [string|function] [function]', [key, msg, parseFn], arguments.length); - if (typeof key === 'object' && !Array.isArray(key)) { - key = applyExtends(key, __classPrivateFieldGet(this, _YargsInstance_cwd, "f"), this[kGetParserConfiguration]()['deep-merge-config'] || false, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = (__classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []).concat(key); - return this; - } - if (typeof msg === 'function') { - parseFn = msg; - msg = undefined; - } - this.describe(key, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Path to JSON config file')); - (Array.isArray(key) ? key : [key]).forEach(k => { - __classPrivateFieldGet(this, _YargsInstance_options, "f").config[k] = parseFn || true; - }); - return this; - } - completion(cmd, desc, fn) { - argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length); - if (typeof desc === 'function') { - fn = desc; - desc = undefined; - } - __classPrivateFieldSet(this, _YargsInstance_completionCommand, cmd || __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") || 'completion', "f"); - if (!desc && desc !== false) { - desc = 'generate completion script'; - } - this.command(__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f"), desc); - if (fn) - __classPrivateFieldGet(this, _YargsInstance_completion, "f").registerFunction(fn); - return this; - } - command(cmd, description, builder, handler, middlewares, deprecated) { - argsert(' [string|boolean] [function|object] [function] [array] [boolean|string]', [cmd, description, builder, handler, middlewares, deprecated], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_command, "f").addHandler(cmd, description, builder, handler, middlewares, deprecated); - return this; - } - commands(cmd, description, builder, handler, middlewares, deprecated) { - return this.command(cmd, description, builder, handler, middlewares, deprecated); - } - commandDir(dir, opts) { - argsert(' [object]', [dir, opts], arguments.length); - const req = __classPrivateFieldGet(this, _YargsInstance_parentRequire, "f") || __classPrivateFieldGet(this, _YargsInstance_shim, "f").require; - __classPrivateFieldGet(this, _YargsInstance_command, "f").addDirectory(dir, req, __classPrivateFieldGet(this, _YargsInstance_shim, "f").getCallerFile(), opts); - return this; - } - count(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('count', keys); - this[kTrackManuallySetKeys](keys); - return this; - } - default(key, value, defaultDescription) { - argsert(' [*] [string]', [key, value, defaultDescription], arguments.length); - if (defaultDescription) { - assertSingleKey(key, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = defaultDescription; - } - if (typeof value === 'function') { - assertSingleKey(key, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - if (!__classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key]) - __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = - __classPrivateFieldGet(this, _YargsInstance_usage, "f").functionDescription(value); - value = value.call(); - } - this[kPopulateParserHintSingleValueDictionary](this.default.bind(this), 'default', key, value); - return this; - } - defaults(key, value, defaultDescription) { - return this.default(key, value, defaultDescription); - } - demandCommand(min = 1, max, minMsg, maxMsg) { - argsert('[number] [number|string] [string|null|undefined] [string|null|undefined]', [min, max, minMsg, maxMsg], arguments.length); - if (typeof max !== 'number') { - minMsg = max; - max = Infinity; - } - this.global('_', false); - __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedCommands._ = { - min, - max, - minMsg, - maxMsg, - }; - return this; - } - demand(keys, max, msg) { - if (Array.isArray(max)) { - max.forEach(key => { - assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - this.demandOption(key, msg); - }); - max = Infinity; - } - else if (typeof max !== 'number') { - msg = max; - max = Infinity; - } - if (typeof keys === 'number') { - assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - this.demandCommand(keys, max, msg, msg); - } - else if (Array.isArray(keys)) { - keys.forEach(key => { - assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - this.demandOption(key, msg); - }); - } - else { - if (typeof msg === 'string') { - this.demandOption(keys, msg); - } - else if (msg === true || typeof msg === 'undefined') { - this.demandOption(keys); - } - } - return this; - } - demandOption(keys, msg) { - argsert(' [string]', [keys, msg], arguments.length); - this[kPopulateParserHintSingleValueDictionary](this.demandOption.bind(this), 'demandedOptions', keys, msg); - return this; - } - deprecateOption(option, message) { - argsert(' [string|boolean]', [option, message], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions[option] = message; - return this; - } - describe(keys, description) { - argsert(' [string]', [keys, description], arguments.length); - this[kSetKey](keys, true); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").describe(keys, description); - return this; - } - detectLocale(detect) { - argsert('', [detect], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_detectLocale, detect, "f"); - return this; - } - env(prefix) { - argsert('[string|boolean]', [prefix], arguments.length); - if (prefix === false) - delete __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix; - else - __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix = prefix || ''; - return this; - } - epilogue(msg) { - argsert('', [msg], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").epilog(msg); - return this; - } - epilog(msg) { - return this.epilogue(msg); - } - example(cmd, description) { - argsert(' [string]', [cmd, description], arguments.length); - if (Array.isArray(cmd)) { - cmd.forEach(exampleParams => this.example(...exampleParams)); - } - else { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").example(cmd, description); - } - return this; - } - exit(code, err) { - __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f"); - __classPrivateFieldSet(this, _YargsInstance_exitError, err, "f"); - if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) - __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.exit(code); - } - exitProcess(enabled = true) { - argsert('[boolean]', [enabled], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_exitProcess, enabled, "f"); - return this; - } - fail(f) { - argsert('', [f], arguments.length); - if (typeof f === 'boolean' && f !== false) { - throw new YError("Invalid first argument. Expected function or boolean 'false'"); - } - __classPrivateFieldGet(this, _YargsInstance_usage, "f").failFn(f); - return this; - } - getAliases() { - return this.parsed ? this.parsed.aliases : {}; - } - async getCompletion(args, done) { - argsert(' [function]', [args, done], arguments.length); - if (!done) { - return new Promise((resolve, reject) => { - __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => { - if (err) - reject(err); - else - resolve(completions); - }); - }); - } - else { - return __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, done); - } - } - getDemandedOptions() { - argsert([], 0); - return __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedOptions; - } - getDemandedCommands() { - argsert([], 0); - return __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedCommands; - } - getDeprecatedOptions() { - argsert([], 0); - return __classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions; - } - getDetectLocale() { - return __classPrivateFieldGet(this, _YargsInstance_detectLocale, "f"); - } - getExitProcess() { - return __classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"); - } - getGroups() { - return Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_groups, "f"), __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")); - } - getHelp() { - __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f"); - if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) { - if (!this.parsed) { - const parse = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), undefined, undefined, 0, true); - if (isPromise(parse)) { - return parse.then(() => { - return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help(); - }); - } - } - const builderResponse = __classPrivateFieldGet(this, _YargsInstance_command, "f").runDefaultBuilderOn(this); - if (isPromise(builderResponse)) { - return builderResponse.then(() => { - return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help(); - }); - } - } - return Promise.resolve(__classPrivateFieldGet(this, _YargsInstance_usage, "f").help()); - } - getOptions() { - return __classPrivateFieldGet(this, _YargsInstance_options, "f"); - } - getStrict() { - return __classPrivateFieldGet(this, _YargsInstance_strict, "f"); - } - getStrictCommands() { - return __classPrivateFieldGet(this, _YargsInstance_strictCommands, "f"); - } - getStrictOptions() { - return __classPrivateFieldGet(this, _YargsInstance_strictOptions, "f"); - } - global(globals, global) { - argsert(' [boolean]', [globals, global], arguments.length); - globals = [].concat(globals); - if (global !== false) { - __classPrivateFieldGet(this, _YargsInstance_options, "f").local = __classPrivateFieldGet(this, _YargsInstance_options, "f").local.filter(l => globals.indexOf(l) === -1); - } - else { - globals.forEach(g => { - if (!__classPrivateFieldGet(this, _YargsInstance_options, "f").local.includes(g)) - __classPrivateFieldGet(this, _YargsInstance_options, "f").local.push(g); - }); - } - return this; - } - group(opts, groupName) { - argsert(' ', [opts, groupName], arguments.length); - const existing = __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName] || __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName]; - if (__classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName]) { - delete __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName]; - } - const seen = {}; - __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName] = (existing || []).concat(opts).filter(key => { - if (seen[key]) - return false; - return (seen[key] = true); - }); - return this; - } - hide(key) { - argsert('', [key], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_options, "f").hiddenOptions.push(key); - return this; - } - implies(key, value) { - argsert(' [number|string|array]', [key, value], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").implies(key, value); - return this; - } - locale(locale) { - argsert('[string]', [locale], arguments.length); - if (locale === undefined) { - this[kGuessLocale](); - return __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.getLocale(); - } - __classPrivateFieldSet(this, _YargsInstance_detectLocale, false, "f"); - __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.setLocale(locale); - return this; - } - middleware(callback, applyBeforeValidation, global) { - return __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addMiddleware(callback, !!applyBeforeValidation, global); - } - nargs(key, value) { - argsert(' [number]', [key, value], arguments.length); - this[kPopulateParserHintSingleValueDictionary](this.nargs.bind(this), 'narg', key, value); - return this; - } - normalize(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('normalize', keys); - return this; - } - number(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('number', keys); - this[kTrackManuallySetKeys](keys); - return this; - } - option(key, opt) { - argsert(' [object]', [key, opt], arguments.length); - if (typeof key === 'object') { - Object.keys(key).forEach(k => { - this.options(k, key[k]); - }); - } - else { - if (typeof opt !== 'object') { - opt = {}; - } - this[kTrackManuallySetKeys](key); - if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && (key === 'version' || (opt === null || opt === void 0 ? void 0 : opt.alias) === 'version')) { - this[kEmitWarning]([ - '"version" is a reserved word.', - 'Please do one of the following:', - '- Disable version with `yargs.version(false)` if using "version" as an option', - '- Use the built-in `yargs.version` method instead (if applicable)', - '- Use a different option key', - 'https://yargs.js.org/docs/#api-reference-version', - ].join('\n'), undefined, 'versionWarning'); - } - __classPrivateFieldGet(this, _YargsInstance_options, "f").key[key] = true; - if (opt.alias) - this.alias(key, opt.alias); - const deprecate = opt.deprecate || opt.deprecated; - if (deprecate) { - this.deprecateOption(key, deprecate); - } - const demand = opt.demand || opt.required || opt.require; - if (demand) { - this.demand(key, demand); - } - if (opt.demandOption) { - this.demandOption(key, typeof opt.demandOption === 'string' ? opt.demandOption : undefined); - } - if (opt.conflicts) { - this.conflicts(key, opt.conflicts); - } - if ('default' in opt) { - this.default(key, opt.default); - } - if (opt.implies !== undefined) { - this.implies(key, opt.implies); - } - if (opt.nargs !== undefined) { - this.nargs(key, opt.nargs); - } - if (opt.config) { - this.config(key, opt.configParser); - } - if (opt.normalize) { - this.normalize(key); - } - if (opt.choices) { - this.choices(key, opt.choices); - } - if (opt.coerce) { - this.coerce(key, opt.coerce); - } - if (opt.group) { - this.group(key, opt.group); - } - if (opt.boolean || opt.type === 'boolean') { - this.boolean(key); - if (opt.alias) - this.boolean(opt.alias); - } - if (opt.array || opt.type === 'array') { - this.array(key); - if (opt.alias) - this.array(opt.alias); - } - if (opt.number || opt.type === 'number') { - this.number(key); - if (opt.alias) - this.number(opt.alias); - } - if (opt.string || opt.type === 'string') { - this.string(key); - if (opt.alias) - this.string(opt.alias); - } - if (opt.count || opt.type === 'count') { - this.count(key); - } - if (typeof opt.global === 'boolean') { - this.global(key, opt.global); - } - if (opt.defaultDescription) { - __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = opt.defaultDescription; - } - if (opt.skipValidation) { - this.skipValidation(key); - } - const desc = opt.describe || opt.description || opt.desc; - const descriptions = __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions(); - if (!Object.prototype.hasOwnProperty.call(descriptions, key) || - typeof desc === 'string') { - this.describe(key, desc); - } - if (opt.hidden) { - this.hide(key); - } - if (opt.requiresArg) { - this.requiresArg(key); - } - } - return this; - } - options(key, opt) { - return this.option(key, opt); - } - parse(args, shortCircuit, _parseFn) { - argsert('[string|array] [function|boolean|object] [function]', [args, shortCircuit, _parseFn], arguments.length); - this[kFreeze](); - if (typeof args === 'undefined') { - args = __classPrivateFieldGet(this, _YargsInstance_processArgs, "f"); - } - if (typeof shortCircuit === 'object') { - __classPrivateFieldSet(this, _YargsInstance_parseContext, shortCircuit, "f"); - shortCircuit = _parseFn; - } - if (typeof shortCircuit === 'function') { - __classPrivateFieldSet(this, _YargsInstance_parseFn, shortCircuit, "f"); - shortCircuit = false; - } - if (!shortCircuit) - __classPrivateFieldSet(this, _YargsInstance_processArgs, args, "f"); - if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) - __classPrivateFieldSet(this, _YargsInstance_exitProcess, false, "f"); - const parsed = this[kRunYargsParserAndExecuteCommands](args, !!shortCircuit); - const tmpParsed = this.parsed; - __classPrivateFieldGet(this, _YargsInstance_completion, "f").setParsed(this.parsed); - if (isPromise(parsed)) { - return parsed - .then(argv => { - if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) - __classPrivateFieldGet(this, _YargsInstance_parseFn, "f").call(this, __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), argv, __classPrivateFieldGet(this, _YargsInstance_output, "f")); - return argv; - }) - .catch(err => { - if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) { - __classPrivateFieldGet(this, _YargsInstance_parseFn, "f")(err, this.parsed.argv, __classPrivateFieldGet(this, _YargsInstance_output, "f")); - } - throw err; - }) - .finally(() => { - this[kUnfreeze](); - this.parsed = tmpParsed; - }); - } - else { - if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) - __classPrivateFieldGet(this, _YargsInstance_parseFn, "f").call(this, __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), parsed, __classPrivateFieldGet(this, _YargsInstance_output, "f")); - this[kUnfreeze](); - this.parsed = tmpParsed; - } - return parsed; - } - parseAsync(args, shortCircuit, _parseFn) { - const maybePromise = this.parse(args, shortCircuit, _parseFn); - return !isPromise(maybePromise) - ? Promise.resolve(maybePromise) - : maybePromise; - } - parseSync(args, shortCircuit, _parseFn) { - const maybePromise = this.parse(args, shortCircuit, _parseFn); - if (isPromise(maybePromise)) { - throw new YError('.parseSync() must not be used with asynchronous builders, handlers, or middleware'); - } - return maybePromise; - } - parserConfiguration(config) { - argsert('', [config], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_parserConfig, config, "f"); - return this; - } - pkgConf(key, rootPath) { - argsert(' [string]', [key, rootPath], arguments.length); - let conf = null; - const obj = this[kPkgUp](rootPath || __classPrivateFieldGet(this, _YargsInstance_cwd, "f")); - if (obj[key] && typeof obj[key] === 'object') { - conf = applyExtends(obj[key], rootPath || __classPrivateFieldGet(this, _YargsInstance_cwd, "f"), this[kGetParserConfiguration]()['deep-merge-config'] || false, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = (__classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []).concat(conf); - } - return this; - } - positional(key, opts) { - argsert(' ', [key, opts], arguments.length); - const supportedOpts = [ - 'default', - 'defaultDescription', - 'implies', - 'normalize', - 'choices', - 'conflicts', - 'coerce', - 'type', - 'describe', - 'desc', - 'description', - 'alias', - ]; - opts = objFilter(opts, (k, v) => { - if (k === 'type' && !['string', 'number', 'boolean'].includes(v)) - return false; - return supportedOpts.includes(k); - }); - const fullCommand = __classPrivateFieldGet(this, _YargsInstance_context, "f").fullCommands[__classPrivateFieldGet(this, _YargsInstance_context, "f").fullCommands.length - 1]; - const parseOptions = fullCommand - ? __classPrivateFieldGet(this, _YargsInstance_command, "f").cmdToParseOptions(fullCommand) - : { - array: [], - alias: {}, - default: {}, - demand: {}, - }; - objectKeys(parseOptions).forEach(pk => { - const parseOption = parseOptions[pk]; - if (Array.isArray(parseOption)) { - if (parseOption.indexOf(key) !== -1) - opts[pk] = true; - } - else { - if (parseOption[key] && !(pk in opts)) - opts[pk] = parseOption[key]; - } - }); - this.group(key, __classPrivateFieldGet(this, _YargsInstance_usage, "f").getPositionalGroupName()); - return this.option(key, opts); - } - recommendCommands(recommend = true) { - argsert('[boolean]', [recommend], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_recommendCommands, recommend, "f"); - return this; - } - required(keys, max, msg) { - return this.demand(keys, max, msg); - } - require(keys, max, msg) { - return this.demand(keys, max, msg); - } - requiresArg(keys) { - argsert(' [number]', [keys], arguments.length); - if (typeof keys === 'string' && __classPrivateFieldGet(this, _YargsInstance_options, "f").narg[keys]) { - return this; - } - else { - this[kPopulateParserHintSingleValueDictionary](this.requiresArg.bind(this), 'narg', keys, NaN); - } - return this; - } - showCompletionScript($0, cmd) { - argsert('[string] [string]', [$0, cmd], arguments.length); - $0 = $0 || this.$0; - __classPrivateFieldGet(this, _YargsInstance_logger, "f").log(__classPrivateFieldGet(this, _YargsInstance_completion, "f").generateCompletionScript($0, cmd || __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") || 'completion')); - return this; - } - showHelp(level) { - argsert('[string|function]', [level], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f"); - if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) { - if (!this.parsed) { - const parse = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), undefined, undefined, 0, true); - if (isPromise(parse)) { - parse.then(() => { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level); - }); - return this; - } - } - const builderResponse = __classPrivateFieldGet(this, _YargsInstance_command, "f").runDefaultBuilderOn(this); - if (isPromise(builderResponse)) { - builderResponse.then(() => { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level); - }); - return this; - } - } - __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level); - return this; - } - scriptName(scriptName) { - this.customScriptName = true; - this.$0 = scriptName; - return this; - } - showHelpOnFail(enabled, message) { - argsert('[boolean|string] [string]', [enabled, message], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelpOnFail(enabled, message); - return this; - } - showVersion(level) { - argsert('[string|function]', [level], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").showVersion(level); - return this; - } - skipValidation(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('skipValidation', keys); - return this; - } - strict(enabled) { - argsert('[boolean]', [enabled], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_strict, enabled !== false, "f"); - return this; - } - strictCommands(enabled) { - argsert('[boolean]', [enabled], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_strictCommands, enabled !== false, "f"); - return this; - } - strictOptions(enabled) { - argsert('[boolean]', [enabled], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_strictOptions, enabled !== false, "f"); - return this; - } - string(keys) { - argsert('', [keys], arguments.length); - this[kPopulateParserHintArray]('string', keys); - this[kTrackManuallySetKeys](keys); - return this; - } - terminalWidth() { - argsert([], 0); - return __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.stdColumns; - } - updateLocale(obj) { - return this.updateStrings(obj); - } - updateStrings(obj) { - argsert('', [obj], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_detectLocale, false, "f"); - __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.updateLocale(obj); - return this; - } - usage(msg, description, builder, handler) { - argsert(' [string|boolean] [function|object] [function]', [msg, description, builder, handler], arguments.length); - if (description !== undefined) { - assertNotStrictEqual(msg, null, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - if ((msg || '').match(/^\$0( |$)/)) { - return this.command(msg, description, builder, handler); - } - else { - throw new YError('.usage() description must start with $0 if being used as alias for .command()'); - } - } - else { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").usage(msg); - return this; - } - } - usageConfiguration(config) { - argsert('', [config], arguments.length); - __classPrivateFieldSet(this, _YargsInstance_usageConfig, config, "f"); - return this; - } - version(opt, msg, ver) { - const defaultVersionOpt = 'version'; - argsert('[boolean|string] [string] [string]', [opt, msg, ver], arguments.length); - if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f")) { - this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f")); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").version(undefined); - __classPrivateFieldSet(this, _YargsInstance_versionOpt, null, "f"); - } - if (arguments.length === 0) { - ver = this[kGuessVersion](); - opt = defaultVersionOpt; - } - else if (arguments.length === 1) { - if (opt === false) { - return this; - } - ver = opt; - opt = defaultVersionOpt; - } - else if (arguments.length === 2) { - ver = msg; - msg = undefined; - } - __classPrivateFieldSet(this, _YargsInstance_versionOpt, typeof opt === 'string' ? opt : defaultVersionOpt, "f"); - msg = msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup('Show version number'); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").version(ver || undefined); - this.boolean(__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f")); - this.describe(__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"), msg); - return this; - } - wrap(cols) { - argsert('', [cols], arguments.length); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").wrap(cols); - return this; - } - [(_YargsInstance_command = new WeakMap(), _YargsInstance_cwd = new WeakMap(), _YargsInstance_context = new WeakMap(), _YargsInstance_completion = new WeakMap(), _YargsInstance_completionCommand = new WeakMap(), _YargsInstance_defaultShowHiddenOpt = new WeakMap(), _YargsInstance_exitError = new WeakMap(), _YargsInstance_detectLocale = new WeakMap(), _YargsInstance_emittedWarnings = new WeakMap(), _YargsInstance_exitProcess = new WeakMap(), _YargsInstance_frozens = new WeakMap(), _YargsInstance_globalMiddleware = new WeakMap(), _YargsInstance_groups = new WeakMap(), _YargsInstance_hasOutput = new WeakMap(), _YargsInstance_helpOpt = new WeakMap(), _YargsInstance_isGlobalContext = new WeakMap(), _YargsInstance_logger = new WeakMap(), _YargsInstance_output = new WeakMap(), _YargsInstance_options = new WeakMap(), _YargsInstance_parentRequire = new WeakMap(), _YargsInstance_parserConfig = new WeakMap(), _YargsInstance_parseFn = new WeakMap(), _YargsInstance_parseContext = new WeakMap(), _YargsInstance_pkgs = new WeakMap(), _YargsInstance_preservedGroups = new WeakMap(), _YargsInstance_processArgs = new WeakMap(), _YargsInstance_recommendCommands = new WeakMap(), _YargsInstance_shim = new WeakMap(), _YargsInstance_strict = new WeakMap(), _YargsInstance_strictCommands = new WeakMap(), _YargsInstance_strictOptions = new WeakMap(), _YargsInstance_usage = new WeakMap(), _YargsInstance_usageConfig = new WeakMap(), _YargsInstance_versionOpt = new WeakMap(), _YargsInstance_validation = new WeakMap(), kCopyDoubleDash)](argv) { - if (!argv._ || !argv['--']) - return argv; - argv._.push.apply(argv._, argv['--']); - try { - delete argv['--']; - } - catch (_err) { } - return argv; - } - [kCreateLogger]() { - return { - log: (...args) => { - if (!this[kHasParseCallback]()) - console.log(...args); - __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f"); - if (__classPrivateFieldGet(this, _YargsInstance_output, "f").length) - __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + '\n', "f"); - __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + args.join(' '), "f"); - }, - error: (...args) => { - if (!this[kHasParseCallback]()) - console.error(...args); - __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f"); - if (__classPrivateFieldGet(this, _YargsInstance_output, "f").length) - __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + '\n', "f"); - __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + args.join(' '), "f"); - }, - }; - } - [kDeleteFromParserHintObject](optionKey) { - objectKeys(__classPrivateFieldGet(this, _YargsInstance_options, "f")).forEach((hintKey) => { - if (((key) => key === 'configObjects')(hintKey)) - return; - const hint = __classPrivateFieldGet(this, _YargsInstance_options, "f")[hintKey]; - if (Array.isArray(hint)) { - if (hint.includes(optionKey)) - hint.splice(hint.indexOf(optionKey), 1); - } - else if (typeof hint === 'object') { - delete hint[optionKey]; - } - }); - delete __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions()[optionKey]; - } - [kEmitWarning](warning, type, deduplicationId) { - if (!__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId]) { - __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning, type); - __classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId] = true; - } - } - [kFreeze]() { - __classPrivateFieldGet(this, _YargsInstance_frozens, "f").push({ - options: __classPrivateFieldGet(this, _YargsInstance_options, "f"), - configObjects: __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects.slice(0), - exitProcess: __classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"), - groups: __classPrivateFieldGet(this, _YargsInstance_groups, "f"), - strict: __classPrivateFieldGet(this, _YargsInstance_strict, "f"), - strictCommands: __classPrivateFieldGet(this, _YargsInstance_strictCommands, "f"), - strictOptions: __classPrivateFieldGet(this, _YargsInstance_strictOptions, "f"), - completionCommand: __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f"), - output: __classPrivateFieldGet(this, _YargsInstance_output, "f"), - exitError: __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), - hasOutput: __classPrivateFieldGet(this, _YargsInstance_hasOutput, "f"), - parsed: this.parsed, - parseFn: __classPrivateFieldGet(this, _YargsInstance_parseFn, "f"), - parseContext: __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"), - }); - __classPrivateFieldGet(this, _YargsInstance_usage, "f").freeze(); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").freeze(); - __classPrivateFieldGet(this, _YargsInstance_command, "f").freeze(); - __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").freeze(); - } - [kGetDollarZero]() { - let $0 = ''; - let default$0; - if (/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv()[0])) { - default$0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv().slice(1, 2); - } - else { - default$0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv().slice(0, 1); - } - $0 = default$0 - .map(x => { - const b = this[kRebase](__classPrivateFieldGet(this, _YargsInstance_cwd, "f"), x); - return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x; - }) - .join(' ') - .trim(); - if (__classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('_') && - __classPrivateFieldGet(this, _YargsInstance_shim, "f").getProcessArgvBin() === __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('_')) { - $0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f") - .getEnv('_') - .replace(`${__classPrivateFieldGet(this, _YargsInstance_shim, "f").path.dirname(__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.execPath())}/`, ''); - } - return $0; - } - [kGetParserConfiguration]() { - return __classPrivateFieldGet(this, _YargsInstance_parserConfig, "f"); - } - [kGetUsageConfiguration]() { - return __classPrivateFieldGet(this, _YargsInstance_usageConfig, "f"); - } - [kGuessLocale]() { - if (!__classPrivateFieldGet(this, _YargsInstance_detectLocale, "f")) - return; - const locale = __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LC_ALL') || - __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LC_MESSAGES') || - __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LANG') || - __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv('LANGUAGE') || - 'en_US'; - this.locale(locale.replace(/[.:].*/, '')); - } - [kGuessVersion]() { - const obj = this[kPkgUp](); - return obj.version || 'unknown'; - } - [kParsePositionalNumbers](argv) { - const args = argv['--'] ? argv['--'] : argv._; - for (let i = 0, arg; (arg = args[i]) !== undefined; i++) { - if (__classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.looksLikeNumber(arg) && - Number.isSafeInteger(Math.floor(parseFloat(`${arg}`)))) { - args[i] = Number(arg); - } - } - return argv; - } - [kPkgUp](rootPath) { - const npath = rootPath || '*'; - if (__classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath]) - return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath]; - let obj = {}; - try { - let startDir = rootPath || __classPrivateFieldGet(this, _YargsInstance_shim, "f").mainFilename; - if (!rootPath && __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.extname(startDir)) { - startDir = __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.dirname(startDir); - } - const pkgJsonPath = __classPrivateFieldGet(this, _YargsInstance_shim, "f").findUp(startDir, (dir, names) => { - if (names.includes('package.json')) { - return 'package.json'; - } - else { - return undefined; - } - }); - assertNotStrictEqual(pkgJsonPath, undefined, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - obj = JSON.parse(__classPrivateFieldGet(this, _YargsInstance_shim, "f").readFileSync(pkgJsonPath, 'utf8')); - } - catch (_noop) { } - __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath] = obj || {}; - return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath]; - } - [kPopulateParserHintArray](type, keys) { - keys = [].concat(keys); - keys.forEach(key => { - key = this[kSanitizeKey](key); - __classPrivateFieldGet(this, _YargsInstance_options, "f")[type].push(key); - }); - } - [kPopulateParserHintSingleValueDictionary](builder, type, key, value) { - this[kPopulateParserHintDictionary](builder, type, key, value, (type, key, value) => { - __classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] = value; - }); - } - [kPopulateParserHintArrayDictionary](builder, type, key, value) { - this[kPopulateParserHintDictionary](builder, type, key, value, (type, key, value) => { - __classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] || []).concat(value); - }); - } - [kPopulateParserHintDictionary](builder, type, key, value, singleKeyHandler) { - if (Array.isArray(key)) { - key.forEach(k => { - builder(k, value); - }); - } - else if (((key) => typeof key === 'object')(key)) { - for (const k of objectKeys(key)) { - builder(k, key[k]); - } - } - else { - singleKeyHandler(type, this[kSanitizeKey](key), value); - } - } - [kSanitizeKey](key) { - if (key === '__proto__') - return '___proto___'; - return key; - } - [kSetKey](key, set) { - this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this), 'key', key, set); - return this; - } - [kUnfreeze]() { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; - const frozen = __classPrivateFieldGet(this, _YargsInstance_frozens, "f").pop(); - assertNotStrictEqual(frozen, undefined, __classPrivateFieldGet(this, _YargsInstance_shim, "f")); - let configObjects; - (_a = this, _b = this, _c = this, _d = this, _e = this, _f = this, _g = this, _h = this, _j = this, _k = this, _l = this, _m = this, { - options: ({ set value(_o) { __classPrivateFieldSet(_a, _YargsInstance_options, _o, "f"); } }).value, - configObjects, - exitProcess: ({ set value(_o) { __classPrivateFieldSet(_b, _YargsInstance_exitProcess, _o, "f"); } }).value, - groups: ({ set value(_o) { __classPrivateFieldSet(_c, _YargsInstance_groups, _o, "f"); } }).value, - output: ({ set value(_o) { __classPrivateFieldSet(_d, _YargsInstance_output, _o, "f"); } }).value, - exitError: ({ set value(_o) { __classPrivateFieldSet(_e, _YargsInstance_exitError, _o, "f"); } }).value, - hasOutput: ({ set value(_o) { __classPrivateFieldSet(_f, _YargsInstance_hasOutput, _o, "f"); } }).value, - parsed: this.parsed, - strict: ({ set value(_o) { __classPrivateFieldSet(_g, _YargsInstance_strict, _o, "f"); } }).value, - strictCommands: ({ set value(_o) { __classPrivateFieldSet(_h, _YargsInstance_strictCommands, _o, "f"); } }).value, - strictOptions: ({ set value(_o) { __classPrivateFieldSet(_j, _YargsInstance_strictOptions, _o, "f"); } }).value, - completionCommand: ({ set value(_o) { __classPrivateFieldSet(_k, _YargsInstance_completionCommand, _o, "f"); } }).value, - parseFn: ({ set value(_o) { __classPrivateFieldSet(_l, _YargsInstance_parseFn, _o, "f"); } }).value, - parseContext: ({ set value(_o) { __classPrivateFieldSet(_m, _YargsInstance_parseContext, _o, "f"); } }).value, - } = frozen); - __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = configObjects; - __classPrivateFieldGet(this, _YargsInstance_usage, "f").unfreeze(); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").unfreeze(); - __classPrivateFieldGet(this, _YargsInstance_command, "f").unfreeze(); - __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").unfreeze(); - } - [kValidateAsync](validation, argv) { - return maybeAsyncResult(argv, result => { - validation(result); - return result; - }); - } - getInternalMethods() { - return { - getCommandInstance: this[kGetCommandInstance].bind(this), - getContext: this[kGetContext].bind(this), - getHasOutput: this[kGetHasOutput].bind(this), - getLoggerInstance: this[kGetLoggerInstance].bind(this), - getParseContext: this[kGetParseContext].bind(this), - getParserConfiguration: this[kGetParserConfiguration].bind(this), - getUsageConfiguration: this[kGetUsageConfiguration].bind(this), - getUsageInstance: this[kGetUsageInstance].bind(this), - getValidationInstance: this[kGetValidationInstance].bind(this), - hasParseCallback: this[kHasParseCallback].bind(this), - isGlobalContext: this[kIsGlobalContext].bind(this), - postProcess: this[kPostProcess].bind(this), - reset: this[kReset].bind(this), - runValidation: this[kRunValidation].bind(this), - runYargsParserAndExecuteCommands: this[kRunYargsParserAndExecuteCommands].bind(this), - setHasOutput: this[kSetHasOutput].bind(this), - }; - } - [kGetCommandInstance]() { - return __classPrivateFieldGet(this, _YargsInstance_command, "f"); - } - [kGetContext]() { - return __classPrivateFieldGet(this, _YargsInstance_context, "f"); - } - [kGetHasOutput]() { - return __classPrivateFieldGet(this, _YargsInstance_hasOutput, "f"); - } - [kGetLoggerInstance]() { - return __classPrivateFieldGet(this, _YargsInstance_logger, "f"); - } - [kGetParseContext]() { - return __classPrivateFieldGet(this, _YargsInstance_parseContext, "f") || {}; - } - [kGetUsageInstance]() { - return __classPrivateFieldGet(this, _YargsInstance_usage, "f"); - } - [kGetValidationInstance]() { - return __classPrivateFieldGet(this, _YargsInstance_validation, "f"); - } - [kHasParseCallback]() { - return !!__classPrivateFieldGet(this, _YargsInstance_parseFn, "f"); - } - [kIsGlobalContext]() { - return __classPrivateFieldGet(this, _YargsInstance_isGlobalContext, "f"); - } - [kPostProcess](argv, populateDoubleDash, calledFromCommand, runGlobalMiddleware) { - if (calledFromCommand) - return argv; - if (isPromise(argv)) - return argv; - if (!populateDoubleDash) { - argv = this[kCopyDoubleDash](argv); - } - const parsePositionalNumbers = this[kGetParserConfiguration]()['parse-positional-numbers'] || - this[kGetParserConfiguration]()['parse-positional-numbers'] === undefined; - if (parsePositionalNumbers) { - argv = this[kParsePositionalNumbers](argv); - } - if (runGlobalMiddleware) { - argv = applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), false); - } - return argv; - } - [kReset](aliases = {}) { - __classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f") || {}, "f"); - const tmpOptions = {}; - tmpOptions.local = __classPrivateFieldGet(this, _YargsInstance_options, "f").local || []; - tmpOptions.configObjects = __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []; - const localLookup = {}; - tmpOptions.local.forEach(l => { - localLookup[l] = true; - (aliases[l] || []).forEach(a => { - localLookup[a] = true; - }); - }); - Object.assign(__classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f"), Object.keys(__classPrivateFieldGet(this, _YargsInstance_groups, "f")).reduce((acc, groupName) => { - const keys = __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName].filter(key => !(key in localLookup)); - if (keys.length > 0) { - acc[groupName] = keys; - } - return acc; - }, {})); - __classPrivateFieldSet(this, _YargsInstance_groups, {}, "f"); - const arrayOptions = [ - 'array', - 'boolean', - 'string', - 'skipValidation', - 'count', - 'normalize', - 'number', - 'hiddenOptions', - ]; - const objectOptions = [ - 'narg', - 'key', - 'alias', - 'default', - 'defaultDescription', - 'config', - 'choices', - 'demandedOptions', - 'demandedCommands', - 'deprecatedOptions', - ]; - arrayOptions.forEach(k => { - tmpOptions[k] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[k] || []).filter((k) => !localLookup[k]); - }); - objectOptions.forEach((k) => { - tmpOptions[k] = objFilter(__classPrivateFieldGet(this, _YargsInstance_options, "f")[k], k => !localLookup[k]); - }); - tmpOptions.envPrefix = __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix; - __classPrivateFieldSet(this, _YargsInstance_options, tmpOptions, "f"); - __classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f") - ? __classPrivateFieldGet(this, _YargsInstance_usage, "f").reset(localLookup) - : Usage(this, __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f"); - __classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f") - ? __classPrivateFieldGet(this, _YargsInstance_validation, "f").reset(localLookup) - : Validation(this, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f"); - __classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f") - ? __classPrivateFieldGet(this, _YargsInstance_command, "f").reset() - : Command(__classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_validation, "f"), __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f"); - if (!__classPrivateFieldGet(this, _YargsInstance_completion, "f")) - __classPrivateFieldSet(this, _YargsInstance_completion, Completion(this, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_command, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f"); - __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").reset(); - __classPrivateFieldSet(this, _YargsInstance_completionCommand, null, "f"); - __classPrivateFieldSet(this, _YargsInstance_output, '', "f"); - __classPrivateFieldSet(this, _YargsInstance_exitError, null, "f"); - __classPrivateFieldSet(this, _YargsInstance_hasOutput, false, "f"); - this.parsed = false; - return this; - } - [kRebase](base, dir) { - return __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.relative(base, dir); - } - [kRunYargsParserAndExecuteCommands](args, shortCircuit, calledFromCommand, commandIndex = 0, helpOnly = false) { - let skipValidation = !!calledFromCommand || helpOnly; - args = args || __classPrivateFieldGet(this, _YargsInstance_processArgs, "f"); - __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__; - __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration](); - const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration['populate--']; - const config = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, { - 'populate--': true, - }); - const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), { - configuration: { 'parse-positional-numbers': false, ...config }, - })); - const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f")); - let argvPromise = undefined; - const aliases = parsed.aliases; - let helpOptSet = false; - let versionOptSet = false; - Object.keys(argv).forEach(key => { - if (key === __classPrivateFieldGet(this, _YargsInstance_helpOpt, "f") && argv[key]) { - helpOptSet = true; - } - else if (key === __classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && argv[key]) { - versionOptSet = true; - } - }); - argv.$0 = this.$0; - this.parsed = parsed; - if (commandIndex === 0) { - __classPrivateFieldGet(this, _YargsInstance_usage, "f").clearCachedHelpMessage(); - } - try { - this[kGuessLocale](); - if (shortCircuit) { - return this[kPostProcess](argv, populateDoubleDash, !!calledFromCommand, false); - } - if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) { - const helpCmds = [__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")] - .concat(aliases[__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")] || []) - .filter(k => k.length > 1); - if (helpCmds.includes('' + argv._[argv._.length - 1])) { - argv._.pop(); - helpOptSet = true; - } - } - __classPrivateFieldSet(this, _YargsInstance_isGlobalContext, false, "f"); - const handlerKeys = __classPrivateFieldGet(this, _YargsInstance_command, "f").getCommands(); - const requestCompletions = __classPrivateFieldGet(this, _YargsInstance_completion, "f").completionKey in argv; - const skipRecommendation = helpOptSet || requestCompletions || helpOnly; - if (argv._.length) { - if (handlerKeys.length) { - let firstUnknownCommand; - for (let i = commandIndex || 0, cmd; argv._[i] !== undefined; i++) { - cmd = String(argv._[i]); - if (handlerKeys.includes(cmd) && cmd !== __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) { - const innerArgv = __classPrivateFieldGet(this, _YargsInstance_command, "f").runCommand(cmd, this, parsed, i + 1, helpOnly, helpOptSet || versionOptSet || helpOnly); - return this[kPostProcess](innerArgv, populateDoubleDash, !!calledFromCommand, false); - } - else if (!firstUnknownCommand && - cmd !== __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) { - firstUnknownCommand = cmd; - break; - } - } - if (!__classPrivateFieldGet(this, _YargsInstance_command, "f").hasDefaultCommand() && - __classPrivateFieldGet(this, _YargsInstance_recommendCommands, "f") && - firstUnknownCommand && - !skipRecommendation) { - __classPrivateFieldGet(this, _YargsInstance_validation, "f").recommendCommands(firstUnknownCommand, handlerKeys); - } - } - if (__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") && - argv._.includes(__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) && - !requestCompletions) { - if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) - setBlocking(true); - this.showCompletionScript(); - this.exit(0); - } - } - if (__classPrivateFieldGet(this, _YargsInstance_command, "f").hasDefaultCommand() && !skipRecommendation) { - const innerArgv = __classPrivateFieldGet(this, _YargsInstance_command, "f").runCommand(null, this, parsed, 0, helpOnly, helpOptSet || versionOptSet || helpOnly); - return this[kPostProcess](innerArgv, populateDoubleDash, !!calledFromCommand, false); - } - if (requestCompletions) { - if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) - setBlocking(true); - args = [].concat(args); - const completionArgs = args.slice(args.indexOf(`--${__classPrivateFieldGet(this, _YargsInstance_completion, "f").completionKey}`) + 1); - __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(completionArgs, (err, completions) => { - if (err) - throw new YError(err.message); - (completions || []).forEach(completion => { - __classPrivateFieldGet(this, _YargsInstance_logger, "f").log(completion); - }); - this.exit(0); - }); - return this[kPostProcess](argv, !populateDoubleDash, !!calledFromCommand, false); - } - if (!__classPrivateFieldGet(this, _YargsInstance_hasOutput, "f")) { - if (helpOptSet) { - if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) - setBlocking(true); - skipValidation = true; - this.showHelp('log'); - this.exit(0); - } - else if (versionOptSet) { - if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) - setBlocking(true); - skipValidation = true; - __classPrivateFieldGet(this, _YargsInstance_usage, "f").showVersion('log'); - this.exit(0); - } - } - if (!skipValidation && __classPrivateFieldGet(this, _YargsInstance_options, "f").skipValidation.length > 0) { - skipValidation = Object.keys(argv).some(key => __classPrivateFieldGet(this, _YargsInstance_options, "f").skipValidation.indexOf(key) >= 0 && argv[key] === true); - } - if (!skipValidation) { - if (parsed.error) - throw new YError(parsed.error.message); - if (!requestCompletions) { - const validation = this[kRunValidation](aliases, {}, parsed.error); - if (!calledFromCommand) { - argvPromise = applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), true); - } - argvPromise = this[kValidateAsync](validation, argvPromise !== null && argvPromise !== void 0 ? argvPromise : argv); - if (isPromise(argvPromise) && !calledFromCommand) { - argvPromise = argvPromise.then(() => { - return applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), false); - }); - } - } - } - } - catch (err) { - if (err instanceof YError) - __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(err.message, err); - else - throw err; - } - return this[kPostProcess](argvPromise !== null && argvPromise !== void 0 ? argvPromise : argv, populateDoubleDash, !!calledFromCommand, true); - } - [kRunValidation](aliases, positionalMap, parseErrors, isDefaultCommand) { - const demandedOptions = { ...this.getDemandedOptions() }; - return (argv) => { - if (parseErrors) - throw new YError(parseErrors.message); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").nonOptionCount(argv); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").requiredArguments(argv, demandedOptions); - let failedStrictCommands = false; - if (__classPrivateFieldGet(this, _YargsInstance_strictCommands, "f")) { - failedStrictCommands = __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownCommands(argv); - } - if (__classPrivateFieldGet(this, _YargsInstance_strict, "f") && !failedStrictCommands) { - __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownArguments(argv, aliases, positionalMap, !!isDefaultCommand); - } - else if (__classPrivateFieldGet(this, _YargsInstance_strictOptions, "f")) { - __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownArguments(argv, aliases, {}, false, false); - } - __classPrivateFieldGet(this, _YargsInstance_validation, "f").limitedChoices(argv); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").implications(argv); - __classPrivateFieldGet(this, _YargsInstance_validation, "f").conflicting(argv); - }; - } - [kSetHasOutput]() { - __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f"); - } - [kTrackManuallySetKeys](keys) { - if (typeof keys === 'string') { - __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true; - } - else { - for (const k of keys) { - __classPrivateFieldGet(this, _YargsInstance_options, "f").key[k] = true; - } - } - } -} -export function isYargsInstance(y) { - return !!y && typeof y.getInternalMethods === 'function'; -} diff --git a/node_modules/yargs/build/lib/yerror.js b/node_modules/yargs/build/lib/yerror.js deleted file mode 100644 index 7a36684..0000000 --- a/node_modules/yargs/build/lib/yerror.js +++ /dev/null @@ -1,9 +0,0 @@ -export class YError extends Error { - constructor(msg) { - super(msg || 'yargs error'); - this.name = 'YError'; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, YError); - } - } -} diff --git a/node_modules/yargs/helpers/helpers.mjs b/node_modules/yargs/helpers/helpers.mjs deleted file mode 100644 index 3f96b3d..0000000 --- a/node_modules/yargs/helpers/helpers.mjs +++ /dev/null @@ -1,10 +0,0 @@ -import {applyExtends as _applyExtends} from '../build/lib/utils/apply-extends.js'; -import {hideBin} from '../build/lib/utils/process-argv.js'; -import Parser from 'yargs-parser'; -import shim from '../lib/platform-shims/esm.mjs'; - -const applyExtends = (config, cwd, mergeExtends) => { - return _applyExtends(config, cwd, mergeExtends, shim); -}; - -export {applyExtends, hideBin, Parser}; diff --git a/node_modules/yargs/helpers/index.js b/node_modules/yargs/helpers/index.js deleted file mode 100644 index 8ab79a3..0000000 --- a/node_modules/yargs/helpers/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const { - applyExtends, - cjsPlatformShim, - Parser, - processArgv, -} = require('../build/index.cjs'); - -module.exports = { - applyExtends: (config, cwd, mergeExtends) => { - return applyExtends(config, cwd, mergeExtends, cjsPlatformShim); - }, - hideBin: processArgv.hideBin, - Parser, -}; diff --git a/node_modules/yargs/helpers/package.json b/node_modules/yargs/helpers/package.json deleted file mode 100644 index 5bbefff..0000000 --- a/node_modules/yargs/helpers/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "commonjs" -} diff --git a/node_modules/yargs/index.cjs b/node_modules/yargs/index.cjs deleted file mode 100644 index d1eee82..0000000 --- a/node_modules/yargs/index.cjs +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; -// classic singleton yargs API, to use yargs -// without running as a singleton do: -// require('yargs/yargs')(process.argv.slice(2)) -const {Yargs, processArgv} = require('./build/index.cjs'); - -Argv(processArgv.hideBin(process.argv)); - -module.exports = Argv; - -function Argv(processArgs, cwd) { - const argv = Yargs(processArgs, cwd, require); - singletonify(argv); - // TODO(bcoe): warn if argv.parse() or argv.argv is used directly. - return argv; -} - -function defineGetter(obj, key, getter) { - Object.defineProperty(obj, key, { - configurable: true, - enumerable: true, - get: getter, - }); -} -function lookupGetter(obj, key) { - const desc = Object.getOwnPropertyDescriptor(obj, key); - if (typeof desc !== 'undefined') { - return desc.get; - } -} - -/* Hack an instance of Argv with process.argv into Argv - so people can do - require('yargs')(['--beeble=1','-z','zizzle']).argv - to parse a list of args and - require('yargs').argv - to get a parsed version of process.argv. -*/ -function singletonify(inst) { - [ - ...Object.keys(inst), - ...Object.getOwnPropertyNames(inst.constructor.prototype), - ].forEach(key => { - if (key === 'argv') { - defineGetter(Argv, key, lookupGetter(inst, key)); - } else if (typeof inst[key] === 'function') { - Argv[key] = inst[key].bind(inst); - } else { - defineGetter(Argv, '$0', () => inst.$0); - defineGetter(Argv, 'parsed', () => inst.parsed); - } - }); -} diff --git a/node_modules/yargs/index.mjs b/node_modules/yargs/index.mjs deleted file mode 100644 index c6440b9..0000000 --- a/node_modules/yargs/index.mjs +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -// Bootstraps yargs for ESM: -import esmPlatformShim from './lib/platform-shims/esm.mjs'; -import {YargsFactory} from './build/lib/yargs-factory.js'; - -const Yargs = YargsFactory(esmPlatformShim); -export default Yargs; diff --git a/node_modules/yargs/lib/platform-shims/browser.mjs b/node_modules/yargs/lib/platform-shims/browser.mjs deleted file mode 100644 index 5f8ec61..0000000 --- a/node_modules/yargs/lib/platform-shims/browser.mjs +++ /dev/null @@ -1,95 +0,0 @@ -/* eslint-disable no-unused-vars */ -'use strict'; - -import cliui from 'https://unpkg.com/cliui@7.0.1/index.mjs'; // eslint-disable-line -import Parser from 'https://unpkg.com/yargs-parser@19.0.0/browser.js'; // eslint-disable-line -import {getProcessArgvBin} from '../../build/lib/utils/process-argv.js'; -import {YError} from '../../build/lib/yerror.js'; - -const REQUIRE_ERROR = 'require is not supported in browser'; -const REQUIRE_DIRECTORY_ERROR = - 'loading a directory of commands is not supported in browser'; - -export default { - assert: { - notStrictEqual: (a, b) => { - // noop. - }, - strictEqual: (a, b) => { - // noop. - }, - }, - cliui, - findUp: () => undefined, - getEnv: key => { - // There is no environment in browser: - return undefined; - }, - inspect: console.log, - getCallerFile: () => { - throw new YError(REQUIRE_DIRECTORY_ERROR); - }, - getProcessArgvBin, - mainFilename: 'yargs', - Parser, - path: { - basename: str => str, - dirname: str => str, - extname: str => str, - relative: str => str, - }, - process: { - argv: () => [], - cwd: () => '', - emitWarning: (warning, name) => {}, - execPath: () => '', - // exit is noop browser: - exit: () => {}, - nextTick: cb => { - // eslint-disable-next-line no-undef - window.setTimeout(cb, 1); - }, - stdColumns: 80, - }, - readFileSync: () => { - return ''; - }, - require: () => { - throw new YError(REQUIRE_ERROR); - }, - requireDirectory: () => { - throw new YError(REQUIRE_DIRECTORY_ERROR); - }, - stringWidth: str => { - return [...str].length; - }, - // TODO: replace this with y18n once it's ported to ESM: - y18n: { - __: (...str) => { - if (str.length === 0) return ''; - const args = str.slice(1); - return sprintf(str[0], ...args); - }, - __n: (str1, str2, count, ...args) => { - if (count === 1) { - return sprintf(str1, ...args); - } else { - return sprintf(str2, ...args); - } - }, - getLocale: () => { - return 'en_US'; - }, - setLocale: () => {}, - updateLocale: () => {}, - }, -}; - -function sprintf(_str, ...args) { - let str = ''; - const split = _str.split('%s'); - split.forEach((token, i) => { - str += `${token}${split[i + 1] !== undefined && args[i] ? args[i] : ''}`; - }); - return str; -} diff --git a/node_modules/yargs/lib/platform-shims/esm.mjs b/node_modules/yargs/lib/platform-shims/esm.mjs deleted file mode 100644 index c25baa5..0000000 --- a/node_modules/yargs/lib/platform-shims/esm.mjs +++ /dev/null @@ -1,73 +0,0 @@ -'use strict' - -import { notStrictEqual, strictEqual } from 'assert' -import cliui from 'cliui' -import escalade from 'escalade/sync' -import { inspect } from 'util' -import { readFileSync } from 'fs' -import { fileURLToPath } from 'url'; -import Parser from 'yargs-parser' -import { basename, dirname, extname, relative, resolve } from 'path' -import { getProcessArgvBin } from '../../build/lib/utils/process-argv.js' -import { YError } from '../../build/lib/yerror.js' -import y18n from 'y18n' - -const REQUIRE_ERROR = 'require is not supported by ESM' -const REQUIRE_DIRECTORY_ERROR = 'loading a directory of commands is not supported yet for ESM' - -let __dirname; -try { - __dirname = fileURLToPath(import.meta.url); -} catch (e) { - __dirname = process.cwd(); -} -const mainFilename = __dirname.substring(0, __dirname.lastIndexOf('node_modules')); - -export default { - assert: { - notStrictEqual, - strictEqual - }, - cliui, - findUp: escalade, - getEnv: (key) => { - return process.env[key] - }, - inspect, - getCallerFile: () => { - throw new YError(REQUIRE_DIRECTORY_ERROR) - }, - getProcessArgvBin, - mainFilename: mainFilename || process.cwd(), - Parser, - path: { - basename, - dirname, - extname, - relative, - resolve - }, - process: { - argv: () => process.argv, - cwd: process.cwd, - emitWarning: (warning, type) => process.emitWarning(warning, type), - execPath: () => process.execPath, - exit: process.exit, - nextTick: process.nextTick, - stdColumns: typeof process.stdout.columns !== 'undefined' ? process.stdout.columns : null - }, - readFileSync, - require: () => { - throw new YError(REQUIRE_ERROR) - }, - requireDirectory: () => { - throw new YError(REQUIRE_DIRECTORY_ERROR) - }, - stringWidth: (str) => { - return [...str].length - }, - y18n: y18n({ - directory: resolve(__dirname, '../../../locales'), - updateFiles: false - }) -} diff --git a/node_modules/yargs/locales/be.json b/node_modules/yargs/locales/be.json deleted file mode 100644 index e28fa30..0000000 --- a/node_modules/yargs/locales/be.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Каманды:", - "Options:": "Опцыі:", - "Examples:": "Прыклады:", - "boolean": "булевы тып", - "count": "падлік", - "string": "радковы тып", - "number": "лік", - "array": "масіў", - "required": "неабходна", - "default": "па змаўчанні", - "default:": "па змаўчанні:", - "choices:": "магчымасці:", - "aliases:": "аліасы:", - "generated-value": "згенераванае значэнне", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s", - "other": "Недастаткова неапцыйных аргументаў: ёсць %s, трэба як мінімум %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s", - "other": "Занадта шмат неапцыйных аргументаў: ёсць %s, максімум дапушчальна %s" - }, - "Missing argument value: %s": { - "one": "Не хапае значэння аргументу: %s", - "other": "Не хапае значэнняў аргументаў: %s" - }, - "Missing required argument: %s": { - "one": "Не хапае неабходнага аргументу: %s", - "other": "Не хапае неабходных аргументаў: %s" - }, - "Unknown argument: %s": { - "one": "Невядомы аргумент: %s", - "other": "Невядомыя аргументы: %s" - }, - "Invalid values:": "Несапраўдныя значэння:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Дадзенае значэнне: %s, Магчымасці: %s", - "Argument check failed: %s": "Праверка аргументаў не ўдалася: %s", - "Implications failed:": "Дадзены аргумент патрабуе наступны дадатковы аргумент:", - "Not enough arguments following: %s": "Недастаткова наступных аргументаў: %s", - "Invalid JSON config file: %s": "Несапраўдны файл канфігурацыі JSON: %s", - "Path to JSON config file": "Шлях да файла канфігурацыі JSON", - "Show help": "Паказаць дапамогу", - "Show version number": "Паказаць нумар версіі", - "Did you mean %s?": "Вы мелі на ўвазе %s?" -} diff --git a/node_modules/yargs/locales/cs.json b/node_modules/yargs/locales/cs.json deleted file mode 100644 index 6394875..0000000 --- a/node_modules/yargs/locales/cs.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "Příkazy:", - "Options:": "Možnosti:", - "Examples:": "Příklady:", - "boolean": "logická hodnota", - "count": "počet", - "string": "řetězec", - "number": "číslo", - "array": "pole", - "required": "povinné", - "default": "výchozí", - "default:": "výchozí:", - "choices:": "volby:", - "aliases:": "aliasy:", - "generated-value": "generovaná-hodnota", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s", - "other": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Příliš mnoho argumentů: zadáno %s, maximálně %s", - "other": "Příliš mnoho argumentů: zadáno %s, maximálně %s" - }, - "Missing argument value: %s": { - "one": "Chybí hodnota argumentu: %s", - "other": "Chybí hodnoty argumentů: %s" - }, - "Missing required argument: %s": { - "one": "Chybí požadovaný argument: %s", - "other": "Chybí požadované argumenty: %s" - }, - "Unknown argument: %s": { - "one": "Neznámý argument: %s", - "other": "Neznámé argumenty: %s" - }, - "Invalid values:": "Neplatné hodnoty:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Zadáno: %s, Možnosti: %s", - "Argument check failed: %s": "Kontrola argumentů se nezdařila: %s", - "Implications failed:": "Chybí závislé argumenty:", - "Not enough arguments following: %s": "Následuje nedostatek argumentů: %s", - "Invalid JSON config file: %s": "Neplatný konfigurační soubor JSON: %s", - "Path to JSON config file": "Cesta ke konfiguračnímu souboru JSON", - "Show help": "Zobrazit nápovědu", - "Show version number": "Zobrazit číslo verze", - "Did you mean %s?": "Měl jste na mysli %s?", - "Arguments %s and %s are mutually exclusive" : "Argumenty %s a %s se vzájemně vylučují", - "Positionals:": "Poziční:", - "command": "příkaz", - "deprecated": "zastaralé", - "deprecated: %s": "zastaralé: %s" -} diff --git a/node_modules/yargs/locales/de.json b/node_modules/yargs/locales/de.json deleted file mode 100644 index dc73ec3..0000000 --- a/node_modules/yargs/locales/de.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Kommandos:", - "Options:": "Optionen:", - "Examples:": "Beispiele:", - "boolean": "boolean", - "count": "Zähler", - "string": "string", - "number": "Zahl", - "array": "array", - "required": "erforderlich", - "default": "Standard", - "default:": "Standard:", - "choices:": "Möglichkeiten:", - "aliases:": "Aliase:", - "generated-value": "Generierter-Wert", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt", - "other": "Nicht genügend Argumente ohne Optionen: %s vorhanden, mindestens %s benötigt" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt", - "other": "Zu viele Argumente ohne Optionen: %s vorhanden, maximal %s erlaubt" - }, - "Missing argument value: %s": { - "one": "Fehlender Argumentwert: %s", - "other": "Fehlende Argumentwerte: %s" - }, - "Missing required argument: %s": { - "one": "Fehlendes Argument: %s", - "other": "Fehlende Argumente: %s" - }, - "Unknown argument: %s": { - "one": "Unbekanntes Argument: %s", - "other": "Unbekannte Argumente: %s" - }, - "Invalid values:": "Unzulässige Werte:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeben: %s, Möglichkeiten: %s", - "Argument check failed: %s": "Argumente-Check fehlgeschlagen: %s", - "Implications failed:": "Fehlende abhängige Argumente:", - "Not enough arguments following: %s": "Nicht genügend Argumente nach: %s", - "Invalid JSON config file: %s": "Fehlerhafte JSON-Config Datei: %s", - "Path to JSON config file": "Pfad zur JSON-Config Datei", - "Show help": "Hilfe anzeigen", - "Show version number": "Version anzeigen", - "Did you mean %s?": "Meintest du %s?" -} diff --git a/node_modules/yargs/locales/en.json b/node_modules/yargs/locales/en.json deleted file mode 100644 index af096a1..0000000 --- a/node_modules/yargs/locales/en.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "Commands:": "Commands:", - "Options:": "Options:", - "Examples:": "Examples:", - "boolean": "boolean", - "count": "count", - "string": "string", - "number": "number", - "array": "array", - "required": "required", - "default": "default", - "default:": "default:", - "choices:": "choices:", - "aliases:": "aliases:", - "generated-value": "generated-value", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Not enough non-option arguments: got %s, need at least %s", - "other": "Not enough non-option arguments: got %s, need at least %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Too many non-option arguments: got %s, maximum of %s", - "other": "Too many non-option arguments: got %s, maximum of %s" - }, - "Missing argument value: %s": { - "one": "Missing argument value: %s", - "other": "Missing argument values: %s" - }, - "Missing required argument: %s": { - "one": "Missing required argument: %s", - "other": "Missing required arguments: %s" - }, - "Unknown argument: %s": { - "one": "Unknown argument: %s", - "other": "Unknown arguments: %s" - }, - "Unknown command: %s": { - "one": "Unknown command: %s", - "other": "Unknown commands: %s" - }, - "Invalid values:": "Invalid values:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s", - "Argument check failed: %s": "Argument check failed: %s", - "Implications failed:": "Missing dependent arguments:", - "Not enough arguments following: %s": "Not enough arguments following: %s", - "Invalid JSON config file: %s": "Invalid JSON config file: %s", - "Path to JSON config file": "Path to JSON config file", - "Show help": "Show help", - "Show version number": "Show version number", - "Did you mean %s?": "Did you mean %s?", - "Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive", - "Positionals:": "Positionals:", - "command": "command", - "deprecated": "deprecated", - "deprecated: %s": "deprecated: %s" -} diff --git a/node_modules/yargs/locales/es.json b/node_modules/yargs/locales/es.json deleted file mode 100644 index d77b461..0000000 --- a/node_modules/yargs/locales/es.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opciones:", - "Examples:": "Ejemplos:", - "boolean": "booleano", - "count": "cuenta", - "string": "cadena de caracteres", - "number": "número", - "array": "tabla", - "required": "requerido", - "default": "defecto", - "default:": "defecto:", - "choices:": "selección:", - "aliases:": "alias:", - "generated-value": "valor-generado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s", - "other": "Hacen falta argumentos no-opcionales: Número recibido %s, necesita por lo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s", - "other": "Demasiados argumentos no-opcionales: Número recibido %s, máximo es %s" - }, - "Missing argument value: %s": { - "one": "Falta argumento: %s", - "other": "Faltan argumentos: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento requerido: %s", - "other": "Faltan argumentos requeridos: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconocido: %s", - "other": "Argumentos desconocidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Recibido: %s, Seleccionados: %s", - "Argument check failed: %s": "Verificación de argumento ha fallado: %s", - "Implications failed:": "Implicaciones fallidas:", - "Not enough arguments following: %s": "No hay suficientes argumentos después de: %s", - "Invalid JSON config file: %s": "Archivo de configuración JSON inválido: %s", - "Path to JSON config file": "Ruta al archivo de configuración JSON", - "Show help": "Muestra ayuda", - "Show version number": "Muestra número de versión", - "Did you mean %s?": "Quisiste decir %s?" -} diff --git a/node_modules/yargs/locales/fi.json b/node_modules/yargs/locales/fi.json deleted file mode 100644 index 481feb7..0000000 --- a/node_modules/yargs/locales/fi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Komennot:", - "Options:": "Valinnat:", - "Examples:": "Esimerkkejä:", - "boolean": "totuusarvo", - "count": "lukumäärä", - "string": "merkkijono", - "number": "numero", - "array": "taulukko", - "required": "pakollinen", - "default": "oletusarvo", - "default:": "oletusarvo:", - "choices:": "vaihtoehdot:", - "aliases:": "aliakset:", - "generated-value": "generoitu-arvo", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s", - "other": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s", - "other": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s" - }, - "Missing argument value: %s": { - "one": "Argumentin arvo puuttuu: %s", - "other": "Argumentin arvot puuttuvat: %s" - }, - "Missing required argument: %s": { - "one": "Pakollinen argumentti puuttuu: %s", - "other": "Pakollisia argumentteja puuttuu: %s" - }, - "Unknown argument: %s": { - "one": "Tuntematon argumentti: %s", - "other": "Tuntemattomia argumentteja: %s" - }, - "Invalid values:": "Virheelliset arvot:", - "Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s", - "Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s", - "Implications failed:": "Riippuvia argumentteja puuttuu:", - "Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s", - "Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s", - "Path to JSON config file": "JSON-asetustiedoston polku", - "Show help": "Näytä ohje", - "Show version number": "Näytä versionumero", - "Did you mean %s?": "Tarkoititko %s?", - "Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat", - "Positionals:": "Sijaintiparametrit:", - "command": "komento" -} diff --git a/node_modules/yargs/locales/fr.json b/node_modules/yargs/locales/fr.json deleted file mode 100644 index edd743f..0000000 --- a/node_modules/yargs/locales/fr.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "Commands:": "Commandes :", - "Options:": "Options :", - "Examples:": "Exemples :", - "boolean": "booléen", - "count": "compteur", - "string": "chaîne de caractères", - "number": "nombre", - "array": "tableau", - "required": "requis", - "default": "défaut", - "default:": "défaut :", - "choices:": "choix :", - "aliases:": "alias :", - "generated-value": "valeur générée", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Pas assez d'arguments (hors options) : reçu %s, besoin d'au moins %s", - "other": "Pas assez d'arguments (hors options) : reçus %s, besoin d'au moins %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Trop d'arguments (hors options) : reçu %s, maximum de %s", - "other": "Trop d'arguments (hors options) : reçus %s, maximum de %s" - }, - "Missing argument value: %s": { - "one": "Argument manquant : %s", - "other": "Arguments manquants : %s" - }, - "Missing required argument: %s": { - "one": "Argument requis manquant : %s", - "other": "Arguments requis manquants : %s" - }, - "Unknown argument: %s": { - "one": "Argument inconnu : %s", - "other": "Arguments inconnus : %s" - }, - "Unknown command: %s": { - "one": "Commande inconnue : %s", - "other": "Commandes inconnues : %s" - }, - "Invalid values:": "Valeurs invalides :", - "Argument: %s, Given: %s, Choices: %s": "Argument : %s, donné : %s, choix : %s", - "Argument check failed: %s": "Echec de la vérification de l'argument : %s", - "Implications failed:": "Arguments dépendants manquants :", - "Not enough arguments following: %s": "Pas assez d'arguments après : %s", - "Invalid JSON config file: %s": "Fichier de configuration JSON invalide : %s", - "Path to JSON config file": "Chemin du fichier de configuration JSON", - "Show help": "Affiche l'aide", - "Show version number": "Affiche le numéro de version", - "Did you mean %s?": "Vouliez-vous dire %s ?", - "Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs", - "Positionals:": "Arguments positionnels :", - "command": "commande" -} diff --git a/node_modules/yargs/locales/hi.json b/node_modules/yargs/locales/hi.json deleted file mode 100644 index a9de77c..0000000 --- a/node_modules/yargs/locales/hi.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "आदेश:", - "Options:": "विकल्प:", - "Examples:": "उदाहरण:", - "boolean": "सत्यता", - "count": "संख्या", - "string": "वर्णों का तार ", - "number": "अंक", - "array": "सरणी", - "required": "आवश्यक", - "default": "डिफॉल्ट", - "default:": "डिफॉल्ट:", - "choices:": "विकल्प:", - "aliases:": "उपनाम:", - "generated-value": "उत्पन्न-मूल्य", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है", - "other": "पर्याप्त गैर-विकल्प तर्क प्राप्त नहीं: %s प्राप्त, कम से कम %s की आवश्यकता है" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य", - "other": "बहुत सारे गैर-विकल्प तर्क: %s प्राप्त, अधिकतम %s मान्य" - }, - "Missing argument value: %s": { - "one": "कुछ तर्को के मूल्य गुम हैं: %s", - "other": "कुछ तर्को के मूल्य गुम हैं: %s" - }, - "Missing required argument: %s": { - "one": "आवश्यक तर्क गुम हैं: %s", - "other": "आवश्यक तर्क गुम हैं: %s" - }, - "Unknown argument: %s": { - "one": "अज्ञात तर्क प्राप्त: %s", - "other": "अज्ञात तर्क प्राप्त: %s" - }, - "Invalid values:": "अमान्य मूल्य:", - "Argument: %s, Given: %s, Choices: %s": "तर्क: %s, प्राप्त: %s, विकल्प: %s", - "Argument check failed: %s": "तर्क जांच विफल: %s", - "Implications failed:": "दिए गए तर्क के लिए अतिरिक्त तर्क की अपेक्षा है:", - "Not enough arguments following: %s": "निम्नलिखित के बाद पर्याप्त तर्क नहीं प्राप्त: %s", - "Invalid JSON config file: %s": "अमान्य JSON config फाइल: %s", - "Path to JSON config file": "JSON config फाइल का पथ", - "Show help": "सहायता दिखाएँ", - "Show version number": "Version संख्या दिखाएँ", - "Did you mean %s?": "क्या आपका मतलब है %s?", - "Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं", - "Positionals:": "स्थानीय:", - "command": "आदेश" -} diff --git a/node_modules/yargs/locales/hu.json b/node_modules/yargs/locales/hu.json deleted file mode 100644 index 21492d0..0000000 --- a/node_modules/yargs/locales/hu.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Parancsok:", - "Options:": "Opciók:", - "Examples:": "Példák:", - "boolean": "boolean", - "count": "számláló", - "string": "szöveg", - "number": "szám", - "array": "tömb", - "required": "kötelező", - "default": "alapértelmezett", - "default:": "alapértelmezett:", - "choices:": "lehetőségek:", - "aliases:": "aliaszok:", - "generated-value": "generált-érték", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell", - "other": "Nincs elég nem opcionális argumentum: %s van, legalább %s kell" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet", - "other": "Túl sok nem opciánlis argumentum van: %s van, maximum %s lehet" - }, - "Missing argument value: %s": { - "one": "Hiányzó argumentum érték: %s", - "other": "Hiányzó argumentum értékek: %s" - }, - "Missing required argument: %s": { - "one": "Hiányzó kötelező argumentum: %s", - "other": "Hiányzó kötelező argumentumok: %s" - }, - "Unknown argument: %s": { - "one": "Ismeretlen argumentum: %s", - "other": "Ismeretlen argumentumok: %s" - }, - "Invalid values:": "Érvénytelen érték:", - "Argument: %s, Given: %s, Choices: %s": "Argumentum: %s, Megadott: %s, Lehetőségek: %s", - "Argument check failed: %s": "Argumentum ellenőrzés sikertelen: %s", - "Implications failed:": "Implikációk sikertelenek:", - "Not enough arguments following: %s": "Nem elég argumentum követi: %s", - "Invalid JSON config file: %s": "Érvénytelen JSON konfigurációs file: %s", - "Path to JSON config file": "JSON konfigurációs file helye", - "Show help": "Súgo megjelenítése", - "Show version number": "Verziószám megjelenítése", - "Did you mean %s?": "Erre gondoltál %s?" -} diff --git a/node_modules/yargs/locales/id.json b/node_modules/yargs/locales/id.json deleted file mode 100644 index 125867c..0000000 --- a/node_modules/yargs/locales/id.json +++ /dev/null @@ -1,50 +0,0 @@ - -{ - "Commands:": "Perintah:", - "Options:": "Pilihan:", - "Examples:": "Contoh:", - "boolean": "boolean", - "count": "jumlah", - "number": "nomor", - "string": "string", - "array": "larik", - "required": "diperlukan", - "default": "bawaan", - "default:": "bawaan:", - "aliases:": "istilah lain:", - "choices:": "pilihan:", - "generated-value": "nilai-yang-dihasilkan", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumen wajib kurang: hanya %s, minimal %s", - "other": "Argumen wajib kurang: hanya %s, minimal %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Terlalu banyak argumen wajib: ada %s, maksimal %s", - "other": "Terlalu banyak argumen wajib: ada %s, maksimal %s" - }, - "Missing argument value: %s": { - "one": "Kurang argumen: %s", - "other": "Kurang argumen: %s" - }, - "Missing required argument: %s": { - "one": "Kurang argumen wajib: %s", - "other": "Kurang argumen wajib: %s" - }, - "Unknown argument: %s": { - "one": "Argumen tak diketahui: %s", - "other": "Argumen tak diketahui: %s" - }, - "Invalid values:": "Nilai-nilai tidak valid:", - "Argument: %s, Given: %s, Choices: %s": "Argumen: %s, Diberikan: %s, Pilihan: %s", - "Argument check failed: %s": "Pemeriksaan argument gagal: %s", - "Implications failed:": "Implikasi gagal:", - "Not enough arguments following: %s": "Kurang argumen untuk: %s", - "Invalid JSON config file: %s": "Berkas konfigurasi JSON tidak valid: %s", - "Path to JSON config file": "Alamat berkas konfigurasi JSON", - "Show help": "Lihat bantuan", - "Show version number": "Lihat nomor versi", - "Did you mean %s?": "Maksud Anda: %s?", - "Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif", - "Positionals:": "Posisional-posisional:", - "command": "perintah" -} diff --git a/node_modules/yargs/locales/it.json b/node_modules/yargs/locales/it.json deleted file mode 100644 index fde5756..0000000 --- a/node_modules/yargs/locales/it.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "Comandi:", - "Options:": "Opzioni:", - "Examples:": "Esempi:", - "boolean": "booleano", - "count": "contatore", - "string": "stringa", - "number": "numero", - "array": "vettore", - "required": "richiesto", - "default": "predefinito", - "default:": "predefinito:", - "choices:": "scelte:", - "aliases:": "alias:", - "generated-value": "valore generato", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s", - "other": "Numero insufficiente di argomenti non opzione: inseriti %s, richiesti almeno %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s", - "other": "Troppi argomenti non opzione: inseriti %s, massimo possibile %s" - }, - "Missing argument value: %s": { - "one": "Argomento mancante: %s", - "other": "Argomenti mancanti: %s" - }, - "Missing required argument: %s": { - "one": "Argomento richiesto mancante: %s", - "other": "Argomenti richiesti mancanti: %s" - }, - "Unknown argument: %s": { - "one": "Argomento sconosciuto: %s", - "other": "Argomenti sconosciuti: %s" - }, - "Invalid values:": "Valori non validi:", - "Argument: %s, Given: %s, Choices: %s": "Argomento: %s, Richiesto: %s, Scelte: %s", - "Argument check failed: %s": "Controllo dell'argomento fallito: %s", - "Implications failed:": "Argomenti dipendenti mancanti:", - "Not enough arguments following: %s": "Argomenti insufficienti dopo: %s", - "Invalid JSON config file: %s": "File di configurazione JSON non valido: %s", - "Path to JSON config file": "Percorso del file di configurazione JSON", - "Show help": "Mostra la schermata di aiuto", - "Show version number": "Mostra il numero di versione", - "Did you mean %s?": "Intendi forse %s?" -} diff --git a/node_modules/yargs/locales/ja.json b/node_modules/yargs/locales/ja.json deleted file mode 100644 index 3954ae6..0000000 --- a/node_modules/yargs/locales/ja.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "コマンド:", - "Options:": "オプション:", - "Examples:": "例:", - "boolean": "真偽", - "count": "カウント", - "string": "文字列", - "number": "数値", - "array": "配列", - "required": "必須", - "default": "デフォルト", - "default:": "デフォルト:", - "choices:": "選択してください:", - "aliases:": "エイリアス:", - "generated-value": "生成された値", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:", - "other": "オプションではない引数が %s 個では不足しています。少なくとも %s 個の引数が必要です:" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:", - "other": "オプションではない引数が %s 個では多すぎます。最大で %s 個までです:" - }, - "Missing argument value: %s": { - "one": "引数の値が見つかりません: %s", - "other": "引数の値が見つかりません: %s" - }, - "Missing required argument: %s": { - "one": "必須の引数が見つかりません: %s", - "other": "必須の引数が見つかりません: %s" - }, - "Unknown argument: %s": { - "one": "未知の引数です: %s", - "other": "未知の引数です: %s" - }, - "Invalid values:": "不正な値です:", - "Argument: %s, Given: %s, Choices: %s": "引数は %s です。与えられた値: %s, 選択してください: %s", - "Argument check failed: %s": "引数のチェックに失敗しました: %s", - "Implications failed:": "オプションの組み合わせで不正が生じました:", - "Not enough arguments following: %s": "次の引数が不足しています。: %s", - "Invalid JSON config file: %s": "JSONの設定ファイルが不正です: %s", - "Path to JSON config file": "JSONの設定ファイルまでのpath", - "Show help": "ヘルプを表示", - "Show version number": "バージョンを表示", - "Did you mean %s?": "もしかして %s?", - "Arguments %s and %s are mutually exclusive" : "引数 %s と %s は同時に指定できません", - "Positionals:": "位置:", - "command": "コマンド", - "deprecated": "非推奨", - "deprecated: %s": "非推奨: %s" -} diff --git a/node_modules/yargs/locales/ko.json b/node_modules/yargs/locales/ko.json deleted file mode 100644 index 746bc89..0000000 --- a/node_modules/yargs/locales/ko.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "명령:", - "Options:": "옵션:", - "Examples:": "예시:", - "boolean": "불리언", - "count": "개수", - "string": "문자열", - "number": "숫자", - "array": "배열", - "required": "필수", - "default": "기본값", - "default:": "기본값:", - "choices:": "선택지:", - "aliases:": "별칭:", - "generated-value": "생성된 값", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "옵션이 아닌 인수가 충분하지 않습니다: %s개 입력받음, 최소 %s개 입력 필요", - "other": "옵션이 아닌 인수가 충분하지 않습니다: %s개 입력받음, 최소 %s개 입력 필요" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "옵션이 아닌 인수가 너무 많습니다: %s개 입력받음, 최대 %s개 입력 가능", - "other": "옵션이 아닌 인수가 너무 많습니다: %s개 입력받음, 최대 %s개 입력 가능" - }, - "Missing argument value: %s": { - "one": "인수가 주어지지 않았습니다: %s", - "other": "인수가 주어지지 않았습니다: %s" - }, - "Missing required argument: %s": { - "one": "필수 인수가 주어지지 않았습니다: %s", - "other": "필수 인수가 주어지지 않았습니다: %s" - }, - "Unknown argument: %s": { - "one": "알 수 없는 인수입니다: %s", - "other": "알 수 없는 인수입니다: %s" - }, - "Invalid values:": "유효하지 않은 값:", - "Argument: %s, Given: %s, Choices: %s": "인수: %s, 주어진 값: %s, 선택지: %s", - "Argument check failed: %s": "인수 체크에 실패했습니다: %s", - "Implications failed:": "주어진 인수에 필요한 추가 인수가 주어지지 않았습니다:", - "Not enough arguments following: %s": "다음 인수가 주어지지 않았습니다: %s", - "Invalid JSON config file: %s": "유효하지 않은 JSON 설정 파일: %s", - "Path to JSON config file": "JSON 설정 파일 경로", - "Show help": "도움말 표시", - "Show version number": "버전 표시", - "Did you mean %s?": "%s을(를) 찾으시나요?", - "Arguments %s and %s are mutually exclusive" : "인수 %s과(와) %s은(는) 동시에 지정할 수 없습니다", - "Positionals:": "위치:", - "command": "명령" -} diff --git a/node_modules/yargs/locales/nb.json b/node_modules/yargs/locales/nb.json deleted file mode 100644 index 6f410ed..0000000 --- a/node_modules/yargs/locales/nb.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Commands:": "Kommandoer:", - "Options:": "Alternativer:", - "Examples:": "Eksempler:", - "boolean": "boolsk", - "count": "antall", - "string": "streng", - "number": "nummer", - "array": "matrise", - "required": "obligatorisk", - "default": "standard", - "default:": "standard:", - "choices:": "valg:", - "generated-value": "generert-verdi", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s", - "other": "Ikke nok ikke-alternativ argumenter: fikk %s, trenger minst %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s", - "other": "For mange ikke-alternativ argumenter: fikk %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Mangler argument verdi: %s", - "other": "Mangler argument verdier: %s" - }, - "Missing required argument: %s": { - "one": "Mangler obligatorisk argument: %s", - "other": "Mangler obligatoriske argumenter: %s" - }, - "Unknown argument: %s": { - "one": "Ukjent argument: %s", - "other": "Ukjente argumenter: %s" - }, - "Invalid values:": "Ugyldige verdier:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gitt: %s, Valg: %s", - "Argument check failed: %s": "Argumentsjekk mislyktes: %s", - "Implications failed:": "Konsekvensene mislyktes:", - "Not enough arguments following: %s": "Ikke nok følgende argumenter: %s", - "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", - "Path to JSON config file": "Bane til JSON konfigurasjonsfil", - "Show help": "Vis hjelp", - "Show version number": "Vis versjonsnummer" -} diff --git a/node_modules/yargs/locales/nl.json b/node_modules/yargs/locales/nl.json deleted file mode 100644 index 9ff95c5..0000000 --- a/node_modules/yargs/locales/nl.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Commando's:", - "Options:": "Opties:", - "Examples:": "Voorbeelden:", - "boolean": "booleaans", - "count": "aantal", - "string": "string", - "number": "getal", - "array": "lijst", - "required": "verplicht", - "default": "standaard", - "default:": "standaard:", - "choices:": "keuzes:", - "aliases:": "aliassen:", - "generated-value": "gegenereerde waarde", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig", - "other": "Niet genoeg niet-optie-argumenten: %s gekregen, minstens %s nodig" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s", - "other": "Te veel niet-optie-argumenten: %s gekregen, maximum is %s" - }, - "Missing argument value: %s": { - "one": "Missende argumentwaarde: %s", - "other": "Missende argumentwaarden: %s" - }, - "Missing required argument: %s": { - "one": "Missend verplicht argument: %s", - "other": "Missende verplichte argumenten: %s" - }, - "Unknown argument: %s": { - "one": "Onbekend argument: %s", - "other": "Onbekende argumenten: %s" - }, - "Invalid values:": "Ongeldige waarden:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gegeven: %s, Keuzes: %s", - "Argument check failed: %s": "Argumentcontrole mislukt: %s", - "Implications failed:": "Ontbrekende afhankelijke argumenten:", - "Not enough arguments following: %s": "Niet genoeg argumenten na: %s", - "Invalid JSON config file: %s": "Ongeldig JSON-config-bestand: %s", - "Path to JSON config file": "Pad naar JSON-config-bestand", - "Show help": "Toon help", - "Show version number": "Toon versienummer", - "Did you mean %s?": "Bedoelde u misschien %s?", - "Arguments %s and %s are mutually exclusive": "Argumenten %s en %s kunnen niet tegelijk gebruikt worden", - "Positionals:": "Positie-afhankelijke argumenten", - "command": "commando" -} diff --git a/node_modules/yargs/locales/nn.json b/node_modules/yargs/locales/nn.json deleted file mode 100644 index 24479ac..0000000 --- a/node_modules/yargs/locales/nn.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "Commands:": "Kommandoar:", - "Options:": "Alternativ:", - "Examples:": "Døme:", - "boolean": "boolsk", - "count": "mengd", - "string": "streng", - "number": "nummer", - "array": "matrise", - "required": "obligatorisk", - "default": "standard", - "default:": "standard:", - "choices:": "val:", - "generated-value": "generert-verdi", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s", - "other": "Ikkje nok ikkje-alternativ argument: fekk %s, treng minst %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "For mange ikkje-alternativ argument: fekk %s, maksimum %s", - "other": "For mange ikkje-alternativ argument: fekk %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Manglar argumentverdi: %s", - "other": "Manglar argumentverdiar: %s" - }, - "Missing required argument: %s": { - "one": "Manglar obligatorisk argument: %s", - "other": "Manglar obligatoriske argument: %s" - }, - "Unknown argument: %s": { - "one": "Ukjent argument: %s", - "other": "Ukjende argument: %s" - }, - "Invalid values:": "Ugyldige verdiar:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Gjeve: %s, Val: %s", - "Argument check failed: %s": "Argumentsjekk mislukkast: %s", - "Implications failed:": "Konsekvensane mislukkast:", - "Not enough arguments following: %s": "Ikkje nok fylgjande argument: %s", - "Invalid JSON config file: %s": "Ugyldig JSON konfigurasjonsfil: %s", - "Path to JSON config file": "Bane til JSON konfigurasjonsfil", - "Show help": "Vis hjelp", - "Show version number": "Vis versjonsnummer" -} diff --git a/node_modules/yargs/locales/pirate.json b/node_modules/yargs/locales/pirate.json deleted file mode 100644 index dcb5cb7..0000000 --- a/node_modules/yargs/locales/pirate.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Commands:": "Choose yer command:", - "Options:": "Options for me hearties!", - "Examples:": "Ex. marks the spot:", - "required": "requi-yar-ed", - "Missing required argument: %s": { - "one": "Ye be havin' to set the followin' argument land lubber: %s", - "other": "Ye be havin' to set the followin' arguments land lubber: %s" - }, - "Show help": "Parlay this here code of conduct", - "Show version number": "'Tis the version ye be askin' fer", - "Arguments %s and %s are mutually exclusive" : "Yon scurvy dogs %s and %s be as bad as rum and a prudish wench" -} diff --git a/node_modules/yargs/locales/pl.json b/node_modules/yargs/locales/pl.json deleted file mode 100644 index a41d4bd..0000000 --- a/node_modules/yargs/locales/pl.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "Commands:": "Polecenia:", - "Options:": "Opcje:", - "Examples:": "Przykłady:", - "boolean": "boolean", - "count": "ilość", - "string": "ciąg znaków", - "number": "liczba", - "array": "tablica", - "required": "wymagany", - "default": "domyślny", - "default:": "domyślny:", - "choices:": "dostępne:", - "aliases:": "aliasy:", - "generated-value": "wygenerowana-wartość", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s", - "other": "Niewystarczająca ilość argumentów: otrzymano %s, wymagane co najmniej %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s", - "other": "Zbyt duża ilość argumentów: otrzymano %s, wymagane co najwyżej %s" - }, - "Missing argument value: %s": { - "one": "Brak wartości dla argumentu: %s", - "other": "Brak wartości dla argumentów: %s" - }, - "Missing required argument: %s": { - "one": "Brak wymaganego argumentu: %s", - "other": "Brak wymaganych argumentów: %s" - }, - "Unknown argument: %s": { - "one": "Nieznany argument: %s", - "other": "Nieznane argumenty: %s" - }, - "Invalid values:": "Nieprawidłowe wartości:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Otrzymano: %s, Dostępne: %s", - "Argument check failed: %s": "Weryfikacja argumentów nie powiodła się: %s", - "Implications failed:": "Założenia nie zostały spełnione:", - "Not enough arguments following: %s": "Niewystarczająca ilość argumentów następujących po: %s", - "Invalid JSON config file: %s": "Nieprawidłowy plik konfiguracyjny JSON: %s", - "Path to JSON config file": "Ścieżka do pliku konfiguracyjnego JSON", - "Show help": "Pokaż pomoc", - "Show version number": "Pokaż numer wersji", - "Did you mean %s?": "Czy chodziło Ci o %s?", - "Arguments %s and %s are mutually exclusive": "Argumenty %s i %s wzajemnie się wykluczają", - "Positionals:": "Pozycyjne:", - "command": "polecenie" -} diff --git a/node_modules/yargs/locales/pt.json b/node_modules/yargs/locales/pt.json deleted file mode 100644 index 0c8ac99..0000000 --- a/node_modules/yargs/locales/pt.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opções:", - "Examples:": "Exemplos:", - "boolean": "boolean", - "count": "contagem", - "string": "cadeia de caracteres", - "number": "número", - "array": "arranjo", - "required": "requerido", - "default": "padrão", - "default:": "padrão:", - "choices:": "escolhas:", - "generated-value": "valor-gerado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s", - "other": "Argumentos insuficientes não opcionais: Argumento %s, necessário pelo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Excesso de argumentos não opcionais: recebido %s, máximo de %s", - "other": "Excesso de argumentos não opcionais: recebido %s, máximo de %s" - }, - "Missing argument value: %s": { - "one": "Falta valor de argumento: %s", - "other": "Falta valores de argumento: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento obrigatório: %s", - "other": "Faltando argumentos obrigatórios: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconhecido: %s", - "other": "Argumentos desconhecidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Escolhas: %s", - "Argument check failed: %s": "Verificação de argumento falhou: %s", - "Implications failed:": "Implicações falharam:", - "Not enough arguments following: %s": "Insuficientes argumentos a seguir: %s", - "Invalid JSON config file: %s": "Arquivo de configuração em JSON esta inválido: %s", - "Path to JSON config file": "Caminho para o arquivo de configuração em JSON", - "Show help": "Mostra ajuda", - "Show version number": "Mostra número de versão", - "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos" -} diff --git a/node_modules/yargs/locales/pt_BR.json b/node_modules/yargs/locales/pt_BR.json deleted file mode 100644 index eae1ec6..0000000 --- a/node_modules/yargs/locales/pt_BR.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "Comandos:", - "Options:": "Opções:", - "Examples:": "Exemplos:", - "boolean": "booleano", - "count": "contagem", - "string": "string", - "number": "número", - "array": "array", - "required": "obrigatório", - "default:": "padrão:", - "choices:": "opções:", - "aliases:": "sinônimos:", - "generated-value": "valor-gerado", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s", - "other": "Argumentos insuficientes: Argumento %s, necessário pelo menos %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Excesso de argumentos: recebido %s, máximo de %s", - "other": "Excesso de argumentos: recebido %s, máximo de %s" - }, - "Missing argument value: %s": { - "one": "Falta valor de argumento: %s", - "other": "Falta valores de argumento: %s" - }, - "Missing required argument: %s": { - "one": "Falta argumento obrigatório: %s", - "other": "Faltando argumentos obrigatórios: %s" - }, - "Unknown argument: %s": { - "one": "Argumento desconhecido: %s", - "other": "Argumentos desconhecidos: %s" - }, - "Invalid values:": "Valores inválidos:", - "Argument: %s, Given: %s, Choices: %s": "Argumento: %s, Dado: %s, Opções: %s", - "Argument check failed: %s": "Verificação de argumento falhou: %s", - "Implications failed:": "Implicações falharam:", - "Not enough arguments following: %s": "Argumentos insuficientes a seguir: %s", - "Invalid JSON config file: %s": "Arquivo JSON de configuração inválido: %s", - "Path to JSON config file": "Caminho para o arquivo JSON de configuração", - "Show help": "Exibe ajuda", - "Show version number": "Exibe a versão", - "Did you mean %s?": "Você quis dizer %s?", - "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos", - "Positionals:": "Posicionais:", - "command": "comando" -} diff --git a/node_modules/yargs/locales/ru.json b/node_modules/yargs/locales/ru.json deleted file mode 100644 index d5c9e32..0000000 --- a/node_modules/yargs/locales/ru.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "Команды:", - "Options:": "Опции:", - "Examples:": "Примеры:", - "boolean": "булевый тип", - "count": "подсчет", - "string": "строковой тип", - "number": "число", - "array": "массив", - "required": "необходимо", - "default": "по умолчанию", - "default:": "по умолчанию:", - "choices:": "возможности:", - "aliases:": "алиасы:", - "generated-value": "генерированное значение", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s", - "other": "Недостаточно неопционных аргументов: есть %s, нужно как минимум %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s", - "other": "Слишком много неопционных аргументов: есть %s, максимум допустимо %s" - }, - "Missing argument value: %s": { - "one": "Не хватает значения аргумента: %s", - "other": "Не хватает значений аргументов: %s" - }, - "Missing required argument: %s": { - "one": "Не хватает необходимого аргумента: %s", - "other": "Не хватает необходимых аргументов: %s" - }, - "Unknown argument: %s": { - "one": "Неизвестный аргумент: %s", - "other": "Неизвестные аргументы: %s" - }, - "Invalid values:": "Недействительные значения:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Данное значение: %s, Возможности: %s", - "Argument check failed: %s": "Проверка аргументов не удалась: %s", - "Implications failed:": "Данный аргумент требует следующий дополнительный аргумент:", - "Not enough arguments following: %s": "Недостаточно следующих аргументов: %s", - "Invalid JSON config file: %s": "Недействительный файл конфигурации JSON: %s", - "Path to JSON config file": "Путь к файлу конфигурации JSON", - "Show help": "Показать помощь", - "Show version number": "Показать номер версии", - "Did you mean %s?": "Вы имели в виду %s?", - "Arguments %s and %s are mutually exclusive": "Аргументы %s и %s являются взаимоисключающими", - "Positionals:": "Позиционные аргументы:", - "command": "команда", - "deprecated": "устар.", - "deprecated: %s": "устар.: %s" -} diff --git a/node_modules/yargs/locales/th.json b/node_modules/yargs/locales/th.json deleted file mode 100644 index 33b048e..0000000 --- a/node_modules/yargs/locales/th.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "Commands:": "คอมมาน", - "Options:": "ออฟชั่น", - "Examples:": "ตัวอย่าง", - "boolean": "บูลีน", - "count": "นับ", - "string": "สตริง", - "number": "ตัวเลข", - "array": "อาเรย์", - "required": "จำเป็น", - "default": "ค่าเริ่มต้", - "default:": "ค่าเริ่มต้น", - "choices:": "ตัวเลือก", - "aliases:": "เอเลียส", - "generated-value": "ค่าที่ถูกสร้างขึ้น", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า", - "other": "ใส่อาร์กิวเมนต์ไม่ครบตามจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการอย่างน้อย %s ค่า" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า", - "other": "ใส่อาร์กิวเมนต์เกินจำนวนที่กำหนด: ใส่ค่ามาจำนวน %s ค่า, แต่ต้องการมากที่สุด %s ค่า" - }, - "Missing argument value: %s": { - "one": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s", - "other": "ค่าอาร์กิวเมนต์ที่ขาดไป: %s" - }, - "Missing required argument: %s": { - "one": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s", - "other": "อาร์กิวเมนต์จำเป็นที่ขาดไป: %s" - }, - "Unknown argument: %s": { - "one": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s", - "other": "อาร์กิวเมนต์ที่ไม่รู้จัก: %s" - }, - "Invalid values:": "ค่าไม่ถูกต้อง:", - "Argument: %s, Given: %s, Choices: %s": "อาร์กิวเมนต์: %s, ได้รับ: %s, ตัวเลือก: %s", - "Argument check failed: %s": "ตรวจสอบพบอาร์กิวเมนต์ที่ไม่ถูกต้อง: %s", - "Implications failed:": "Implications ไม่สำเร็จ:", - "Not enough arguments following: %s": "ใส่อาร์กิวเมนต์ไม่ครบ: %s", - "Invalid JSON config file: %s": "ไฟล์คอนฟิค JSON ไม่ถูกต้อง: %s", - "Path to JSON config file": "พาทไฟล์คอนฟิค JSON", - "Show help": "ขอความช่วยเหลือ", - "Show version number": "แสดงตัวเลขเวอร์ชั่น", - "Did you mean %s?": "คุณหมายถึง %s?" -} diff --git a/node_modules/yargs/locales/tr.json b/node_modules/yargs/locales/tr.json deleted file mode 100644 index 0d0d2cc..0000000 --- a/node_modules/yargs/locales/tr.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "Komutlar:", - "Options:": "Seçenekler:", - "Examples:": "Örnekler:", - "boolean": "boolean", - "count": "sayı", - "string": "string", - "number": "numara", - "array": "array", - "required": "zorunlu", - "default": "varsayılan", - "default:": "varsayılan:", - "choices:": "seçimler:", - "aliases:": "takma adlar:", - "generated-value": "oluşturulan-değer", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli", - "other": "Seçenek dışı argümanlar yetersiz: %s bulundu, %s gerekli" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s", - "other": "Seçenek dışı argümanlar gereğinden fazla: %s bulundu, azami %s" - }, - "Missing argument value: %s": { - "one": "Eksik argüman değeri: %s", - "other": "Eksik argüman değerleri: %s" - }, - "Missing required argument: %s": { - "one": "Eksik zorunlu argüman: %s", - "other": "Eksik zorunlu argümanlar: %s" - }, - "Unknown argument: %s": { - "one": "Bilinmeyen argüman: %s", - "other": "Bilinmeyen argümanlar: %s" - }, - "Invalid values:": "Geçersiz değerler:", - "Argument: %s, Given: %s, Choices: %s": "Argüman: %s, Verilen: %s, Seçimler: %s", - "Argument check failed: %s": "Argüman kontrolü başarısız oldu: %s", - "Implications failed:": "Sonuçlar başarısız oldu:", - "Not enough arguments following: %s": "%s için yeterli argüman bulunamadı", - "Invalid JSON config file: %s": "Geçersiz JSON yapılandırma dosyası: %s", - "Path to JSON config file": "JSON yapılandırma dosya konumu", - "Show help": "Yardım detaylarını göster", - "Show version number": "Versiyon detaylarını göster", - "Did you mean %s?": "Bunu mu demek istediniz: %s?", - "Positionals:": "Sıralılar:", - "command": "komut" -} diff --git a/node_modules/yargs/locales/uk_UA.json b/node_modules/yargs/locales/uk_UA.json deleted file mode 100644 index 0af0e99..0000000 --- a/node_modules/yargs/locales/uk_UA.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "Команди:", - "Options:": "Опції:", - "Examples:": "Приклади:", - "boolean": "boolean", - "count": "кількість", - "string": "строка", - "number": "число", - "array": "масива", - "required": "обов'язково", - "default": "за замовчуванням", - "default:": "за замовчуванням:", - "choices:": "доступні варіанти:", - "aliases:": "псевдоніми:", - "generated-value": "згенероване значення", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "Недостатньо аргументів: наразі %s, потрібно %s або більше", - "other": "Недостатньо аргументів: наразі %s, потрібно %s або більше" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "Забагато аргументів: наразі %s, максимум %s", - "other": "Too many non-option arguments: наразі %s, максимум of %s" - }, - "Missing argument value: %s": { - "one": "Відсутнє значення для аргументу: %s", - "other": "Відсутні значення для аргументу: %s" - }, - "Missing required argument: %s": { - "one": "Відсутній обов'язковий аргумент: %s", - "other": "Відсутні обов'язкові аргументи: %s" - }, - "Unknown argument: %s": { - "one": "Аргумент %s не підтримується", - "other": "Аргументи %s не підтримуються" - }, - "Invalid values:": "Некоректні значення:", - "Argument: %s, Given: %s, Choices: %s": "Аргумент: %s, Введено: %s, Доступні варіанти: %s", - "Argument check failed: %s": "Аргумент не пройшов перевірку: %s", - "Implications failed:": "Відсутні залежні аргументи:", - "Not enough arguments following: %s": "Не достатньо аргументів після: %s", - "Invalid JSON config file: %s": "Некоректний JSON-файл конфігурації: %s", - "Path to JSON config file": "Шлях до JSON-файлу конфігурації", - "Show help": "Показати довідку", - "Show version number": "Показати версію", - "Did you mean %s?": "Можливо, ви мали на увазі %s?", - "Arguments %s and %s are mutually exclusive" : "Аргументи %s та %s взаємовиключні", - "Positionals:": "Позиційні:", - "command": "команда", - "deprecated": "застарілий", - "deprecated: %s": "застарілий: %s" -} diff --git a/node_modules/yargs/locales/uz.json b/node_modules/yargs/locales/uz.json deleted file mode 100644 index 0d07168..0000000 --- a/node_modules/yargs/locales/uz.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "Commands:": "Buyruqlar:", - "Options:": "Imkoniyatlar:", - "Examples:": "Misollar:", - "boolean": "boolean", - "count": "sanoq", - "string": "satr", - "number": "raqam", - "array": "massiv", - "required": "majburiy", - "default": "boshlang'ich", - "default:": "boshlang'ich:", - "choices:": "tanlovlar:", - "aliases:": "taxalluslar:", - "generated-value": "yaratilgan-qiymat", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "No-imkoniyat argumentlar yetarli emas: berilgan %s, minimum %s", - "other": "No-imkoniyat argumentlar yetarli emas: berilgan %s, minimum %s" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "No-imkoniyat argumentlar juda ko'p: berilgan %s, maksimum %s", - "other": "No-imkoniyat argumentlar juda ko'p: got %s, maksimum %s" - }, - "Missing argument value: %s": { - "one": "Argument qiymati berilmagan: %s", - "other": "Argument qiymatlari berilmagan: %s" - }, - "Missing required argument: %s": { - "one": "Majburiy argument berilmagan: %s", - "other": "Majburiy argumentlar berilmagan: %s" - }, - "Unknown argument: %s": { - "one": "Noma'lum argument berilmagan: %s", - "other": "Noma'lum argumentlar berilmagan: %s" - }, - "Invalid values:": "Nosoz qiymatlar:", - "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Berilgan: %s, Tanlovlar: %s", - "Argument check failed: %s": "Muvaffaqiyatsiz argument tekshiruvi: %s", - "Implications failed:": "Bog'liq argumentlar berilmagan:", - "Not enough arguments following: %s": "Quyidagi argumentlar yetarli emas: %s", - "Invalid JSON config file: %s": "Nosoz JSON konfiguratsiya fayli: %s", - "Path to JSON config file": "JSON konfiguratsiya fayli joylashuvi", - "Show help": "Yordam ko'rsatish", - "Show version number": "Versiyani ko'rsatish", - "Did you mean %s?": "%s ni nazarda tutyapsizmi?", - "Arguments %s and %s are mutually exclusive" : "%s va %s argumentlari alohida", - "Positionals:": "Positsionallar:", - "command": "buyruq", - "deprecated": "eskirgan", - "deprecated: %s": "eskirgan: %s" - } - \ No newline at end of file diff --git a/node_modules/yargs/locales/zh_CN.json b/node_modules/yargs/locales/zh_CN.json deleted file mode 100644 index 257d26b..0000000 --- a/node_modules/yargs/locales/zh_CN.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Commands:": "命令:", - "Options:": "选项:", - "Examples:": "示例:", - "boolean": "布尔", - "count": "计数", - "string": "字符串", - "number": "数字", - "array": "数组", - "required": "必需", - "default": "默认值", - "default:": "默认值:", - "choices:": "可选值:", - "generated-value": "生成的值", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个", - "other": "缺少 non-option 参数:传入了 %s 个, 至少需要 %s 个" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个", - "other": "non-option 参数过多:传入了 %s 个, 最大允许 %s 个" - }, - "Missing argument value: %s": { - "one": "没有给此选项指定值:%s", - "other": "没有给这些选项指定值:%s" - }, - "Missing required argument: %s": { - "one": "缺少必须的选项:%s", - "other": "缺少这些必须的选项:%s" - }, - "Unknown argument: %s": { - "one": "无法识别的选项:%s", - "other": "无法识别这些选项:%s" - }, - "Invalid values:": "无效的选项值:", - "Argument: %s, Given: %s, Choices: %s": "选项名称: %s, 传入的值: %s, 可选的值:%s", - "Argument check failed: %s": "选项值验证失败:%s", - "Implications failed:": "缺少依赖的选项:", - "Not enough arguments following: %s": "没有提供足够的值给此选项:%s", - "Invalid JSON config file: %s": "无效的 JSON 配置文件:%s", - "Path to JSON config file": "JSON 配置文件的路径", - "Show help": "显示帮助信息", - "Show version number": "显示版本号", - "Did you mean %s?": "是指 %s?", - "Arguments %s and %s are mutually exclusive" : "选项 %s 和 %s 是互斥的", - "Positionals:": "位置:", - "command": "命令" -} diff --git a/node_modules/yargs/locales/zh_TW.json b/node_modules/yargs/locales/zh_TW.json deleted file mode 100644 index e38495d..0000000 --- a/node_modules/yargs/locales/zh_TW.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "Commands:": "命令:", - "Options:": "選項:", - "Examples:": "範例:", - "boolean": "布林", - "count": "次數", - "string": "字串", - "number": "數字", - "array": "陣列", - "required": "必填", - "default": "預設值", - "default:": "預設值:", - "choices:": "可選值:", - "aliases:": "別名:", - "generated-value": "生成的值", - "Not enough non-option arguments: got %s, need at least %s": { - "one": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個", - "other": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個" - }, - "Too many non-option arguments: got %s, maximum of %s": { - "one": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個", - "other": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個" - }, - "Missing argument value: %s": { - "one": "此引數無指定值:%s", - "other": "這些引數無指定值:%s" - }, - "Missing required argument: %s": { - "one": "缺少必須的引數:%s", - "other": "缺少這些必須的引數:%s" - }, - "Unknown argument: %s": { - "one": "未知的引數:%s", - "other": "未知的引數:%s" - }, - "Invalid values:": "無效的選項值:", - "Argument: %s, Given: %s, Choices: %s": "引數名稱: %s, 傳入的值: %s, 可選的值:%s", - "Argument check failed: %s": "引數驗證失敗:%s", - "Implications failed:": "缺少依賴引數:", - "Not enough arguments following: %s": "沒有提供足夠的值給此引數:%s", - "Invalid JSON config file: %s": "無效的 JSON 設置文件:%s", - "Path to JSON config file": "JSON 設置文件的路徑", - "Show help": "顯示說明", - "Show version number": "顯示版本", - "Did you mean %s?": "您是指 %s 嗎?", - "Arguments %s and %s are mutually exclusive" : "引數 %s 和 %s 互斥", - "Positionals:": "位置:", - "command": "命令", - "deprecated": "已淘汰", - "deprecated: %s": "已淘汰:%s" - } diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json deleted file mode 100644 index 389cc6b..0000000 --- a/node_modules/yargs/package.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "name": "yargs", - "version": "17.7.2", - "description": "yargs the modern, pirate-themed, successor to optimist.", - "main": "./index.cjs", - "exports": { - "./package.json": "./package.json", - ".": [ - { - "import": "./index.mjs", - "require": "./index.cjs" - }, - "./index.cjs" - ], - "./helpers": { - "import": "./helpers/helpers.mjs", - "require": "./helpers/index.js" - }, - "./browser": { - "import": "./browser.mjs", - "types": "./browser.d.ts" - }, - "./yargs": [ - { - "import": "./yargs.mjs", - "require": "./yargs" - }, - "./yargs" - ] - }, - "type": "module", - "module": "./index.mjs", - "contributors": [ - { - "name": "Yargs Contributors", - "url": "https://github.com/yargs/yargs/graphs/contributors" - } - ], - "files": [ - "browser.mjs", - "browser.d.ts", - "index.cjs", - "helpers/*.js", - "helpers/*", - "index.mjs", - "yargs", - "yargs.mjs", - "build", - "locales", - "LICENSE", - "lib/platform-shims/*.mjs", - "!*.d.ts", - "!**/*.d.ts" - ], - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "devDependencies": { - "@types/chai": "^4.2.11", - "@types/mocha": "^9.0.0", - "@types/node": "^18.0.0", - "c8": "^7.7.0", - "chai": "^4.2.0", - "chalk": "^4.0.0", - "coveralls": "^3.0.9", - "cpr": "^3.0.1", - "cross-env": "^7.0.2", - "cross-spawn": "^7.0.0", - "eslint": "^7.23.0", - "gts": "^3.0.0", - "hashish": "0.0.4", - "mocha": "^9.0.0", - "rimraf": "^3.0.2", - "rollup": "^2.23.0", - "rollup-plugin-cleanup": "^3.1.1", - "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-ts": "^2.0.4", - "typescript": "^4.0.2", - "which": "^2.0.0", - "yargs-test-extends": "^1.0.1" - }, - "scripts": { - "fix": "gts fix && npm run fix:js", - "fix:js": "eslint . --ext cjs --ext mjs --ext js --fix", - "posttest": "npm run check", - "test": "c8 mocha --enable-source-maps ./test/*.cjs --require ./test/before.cjs --timeout=12000 --check-leaks", - "test:esm": "c8 mocha --enable-source-maps ./test/esm/*.mjs --check-leaks", - "coverage": "c8 report --check-coverage", - "prepare": "npm run compile", - "pretest": "npm run compile -- -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs", - "compile": "rimraf build && tsc", - "postcompile": "npm run build:cjs", - "build:cjs": "rollup -c rollup.config.cjs", - "postbuild:cjs": "rimraf ./build/index.cjs.d.ts", - "check": "gts lint && npm run check:js", - "check:js": "eslint . --ext cjs --ext mjs --ext js", - "clean": "gts clean" - }, - "repository": { - "type": "git", - "url": "https://github.com/yargs/yargs.git" - }, - "homepage": "https://yargs.js.org/", - "keywords": [ - "argument", - "args", - "option", - "parser", - "parsing", - "cli", - "command" - ], - "license": "MIT", - "engines": { - "node": ">=12" - } -} diff --git a/node_modules/yargs/yargs b/node_modules/yargs/yargs deleted file mode 100644 index 8460d10..0000000 --- a/node_modules/yargs/yargs +++ /dev/null @@ -1,9 +0,0 @@ -// TODO: consolidate on using a helpers file at some point in the future, which -// is the approach currently used to export Parser and applyExtends for ESM: -const {applyExtends, cjsPlatformShim, Parser, Yargs, processArgv} = require('./build/index.cjs') -Yargs.applyExtends = (config, cwd, mergeExtends) => { - return applyExtends(config, cwd, mergeExtends, cjsPlatformShim) -} -Yargs.hideBin = processArgv.hideBin -Yargs.Parser = Parser -module.exports = Yargs diff --git a/node_modules/yargs/yargs.mjs b/node_modules/yargs/yargs.mjs deleted file mode 100644 index 6d9f390..0000000 --- a/node_modules/yargs/yargs.mjs +++ /dev/null @@ -1,10 +0,0 @@ -// TODO: consolidate on using a helpers file at some point in the future, which -// is the approach currently used to export Parser and applyExtends for ESM: -import pkg from './build/index.cjs'; -const {applyExtends, cjsPlatformShim, Parser, processArgv, Yargs} = pkg; -Yargs.applyExtends = (config, cwd, mergeExtends) => { - return applyExtends(config, cwd, mergeExtends, cjsPlatformShim); -}; -Yargs.hideBin = processArgv.hideBin; -Yargs.Parser = Parser; -export default Yargs; diff --git a/node_modules/yocto-queue/index.d.ts b/node_modules/yocto-queue/index.d.ts deleted file mode 100644 index 9541986..0000000 --- a/node_modules/yocto-queue/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -declare class Queue implements Iterable { - /** - The size of the queue. - */ - readonly size: number; - - /** - Tiny queue data structure. - - The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow. - - @example - ``` - import Queue = require('yocto-queue'); - - const queue = new Queue(); - - queue.enqueue('🦄'); - queue.enqueue('🌈'); - - console.log(queue.size); - //=> 2 - - console.log(...queue); - //=> '🦄 🌈' - - console.log(queue.dequeue()); - //=> '🦄' - - console.log(queue.dequeue()); - //=> '🌈' - ``` - */ - constructor(); - - [Symbol.iterator](): IterableIterator; - - /** - Add a value to the queue. - */ - enqueue(value: ValueType): void; - - /** - Remove the next value in the queue. - - @returns The removed value or `undefined` if the queue is empty. - */ - dequeue(): ValueType | undefined; - - /** - Clear the queue. - */ - clear(): void; -} - -export = Queue; diff --git a/node_modules/yocto-queue/index.js b/node_modules/yocto-queue/index.js deleted file mode 100644 index 2f3e6dc..0000000 --- a/node_modules/yocto-queue/index.js +++ /dev/null @@ -1,68 +0,0 @@ -class Node { - /// value; - /// next; - - constructor(value) { - this.value = value; - - // TODO: Remove this when targeting Node.js 12. - this.next = undefined; - } -} - -class Queue { - // TODO: Use private class fields when targeting Node.js 12. - // #_head; - // #_tail; - // #_size; - - constructor() { - this.clear(); - } - - enqueue(value) { - const node = new Node(value); - - if (this._head) { - this._tail.next = node; - this._tail = node; - } else { - this._head = node; - this._tail = node; - } - - this._size++; - } - - dequeue() { - const current = this._head; - if (!current) { - return; - } - - this._head = this._head.next; - this._size--; - return current.value; - } - - clear() { - this._head = undefined; - this._tail = undefined; - this._size = 0; - } - - get size() { - return this._size; - } - - * [Symbol.iterator]() { - let current = this._head; - - while (current) { - yield current.value; - current = current.next; - } - } -} - -module.exports = Queue; diff --git a/node_modules/yocto-queue/license b/node_modules/yocto-queue/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/yocto-queue/license +++ /dev/null @@ -1,9 +0,0 @@ -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/yocto-queue/package.json b/node_modules/yocto-queue/package.json deleted file mode 100644 index 71a9101..0000000 --- a/node_modules/yocto-queue/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "yocto-queue", - "version": "0.1.0", - "description": "Tiny queue data structure", - "license": "MIT", - "repository": "sindresorhus/yocto-queue", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "queue", - "data", - "structure", - "algorithm", - "queues", - "queuing", - "list", - "array", - "linkedlist", - "fifo", - "enqueue", - "dequeue", - "data-structure" - ], - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.13.1", - "xo": "^0.35.0" - } -} diff --git a/node_modules/yocto-queue/readme.md b/node_modules/yocto-queue/readme.md deleted file mode 100644 index c72fefc..0000000 --- a/node_modules/yocto-queue/readme.md +++ /dev/null @@ -1,64 +0,0 @@ -# yocto-queue [![](https://badgen.net/bundlephobia/minzip/yocto-queue)](https://bundlephobia.com/result?p=yocto-queue) - -> Tiny queue data structure - -You should use this package instead of an array if you do a lot of `Array#push()` and `Array#shift()` on large arrays, since `Array#shift()` has [linear time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(N)%E2%80%94Linear%20Time) *O(n)* while `Queue#dequeue()` has [constant time complexity](https://medium.com/@ariel.salem1989/an-easy-to-use-guide-to-big-o-time-complexity-5dcf4be8a444#:~:text=O(1)%20%E2%80%94%20Constant%20Time) *O(1)*. That makes a huge difference for large arrays. - -> A [queue](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is an ordered list of elements where an element is inserted at the end of the queue and is removed from the front of the queue. A queue works based on the first-in, first-out ([FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics))) principle. - -## Install - -``` -$ npm install yocto-queue -``` - -## Usage - -```js -const Queue = require('yocto-queue'); - -const queue = new Queue(); - -queue.enqueue('🦄'); -queue.enqueue('🌈'); - -console.log(queue.size); -//=> 2 - -console.log(...queue); -//=> '🦄 🌈' - -console.log(queue.dequeue()); -//=> '🦄' - -console.log(queue.dequeue()); -//=> '🌈' -``` - -## API - -### `queue = new Queue()` - -The instance is an [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols), which means you can iterate over the queue front to back with a “for…of” loop, or use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow. - -#### `.enqueue(value)` - -Add a value to the queue. - -#### `.dequeue()` - -Remove the next value in the queue. - -Returns the removed value or `undefined` if the queue is empty. - -#### `.clear()` - -Clear the queue. - -#### `.size` - -The size of the queue. - -## Related - -- [quick-lru](https://github.com/sindresorhus/quick-lru) - Simple “Least Recently Used” (LRU) cache